function startSpinner(n,t,i,r){t.$set("disabled",!0);r===undefined&&(r=i);n.html('<i class="fa fa-fw fa-spinner fa-spin"><\/i>')}function stopSpinner(n,t,i,r){n.html(i);t.$set("disabled",!1);r==="true"&&n.css("padding","10px")}function closeModal(n){$("#"+n).hasClass("in")&&($("#"+n).modal("hide"),$(".modal-backdrop.fv-modal-stack-"+n).remove(),$("body").data("open-modals")<1&&$("body").removeClass("modal-open"))}function modalTop(n){n.parents(".modal").animate({scrollTop:0},500)}function handlePromise(n,t,i,r,u,f,e){n!=undefined?n["finally"](function(){t===undefined&&stopSpinner(i,r,u,f)}):e.error("Button spinner has an undefined promise for button "+u)}var __extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),buyer,EmailValidationService,base64,LightBox,lightBox,Materials,events,common,Timer,EmployeeForgotPasswordController,EmployeeLoginController,SecurityCodeMessageSentComponent,SecurityCodeMessageSentController,LogLevel,templatePath,__assign,ItemType,VoucherHubController,voucher,ExitVoucherBannerComponent,ExitVoucherBannerController,ExitVoucherModalComponent,ExitVoucherModalController,ns;(function(n){var t=function(){function n(){this.companyName=null;this.department=null;this.firstName=null;this.lastName=null;this.street1=null;this.street2=null;this.city=null;this.countryCode=null;this.stateCode=null;this.zipCode=null;this.phone=null;this.phoneExtension=null;this.state=null;this.isAlreadyCleansed=!1;this.cleansedAddressInfo=null}return n.prototype.update=function(n){this.companyName=n.companyName;this.department=n.department;this.firstName=n.firstName;this.lastName=n.lastName;this.street1=n.street1;this.street2=n.street2;this.city=n.city;this.countryCode=n.countryCode;this.stateCode=n.stateCode;this.zipCode=n.zipCode;this.phone=n.phone;this.phoneExtension=n.phoneExtension;this.state=null;this.isAlreadyCleansed=n.isAlreadyCleansed;this.cleansedAddressInfo=n.cleansedAddressInfo},n.prototype.getAddressDisplayInfo=function(){return"".concat(this.city,", ",this.stateCode," ",this.zipCode)},n}(),r,u,i,f,e,o,s;n.Address=t;r=function(n){function t(){var t=n.call(this)||this;return t.shipToId=null,t.displayName=null,t.plantCode=null,t.specialDeliveryInstructions=null,t.isSameAsBilling=!1,t.isDefaultShipTo=!1,t.setAsDefaultShipTo=!1,t.isPoBox=!1,t.isRestrictedForCartMaterials=!1,t.isFromAdminHub=!1,t.isReadOnly=!1,t}return __extends(t,n),t.prototype.update=function(t){n.prototype.update.call(this,t);this.shipToId=t.shipToId;this.displayName=t.displayName;this.isSameAsBilling=t.isSameAsBilling;this.isDefaultShipTo=t.isDefaultShipTo;this.specialDeliveryInstructions=t.specialDeliveryInstructions;this.setAsDefaultShipTo=t.setAsDefaultShipTo;this.isPoBox=t.isPoBox;this.plantCode=t.plantCode;this.isRestrictedForCartMaterials=t.isRestrictedForCartMaterials;this.isFromAdminHub=t.isFromAdminHub;this.isReadOnly=t.isReadOnly},t}(t);n.ShippingAddress=r;u=function(n){function t(){var t=n.call(this)||this;return t.soldToId=null,t.displayName=null,t.specialHandling=!1,t}return __extends(t,n),t.prototype.update=function(t){n.prototype.update.call(this,t);this.soldToId=t.soldToId;this.displayName=t.displayName;this.specialHandling=t.specialHandling},t}(t);n.SoldToAddress=u;i=function(n){function t(){var t=n.call(this)||this;return t.buyerId=null,t.email=null,t}return __extends(t,n),t.prototype.update=function(t){n.prototype.update.call(this,t);this.buyerId=t.buyerId;this.email=t.email},t}(t);n.MailingAddress=i;f=function(n){function t(){var t=n.call(this)||this;return t.billToId=null,t.displayName=null,t}return __extends(t,n),t.prototype.update=function(t){n.prototype.update.call(this,t);this.billToId=t.billToId;this.displayName=t.displayName},t}(t);n.BillToAddress=f;e=function(n){function t(){var t=n.call(this)||this;return t.cleansingId=null,t}return __extends(t,n),t.prototype.update=function(t){n.prototype.update.call(this,t)},t}(i);n.AddressForCleansing=e;o=function(){function n(){this.streetNotFound=!1;this.addressCleanseFail=!1;this.isAlreadyCleansed=!1;this.cleansedAddressInfo=null}return n.prototype.reset=function(){this.streetNotFound=!1;this.addressCleanseFail=!1;this.isAlreadyCleansed=!1;this.cleansedAddressInfo=null},n.prototype.update=function(n){this.cleansedAddressInfo=n.cleansedAddressInfo},n.prototype.setStreetNotFound=function(){this.streetNotFound=!0;this.addressCleanseFail=!1},n.prototype.setAddressCleanseFail=function(){this.addressCleanseFail=!0;this.streetNotFound=!1},n.prototype.isAddressCleanseSuccess=function(){return!this.addressCleanseFail&&!this.streetNotFound},n.prototype.getAddressCleansedDisplayInfo=function(){return this.cleansedAddressInfo?"".concat(this.cleansedAddressInfo.city,", ",this.cleansedAddressInfo.stateCode," ",this.cleansedAddressInfo.zipCode):""},n}();n.AddressCleansed=o;s=function(){function n(n,t){this.cartId=n;this.zipCode=t;this.zipCode.length>5&&(this.zipCode=this.zipCode.slice(0,5))}return n}();n.AddressRestrictionInput=s})(ns||(ns={})),function(n){"use strict";var t,i;(function(n){n[n.FullMatch=0]="FullMatch";n[n.MinorChanges=1]="MinorChanges";n[n.StreetNotFound=2]="StreetNotFound";n[n.GeneralFailure=3]="GeneralFailure";n[n.TaxJurisdictionFailure=4]="TaxJurisdictionFailure"})(t||(t={}));i=function(){function i(n,t,i,r,u,f,e,o,s,h){this.cookieService=n;this.$filter=t;this.$q=i;this.configs=r;this.initialData=u;this.eventsService=f;this.modelsFactory=e;this.apiService=o;this.userService=s;this.navigationService=h;this.isAddressBookLoading=!1;this.init()}return Object.defineProperty(i.prototype,"addressBook",{get:function(){return this._addressBookIsLoaded||this.loadAddressBook(),this._addressBook},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selectedShipToAddress",{get:function(){return this._selectedShipToAddress},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selectedAddressForEdit",{get:function(){return this._selectedAddressForEdit},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"statesSelectList",{get:function(){return this._statesSelectList},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"addressCleansedResult",{get:function(){return this._addressCleansedResult},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"soldToAddress",{get:function(){return this._soldToAddress},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"billToAddress",{get:function(){return this._billToAddress},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"mailingAddress",{get:function(){return this._mailingAddress},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"editedAddress",{get:function(){return this._editedAddress},enumerable:!0,configurable:!0}),i.prototype.setEmployeeGuid=function(n){this._employeeGuid=n},i.prototype.setCurrentEditedAddress=function(n){this._editedAddress=n},i.prototype.stateCodeIsCanadian=function(n){var t=this.getStateByStateCode(n);return t&&t.IsCanadian},i.prototype.streetAddressContainsPoBox=function(n){var r=n.stateCode,t=n.street1,i,u;return!r||!t?!1:(i=this.getStateByStateCode(r),t.toLowerCase().indexOf("box ")===0&&i&&i.AddressCanStartWithPOBox)?!0:(u=t.replace(/[^A-Za-z]+/g,"").replace(/[_\s]/g,"-"),u.toLowerCase().indexOf("pobox")>-1)},i.prototype.editBillingAddress=function(n){var i=this,t;return this.setCurrentEditedAddress(n),t=this.$q.defer(),this.apiService.editBillingAddress(n).then(function(n){i.handleAddressResult(n,t,!0)}),t.promise},i.prototype.addOrEditShippingLocation=function(n){var i=this,t;return this.setAddressPropertiesForAddOrEdit(n),this.setCurrentEditedAddress(n),t=this.$q.defer(),this._employeeGuid!==null?this.apiService.addOrEditEmployeeShippingLocationByGuid(n,this._employeeGuid).then(function(r){i.handleAddressResult(r,t,!n.isFromAdminHub)}):this.userService.user.isEmployeeUser?this.apiService.addOrEditEmployeeShippingLocation(n).then(function(r){i.handleAddressResult(r,t,!n.isFromAdminHub)}):n.isReadOnly?this.apiService.editReadOnlyShippingLocation(n).then(function(){i.loadAddressBook().then(function(){t.resolve(!0);i.addressCleansedResult.reset()})}):this.apiService.addOrEditShippingLocation(n).then(function(r){i.handleAddressResult(r,t,!n.isFromAdminHub)}),t.promise},i.prototype.editMailingAddress=function(n){var t=this,i,r;return this.setCurrentEditedAddress(n),i=this.$q.defer(),r=this.getAddressForCleansing(n),this.apiService.editMailingAddress(r).then(function(n){t.handleAddressResult(n,i,!1);t.isSuccessful(n)&&(t.initialData.mailingAddress=n.data.resultObject.savedAddress)}),i.promise},i.prototype.removeShippingLocation=function(n){var t=this,i=this.getAddressToRemove(n),r=this.$q.defer(),f=this.userService.user.isEmployeeUser?this.apiService.removeEmployeeShippingLocation(i.shipToId):this.apiService.removeShippingLocation(i.shipToId),u=function(n){return t.loadAddressBook().then(function(){return i.shipToId===t.selectedShipToAddress.shipToId&&n&&t.selectedShipToAddress.update(n),r.resolve(!0)})};return f.then(function(){var n=t.getNextDefaultAddress(i);i.isDefaultShipTo&&n?t.setShippingLocationAsDefault(n.shipToId,!1).then(function(){u(n)}):u(n)}),r.promise},i.prototype.setShippingLocationAsDefault=function(n,t){var i=this,r=this.userService.user.isEmployeeUser?this.apiService.setEmployeeShippingLocationAsDefault(n):this.apiService.setShippingLocationAsDefault(n);return r.then(function(n){return t&&i.loadAddressBook().then(function(){i.updateSelectedAddress(i.findSelectedShipTo())}),n})},i.prototype.stateCodeIsHawayOrAlaska=function(n){return n==="AK"||n==="HI"},i.prototype.getDefaultShippingAddress=function(){return _.find(this._addressBook,function(n){return n.isDefaultShipTo})},i.prototype.selectedShipToIsNonShippable=function(){return!this._selectedShipToAddress||!this._selectedShipToAddress.stateCode?!1:this.stateCodeIsNonShippable(this._selectedShipToAddress.stateCode)},i.prototype.addressCleanseFailed=function(n){return n===t.GeneralFailure||n===t.TaxJurisdictionFailure?!0:!1},i.prototype.addressCleanseIsSuccess=function(n){return n===t.FullMatch||n===t.MinorChanges?!0:!1},i.prototype.updateSelectedAddress=function(n){if(n){if(this.streetAddressContainsPoBox(n)){var t=this.getNextDefaultAddress(n);this._selectedShipToAddress.update(t)}else this._selectedShipToAddress.update(n);this.eventsService.trigger(events.AddressesEvents.SelectedAddressChanged,this._selectedShipToAddress.shipToId,this._selectedShipToAddress.zipCode)}},i.prototype.setSelectedAddressForEdit=function(t,i){var r=this;this.checkAuthenticationCookie().then(function(){i||(i=r.modelsFactory.createShippingAddress());i instanceof n.ShippingAddress&&(r.selectedAddressForEdit.update(i),r.prepareAddressForEdit(r.selectedAddressForEdit));r.addressCleansedResult.reset();$(t).modal("show");r.eventsService.trigger(events.AddressesEvents.AddressForEditChanged)})},i.prototype.prepareAddressForEdit=function(n){n.state=_.findWhere(this.statesSelectList,{stateCode:n.stateCode});n.phone=this.$filter("formatPhoneNumber")(n.phone)},i.prototype.sameAsBillingIsSelectedAndContainsPoBox=function(){return this._selectedShipToAddress&&this._selectedShipToAddress.isSameAsBilling&&this.streetAddressContainsPoBox(this._selectedShipToAddress)},i.prototype.closeAddressBook=function(){$("#address-book").modal("hide")},i.prototype.addressHasNameDefined=function(n){return this.isShipToNameDefined(n)||this.userService.user.isPersonal()&&!!n.companyName},i.prototype.isShipToNameDefined=function(n){return!!n&&(!!n.firstName||!!n.lastName)},i.prototype.checkAuthenticationCookie=function(){var n=this.$q.defer();return this.navigationService.isAddressCleansingPage()?(n.resolve(!0),n.promise):this.cookieService.checkAuthenticationCookie()},i.prototype.getCleansingData=function(){return this._cleansingData?this._cleansingData:!this.initialData||!this.initialData.addressCleansingData.buyerAddress?null:(this._cleansingData=this.modelsFactory.createCleansingData(this.initialData.addressCleansingData),this._mailingAddress=this._cleansingData.buyerAddress,this.formatMailingAddress(),this._cleansingData)},i.prototype.selectedAddressIsRestricted=function(){return this.selectedShipToAddress.isRestrictedForCartMaterials},i.prototype.isSuccessful=function(n){return n.data.success&&this.addressCleanseIsSuccess(n.data.resultObject.addressCleanseStatus)},i.prototype.formatMailingAddress=function(){this._mailingAddress&&(this._mailingAddress.state=_.findWhere(this._statesSelectList,{stateCode:this.mailingAddress.stateCode}),this._mailingAddress.phone=this.$filter("formatPhoneNumber")(this._mailingAddress.phone))},i.prototype.checkAddressRestriction=function(t){var i=this.cookieService.getCartCookie(),r=new n.AddressRestrictionInput(i,t.zipCode);return this.apiService.checkAddressRestriction(r).then(function(n){n&&(t.isRestrictedForCartMaterials=n.data)})},i.prototype.updateSameAsBillingShippingAddressInfo=function(){var n=_.find(this.addressBook,function(n){return n.isSameAsBilling});n&&(angular.extend(n,this.soldToAddress),n.displayName="Same as Billing",this.selectedShipToAddress.isSameAsBilling&&this.updateSelectedAddress(n))},i.prototype.reloadMailingAddress=function(){this._mailingAddress=this.getMailingAddress();this.formatMailingAddress();this.eventsService.trigger(events.AddressesEvents.MailingAddressUpdated)},i.prototype.isAddressFromCanada=function(n){return n.countryCode==="CA"?!0:!1},i.prototype.getEmployeeHasReadOnlyAddress=function(){return this.apiService.getEmployeeHasReadOnlyAddress()},i.prototype.init=function(){this._selectedShipToAddress=this.modelsFactory.createShippingAddress();this._soldToAddress=this.modelsFactory.createSoldToAddress();this._billToAddress=this.modelsFactory.createBillToAddress();this._addressBook=[];this._addressBookIsLoaded=!1;this._statesSelectList=this.getStatesSelectList();this._addressCleansedResult=this.modelsFactory.createAddressCleansedResult();this._mailingAddress=this.getMailingAddress();this._selectedAddressForEdit=this.modelsFactory.createShippingAddress();this._editedAddress=this.modelsFactory.createAddress();this._employeeGuid=null;this.formatMailingAddress();this.shouldLoadAddresses()&&this.loadAddressBook()},i.prototype.shouldLoadAddresses=function(){return this.navigationService.isCheckoutPage()||this.navigationService.isAddressesPage()},i.prototype.getMailingAddress=function(){return this.initialData&&this.initialData.mailingAddress?this.modelsFactory.createMailingAddress(this.initialData.mailingAddress):null},i.prototype.getAddressForCleansing=function(t){t.stateCode=t.state.stateCode;var r=this.navigationService.getParameterByName("uid"),i=new n.AddressForCleansing;return i.update(t),i.cleansingId=r,i.isAlreadyCleansed=t.isAlreadyCleansed,i.cleansedAddressInfo=t.cleansedAddressInfo,i},i.prototype.getStateByStateCode=function(n){return _.find(this.configs.supportedStates,function(t){return t.StateCode===n})},i.prototype.findSelectedShipTo=function(n){if(n)return _.findWhere(this._addressBook,{shipToId:n});var t=_.findWhere(this._addressBook,{isDefaultShipTo:!0});return t?t:_.find(this._addressBook,function(n){return n})},i.prototype.stateCodeIsNonShippable=function(n){var t=this.getStateByStateCode(n);return t&&t.IsNonShippable},i.prototype.getEmployeeNextDefaultAddress=function(n){var t=_.find(this._addressBook,function(t){return t.isDefaultShipTo===!0&&t.shipToId!==n.shipToId});return t?t:_.find(this._addressBook,function(t){return t.shipToId!==n.shipToId})},i.prototype.getNextDefaultAddress=function(n){if(this.userService.user.isEmployeeUser)return this.getEmployeeNextDefaultAddress(n);var t=_.find(this._addressBook,function(n){return n.isSameAsBilling}),i=this.streetAddressContainsPoBox(t);return i&&this._addressBook.length>2?(t.isDefaultShipTo=!1,_.find(this._addressBook,function(t){return!t.isSameAsBilling&&t.shipToId!==n.shipToId})):t},i.prototype.updateSelectedShippingAddress=function(n){var t=n.data.resultObject.savedAddress;t&&!t.isSameAsBilling&&this.updateSelectedAddress(this.findSelectedShipTo(t.shipToId))},i.prototype.handleAddressResult=function(n,t,i){var r=this;if(n.data.success){if(!this.addressCleanseIsSuccess(n.data.resultObject.addressCleanseStatus)){this._addressCleansedResult.update(n.data.resultObject);this._addressCleansedResult.setStreetNotFound();this.eventsService.trigger(events.AddressesEvents.CleansedResultUpdated);t.resolve(!0);return}i?this.loadAddressBook().then(function(){r.updateSameAsBillingShippingAddressInfo();r.updateSelectedShippingAddress(n);t.resolve(!0);r.addressCleansedResult.reset()}):(this.resolvePromise(t,n),this.addressCleansedResult.reset())}else this._addressCleansedResult.setAddressCleanseFail(),this._addressCleansedResult.update(n.data.resultObject),this.eventsService.trigger(events.AddressesEvents.CleansedResultUpdated),t.resolve(!1)},i.prototype.resolvePromise=function(n,t){this._cleansingData&&this._cleansingData.buyerAddress.update(t.data.resultObject.savedAddress);n.resolve(!0)},i.prototype.setAddressPropertiesForAddOrEdit=function(n){n.stateCode=n.state.stateCode;this.sameAsBillingIsSelectedAndContainsPoBox()&&(n.setAsDefaultShipTo=!0)},i.prototype.getStatesSelectList=function(){if(!this.hasStatesSelectList())return[];return _.map(this.initialData.statesSelectList,function(n){return{stateCode:n.value,stateName:n.text}})},i.prototype.hasStatesSelectList=function(){return this.initialData&&!!this.initialData.statesSelectList},i.prototype.getAddressToRemove=function(n){return n||(n=this._selectedAddressForEdit.shipToId),_.findWhere(this._addressBook,{shipToId:n})},i.prototype.loadAddressBook=function(){var n=this,t;return(this.isAddressBookLoading=!0,t=function(){n.isAddressBookLoading=!1},this.userService.user.isEmployeeUser)?this.apiService.getEmployeeAddresses().then(function(i){var u=i.data.resultObject.shippingAddresses,r,f,e;if(u&&u.length>0)for(r=0,f=u;r<f.length;r++)e=f[r],e.department=e.attentionTo;n.updateAddresses(i.data.resultObject.shippingAddresses);n._soldToAddress.update(i.data.resultObject.soldToAddress);i.data.billToAddress&&n._billToAddress.update(i.data.resultObject.billToAddress);t()}):this.apiService.getAddresses().then(function(i){n.updateAddresses(i.data.shippingAddresses);n._soldToAddress.update(i.data.soldToAddress);i.data.billToAddress&&n._billToAddress.update(i.data.billToAddress);t()})},i.prototype.isAddressBookEmpty=function(){return Array.isArray(this._addressBook)&&!this._addressBook.length},i.prototype.updateAddresses=function(t){var i=this,r=function(n){return n.sort(function(n,t){return n.isDefaultShipTo===t.isDefaultShipTo?0:n.isDefaultShipTo===!0?-1:1})};if(this._addressBook=r(t.map(function(n){return i.modelsFactory.createShippingAddress(n)})),this.isAddressBookEmpty()){this._addressBookIsLoaded=!0;this._selectedShipToAddress=new n.ShippingAddress;this.setSelectedAddressForEdit("#add-edit-address-modal");this.eventsService.trigger(events.AddressesEvents.SelectedAddressUpdated);this.eventsService.trigger(events.AddressesEvents.AddressbookLoaded);return}this.checkAddressesRestrictions();this._addressBookIsLoaded||this.updateSelectedAddress(this.findSelectedShipTo());this._addressBookIsLoaded=!0;this.waitForAddressRestrictionChecks()},i.prototype.checkAddressesRestrictions=function(){var n=this;this.navigationService.isCheckoutPage()&&(this._geoRestrictionPromises=[],_.each(this._addressBook,function(t){n._geoRestrictionPromises.push(n.checkAddressRestriction(t))}))},i.prototype.waitForAddressRestrictionChecks=function(){var n=this;this.navigationService.isCheckoutPage()&&this._geoRestrictionPromises.length>0?this.$q.all(this._geoRestrictionPromises).then(function(){n._selectedShipToAddress.isRestrictedForCartMaterials=n.findSelectedShipTo(n._selectedShipToAddress.shipToId).isRestrictedForCartMaterials;n.eventsService.trigger(events.AddressesEvents.SelectedAddressUpdated);n.eventsService.trigger(events.AddressesEvents.AddressbookLoaded)}):this.eventsService.trigger(events.AddressesEvents.AddressbookLoaded)},i}();i.$inject=["cookieService","$filter","$q","configs","initialData","eventsService","modelsFactory","apiService","userService","navigationService"];n.AddressService=i;angular.module("ns").service("addressService",i)}(ns||(ns={})),function(n){"use strict";var t=function(){function n(n,t,i,r,u,f){var e=this;this.addressService=n;this.eventsService=t;this.userService=i;this.analyticsService=r;this.cartService=u;this.featureData=f;this.isEmployeeWithReadonlyAddress=!1;this.buyerCanUpdateShippingAddresses=!0;this.addressBook=[];this.selectedShipTo=this.addressService.selectedShipToAddress;i.user.isEmployeeUser===!0&&this.addressService.getEmployeeHasReadOnlyAddress().then(function(n){e.isEmployeeWithReadonlyAddress=n.data});this.init()}return n.prototype.checkAuthenticationCookieThenHideModal=function(n){return this.addressService.checkAuthenticationCookie().then(function(){$(n).modal("hide")})},n.prototype.checkAuthenticationCookieThenShowModal=function(n){var t=this;return this.addressService.checkAuthenticationCookie().then(function(){t.analyticsService.trackShippingInformationAddressBook();$(n).modal("show")})},n.prototype.deleteAddress=function(n){this.addressService.removeShippingLocation(n.shipToId)},n.prototype.isShipToNameDefined=function(n){return this.addressService.isShipToNameDefined(n)},n.prototype.addressBookTotalItems=function(){var n=_.find(this.addressBook,{isSameAsBilling:!0});return n&&this.addressService.streetAddressContainsPoBox(n)?this.addressBook.length-1:this.addressBook.length},n.prototype.selectShipToFromAddressBook=function(n){var t=this;this.addressService.checkAuthenticationCookie().then(function(){t.addressService.updateSelectedAddress(n);t.addressService.closeAddressBook();t.analyticsService.trackEditCartOrCheckout("Update Shipping Location")}).then(function(){t.addressIsFromCanada=t.addressService.isAddressFromCanada(n)})},n.prototype.subTotalUnder250=function(){var n=this.cartService.getCart().getSubtotal();return n<250?!0:!1},n.prototype.setShippingLocationAsDefault=function(n){this.addressService.setShippingLocationAsDefault(n.shipToId,!0)},n.prototype.sameAsBillingIsSelectedAndContainsPoBox=function(){return this.addressService.sameAsBillingIsSelectedAndContainsPoBox()},n.prototype.isPersonalCustomer=function(){return this.userService.user.isPersonal()},n.prototype.isAssociateCustomer=function(){return this.userService.user.isAssociate()},n.prototype.isAddressBookEmpty=function(){return Array.isArray(this.addressBook)&&!this.addressBook.length},n.prototype.isAddressBookLoading=function(){return this.addressService.isAddressBookLoading},n.prototype.init=function(){var n=this;this.buyerCanUpdateShippingAddresses=this.featureData.pathfinder_MakeAddressBookReadOnlyFeature&&!this.userService.user.isEmployeeUser?this.userService.user.canBuyerUpdateShippingAddresses:!0;this.addressBook=this.addressService.addressBook;this.eventsService.on(events.AddressesEvents.AddressbookLoaded,function(){n.addressBook=n.addressService.addressBook;n.selectedShipTo=n.addressService.selectedShipToAddress;n.addressIsFromCanada=n.addressService.isAddressFromCanada(n.selectedShipTo)})},n}();t.$inject=["addressService","eventsService","userService","analyticsService","cartService","featureData"];n.AddressController=t;angular.module("ns").controller("addressController",t)}(ns||(ns={})),function(n){var f=function(){function n(){this.restrict="A";this.template='<a href="#" enter-keypress="addAddressController.setSelectedAddressForEdit(\'#add-edit-address-modal\')" class="btn btn-default btn-block" ng-click="addAddressController.setSelectedAddressForEdit(\'#add-edit-address-modal\')"> ADD A NEW ADDRESS<\/a>';this.replace=!0;this.controllerAs="addAddressController";this.controller=t}return n.instance=function(){return new n},n}(),i,r,u,t;angular.module("ns").directive("addAddressButton",f.instance);i=function(){function n(){this.restrict="A";this.template='<a class="btn btn-link" enter-keypress="addAddressController.setSelectedAddressForEdit(\'#add-edit-address-modal\')" tabindex="0" ng-click="addAddressController.setSelectedAddressForEdit(\'#add-edit-address-modal\')"> Add New Location<\/a>';this.replace=!0;this.controller=t;this.controllerAs="addAddressController"}return n.instance=function(){return new n},n}();angular.module("ns").directive("addLocationLink",i.instance);r=function(){function n(){this.restrict="A";this.template='<a class="btn btn-default btn- block" enter-keypress="addAddressController.setSelectedAddressForEdit(\'#add-edit-address-modal\')" tabindex="0" ng-click="addAddressController.setSelectedAddressForEdit(\'#add-edit-address-modal\')"> Add New Location<\/a>';this.replace=!0;this.controller=t;this.controllerAs="addAddressController"}return n.instance=function(){return new n},n}();angular.module("ns").directive("addAddressLink",r.instance);u=function(){function n(){this.restrict="A";this.template='<a class="btn btn-link last-option" enter-keypress="addAddressController.setSelectedAddressForEdit(\'#add-edit-address-modal\')" tabindex="0" data-testing-id="add-new-location" ng-click="addAddressController.setSelectedAddressForEdit(\'#add-edit-address-modal\')"> Add New Location<\/a>';this.replace=!0;this.controller=t;this.controllerAs="addAddressController"}return n.instance=function(){return new n},n}();angular.module("ns").directive("addAddressLinkLastOption",u.instance);t=function(){function n(n,t){this.addressService=n;this.analyticsService=t}return n.prototype.setSelectedAddressForEdit=function(n){this.analyticsService.trackShippingInformationAddNewLocation();this.addressService.setSelectedAddressForEdit(n)},n}();t.$inject=["addressService","analyticsService"];n.AddAddressController=t;angular.module("ns").controller("addAddressController",t)}(ns||(ns={})),function(n){"use strict";var i=function(){function n(){this.restrict="A";this.templateUrl="/js/ns/addresses/add-edit-address/add-edit-address-modal.html";this.controller=t;this.controllerAs="shippingAddressController";this.scope={isCheckoutPage:"="}}return n.instance=function(){return new n},n}(),t;angular.module("ns").directive("addEditAddressModal",i.instance);t=function(){function t(n,t,i,r,u,f,e,o,s,h){this.$scope=n;this.addressService=t;this.userService=i;this.eventsService=r;this.focusService=u;this.cookieService=f;this.analyticsService=e;this.shippingMethodsService=o;this.cartService=s;this.featureData=h;this.isEmployeeWithReadonlyAddress=!1;this.init()}return t.prototype.sameAsBillingIsSelectedAndContainsPoBox=function(){return this.addressService.sameAsBillingIsSelectedAndContainsPoBox()},t.prototype.addOrEditShippingLocation=function(n){var t=this,i;if(n&&(n.$setSubmitted(),this.controllerForm=n,n.$invalid)){this.focusService.focusErrorField(n);return}i=this.shippingMethodsService.getSelectedShippingMethod();this.addressService.addOrEditShippingLocation(this.address).then(function(r){t.handleResult(r,n,i);t.$scope.isCheckoutPage&&t.analyticsService.trackEditCartOrCheckout("Update Shipping Location")}).catch(function(){t.handleException()})},t.prototype.changeValueForSetAsDefaultShipTo=function(n){$(n.target).is("input")&&(this.address.setAsDefaultShipTo=!this.address.setAsDefaultShipTo,n.target.checked=this.address.setAsDefaultShipTo)},t.prototype.updateAddressStateCode=function(){this.address.stateCode=this.address.state?this.address.state.stateCode:null},t.prototype.isPersonalCustomer=function(){return this.userService.user.isPersonal()},t.prototype.isEmployeeUser=function(){return this.userService.user.isEmployeeUser},t.prototype.isAssociate=function(){return this.userService.user.isAssociate()},t.prototype.showCompanyName=function(){return!this.isPersonalCustomer()},t.prototype.showDefaultShipping=function(){return this.address.isDefaultShipTo||this.sameAsBillingIsSelectedAndContainsPoBox()},t.prototype.askToSetAsDefaultShipping=function(){return!(this.address.isDefaultShipTo||this.sameAsBillingIsSelectedAndContainsPoBox())},t.prototype.init=function(){var n=this;this.addingOrUpdatingShippingLocationFailed=!1;this.controllerForm=null;this.address=this.addressService.selectedAddressForEdit;this.states=this.addressService.statesSelectList;this.eventsService.on(events.AddressesEvents.AddressForEditChanged,this.reset.bind(this));this.eventsService.on(events.AddressesEvents.SubmitCleansedAddress,this.submitAlreadyCleansedAddress.bind(this));this.addressReadonly=this.address.isReadOnly||this.featureData.pathfinder_MakeAddressBookReadOnlyFeature&&!this.userService.user.isEmployeeUser&&!this.userService.user.canBuyerUpdateShippingAddresses;this.userService.user.isEmployeeUser&&this.addressService.getEmployeeHasReadOnlyAddress().then(function(t){n.isEmployeeWithReadonlyAddress=t.data})},t.prototype.submitAlreadyCleansedAddress=function(t,i){(!i||i[0][0]&&i[0][0]instanceof n.ShippingAddress)&&(this.address.isAlreadyCleansed=!0,this.address.cleansedAddressInfo=this.addressService.addressCleansedResult.cleansedAddressInfo,this.addOrEditShippingLocation())},t.prototype.handleResult=function(n,t,i){var r,u;if(n&&this.addressService.addressCleansedResult.isAddressCleanseSuccess()){window.location.pathname.toLowerCase().indexOf("checkout")!=-1&&(r=[],this.cartService&&(u=this.cartService.getCart(),r=u?u.cartLines:[]),this.analyticsService.trackAddShippingInfo(i,r));this.analyticsService.trackShippingInformationSubmitNewLocation();this.handledSuccessfullSubmit(t);return}this.showAddressVerification()},t.prototype.resetForm=function(n){n&&(n.$setPristine(),n.$submitted=!1,this.addingOrUpdatingShippingLocationFailed=!1)},t.prototype.showAddressVerification=function(){this.eventsService.trigger(events.GenericEvents.DoNotCloseModal);$(".vertex-address-verification").first().modal("show")},t.prototype.handledSuccessfullSubmit=function(n){$(".vertex-address-verification").modal("hide");this.eventsService.trigger("address-submitted");this.addressService.closeAddressBook();this.resetForm(n)},t.prototype.handleException=function(){$(".vertex-address-verification").modal("hide");this.eventsService.trigger(events.GenericEvents.DoNotCloseModal);this.addingOrUpdatingShippingLocationFailed=!0},t.prototype.reset=function(){this.address=this.addressService.selectedAddressForEdit;this.addressReadonly=this.address.isReadOnly||this.featureData.pathfinder_MakeAddressBookReadOnlyFeature&&!this.userService.user.isEmployeeUser&&!this.userService.user.canBuyerUpdateShippingAddresses;this.updateTitle();this.controllerForm&&this.resetForm(this.controllerForm)},t.prototype.updateTitle=function(){this.title=this.address.shipToId?"Edit Shipping Location":"Add New Location"},t}();t.$inject=["$scope","addressService","userService","eventsService","focusService","cookieService","analyticsService","shippingMethodsService","cartService","featureData"];n.AddEditAddressController=t;angular.module("ns").controller("addEditAddressController",t)}(ns||(ns={})),function(n){var t=function(){function t(){this.buyerAddress=null}return t.prototype.update=function(t){this.buyerAddress=new n.MailingAddress;this.buyerAddress.update(t.buyerAddress);this.isCleansed=t.isCleansed;this.isLinkExpired=t.isLinkExpired;this.customerType=t.customerType;this.hasUser=t.hasUser},t}();n.CleansingData=t}(ns||(ns={})),function(n){"use strict";var t=function(){function n(n,t,i,r,u,f){this.addressService=n;this.eventsService=t;this.$q=i;this.navigationService=r;this.forgotPasswordService=u;this.userServiceFactory=f;this.init()}return n.prototype.requiresCleansing=function(){return!this.addressIsCleansed&&!this.cleansingData.isLinkExpired&&!this.cleansingData.isCleansed},n.prototype.isCleansedOrIsExpired=function(){return this.cleansingData.isCleansed||this.cleansingData.isLinkExpired},n.prototype.continueShopping=function(){return this.$q.when(this.navigationService.goToHomePage())},n.prototype.goToLogin=function(){return this.$q.when(this.navigationService.goToNewLogin())},n.prototype.createPassword=function(){var n=this;return this.forgotPasswordService.createPassword(this.address.email).then(function(){return n.$q.when(n.navigationService.goToForgotPassword())})},n.prototype.isPersonalCustomer=function(){return this.userService.user.isPersonal()},n.prototype.init=function(){this.cleansingData=this.addressService.getCleansingData();this.buyerFirstName=this.cleansingData.buyerAddress.firstName;this.address=this.cleansingData.buyerAddress;this.userService=this.userServiceFactory.getUserService();this.eventsService.on(events.AddressesEvents.MailingAddressSaved,this.handleSave.bind(this))},n.prototype.handleSave=function(n,t){var i=t[0][0];i&&(this.addressIsCleansed=!0,this.cleansingData=this.addressService.getCleansingData(),this.address=this.cleansingData.buyerAddress)},n}();t.$inject=["addressService","eventsService","$q","navigationService","forgotPasswordService","userServiceFactory"];n.MassAddressCleansingController=t;angular.module("ns").controller("massAddressCleansingController",t)}(ns||(ns={})),function(n){"use strict";var t=function(){function n(n,t){this.modelsFactory=n;this.initialData=t;this.init()}return n.prototype.isForAddressCleansing=function(){return!0},n.prototype.init=function(){this.initialData&&this.initialData.addressCleansingData&&(this.user=this.modelsFactory.createUser(this.initialData.addressCleansingData))},n}();t.$inject=["modelsFactory","initialData"];n.MassUserService=t;angular.module("ns").service("massUserService",t)}(ns||(ns={})),function(n){"use strict";var t=function(){function t(n,t,i,r,u,f){this.eventsService=n;this.addressService=t;this.userServiceFactory=i;this.focusService=r;this.analyticsService=u;this.featureData=f;this.init()}return t.prototype.getTitle=function(){return"Edit My Company Billing Address"},t.prototype.showCompanyNameField=function(){return!this.isPersonalCustomer()&&!!this.addressForEdit.companyName},t.prototype.isPersonalCustomer=function(){return this.userService.user.isPersonal()},t.prototype.editIsAllowed=function(){return!(this.isAssociateCustomer()||this.hasBillToAddress()||this.customerHasSpecialHandling()||this.hasCustomerSite()||this.hasManagedAccount())&&this.isAllowedToUpdateAddress()},t.prototype.editAddress=function(n){if(!this.formIsInvalid(n))return this.editBillingAddress()},t.prototype.editAlreadyCleansedAddress=function(t,i){if(!i||i[0][0]&&i[0][0]instanceof n.SoldToAddress)return this.addressForEdit.isAlreadyCleansed=!0,this.addressForEdit.cleansedAddressInfo=this.addressService.addressCleansedResult.cleansedAddressInfo,this.editAddress()},t.prototype.setAddressToEditToBillingAddress=function(n){this.addressService.setSelectedAddressForEdit(n,this.soldToAddress);this.analyticsService.trackEditLocationBillingInformation()},t.prototype.init=function(){this.soldToAddress=this.addressService.soldToAddress;this.billToAddress=this.addressService.billToAddress;this.addressForEdit=new n.SoldToAddress;this.userService=this.userServiceFactory.getUserService();this.eventsService.on(events.AddressesEvents.AddressForEditChanged,this.update.bind(this));this.eventsService.on(events.AddressesEvents.SubmitCleansedAddress,this.editAlreadyCleansedAddress.bind(this));this.eventsService.on(events.AddressesEvents.AddressbookLoaded,this.updateAddresses.bind(this));this.displayAddress=new n.Address},t.prototype.updateAddresses=function(){this.billToAddress.billToId?this.displayAddress.update(this.billToAddress):this.displayAddress.update(this.soldToAddress)},t.prototype.update=function(){this.addressForEdit.update(this.soldToAddress);this.addressService.prepareAddressForEdit(this.addressForEdit);this.editingBillingInformationFailed=!1;this.resetForm()},t.prototype.resetForm=function(){this.form&&(this.form.$setPristine(),this.form.$submitted=!1)},t.prototype.handleResult=function(n){if(n&&this.addressService.addressCleansedResult.isAddressCleanseSuccess()){this.handleSuccesfulSubmit();return}this.showAddressVerification()},t.prototype.isAssociateCustomer=function(){return this.userService.user.isAssociate()},t.prototype.isAllowedToUpdateAddress=function(){return this.userService.user.canBuyerUpdateShippingAddresses},t.prototype.editBillingAddress=function(){var n=this;return this.addressService.editBillingAddress(this.addressForEdit).then(function(t){n.handleResult(t)}).catch(function(){n.handleException()})},t.prototype.formIsInvalid=function(n){return n&&(this.form=n,this.form.$setSubmitted(),this.form.$invalid)?(this.focusService.focusErrorField(this.form),!0):!1},t.prototype.showAddressVerification=function(){this.eventsService.trigger(events.GenericEvents.DoNotCloseModal);$(".vertex-address-verification").first().modal("show")},t.prototype.handleException=function(){$(".vertex-address-verification").modal("hide");this.eventsService.trigger(events.GenericEvents.DoNotCloseModal);this.editingBillingInformationFailed=!0},t.prototype.handleSuccesfulSubmit=function(){this.analyticsService.trackEditedBillingAddressSubmitted();this.eventsService.trigger(events.AddressesEvents.BillingAddressSaved);$(".vertex-address-verification").modal("hide")},t.prototype.hasBillToAddress=function(){return!!this.billToAddress.billToId},t.prototype.hasCustomerSite=function(){return this.userService.user.customerSiteName!=null||this.userService.user.customerSiteURI!=null},t.prototype.hasManagedAccount=function(){return this.userService.user.isManaged},t.prototype.customerHasSpecialHandling=function(){return this.soldToAddress.specialHandling},t}();t.$inject=["eventsService","addressService","userServiceFactory","focusService","analyticsService","featureData"];n.BillingInfoController=t;angular.module("ns").controller("billingInfoCtrl",t)}(ns||(ns={})),function(){var t=function(){function t(){this.restrict="A";this.replace=!0;this.scope={address:"="};this.templateUrl="/js/ns/addresses/delete-address/delete-address-link.html";this.controller=n;this.controllerAs="controller"}return t.instance=function(){return new t},t}(),n;angular.module("ns").directive("deleteAddressLink",t.instance);n=function(){function n(n,t){this.scope=n;this.addressService=t}return n.prototype.setSelectedAddressForEdit=function(n){this.addressService.setSelectedAddressForEdit(n,this.scope.address)},n}();n.$inject=["$scope","addressService"]}(ns||(ns={})),function(n){var i=function(){function n(){this.restrict="A";this.templateUrl="/js/ns/addresses/delete-address/delete-address-modal.html";this.controller=t;this.controllerAs="deleteAddressController";this.scope={isCheckoutPage:"="}}return n.instance=function(){return new n},n}(),t;angular.module("ns").directive("deleteAddressModal",i.instance);t=function(){function n(n,t,i,r){this.addressService=n;this.eventsService=t;this.$scope=i;this.analyticsService=r;this.address=this.addressService.selectedAddressForEdit;this.eventsService.on(events.AddressesEvents.AddressForEditChanged,this.reset.bind(this));this.controllerForm=null}return n.prototype.removeAddress=function(n){var t=this,i;n&&(n.$setSubmitted(),this.controllerForm=n);i=this.addressService.selectedShipToAddress.shipToId;this.addressService.removeShippingLocation(this.address.shipToId).then(function(){t.handleResult(n,i)}).catch(function(){t.handleException()})},n.prototype.handleResult=function(n,t){this.$scope.isCheckoutPage&&this.address.shipToId===t&&this.analyticsService.trackEditCartOrCheckout("Update Shipping Location");$("#remove-shipping-address-modal").modal("hide");this.eventsService.trigger(events.AddressesEvents.AddressRemoved);this.resetForm(n)},n.prototype.handleException=function(){this.eventsService.trigger(events.GenericEvents.DoNotCloseModal)},n.prototype.reset=function(){this.address=this.addressService.selectedAddressForEdit;this.controllerForm&&this.resetForm(this.controllerForm)},n.prototype.resetForm=function(n){n&&(n.$setPristine(),n.$submitted=!1)},n}();t.$inject=["addressService","eventsService","$scope","analyticsService"];n.DeleteAddressModalController=t;angular.module("ns").controller("deleteAddressModalController",t)}(ns||(ns={})),function(n){"use strict";n.directive("editAddressLink",function(){return{restrict:"A",templateUrl:"/js/ns/addresses/edit-address/edit-address-link.html",replace:!0,scope:{address:"="},controller:["$scope","addressService",function(n,t){n.setSelectedAddressForEdit=function(i){t.setSelectedAddressForEdit(i,n.address)}}]}})}(angular.module("ns")),function(n){var r=function(){function n(){this.restrict="A";this.scope={};this.controller=t;this.controllerAs="controller";this.templateUrl="/js/ns/addresses/mailing-address/mailing-address.html";this.replace=!0}return n.instance=function(){return new n},n}(),i,t;angular.module("ns").directive("mailingAddress",r.instance);i=function(){function n(){this.restrict="A";this.scope={};this.controller=t;this.controllerAs="controller";this.templateUrl="/js/ns/addresses/mailing-address/mailing-address-modal.html";this.replace=!0}return n.instance=function(){return new n},n}();angular.module("ns").directive("mailingAddressModal",i.instance);t=function(){function t(n,t,i,r){this.addressService=n;this.focusService=t;this.eventsService=i;this.userServiceFactory=r;this.init()}return t.prototype.updateAddressStateCode=function(){this.mailingAddress.stateCode=this.mailingAddress.state?this.mailingAddress.state.stateCode:null},t.prototype.editMailingAddress=function(n){var t=this;if(n&&(this.editForm=n,n.$setSubmitted(),n.$invalid)){this.focusService.focusErrorField(n);this.eventsService.trigger(events.SpinnerEvents.StopSpinner);return}this.addressService.editMailingAddress(this.mailingAddress).then(function(n){t.handleResult(n)}).catch(function(){t.handleException()})},t.prototype.isPersonalCustomer=function(){return this.userService.user.isPersonal()},t.prototype.submitAlreadyCleansedAddress=function(t,i){(!i||i[0][0]&&i[0][0]instanceof n.MailingAddress)&&(this.mailingAddress.isAlreadyCleansed=!0,this.mailingAddress.cleansedAddressInfo=this.addressService.addressCleansedResult.cleansedAddressInfo,this.editMailingAddress())},t.prototype.handleResult=function(n){if(n&&this.addressService.addressCleansedResult.isAddressCleanseSuccess()){this.handleSuccesfulSubmit();return}this.showAddressVerification();this.eventsService.trigger(events.SpinnerEvents.StopSpinner)},t.prototype.init=function(){this.mailingAddress=this.addressService.mailingAddress;this.states=this.addressService.statesSelectList;this.userService=this.userServiceFactory.getUserService();this.eventsService.on(events.AddressesEvents.MailingAddressUpdated,this.resetForm.bind(this));this.eventsService.on(events.AddressesEvents.SubmitCleansedAddress,this.submitAlreadyCleansedAddress.bind(this))},t.prototype.handleSuccesfulSubmit=function(){$(".vertex-address-verification").modal("hide");$("#edit-mailing-address-modal").modal("hide");this.eventsService.trigger(events.AddressesEvents.MailingAddressSaved,!0)},t.prototype.showAddressVerification=function(){this.eventsService.trigger(events.GenericEvents.DoNotCloseModal);$(".vertex-address-verification").first().modal("show")},t.prototype.resetForm=function(){this.mailingAddress=this.addressService.mailingAddress;this.editForm&&(this.editForm.$setPristine(),this.editForm.$submitted=!1,this.editingMailingAddressFailed=!1)},t.prototype.handleException=function(){$(".vertex-address-verification").modal("hide");this.eventsService.trigger(events.GenericEvents.DoNotCloseModal);this.editingMailingAddressFailed=!0},t}();t.$inject=["addressService","focusService","eventsService","userServiceFactory"];angular.module("ns").controller("mailingAddressController",t)}(ns||(ns={})),function(n){var i=function(){function n(){this.restrict="A";this.templateUrl="/js/ns/addresses/vertex-cleansing/address-vertex-cleansing-modal.html";this.controller=t;this.controllerAs="controller"}return n.instance=function(){return new n},n}(),t;angular.module("ns").directive("vertexCleansedAddressModal",i.instance);t=function(){function n(n,t){this.addressService=n;this.eventsService=t;this.init()}return n.prototype.submitAlreadyCleansedAddress=function(){this.address.cleansedAddressInfo=this.addressCleansedResult.cleansedAddressInfo;this.address.isAlreadyCleansed=!0;this.eventsService.trigger(events.AddressesEvents.SubmitCleansedAddress,this.address)},n.prototype.init=function(){this.addressCleansedResult=this.addressService.addressCleansedResult;this.address=this.addressService.editedAddress;this.eventsService.on(events.AddressesEvents.CleansedResultUpdated,this.updateData.bind(this))},n.prototype.updateData=function(){this.addressCleansedResult=this.addressService.addressCleansedResult;this.address=this.addressService.editedAddress},n}();t.$inject=["addressService","eventsService"];n.AddressVertexCleansingController=t;angular.module("ns").controller("addressVertexCleansingController",t)}(ns||(ns={})),function(n){var t=function(){function n(){}return n}(),r,u,i;n.GTMEvent=t;r=function(){function n(){}return n}();n.GA4Event=r;u=function(){function n(){}return n}();n.GtmProductInfo=u;i=function(){function i(n,t,i){this.$window=n;this.gtmEventService=t;this.featureData=i;this.currency="USD"}return i.prototype.trackPromotionEvent=function(n,t){this.featureData.useGA4Implementation&&dataLayer.push({event:n,creative_name:t.creativeName,creative_slot:t.creativeSlot,promotion_id:t.promoCode,promotion_name:t.promoName,items:[{item_name:"item_name_placeholder"}]})},i.prototype.trackViewSearchResults=function(n,t){this.featureData.useGA4Implementation&&dataLayer.push({event:"view_search_results",search_term:n,number_of_search_results:t})},i.prototype.trackCheckOrderStatus=function(n,t){this.featureData.useGA4Implementation&&dataLayer.push({event:"check_order_status",purchase_order:t,order_number:n})},i.prototype.trackProductPrint=function(n){this.featureData.useGA4Implementation&&dataLayer.push({event:"product_print",product_name:n.materialName,product_id:n.materialBaseNumber})},i.prototype.trackExclusiveWeeklyEmailDealsSignUp=function(){this.featureData.useGA4Implementation&&dataLayer.push({event:"sign_up"})},i.prototype.trackEmailSignUp=function(n){n.emailSpecials===6&&this.pushEmailOptOutEvent("EmailSpecials");n.abandonedCartReminders===1&&this.pushEmailOptOutEvent("Shopping Cart Reminders");n.orderShipConfirmations===3&&this.pushEmailOptOutEvent("Order & Shipping Confirmations");n.productReviews===1&&this.pushEmailOptOutEvent("Product Reviews");n.survey===1&&this.pushEmailOptOutEvent("Surveys")},i.prototype.pushEmailOptOutEvent=function(n){dataLayer.push({event:"email_opt_out",unsubscribe_reason:n})},i.prototype.trackClick=function(n){dataLayer.push({event:"click",link_url:n,outbound:n.indexOf(window.location.hostname)===-1?!0:!1})},i.prototype.trackEvent=function(n){this.featureData.sendGANEvents&&dataLayer.push({event:n.name,eventCategory:n.pageType,eventAction:n.action,eventLabel:n.label,ecommerce:n.productsInfo,searchResults:n.searchResults})},i.prototype.trackNavClickGA4=function(n){this.featureData.useGA4Implementation&&dataLayer.push({event:"navigation_click",navigation_item:n})},i.prototype.trackShippingEstimator=function(n){this.featureData.useGA4Implementation&&dataLayer.push({event:"shipping_estimator",zip_code:n})},i.prototype.trackInvoiceSearch=function(n){this.featureData.useGA4Implementation&&dataLayer.push({event:"invoice_search",service:n})},i.prototype.trackLiveChatStart=function(){dataLayer.push({event:"live_chat_start"})},i.prototype.trackNavEvent=function(n){if(this.featureData.sendGANEvents){var t={event:n.name,eventCategory:n.pageType,eventAction:n.action,eventLabel:n.label};dataLayer.push(t)}},i.prototype.trackNavClick=function(n,i,r,u){if(r===void 0&&(r="trackNav"),u===void 0&&(u="navigation"),this.featureData.sendGANEvents){var f=new t;f.name=r;f.pageType=u;f.action=n;f.label=i;this.trackNavEvent(f)}},i.prototype.trackExternalLinkClick=function(n){this.featureData.useGA4Implementation&&this.trackClick(n);this.featureData.sendGANEvents&&this.trackEvent({name:"trackEvent",pageType:"external link",action:"click",label:n})},i.prototype.trackRegistrationStart=function(){this.featureData.useGA4Implementation&&dataLayer.push({event:"registration_start"})},i.prototype.trackRegistrationCompleted=function(n){this.featureData.useGA4Implementation&&dataLayer.push({event:"registration_complete",registration_type:n.accountType,registration_business_type:n.isNewBuyer===!0?"new":"existing",registration_state:n.stateCode})},i.prototype.trackContactUsView=function(){this.featureData.useGA4Implementation&&dataLayer.push({event:"contact_us_view"})},i.prototype.trackContactUsStart=function(){this.featureData.useGA4Implementation&&dataLayer.push({event:"contact_us_start"})},i.prototype.trackContactUsSubmit=function(){this.featureData.useGA4Implementation&&dataLayer.push({event:"contact_us_submit"})},i.prototype.trackOrderHistoryReview=function(){this.featureData.useGA4Implementation&&dataLayer.push({event:"order_history_review"})},i.prototype.trackOrderHistoryDetailReview=function(n,t){this.featureData.useGA4Implementation&&dataLayer.push({event:"order_history_detail_review",order_number:n,purchase_order:t})},i.prototype.trackLogin=function(){this.featureData.useGA4Implementation&&dataLayer.push({event:"login"})},i.prototype.trackLogout=function(){this.featureData.useGA4Implementation&&dataLayer.push({event:"logout"})},i.prototype.trackLoginFail=function(){dataLayer.push({event:"login_fail"})},i.prototype.trackMarketingLandingPage=function(n,t,i){var r,u;t===void 0&&(t="all pages");i===void 0&&(i=3);this.featureData.sendGANEvents&&(r=dataLayer.filter(function(n){return n.event===t}),r.length>0&&r[0]&&(u=r[0],u.page={pageType:n},u["gtm.uniqueEventId"]=i))},i.prototype.trackFileDownload=function(n,t,i,r){this.featureData.useGA4Implementation&&dataLayer.push({event:"file_download",file_extension:n,file_name:t,link_text:i,link_url:r})},i.prototype.trackThankYouForReview=function(){},i.prototype.trackIsMaterialOutOfStock=function(){},i.prototype.trackRemoveFromCart=function(n,t){var i=[],r,u;this.featureData.useGA4Implementation&&(i.push(this.gtmEventService.mapProductToItem(n,0,t)),r=i.reduce(function(n,t){return n+t.price*t.quantity},0),dataLayer.push({ecommerce:null}),dataLayer.push({event:"remove_from_cart",ecommerce:{currency:this.currency,value:r,items:i}}));this.featureData.sendGANEvents&&(i=[],u=this.gtmEventService.generateRemoveFromCartGtmProduct(n,t),i.push(u),dataLayer.push({event:"removeFromCart",eventCategory:"Cart",eventAction:"Remove From Cart",eventLabel:n.materialName,ecommerce:{currencyCode:this.currency,remove:{products:i}}}))},i.prototype.trackLiveChatClick=function(n){this.featureData.useGA4Implementation&&dataLayer.push({event:"live_chat_click"});this.featureData.sendGANEvents&&this.trackEvent({name:"trackEvent",pageType:"Contact",action:"Click to Chat",label:n})},i.prototype.trackAddToCart=function(n,t){var i=[],r=t?t:window.GANEventConstants.actionField?window.GANEventConstants.category+": "+window.GANEventConstants.actionField:window.GANEventConstants.category;this.featureData.useGA4Implementation&&(r.toLowerCase()=="search"&&(r=this.gtmEventService.getItemListNameForSearch()),i.push(this.gtmEventService.mapProductToItem(n,0,r)),this.trackGA4AddToCartEvent(i));this.featureData.sendGANEvents&&(i=[],i.push(this.gtmEventService.generateAddToCartGtmProduct(n,t)),this.trackAddToCartEvent(i,r,"Add To Cart",n.materialName))},i.prototype.trackReorderAndAddProductsToCart=function(n,t,i){var r=this,u=[];this.featureData.useGA4Implementation&&(n.forEach(function(n,i){return u.push(r.gtmEventService.mapProductToItem(n,i,t,r.gtmEventService.getJoinedCharacterSets(n.reOrderData.characterSetValues),n.materialPrice,r.gtmEventService.getProductBrand({brand:n.materialBrand?n.materialBrand:n.brand,noBrand:n.noBrand})))}),this.trackGA4AddToCartEvent(u),this.trackReorderEvent(n));this.featureData.sendGANEvents&&(u=[],n.forEach(function(n){return u.push(r.gtmEventService.generateAddToCartGtmProduct(n,t,r.gtmEventService.getJoinedCharacterSets(n.reOrderData.characterSetValues),n.materialPrice,r.gtmEventService.getProductBrand({brand:n.materialBrand?n.materialBrand:n.brand,noBrand:n.noBrand})))}),this.trackAddToCartEvent(u,t,i))},i.prototype.trackAddAllProductsToCart=function(n,t){var r=this,i=[];this.featureData.useGA4Implementation&&(n.forEach(function(n,u){return i.push(r.gtmEventService.mapProductToItem(n,u,t))}),this.trackGA4AddToCartEvent(i));this.featureData.sendGANEvents&&(i=[],n.forEach(function(n){return i.push(r.gtmEventService.generateAddToCartGtmProduct(n,t))}),this.trackAddToCartEvent(i,"Cart","Add All To Cart"))},i.prototype.trackQuickShopAddToCart=function(n){var t=[];this.featureData.useGA4Implementation&&(t.push(this.gtmEventService.mapProductToItem(n,0,"Quick Shop Page",this.gtmEventService.getJoinedCharacterSets(n.characterSetNames),n.price,this.gtmEventService.getProductBrand({brand:n.brandName,noBrand:n.noBrand}))),this.trackGA4AddToCartEvent(t));this.featureData.sendGANEvents&&(t=[],t.push(this.gtmEventService.generateAddToCartGtmProduct(n,"Quick Shop Page",this.gtmEventService.getJoinedCharacterSets(n.characterSetNames),n.price,this.gtmEventService.getProductBrand({brand:n.brandName,noBrand:n.noBrand}))),this.trackAddToCartEvent(t,"Product","Add To Cart",n.materialName))},i.prototype.trackAddToCartEvent=function(n,i,r,u){var f=new t;f.name="addToCart";f.pageType=i;f.action=r;f.label=u;f.productsInfo={currencyCode:this.currency,add:{products:n}};this.trackEvent(f)},i.prototype.trackReorderEvent=function(n){var t=n.reduce(function(n,t){return n+t.price*t.quantity},0);dataLayer.push({event:"reorder",ecommerce:{currency:this.currency,value:t,items:n}})},i.prototype.trackGA4AddToCartEvent=function(n){var t=n.reduce(function(n,t){return n+t.price*t.quantity},0);dataLayer.push({ecommerce:null});dataLayer.push({event:"add_to_cart",ecommerce:{currency:this.currency,value:t,items:n}})},i.prototype.trackProductImpression=function(n,i,r){var u=this,e,f;r===void 0&&(r=null);this.featureData.sendGANEvents&&n.length>0&&(e=[],n.forEach(function(t){return e.push({id:t.materialBaseNumber,name:t.materialName,list:i,brand:u.gtmEventService.getProductBrand(t),category:u.gtmEventService.getCategoryPathWithChangedDelimiter(t.category,t.isCustomizable),position:n.indexOf(t)+1,materialSaleFlag:u.gtmEventService.getMaterialSaleFlag(t.isSale),freeProductFlag:u.gtmEventService.getFreeProductFlag(t.isFreeGood),brandFlag:u.gtmEventService.getBrandFlag(t.isNsBrand),newMaterialFlag:u.gtmEventService.getNewMaterialFlag(t.isNew)})}),f=new t,f.name="productImpression",f.productsInfo={currencyCode:this.currency,impressions:e},r!=null&&(f.searchResults={searchTerm:r.searchString||"",numberSearchResults:r.totalNumberOfResults}),this.trackEvent(f))},i.prototype.trackProductImpressionBatch=function(n){var i=this,r,u;n&&n.length&&this.featureData.sendGANEvents&&(r=[],n.forEach(function(n){n.products&&n.products.length&&n.products.forEach(function(t){return r.push({id:t.materialBaseNumber,name:t.materialName,list:n.listType,brand:i.gtmEventService.getProductBrand(t),category:i.gtmEventService.getCategoryPathWithChangedDelimiter(t.category,t.isCustomizable),position:n.products.indexOf(t)+1,materialSaleFlag:i.gtmEventService.getMaterialSaleFlag(t.isSale),freeProductFlag:i.gtmEventService.getFreeProductFlag(t.isFreeGood),brandFlag:i.gtmEventService.getBrandFlag(t.isNsBrand),newMaterialFlag:i.gtmEventService.getNewMaterialFlag(t.isNew)})})}),r&&r.length)&&(u=new t,u.name="productImpression",u.productsInfo={currencyCode:this.currency,impressions:r},this.trackEvent(u))},i.prototype.trackViewItemListEvent=function(n,t,i){var f=this,r,u;t===void 0&&(t=null);i===void 0&&(i=!1);this.featureData.useGA4Implementation&&(r=t!=null?t:this.gtmEventService.getItemListNameForSearch(),u=[],i?n.forEach(function(n,t){return u.push(f.gtmEventService.mapAlgoliaProductToViewItemModel(n,t,r))}):n.forEach(function(n,t){return u.push(f.gtmEventService.mapProductToViewItemModel(n,t,r))}),dataLayer.push({ecommerce:null}),dataLayer.push({event:"view_item_list",ecommerce:{item_list_name:r,items:u}}))},i.prototype.trackProductDetails=function(n){if(this.featureData.useGA4Implementation&&(dataLayer.push({ecommerce:null}),dataLayer.push({event:"view_item",ecommerce:{currency:this.currency,value:n.highestPrice,items:[{item_id:n.materialBaseNumber,item_name:n.materialName,item_brand:this.gtmEventService.getProductBrand(n),item_category:this.gtmEventService.getCategoryPathWithChangedDelimiter(n.category,n.isCustomizable),item_list_name:"Product Details Page",promotion_id:this.gtmEventService.getPriorityCode(),coupon:this.gtmEventService.getPriorityCode()}]}})),this.featureData.sendGANEvents){var i=new t;i.name="productDetailView";i.productsInfo={currencyCode:this.currency,detail:{products:[{id:n.materialBaseNumber,name:n.materialName,list:"Product Details Page",brand:this.gtmEventService.getProductBrand(n),category:this.gtmEventService.getCategoryPathWithChangedDelimiter(n.category,n.isCustomizable),materialSaleFlag:this.gtmEventService.getMaterialSaleFlag(n.isSale),freeProductFlag:this.gtmEventService.getFreeProductFlag(n.isFreeGood),brandFlag:this.gtmEventService.getBrandFlag(n.isNsBrand),newMaterialFlag:this.gtmEventService.getNewMaterialFlag(n.isNew)}]}};this.trackEvent(i)}},i.prototype.trackProductQuickView=function(n,i,r){var f=[],u;this.featureData.useGA4Implementation&&dataLayer.push({event:"quick_view_open",product_name:n.materialName,product_id:n.materialBaseNumber});this.featureData.sendGANEvents&&(f.push({id:n.materialBaseNumber,name:n.materialName,brand:this.gtmEventService.getProductBrand(n),category:this.gtmEventService.getCategoryPathWithChangedDelimiter(n.category,n.isCustomizable),materialSaleFlag:this.gtmEventService.getMaterialSaleFlag(n.isSale),freeProductFlag:this.gtmEventService.getFreeProductFlag(n.isFreeGood),brandFlag:this.gtmEventService.getBrandFlag(n.isNsBrand),newMaterialFlag:this.gtmEventService.getNewMaterialFlag(n.isNew)}),u=new t,u.name="productDetailQuickView",u.action="Quick View",u.label=n.materialName,u.pageType=i?i:window.GANEventConstants.category,u.productsInfo={currencyCode:this.currency,detail:{actionField:{list:r?r:i?i:window.GANEventConstants.actionField},products:f}},this.trackEvent(u))},i.prototype.trackProductDetailsPageEvent=function(n,i){if(this.featureData.useGA4Implementation&&dataLayer.push({event:"product_detail_tab_click",product_name:n.materialName,product_id:n.materialBaseNumber,detail_tab:i}),this.featureData.sendGANEvents){var r=new t;r.name="trackEvent";r.pageType="Product Page";r.action=i;r.label=n.materialName;this.trackEvent(r)}},i.prototype.trackProductReviewStartEvent=function(n){this.featureData.useGA4Implementation&&dataLayer.push({event:"product_review_start",product_name:n.materialName,product_id:n.materialBaseNumber})},i.prototype.trackProductReviewSubmitEvent=function(n,t){this.featureData.useGA4Implementation&&dataLayer.push({event:"product_review_submit",product_name:n.materialName,product_id:n.materialBaseNumber,quality_rate:t})},i.prototype.trackViewCart=function(n,i,r){var f=this,u;this.featureData.useGA4Implementation&&(dataLayer.push({ecommerce:null}),dataLayer.push({event:"view_cart",ecommerce:{currency:this.currency,value:i,coupon:r,items:n.map(function(n,t){return{item_id:n.id,item_name:n.name,coupon:r,index:t,item_brand:n.brand,item_category:n.category,item_list_name:"Cart products",item_variant:n.variant,price:n.price,quantity:n.quantity,item_color:f.gtmEventService.getItemColor(n),promotion_id:r}})}}));this.featureData.sendGANEvents&&(u=new t,u.name="cart",u.productsInfo={currencyCode:this.currency,checkout:{actionField:{step:1},products:n}},this.trackEvent(u))},i.prototype.trackViewCheckout=function(n,i,r){var u=this,f;this.featureData.useGA4Implementation&&(dataLayer.push({ecommerce:null}),dataLayer.push({event:"begin_checkout",ecommerce:{currency:this.currency,value:i,coupon:r,items:n.map(function(n,t){return{item_id:n.id,item_name:n.name,coupon:u.gtmEventService.getPriorityCode(),index:t,item_brand:n.brand,item_category:n.category,item_list_name:"Checkout products",item_variant:n.variant,price:n.price,quantity:n.quantity,item_color:u.gtmEventService.getItemColor(n),promotion_id:u.gtmEventService.getPriorityCode()}})}}));this.featureData.sendGANEvents&&(n.forEach(function(n){n.brand=u.gtmEventService.getProductBrand(n)}),f=new t,f.name="checkout",f.productsInfo={currencyCode:this.currency,checkout:{actionField:{step:2},products:n}},this.trackEvent(f))},i.prototype.trackOrderConfirmation=function(n,i){var u=this,r;this.featureData.useGA4Implementation&&(dataLayer.push({ecommerce:null}),dataLayer.push({event:"purchase",ecommerce:{transaction_id:i.id,value:i.revenue,tax:i.tax,shipping:i.shipping,currency:this.currency,coupon:i.coupon,items:n.map(function(n,t){return{item_id:n.id,item_name:n.name,index:t,item_brand:n.brand,item_category:n.category,item_color:u.gtmEventService.getItemColor(n),item_coupon:i.coupon,item_price:n.price,item_quantity:n.quantity,item_variant:n.variant,promotion_id:i.coupon}})}}));this.featureData.sendGANEvents&&(r=new t,r.name="purchase",r.productsInfo={currencyCode:this.currency,purchase:{actionField:i,products:n}},this.trackEvent(r))},i.prototype.trackRegistrationAbandon=function(){this.featureData.useGA4Implementation&&dataLayer.push({event:"registration_abandon"})},i.prototype.trackQuickShopClick=function(){this.featureData.useGA4Implementation&&dataLayer.push({event:"quick_shop_click"})},i.prototype.trackViewPunchOutCheckout=function(){},i.prototype.trackUpdateItemInCart=function(){},i.prototype.trackCartOpen=function(){},i.prototype.trackEnterZipCode=function(){},i.prototype.trackPlaceOrder=function(){},i.prototype.trackEditLocationBillingInformation=function(){this.featureData.sendGANEvents&&this.trackEvent({name:"trackEvent",pageType:"Checkout",action:"Edit Billing Info",label:"Start"})},i.prototype.trackEditedBillingAddressSubmitted=function(){this.featureData.sendGANEvents&&this.trackEvent({name:"trackEvent",pageType:"Checkout",action:"Edit Billing Info",label:"Submit"})},i.prototype.trackShippingInformationAddressBook=function(){this.featureData.sendGANEvents&&this.trackEvent({name:"trackEvent",pageType:"Checkout",action:"Edit Shipping Info",label:"Address book"})},i.prototype.trackShippingInformationAddNewLocation=function(){this.featureData.sendGANEvents&&this.trackEvent({name:"trackEvent",pageType:"Checkout",action:"Edit Shipping Info",label:"New Location Start"})},i.prototype.trackAddShippingInfo=function(n,t){var u=this,i,r;this.featureData.useGA4Implementation&&(i=[],t.forEach(function(n,t){return i.push(u.gtmEventService.mapProductToItem(n,t))}),dataLayer.push({ecommerce:null}),r=i.reduce(function(n,t){return n+t.price*t.quantity},0),dataLayer.push({event:"add_shipping_info",ecommerce:{currency:this.currency,value:r,coupon:this.gtmEventService.getPriorityCode(),shipping_tier:n.name+" "+n.deliveryType.name,items:i}}))},i.prototype.trackShippingInformationSubmitNewLocation=function(){this.featureData.sendGANEvents&&this.trackEvent({name:"trackEvent",pageType:"Checkout",action:"Edit Shipping Info",label:"New Location Submit"})},i.prototype.trackShippingMethod=function(n){this.featureData.sendGANEvents&&this.trackEvent({name:"trackEvent",pageType:"Checkout",action:"Edit Shipping Info",label:n.name})},i.prototype.trackPaymentInformationAddNewCard=function(){this.featureData.sendGANEvents&&this.trackEvent({name:"trackEvent",pageType:"Checkout",action:"Edit Payment Info",label:"New Credit Card Start"})},i.prototype.trackPaymentInformationSubmitNewCard=function(n,t){var u=this,i,r;this.featureData.useGA4Implementation&&(i=[],t.forEach(function(n,t){return i.push(u.gtmEventService.mapProductToItem(n,t))}),dataLayer.push({ecommerce:null}),r=i.reduce(function(n,t){return n+t.price*t.quantity},0),dataLayer.push({event:"add_payment_info",ecommerce:{currency:this.currency,value:r,coupon:this.gtmEventService.getPriorityCode(),payment_type:this.gtmEventService.getCartType(n.CardType),items:i}}));this.featureData.sendGANEvents&&this.trackEvent({name:"trackEvent",pageType:"Checkout",action:"Edit Payment Info",label:"New Credit Card Submit"})},i.prototype.trackScrollEvent=function(){this.featureData.useGA4Implementation&&dataLayer.push({event:"scroll"})},i.prototype.trackPromoCodeEnteredSuccess=function(n,t){this.featureData.useGA4Implementation&&dataLayer.push({event:"promo_code_success",promo_code:n});this.featureData.sendGANEvents&&this.trackEvent({name:"trackEvent",pageType:t,action:"Apply Promo Code Success",label:n})},i.prototype.trackPromoCodeAttempt=function(n){this.featureData.useGA4Implementation&&dataLayer.push({event:"promo_code_attempt",promo_code:n})},i.prototype.trackPromoCodeEnteredFailed=function(n,t){this.featureData.useGA4Implementation&&dataLayer.push({event:"promo_code_fail",promo_code:n});this.featureData.sendGANEvents&&this.trackEvent({name:"trackEvent",pageType:t,action:"Apply Promo Code Failed",label:n})},i.prototype.trackSaveCartForLater=function(n){this.featureData.useGA4Implementation&&dataLayer.push({event:"save_for_later",product_name:n.materialName,product_id:n.materialBaseNumber,product_quantity:n.quantity});this.featureData.sendGANEvents&&this.trackEvent({name:"trackEvent",pageType:"Cart",action:"Save Cart For Later"})},i.prototype.trackEmptyCart=function(n){var r=this,t,i;this.featureData.useGA4Implementation&&(t=[],n.forEach(function(n,i){return t.push(r.gtmEventService.mapProductToItem(n,i,"Cartline List"))}),i=t.reduce(function(n,t){return n+t.price*t.quantity},0),dataLayer.push({ecommerce:null}),dataLayer.push({event:"remove_from_cart",ecommerce:{currency:this.currency,value:i,items:t}}));this.featureData.sendGANEvents&&this.trackEvent({name:"trackEvent",pageType:"Cart",action:"Empty Cart",label:""})},i.prototype.trackGoogleAdWordsTransaction=function(n){this.featureData.sendGANEvents&&n.orderNumber&&this.$window.gtag("event","conversion",{send_to:"AW-1059481073/IfhhCKDM630Q8cuZ-QM",value:n.orderInfo.total,currency:this.currency,transaction_id:n.orderNumber})},i.prototype.trackVideo=function(n,t,i){this.featureData.useGA4Implementation&&dataLayer.push({event:"video_start",video_title:t,video_url:"https://players.brightcove.net/5737985336001/jDgQd0IaM_default/index.html?videoId="+i});this.featureData.sendGANEvents&&this.trackEvent({name:"trackVideo",pageType:window.GANEventConstants.category!=null?window.GANEventConstants.category:n,action:"Watch Video",label:t})},i.prototype.trackVideoSiteView=function(){dataLayer.push({event:"video_site_view",video_title:"",video_url:""})},i.prototype.trackVideoImpression=function(n,t){dataLayer.push({event:"video_impression",video_title:n,video_url:t})},i.prototype.trackProductClick=function(t,i,r,u,f){this.featureData.useGA4Implementation&&((u===n.ProductListTypes.YouMayAlsoLike||u===n.ProductListTypes.RelatedItems||i===n.ProductListTypes.RelatedProducts)&&this.trackRelatedItemClick(t),this.trackSelectItemEvent(t,r));this.featureData.sendGANEvents&&this.trackProductClickEvent_old(t,i,r,u,f)},i.prototype.trackSelectItemEvent=function(n,t){dataLayer.push({ecommerce:null});dataLayer.push({event:"select_item",ecommerce:{item:{item_id:n.materialBaseNumber,item_name:n.materialName,item_brand:this.gtmEventService.getProductBrand(n),item_category:this.gtmEventService.getCategoryPathWithChangedDelimiter(n.category,n.isCustomizable),item_color:this.gtmEventService.getItemColor(n),item_price:n.unitPrice,item_quantity:n.quantity,item_variant:this.gtmEventService.getSelectedCharacterSetsValues(n),index:t?t:""}}})},i.prototype.trackRelatedItemClick=function(n){dataLayer.push({event:"related_item_click",product_id:n.materialBaseNumber,product_name:n.materialName})},i.prototype.trackProductClickEvent_old=function(n,i,r,u,f){var s=i,o=u,h,c,l,e;f&&(s=i!==undefined||u!==undefined?i:window.GANEventConstants.category,o=i!==undefined||u!==undefined?u:window.GANEventConstants.actionField);h=[];c={id:n.materialBaseNumber,name:n.materialName,brand:this.gtmEventService.getProductBrand(n),category:this.gtmEventService.getCategoryPathWithChangedDelimiter(n.category,n.isCustomizable),materialSaleFlag:this.gtmEventService.getMaterialSaleFlag(n.isSale),freeProductFlag:this.gtmEventService.getFreeProductFlag(n.isFreeGood),brandFlag:this.gtmEventService.getBrandFlag(n.isNsBrand),newMaterialFlag:this.gtmEventService.getNewMaterialFlag(n.isNew)};r&&(c.position=r);h.push(c);l=o===undefined||o===null||o===""?s:s+": "+o;e=new t;e.name="productClick";e.action=o==="Related Items"?"Related Items":"Product Click";e.label=n.materialName;e.pageType=s;e.productsInfo={currencyCode:this.currency,click:{actionField:{list:l},products:h}};this.trackEvent(e)},i.prototype.trackPageView=function(n,t,i,r){var u=this.gtmEventService.getLastLevelCategory(r);dataLayer.push({event:"page_view",content_group:u?u:i,login_status:n?"logged in":"logged out",priority_code:this.gtmEventService.getPriorityCode(),env:t})},i.prototype.trackFAQ=function(n){this.featureData.useGA4Implementation&&dataLayer.push({event:"faq_click",faq:n})},i.prototype.trackServicesView=function(n){dataLayer.push({event:"services_view",service:n})},i.prototype.trackArticleView=function(){this.featureData.useGA4Implementation&&dataLayer.push({event:"article_view"})},i.prototype.trackIndustryView=function(n){dataLayer.push({event:"industry_view",industry:n})},i.prototype.trackEditCartOrCheckout=function(n){this.featureData.useGA4Implementation&&dataLayer.push({event:"cart_or_checkout_edit",edit_type:n})},i}();i.$inject=["$window","gtmEventService","featureData"];n.AnalyticsService=i;angular.module("ns").service("analyticsService",i)}(ns||(ns={})),function(n){var t=function(){function t(n,t,i,r,u){this.analyticsService=n;this.navigationService=t;this.userService=i;this.productDetailsService=r;this.featureData=u}return t.prototype.trackNavClickGA4=function(n){this.featureData.useGA4Implementation&&this.analyticsService.trackNavClickGA4(n)},t.prototype.trackNavClick=function(t,i,r,u,f){var o,e;u===void 0&&(u="trackNav");f===void 0&&(f="navigation");this.trackNavClickGA4(i);o=i.split("- ")[1];r==="services"?this.trackServicesView(o):r==="industry"&&this.trackIndustryView(o);this.featureData.sendGANEvents&&(e=new n.GTMEvent,e.name=u,e.pageType=f,e.action=t,e.label=i,this.analyticsService.trackNavEvent(e))},t.prototype.trackPdfDownload=function(n,t,i){var r,u;i?r=n:(u=this.navigationService.getCurrentUrl(),r=""+u+n);var f=n.split("/")[4].split(".")[1],e="/"+n.split("/")[4],o=document.getElementById(t).textContent;this.trackPdfDownloadEvent(f,e,o,r)},t.prototype.trackExternalLinkClick=function(n){this.analyticsService.trackExternalLinkClick(n)},t.prototype.trackLiveChatEvent=function(n){this.analyticsService.trackLiveChatClick(n)},t.prototype.trackQuickShopClick=function(){this.analyticsService.trackQuickShopClick()},t.prototype.trackInvoiceSearch=function(n){this.analyticsService.trackInvoiceSearch(n)},t.prototype.trackLiveChatStart=function(){this.analyticsService.trackLiveChatStart()},t.prototype.trackEmailSignUp=function(n){this.featureData.useGA4Implementation&&this.analyticsService.trackEmailSignUp(n);this.featureData.sendGANEvents&&this.analyticsService.trackEvent({name:"trackEvent",pageType:"Email",action:"Opt Out"})},t.prototype.trackPdfDownloadEvent=function(n,t,i,r){this.featureData.useGA4Implementation&&this.analyticsService.trackFileDownload(n,t,i,r);this.featureData.sendGANEvents&&this.analyticsService.trackEvent({name:"trackEvent",pageType:"Downloads",action:"Click",label:r})},t.prototype.trackPageView=function(n,t){if(this.featureData.useGA4Implementation){var i=!1;this.userService&&this.userService.user&&(i=this.userService.user.isUserAuthenticated);this.analyticsService.trackPageView(i,t,n,this.productDetailsService.product)}},t.prototype.trackContactUsView=function(){this.analyticsService.trackContactUsView()},t.prototype.trackContactUsStart=function(){this.analyticsService.trackContactUsStart()},t.prototype.trackContactUsSubmit=function(){this.analyticsService.trackContactUsSubmit()},t.prototype.trackOrderHistoryReview=function(){this.analyticsService.trackOrderHistoryReview()},t.prototype.trackOrderHistoryDetailReview=function(n,t){this.analyticsService.trackOrderHistoryDetailReview(n,t)},t.prototype.trackServicesView=function(n){this.featureData.useGA4Implementation&&this.analyticsService.trackServicesView(n)},t.prototype.trackPromotionEvent=function(t,i,r,u,f){var e=new n.TrackedAdDetails;e.creativeName=i;e.creativeSlot=r;e.promoCode=u;e.promoName=f;this.analyticsService.trackPromotionEvent(t,e)},t.prototype.trackIndustryView=function(n){this.featureData.useGA4Implementation&&this.analyticsService.trackIndustryView(n)},t.prototype.trackArticleView=function(){this.analyticsService.trackArticleView()},t.prototype.trackVideo=function(n,t,i){this.analyticsService.trackVideo(n,i,t)},t.prototype.trackVideoSiteView=function(){this.featureData.useGA4Implementation&&this.analyticsService.trackVideoSiteView()},t.prototype.trackVideoImpression=function(n,t){if(this.featureData.useGA4Implementation){var i=document.getElementById(t).src;this.analyticsService.trackVideoImpression(n,i)}},t.prototype.trackFAQ=function(n){n.currentTarget.ariaExpanded==="false"&&this.analyticsService.trackFAQ(n.currentTarget.innerText)},t}();t.$inject=["analyticsService","navigationService","userService","productDetailsService","featureData"];angular.module("ns").controller("analyticsController",t)}(ns||(ns={})),function(n){var t=function(){function n(n){this.cookieService=n}return n.prototype.getMaterialSaleFlag=function(n){return n?"On Sale":"Regular Price"},n.prototype.getFreeProductFlag=function(n){return n?"Free Product":"Standard Product"},n.prototype.getBrandFlag=function(n){return n?"Brand":"Non-Brand"},n.prototype.getNewMaterialFlag=function(n){return n?"New":"Non-New"},n.prototype.getSelectedCharacterSetsValues=function(n){var t=[];return n.characterSets&&n.characterSets.forEach(function(n){n.selectedValue&&t.push(n.selectedValue.name)}),this.getJoinedCharacterSets(t)},n.prototype.getJoinedCharacterSets=function(n){return n?n.join(", "):""},n.prototype.getCategoryPathWithChangedDelimiter=function(n,t){var i,r,u;if(n&&n.fullWebPath){for(i=n.fullWebPath.replace(/\-/g," "),r={category2Start:0,category2End:0,category3Start:0,count:0},u=0;u<i.length;u++)i[u]==="/"&&this.getStartAndEndIndexForCategories(r,u);return i=this.removeCategory3(i,r.category2End,r.category3Start),i=this.replaceCategory2WithStandardForNonCustomProducts(i,t,r.category2Start,r.category2End),i.substring(1)}return""},n.prototype.getStartAndEndIndexForCategories=function(n,t){n.count++;switch(n.count){case 2:n.category2Start=t;break;case 3:n.category2End=t;break;case 4:n.category3Start=t}return},n.prototype.replaceBetween=function(n,t,i,r){return r.substring(0,n)+i+r.substring(t)},n.prototype.replaceCategory2WithStandardForNonCustomProducts=function(n,t,i,r){return i===0||r===0?n:t?n:this.replaceBetween(i+1,r,"standard",n)},n.prototype.removeCategory3=function(n,t,i){return t===0||i===0?n:this.replaceBetween(t,i,"",n)},n.prototype.generateAddToCartGtmProduct=function(n,t,i,r,u){var f=this.generateCartProduct(n,i,r,u);return f.addToCartLocation=t?t:window.GANEventConstants.category,f},n.prototype.generateRemoveFromCartGtmProduct=function(n,t){var i=this.generateCartProduct(n);return i.list=t,i},n.prototype.generateCartProduct=function(n,t,i,r){return{id:n.materialBaseNumber,name:n.materialName,brand:r?r:this.getProductBrand(n),category:this.getCategoryPathWithChangedDelimiter(n.category,n.isCustomizable),variant:t?t:this.getSelectedCharacterSetsValues(n),price:i?i:n.unitPrice,quantity:n.quantity,materialSaleFlag:this.getMaterialSaleFlag(n.isSale),freeProductFlag:this.getFreeProductFlag(n.isFreeGood),brandFlag:this.getBrandFlag(n.isNsBrand),newMaterialFlag:this.getNewMaterialFlag(n.isNew)}},n.prototype.getItemColor=function(n){if(n.characterSets)for(var t=0;t<n.characterSets.length;t++)if(n.characterSets[t].name.toLowerCase()==="color")return n.characterSets[t].selectedValue.name;return undefined},n.prototype.mapProductToItem=function(n,t,i,r,u,f){var e=this.getPriorityCode();return{item_id:n.materialBaseNumber,item_name:n.materialName,index:t,item_brand:f?f:this.getProductBrand(n),item_category:this.getCategoryPathWithChangedDelimiter(n.category,n.isCustomizable),item_list_name:i,price:u?u:n.unitPrice,quantity:n.quantity,item_variant:r?r:this.getSelectedCharacterSetsValues(n),item_color:this.getItemColor(n),promotion_id:e,coupon:e}},n.prototype.mapAlgoliaProductToViewItemModel=function(n,t,i){return{index:t,item_id:n.MaterialBaseNumber,item_name:n.Name,item_brand:n.FullBrandName,item_list_name:i,promotion_id:this.getPriorityCode(),coupon:this.getPriorityCode()}},n.prototype.mapProductToViewItemModel=function(n,t,i){return{index:t,item_id:n.materialBaseNumber,item_name:n.materialName,item_brand:this.getProductBrand(n),item_list_name:i,promotion_id:this.getPriorityCode(),coupon:this.getPriorityCode()}},n.prototype.getItemListNameForSearch=function(){var n=window.location.pathname.replace("/Search","");return n.length>0&&(n=n.slice(1).replace(new RegExp("-","g")," ").replace(new RegExp("/","g"),"-").trim()),n?n:"Search Page"},n.prototype.getPriorityCode=function(){var n=this.cookieService.getPriorityCodeCookie();return n?n:(new Date).getFullYear().toString().substr(-2)+"UNWEB"},n.prototype.getProductBrand=function(n){return n.noBrand?"NoBrand":n.brand?n.brand:n.materialBrand},n.prototype.getLastLevelCategory=function(n){if(n&&n.category&&n.category.fullWebPath){var t=n.category.fullWebPath.replace(/\-/g," ");return t.split("/").pop()}return""},n.prototype.getCartType=function(n){switch(n){case"vi":return"visa";case"mc":return"mastercard";case"di":return"discover";case"ax":return"american express";default:return""}},n}();t.$inject=["cookieService"];n.GTMEventService=t;angular.module("ns").service("gtmEventService",t)}(ns||(ns={})),function(n){var t=function(){function n(){this.creativeName=null;this.promoCode=null;this.promoName=null;this.creativeSlot=0}return n}();n.TrackedAdDetails=t}(ns||(ns={})),function(n){var t=function(){function n(){}return n.prototype.showBrowser=function(){var i=navigator.userAgent,t,n=i.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];return/trident/i.test(n[1])?(t=/\brv[ :]+(\d+)/g.exec(i)||[],"IE "+(t[1]||"")):n[1]==="Chrome"&&(t=i.match(/\b(OPR|Edge)\/(\d+)/),t!=null)?t.slice(1).join(" ").replace("OPR","Opera"):(n=n[2]?[n[1],n[2]]:[navigator.appName,navigator.appVersion,"-?"],(t=i.match(/version\/(\d+)/i))!=null&&n.splice(1,1,t[1]),n.join(" "))},n}();n.BrowserDetectionService=t;angular.module("ns").service("browserDetectionService",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t){this.$scope=n;this.analyticsService=t;n.orderNumber="";n.purchaseOrder=""}return n.prototype.trackCheckOrderStatus=function(){var n=this;n.analyticsService.trackCheckOrderStatus(n.$scope.orderNumber,n.$scope.purchaseOrder)},n}();t.$inject=["$scope","analyticsService"];n.CheckOrderController=t;angular.module("ns").controller("checkOrderController",t)}(ns||(ns={})),function(n){var t=function(){function t(n,t,i,r,u,f,e){this.pageErrorsService=n;this.paymentService=t;this.shippingMethodsService=i;this.checkoutService=r;this.cartService=u;this.creditCardService=f;this.featureData=e;this.cart=u.getCart()}return t.prototype.addPaymentErrors=function(){var n=this.addNoCreditCardsError();n||(this.addPaymentWithExpiredCardError(),this.addPaymentWithUntrustedCardWithoutSecurityCodeError(),this.addNotAllowedError(),this.addNoPayrollDeductDisclaimerAccepted())},t.prototype.billMyAccountTabIsOpenError=function(){this.paymentService.billMyAccountInfoTabIsOpen()&&this.pageErrorsService.add(this.pageErrorsService.errors.NoCreditCardInformation)},t.prototype.addShippingErrors=function(){this.addShippingMethodOtherWithoutNotesError();this.addShipingMethodPickupWithInvalidPhoneError();this.addShippingMethodCollectAndInvalidAccountNumberError();this.addShippingRestrictionsNotRespectedErrors();this.addShippingHazmatOrmdToNonContinentalUsAndOtherShippingMethodIsNotSelectedError();this.addShippingToVirginIslandsOrPuertoRicoAndOtherShippingMethodIsNotSelectedError()},t.prototype.addAdditionalForwardOrderEmailsErrors=function(n){var r=this,u,t,i;if(n&&n.trim()){if(u=1e3,n.length>u){this.pageErrorsService.add(this.pageErrorsService.errors.AdditionalForwardOrderEmailsLength);return}t=!0;n.indexOf(",")!==-1?(i=n.split(","),i.forEach(function(n){t&&(r.validateEmail(n)||(t=!1))})):n.indexOf(";")!==-1?(i=n.split(";"),i.forEach(function(n){t&&(r.validateEmail(n)||(t=!1))})):t=this.validateEmail(n);t||this.pageErrorsService.add(this.pageErrorsService.errors.AdditionalForwardOrderEmails)}},t.prototype.validateEmail=function(n){if(!n)return!1;n=n.trim();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(String(n).toLowerCase())},t.prototype.addErrorForErrorCode=function(n){switch(n){case 1:this.pageErrorsService.add(this.pageErrorsService.errors.CartInvalid);return;case 2:this.pageErrorsService.add(this.pageErrorsService.errors.SAPOrderFailed);return;case 3:this.checkoutService.checkout.failedAuthorizingCreditCard=!0;this.pageErrorsService.add(this.pageErrorsService.errors.InvalidCreditCard);return;case 4:this.pageErrorsService.add(this.pageErrorsService.errors.NotShippingToPOBox);return;case 5:this.pageErrorsService.add(this.pageErrorsService.errors.InvalidCollectAccountNumber);return;case 6:this.pageErrorsService.add(this.pageErrorsService.errors.OtherShippingMethodIsRequired);return;case 7:this.pageErrorsService.add(this.pageErrorsService.errors.ProductNotForSaleInCalifornia);return;case 9:this.pageErrorsService.add(this.pageErrorsService.errors.UserNotAuthorized);return;case 11:this.pageErrorsService.add(this.pageErrorsService.errors.InvalidPikupShippingMethodPhoneNumber);return;case 14:this.pageErrorsService.add(this.pageErrorsService.errors.AmountOverApproverLimit);return;case 15:this.pageErrorsService.add(this.pageErrorsService.errors.GetVouchersFailed);return;case 16:this.pageErrorsService.add(this.pageErrorsService.errors.MultipleVouchersInCart);return;case 17:this.pageErrorsService.add(this.pageErrorsService.errors.VoucherNotAvailable);return;case 18:this.pageErrorsService.add(this.pageErrorsService.errors.ShippingAndTaxNotAvailable);return;case 19:this.pageErrorsService.add(this.pageErrorsService.errors.StaleVoucher);return;case 20:this.pageErrorsService.add(this.pageErrorsService.errors.NonContributingVoucherCoverage);return;case 21:this.pageErrorsService.add(this.pageErrorsService.errors.SAPOrderTimeout);return;case 22:this.pageErrorsService.add(this.pageErrorsService.errors.ItemsNotCoveredByVoucherForRestrictedUser);return;default:this.pageErrorsService.add(this.pageErrorsService.errors.UnknownFormPostError);return}},t.prototype.addNoCreditCardsError=function(){return this.creditCardService.hasNoCreditCards()?(this.pageErrorsService.add(this.pageErrorsService.errors.NoCreditCardInformation),!0):!1},t.prototype.addPaymentWithExpiredCardError=function(){this.creditCardService.isExpiredCreditCard()&&this.pageErrorsService.add(this.pageErrorsService.errors.ExpiredCreditCard)},t.prototype.addPaymentWithUntrustedCardWithoutSecurityCodeError=function(){this.creditCardService.isCreditCard()&&(this.creditCardService.isTrusted()||this.creditCardService.hasCvv()||this.pageErrorsService.add(this.pageErrorsService.errors.InvalidSecurityCode))},t.prototype.addNoPayrollDeductDisclaimerAccepted=function(){this.paymentService.isPayrollDeductSelectedAndDisclaimerNotAccepted()&&this.pageErrorsService.add(this.pageErrorsService.errors.PayrollDeductDisclaimerNotAccepted)},t.prototype.addShippingRestrictionsNotRespectedErrors=function(){this.cart.shippingHasCaliforniaError()&&this.pageErrorsService.add(this.pageErrorsService.errors.ProductNotForSaleInCalifornia)},t.prototype.addShippingMethodOtherWithoutNotesError=function(){this.shippingMethodsService.isOtherShipMethodWithoutNotes()&&this.pageErrorsService.add(this.pageErrorsService.errors.MissingOtherShippingMethodDetails)},t.prototype.addShipingMethodPickupWithInvalidPhoneError=function(){this.shippingMethodsService.isPickupMethodWitInvalidPhoneNumber()&&this.pageErrorsService.add(this.pageErrorsService.errors.InvalidPikupShippingMethodPhoneNumber)},t.prototype.addShippingMethodCollectAndInvalidAccountNumberError=function(){this.shippingMethodsService.isCollectShipMethodWithInvalidAccountNumber()&&this.pageErrorsService.add(this.pageErrorsService.errors.InvalidCollectAccountNumber)},t.prototype.addShippingHazmatOrmdToNonContinentalUsAndOtherShippingMethodIsNotSelectedError=function(){this.shippingMethodsService.isShippingHazmatOrmdToNonContinentalUsAndOtherShippingMethodIsNotSelected()&&this.pageErrorsService.add(this.pageErrorsService.errors.OtherShippingMethodIsRequired)},t.prototype.addShippingToVirginIslandsOrPuertoRicoAndOtherShippingMethodIsNotSelectedError=function(){this.shippingMethodsService.isShippingToNonShippableStateAndOtherShippingMethodIsNotSelected()&&this.pageErrorsService.add(this.pageErrorsService.errors.OtherShippingMethodIsRequired)},t.prototype.addPoNumberFieldError=function(n){(n===null||n==="")&&this.pageErrorsService.add("PO Number is required")},t.prototype.addCustomBillingFieldErrors=function(t){var i=this;_.each(t,function(t){t.isPrefilled||!t.checkoutRequired&&i.featureData.pathfinder_ToggleBillingRequiredFields||((t.userInput===null||t.userInput==="")&&i.pageErrorsService.add(t.caption+" is required"),t.inputSelectList.length===0&&t.userInput&&(t.userInput.length>500&&i.pageErrorsService.add(t.caption+" invalid: 500 character limit exceeded."),t.inputType===n.InputTypeEnum[n.InputTypeEnum.numeric]&&(t.minValue===t.maxValue||t.maxValue===t.minValue+1)&&Number(t.userInput)!==t.minValue?i.pageErrorsService.add("The field "+t.caption+" must be "+t.minValue+"."):t.inputType===n.InputTypeEnum[n.InputTypeEnum.numeric]&&(Number(t.userInput)<t.minValue||Number(t.userInput)>t.maxValue)&&i.pageErrorsService.add("The field "+t.caption+" must be a number larger than "+t.minValue+" and smaller than "+t.maxValue),t.inputType===n.InputTypeEnum[n.InputTypeEnum.alphanumeric]&&(t.minLength===t.maxLength||t.maxLength===t.minLength+1)&&t.userInput.length!==t.minLength?i.pageErrorsService.add("The field "+t.caption+" must have "+t.minLength+" "+(t.minLength===1?"character.":"characters.")+" "+(t.allowOnlyDigits&&!i.isNumber(t.userInput)?"The field must contain only digits.":"")):(t.inputType===n.InputTypeEnum[n.InputTypeEnum.alphanumeric]&&(t.userInput.length>t.maxLength||t.userInput.length<t.minLength)||t.allowOnlyDigits&&!i.isNumber(t.userInput))&&i.pageErrorsService.add("The field "+t.caption+" must have more than "+t.minLength+" "+(t.minLength===1?"character":"characters")+" and less than "+t.maxLength+" characters."+(t.allowOnlyDigits&&!i.isNumber(t.userInput)?"The field must contain only digits.":""))))})},t.prototype.addNotAllowedError=function(){this.paymentService.isSelectedPaymentMethod(n.PaymentMethods.notAllowed)&&this.pageErrorsService.add(this.pageErrorsService.errors.PlaceOrderNotAllowed)},t.prototype.isNumber=function(n){return n!=null&&n!==""&&!isNaN(Number(n.toString()))},t.prototype.validateCustomInputRegex=function(n,t){return t?t.test(n):!0},t}();t.$inject=["pageErrorsService","paymentService","shippingMethodsService","checkoutService","cartService","creditCardService","featureData"];n.CheckoutErrorService=t;angular.module("ns").service("checkoutErrorsService",t)}(ns||(ns={})),function(n){var e=function(){function n(n){this.customBillingFields=[];this.collectAccountNumber=n.collectAccountNumber;this.isNonContributionVoucherProgram=n.voucherContext?n.voucherContext.isNonContributing:!1;this.deliveryCostsForShippingMethods=n.deliveryCostsForShippingMethods;this.forwardOrderEmails=n.forwardOrderEmails;this.userInfo=n.userInfo;this.orderConfirmationCartLines=null;this.showOrderConfirmation=!1;this.orderConfirmationLostCartLines=null;this.orderConfirmation=null;this.failedAuthorizingCreditCard=!1;this.showGoogleConfirmation=!0;this.isTestOrder=!1;this.getCustomBillingFields(n.customBillingData);this.isPoRequired=n.isPoRequired;this.prefilledOptionalPoValue=n.prefilledOptionalPoValue;this.isCleansedAddress=n.isCleansedAddress;this.isVoucherContext=n.voucherContext?n.voucherContext.voucherGuid?!0:!1:!1}return n.prototype.getDeliveryCostPerShippingMethod=function(n){return this.deliveryCostsForShippingMethods.deliveryCosts[n]},n.prototype.getCustomBillingFields=function(n){var t=this;n?_.each(n,function(n){n.caption&&t.customBillingFields.push(new r(n))}):this.customBillingFields=[]},n.prototype.getCustomBillingData=function(){var n={};return this.customBillingFields&&_.each(this.customBillingFields,function(t){return n[t.inputName]=t.userInput}),n},n}(),u,f,r,t,i;n.Checkout=e;u=function(){function n(){this.orderNumber=null;this.date=null}return n.prototype.update=function(n){this.orderNumber=n.orderNumber;this.date=moment(n.date).format("MM/DD/YYYY, hh:mm a")},n}();n.OrderConfirmationKey=u;f=function(){function n(n,t){this.userInput=null;this.displayField=n;this.displayName=t}return n}();n.StandardBillingField=f;r=function(){function n(n){this.caption=n.caption;this.allowOnlyDigits=n.allowOnlyDigits;this.minValue=n.minValue;this.maxValue=n.maxValue;this.minLength=n.minLength;this.maxLength=n.maxLength;this.inputType=i[n.inputType];this.helpText=n.helpText;this.inputName=n.inputName;this.inputValues=n.inputValues;this.userInput=n.userInput;this.pattern="";this.inputSelectList=[];this.isPrefilled=n.isPrefilled;this.checkoutRequired=n.checkoutRequired;this.isPrefilled||this.setInputRestrictions()}return n.prototype.setInputRestrictions=function(){var n=this;switch(i[this.inputType]){case i.listOfValues:this.inputSelectList.push(new t("",this.helpText,!0));_.each(this.inputValues,function(i){n.inputSelectList.push(new t(i,i))});this.userInput=this.inputSelectList[0].value;break;case i.yesNo:this.inputSelectList.push(new t("",this.helpText,!0));this.inputSelectList.push(new t("Yes","Yes"),new t("No","No"));this.userInput=this.inputSelectList[0].value;break;case i.numeric:this.pattern=new RegExp(/^\-?[0-9]+$/);this.validationError="Numeric characters only";break;case i.alphanumeric:this.allowOnlyDigits&&(this.pattern=new RegExp(/^\-?[0-9]+$/),this.validationError="The field must contain only digits")}},n}();n.CustomAdditionalFieldVM=r;t=function(){function n(n,t,i){this.value=n;this.label=t;this.disabled=i?i:!1}return n}();n.InputSelectList=t,function(n){n[n.numeric=1]="numeric";n[n.alphanumeric=2]="alphanumeric";n[n.yesNo=3]="yesNo";n[n.listOfValues=4]="listOfValues"}(i=n.InputTypeEnum||(n.InputTypeEnum={}))}(ns||(ns={})),function(n){"use strict";n.factory("checkoutService",["$http","$rootScope","initialData","cartService","apiService","addressService","shippingMethodsService","userService","modelsFactory","paymentService","creditCardService","punchOutService","loggerFactory","featureData","cookieService",function(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y){var b=a.getBackendLogger("CheckoutServiceLogger"),w=r.getCart(),p=s.createCheckout(i.checkout),k=function(n){var t=c.getAppliedCreditCard();n.creditCardId=c.getAppliedCreditCardId();n.creditCardLastFour=t.lastFourDigits;n.creditCardExpirationYear=t.expirationYear;n.creditCardExpirationMonth=t.expirationMonth;n.creditCardToken=t.token;n.creditCardType=t.typeCode;n.creditCardCvv=t.cvv;n.creditCardHolderName=t.ownerName};return{checkout:p,setDeliveryDateEstimationsOnCartLines:function(n){var t=p.deliveryCostsForShippingMethods.deliveryCosts[n].deliveryDate.itemsDeliveryDates,i=_.indexBy(t,"lineId");_.each(w.cartLines,function(n){var r=i[n.lineId],u,t;r?(t={},r.deliveryDate&&(u=new Date(r.deliveryDate.convertDateFromISO()),t.date=u.getCustomFormattedDate()),t.message=r.message,n.deliveryEstimation=t):(t={},t.date=null,n.deliveryEstimation=t)})},deliveryDatesHaveError:function(n){var t=p.deliveryCostsForShippingMethods.deliveryCosts[n],i;return t?(i=t.deliveryDate,i.message!=null):!1},placeOrder:function(n){return n.cartCookieId=w.cartId,n.isPunchOutOrder=l.isPunchOutSession(),u.placeOrder(n).then(function(n){return n.data.success&&(p.showOrderConfirmation=!0,p.orderConfirmation=s.createOrderConfirmationKey(n.data.resultObject),y.removeCartCookie()),n})},removeMaterial:function(n){r.removeItem(n)},isHazmatOrOrmdInCart:function(){return w.hasHazmatOrOrmdItem()},showShipToName:function(n){return f.isShipToNameDefined(n)||o.user.isPersonal()&&n.companyName},buildPlaceOrderInput:function(n){return{isTestOrder:p.isTestOrder,soldToId:f.soldToAddress.soldToId,shipToId:f.selectedShipToAddress.shipToId,shippingMethod:e.getSelectedShippingMethodId(),shippingMethodCode:e.getSelectedShippingConditionCode(),otherShippingMethodNotes:e.getOtherNotes(),collectShippingMethodAccountNumber:e.getCollectAccountNumber(),paymentMethod:h.getPaymentMethod(),purchaseOrder:n.purchaseOrderNo,isAssociateUser:o.user.isAssociate(),adminImpersonatorCustomerId:o.user.adminImpersonatorCustomerId(),managerImpersonatorGuid:o.user.managerImpersonatorGuid(),impersonatorUsername:o.user.impersonatorUsername(),phoneNumber:e.getPickupPhoneNumber(),forwardOrderEmails:n.forwardOrderEmails,additionalBillingData:p.getCustomBillingData(),voucherCoverage:w.getVoucherCoverage()}},showLevelTwoRestrictedWarning:function(){var n=_.find(w.cartLines,function(n){return!n.isQuoted});return n&&o.user.isLevelTwoRestricted?!0:!1},addCreditCardInfoToPlaceOrderInput:k,showOrderConfirmation:function(){return p.showOrderConfirmation},getOrderConfirmationKey:function(){return p.orderConfirmation},getFailedAuthorizingCreditCard:function(){return p.failedAuthorizingCreditCard},saveOrderConfirmation:function(n){return b.debug("Sent order confirmation for order number "+n.orderConfirmation.orderNumber),u.orderConfirmation(n)},getWarningMaterials:function(){var n=f.selectedShipToAddress.shipToId,t=w.cartId;return u.getWarningMaterials(t,n)},displayOptionalPoNumber:function(){return!p.customBillingFields.some(function(n){return n.inputName==="PONumber"})&&!p.prefilledOptionalPoValue},isPoRequired:function(){return p.isPoRequired}}}])}(angular.module("ns")),function(n){"use strict";n.controller("checkoutCtrl",["$scope","checkoutService","navigationService","$rootScope","priorityCodeService","$timeout","addressService","analyticsService","cartService","functionUtils","pageErrorsService","shippingMethodsService","eventsService","userService","dateService","paymentService","checkoutErrorsService","creditCardService","loggerFactory","featureData","gtmEventService","totalsService","apiService","cookieService","shEddTaxService",function(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b,k,d,g,nt,tt,it,rt){var ut=this,vt=!0,yt=k.getBackendLogger("CheckoutService"),ft="a.disable-until-loaded",et,ot,ht,ct,lt,pt,st,at;u.priorityCodeModel&&yt.debug("Priority code "+u.priorityCodeModel.priorityCode+" has end date "+u.priorityCodeModel.endDate);et=!1;v.user.isEmployeeUser===!0&&tt.getEmployeeHasTestModeCatalog().then(function(n){et=n.data});ut.ui={addressBookIsOpen:function(){return $("#address-list").hasClass("active")},netTotal:function(){return s.getNetTotal()},isTestOrder:!1,isTestModeCatalog:function(){return et},isLevelOneRestricted:v.user.isLevelOneRestricted,isLevelTwoRestricted:v.user.isLevelTwoRestricted,showShipToName:function(n){return e.addressHasNameDefined(n)},updatingTotals:!1,displayOptionalPoNumber:t.displayOptionalPoNumber(),isPoRequired:t.isPoRequired(),orderConfirmation:t.getOrderConfirmationKey(),isPersonalCustomer:v.user.isPersonal(),isResellerCustomer:v.user.isReseller(),isAssociateCustomer:v.user.isAssociate(),isEmployeeUser:v.user.isEmployeeUser,isInactiveCustomerForImpersonatedEmployee:function(){return!v.user.isActiveCustomer&&v.user.isUserImpersonated&&v.user.isEmployeeUser},isImpersonatedBuyer:function(){return v.user.isUserImpersonated&&!v.user.isEmployeeUser},showLevelTwoRestrictedWarning:function(){return t.showLevelTwoRestrictedWarning()},showLostCartLinesWarning:!1,redirectToPrevNonCheckoutPage:function(){return i.goToPrevNonCheckoutPage()},failedAuthorizingCreditCard:t.getFailedAuthorizingCreditCard(),priorityCode:{priorityCodeSummary:u.priorityCodeModel,determinePCodePlaceholderText:function(){return ut.ui.priorityCode.priorityCodeSummary.priorityCode?ut.ui.priorityCode.priorityCodeSummary.priorityCode:"Enter Promo Code"}},cartHasPickupItems:s.cartHasPickupItems(),isBranchCustomerPickupMethod:function(){return l.isBranchCustomerPickupMethod()},angularError:!1,placeOrderNotAvailable:!1,isImpersonatedUser:v.user.isUserImpersonated,pathfinder_ToggleBillingRequiredFields:d.pathfinder_ToggleBillingRequiredFields,subTotalUnder250:function(){return s.getCart().getSubtotal()<250},addressIsFromCanada:function(){return e.isAddressFromCanada(e.selectedShipToAddress)},isPlaceOrderAllowed:function(){return!p.isNotAllowedPaymentMethod()},isAddressBookEmpty:function(){return e.isAddressBookEmpty()},isCleansedAddress:!0};ut.data={cart:s.getCart(),checkoutErrors:c.pageErrors,shippingMethods:l.getShippingMethods(),purchaseOrderNo:t.checkout.prefilledOptionalPoValue,forwardOrderEmails:v.getForwardOrderEmails(),adminImpersonatorCustomerId:v.user.adminImpersonatorCustomerId(),managerImpersonatorGuid:v.user.managerImpersonatorGuid(),impersonatorUsername:v.user.impersonatorUsername(),orderDeliveryEstimate:"",orderDeliveryEstimateMax:"",orderDeliveryEstimateMessage:"",orderShipDate:"",checkoutModel:t.checkout,customBillingFields:t.checkout.customBillingFields,warningMaterials:[],confirmWarningChecked:!1,placingOrder:!1};ut.ui.displayAdditionalInfoSection=ut.ui.displayOptionalPoNumber||ut.data.customBillingFields.some(function(n){return n.isPrefilled===!1});ot=[];s.getCart().cartLines.forEach(function(n){return ot.push({id:n.materialBaseNumber,name:n.materialName,brand:n.brand,noBrand:n.noBrand,category:g.getCategoryPathWithChangedDelimiter(n.category,n.isCustomizable),variant:g.getSelectedCharacterSetsValues(n),price:n.unitPrice,quantity:n.quantity,materialSaleFlag:g.getMaterialSaleFlag(n.isSale),freeProductFlag:g.getFreeProductFlag(n.isFreeGood),brandFlag:g.getBrandFlag(n.isNsBrand),newMaterialFlag:g.getNewMaterialFlag(n.isNew)})});o.trackViewCheckout(ot,s.getCart().getSubtotal(),u.priorityCodeModel.priorityCode);ut.ui.trackProductClick=function(n){var t=s.getCart().cartLines.indexOf(n)+1;o.trackProductClick(n,"Checkout",t,"Order Summary")};ht=function(){c.clear();var n=function(){ut.ui.addressBookIsOpen()&&c.add(c.errors.AddressBookIsOpen)},i=function(){n();w.billMyAccountTabIsOpenError()};i();w.addCustomBillingFieldErrors(t.checkout.customBillingFields);ut.ui.isPoRequired&&ut.ui.displayOptionalPoNumber&&!t.checkout.prefilledOptionalPoValue&&w.addPoNumberFieldError(ut.data.purchaseOrderNo);w.addAdditionalForwardOrderEmailsErrors(ut.data.forwardOrderEmails);w.addShippingErrors();w.addPaymentErrors()};ct=function(){var n=t.getOrderConfirmationKey();return{orderDeliveryEstimate:l.getDeliveryDateForOrderConfirmation(),orderDeliveryEstimateMax:l.getMaxDeliveryDateForOrderConfirmation(),orderDeliveryEstimateMessage:l.getEstimateDeliveryDateMessageForOrderConfirmation(),orderShipDate:y.getEstimatedShippingDate(y.getUTCDate(new Date)),orderConfirmation:n,netTotal:ut.ui.netTotal(),showLevelTwoRestrictedWarning:t.showLevelTwoRestrictedWarning(),showGoogleConfirmation:!0,shippingMethodText:l.getDisplayText(l.getSelectedShippingConditionCode(),l.getOtherNotes()),showShipToName:ut.ui.showShipToName(e.selectedShipToAddress)}};ut.ui.checkPlaceOrderAvailable=function(){if(ht(),c.hasErrors()){r.$broadcast("Order-Submitted");return}ut.data.confirmWarningChecked=!1;t.getWarningMaterials().then(function(n){var t=[];n.data.success&&(t=n.data.resultObject);t.length===0?ut.ui.placeOrder():ut.data.warningMaterials=t})};ut.ui.safariWarningWasDisplayed=!1;ut.ui.showSafariWarning=function(){ut.ui.safariWarningWasDisplayed||navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&navigator.userAgent.indexOf("Safari")>-1&&navigator.userAgent.indexOf("Chrome")<0&&(setTimeout(function(){$("#safari-warning-modal").modal("show")},500),ut.ui.safariWarningWasDisplayed=!0)};ut.ui.placeOrder=function(){ut.data.placingOrder=!0;var n=t.buildPlaceOrderInput(ut.data);b.isCreditCard()&&t.addCreditCardInfoToPlaceOrderInput(n);lt=f(function(){c.add(c.errors.SAPOrderTimeout);r.$broadcast(events.GenericEvents.DoNotCloseModal);ut.data.placingOrder=!1},9e4);try{t.placeOrder(n).then(function(n){if(f.cancel(lt),n.data.success){$(".checkout-btn").text("Checkout");var u=ct();pt=f(function(){u.showGoogleConfirmation=!0},5e3);t.saveOrderConfirmation(u).then(function(){var n,t;r.$broadcast("place-order-success");n=v.isEmployeeUser();n?(t=it.getCartCookie(),tt.unsetEmployeeVoucher(t.cartCookieId).then(function(){i.goToOrderConfirmationPage()})):i.goToOrderConfirmationPage()})}else w.addErrorForErrorCode(n.data.errors[0].errorCode),ut.ui.failedAuthorizingCreditCard=t.getFailedAuthorizingCreditCard(),ut.data.placingOrder=!1})}catch(u){ut.data.placingOrder=!1}finally{r.$broadcast(events.GenericEvents.DoNotCloseModal)}};ut.ui.removeMaterial=function(n){t.removeMaterial(n)};ut.ui.priorityCode.showRequiredPriorityCodeErrorMessage=function(n){return n.$submitted&&n.priorityCode&&n.priorityCode.$error.required};ut.ui.priorityCode.showMaxLengthPriorityCodeMessage=function(n){return n.$submitted&&n.priorityCode&&n.priorityCode.$error.maxlength};ut.ui.priorityCode.removeCustomErrors=function(){ut.ui.priorityCode.priorityCodeErrors=null};ut.ui.priorityCode.applyPriorityCode=function(n){var i="Checkout",t=ut.ui.priorityCode.priorityCodeText;o.trackPromoCodeAttempt(t);n.$setSubmitted();n.$valid?u.changePriorityCode(ut.ui.priorityCode.priorityCodeText,e.selectedShipToAddress).then(function(n){n.data.success?(o.trackPromoCodeEnteredSuccess(t,i),ut.ui.priorityCode.priorityCodeErrors=null,ut.ui.priorityCode.priorityCodeText=null):(o.trackPromoCodeEnteredFailed(t,i),ut.ui.priorityCode.priorityCodeErrors=n.data.errors);a.trigger(events.SpinnerEvents.StopSpinner)})["catch"](function(n){o.trackPromoCodeEnteredFailed(t,i);ut.ui.priorityCode.priorityCodeErrors=n.data;a.trigger(events.SpinnerEvents.StopSpinner)}):a.trigger(events.SpinnerEvents.StopSpinner)};ut.ui.priorityCode.removePriorityCode=function(){u.removePriorityCode(e.selectedShipToAddress).then(function(){ut.ui.priorityCode.priorityCodeText=null})};ut.ui.setConfirmWarning=function(){ut.data.confirmWarningChecked=ut.data.confirmWarningChecked===!1?!0:!1};ut.ui.shouldDisplayWarnings=function(){return ut.data.warningMaterials.length&&!ut.data.placingOrder};ut.ui.shouldDisplayErrors=function(){return ut.data.checkoutErrors.length};ut.allowReturns=v.user.allowReturns;st=function(){ut.ui.placeOrderNotAvailable=e.selectedAddressIsRestricted()};at=function(){var n=(nt.showTaxesAsUnavailable()||nt.showShippingAndHandlingAsUnavailable())&&ut.ui.isEmployeeUser;n||(ut.ui.addressIsFromCanada()?$(ft)&&!ut.ui.subTotalUnder250()&&$(ft).removeAttr("disabled"):$(ft)&&$(ft).removeAttr("disabled"))};a.on([events.ShippingEvents.CalculatedTotals,events.ShippingEvents.CalculatedTotalsFailed],function(){ut.ui.updatingTotals=!1;at();t.checkout.isCleansedAddress||rt.isCleansedAddress?ut.ui.isCleansedAddress=!0:(e.setSelectedAddressForEdit("#add-edit-address-modal",e.selectedShipToAddress),ut.ui.isCleansedAddress=!1)});a.on(events.ShippingEvents.CalculatingTotals,function(){ut.ui.updatingTotals=!0;$(ft)&&$(ft).attr("disabled","disabled")});a.on(events.AddressesEvents.SelectedAddressUpdated,st);a.on(events.AddressesEvents.SelectedAddressChanged,st);h.runLast(function(){vt=!1})}])}(angular.module("ns")),function(n){var t=function(){function n(n,t){this.purchaseOrderNumber=n;this.isDefault=t}return n}();n.PurchaseOrder=t}(ns||(ns={})),function(n){"use strict";n.directive("allowInvalid",function(){return{restrict:"A",require:"ngModel",link:function(n,t,i,r){r.$parsers.push(function(){return r.$viewValue})}}})}(angular.module("ns")),function(){}(voucher||(voucher={})),function(){}(buyer||(buyer={})),function(n){var t=function(){function n(n,t){this.$http=n;this.$log=t}return n.prototype.placeOrder=function(n){return this.$http.post("/api/v1/checkout/orders",n)},n.prototype.addOrEditCreditCard=function(n){return this.$http.post("/api/v1/checkout/credit-card",n)},n.prototype.getAddresses=function(){return this.$http.get("/api/v1/address/addresses")},n.prototype.getSoldToAddress=function(){return this.$http.get("/api/v1/address/sold-to-address")},n.prototype.addOrEditShippingLocation=function(n){return this.$http.post("/api/v1/address/shipping-locations",n)},n.prototype.editReadOnlyShippingLocation=function(n){return this.$http.post("/api/v1/address/shipping-locations/edit-read-only",n)},n.prototype.removeShippingLocation=function(n){return this.$http.delete("/api/v1/address/shipping-location/"+n)},n.prototype.removeShippingLocationFromAdmin=function(n){return this.$http.delete("/api/v1/address/shipping-location-from-admin/"+n)},n.prototype.setShippingLocationAsDefault=function(n){return this.$http.put("/api/v1/address/shipping-location/"+n,null)},n.prototype.editBillingAddress=function(n){return this.$http.post("/api/v1/address/billing-addresses",n)},n.prototype.getBuyersAssignedToShipTo=function(n){return this.$http.get("/api/v1/address/getBuyersAssignedToShipTo/"+n)},n.prototype.getDeliveryCosts=function(n){return this.$http.post("/api/v1/checkout/shipping-methods-costs",n)},n.prototype.getPriorityCode=function(n){return this.$http.get("/api/v1/customers/priority-code-summary",{params:n})},n.prototype.changePriorityCode=function(n){return this.$http.put("/api/v1/customers/priority-code",n)},n.prototype.removePriorityCode=function(n){return this.$http.post("/api/v1/customers/remove-priority-code",n)},n.prototype.removeCreditCard=function(n){return this.$http.delete("/api/v1/checkout/remove-credit-card/"+n)},n.prototype.getPunchOutBuildCart=function(n){return this.$http.get("/api/v1/punchout/get-build-cart/"+n)},n.prototype.deletePunchOutSession=function(n){return this.$http.delete("/api/v1/punchout/delete-session/"+n)},n.prototype.setBillMyAccountAsDefaultPayment=function(){return this.$http.get("/api/v1/checkout/bill-my-account")},n.prototype.setCreditCardAsDefaultPayment=function(n){return this.$http.get("/api/v1/checkout/credit-card-default/"+n)},n.prototype.submitRegistration=function(n){return n.isOmniaAccount?this.$http.post("/api/v1/customers/register-omnia",n):this.$http.post("/api/v1/customers/register",n)},n.prototype.submitPrivacyOptionsRequest=function(n){return this.$http.post("/PrivacyOptions/PrivacyOptionsRequest",n)},n.prototype.submitPrivacyOptionsRequestForLoggedUsers=function(n){return this.$http.post("/api/v1/customers/privacy-management-requests",n)},n.prototype.registerEmail=function(n){return this.$http.post("/api/v1/customers/register-email",n)},n.prototype.forgotPassword=function(n){return this.$http.post("/api/v1/customers/forgot-password",{email:n})},n.prototype.resetPassword=function(n,t){return this.$http.post("/api/v1/customers/reset-password",{requestId:n,password:t})},n.prototype.activateAccount=function(n,t,i){return this.$http.post("/api/v1/account/activate-account",{userId:n,email:t,password:i})},n.prototype.assignBuyerRoles=function(n){return this.$http.post("/api/v1/customers/assignBuyerRoles",n)},n.prototype.getBuyerRoles=function(n){return this.$http.get("/api/v1/customers/"+n+"/roles")},n.prototype.addProductToCart=function(n){return this.$http.post("/api/v1/carts/add-to-cart",n)},n.prototype.getYmalItems=function(n){return this.$http.get("/api/v1/ymal/items",{params:n})},n.prototype.getTechnicalNotesForMaterial=function(n){return this.$http.get("/api/v1/materialDetails/"+n)},n.prototype.getWeakPasswords=function(){return this.$http.get("/api/v1/account/weakPasswords")},n.prototype.materialCanBeAddedToCart=function(n,t){return this.$http.post("/api/v1/cart/materialCanBeAdded",{materialBaseNumber:n,characterSetsIds:t})},n.prototype.isMaterialNonReturnable=function(n,t){return this.$http.post("/api/v1/cart/isMaterialNonReturnable",{materialBaseNumber:n,characterSetsIds:t})},n.prototype.changeEmail=function(n){return this.$http.post("/api/v1/customers/change-email",n)},n.prototype.changePassword=function(n){return this.$http.post("/api/v1/customers/change-password",n)},n.prototype.changePasswordViaEmail=function(n){return this.$http.post("/api/v1/customers/change-password-via-email",n)},n.prototype.changePasswordFromLogIn=function(n){return this.$http.post("/MyAccount/ChangePasswordFromLogIn",n)},n.prototype.changeContactPreferences=function(n){return this.$http.post("/api/v1/customers/change-contact-preferences",n)},n.prototype.changeContactPreferencesByEmail=function(n){return this.$http.post("/api/v1/customers/change-contact-preferences-by-email",n)},n.prototype.orderConfirmation=function(n){return this.$http.post("/OrderConfirmation/OrderConfirmation",n)},n.prototype.addFromQuickShop=function(n){return this.$http.post("/Cart/Quick-Shop",n)},n.prototype.addQuickShopItem=function(n){return this.$http.post("/api/v1/cart/quick-shop",n)},n.prototype.sendLog=function(n){this.$http.post("/api/v1/log/save-log",n)},n.prototype.checkAuthenticationCookie=function(){return this.$http.get("/api/v1/customers/check-authentication-cookie")},n.prototype.saveItemForLater=function(n){return this.$http.post("api/v1/carts/save-for-later-list/item",n)},n.prototype.checkGeographicalRestriction=function(n,t){return this.$http.post("/api/v1/geoRestrictions/checkRestriction",{zipCode:n,restrictionCode:t})},n.prototype.updateUserZipCode=function(n){return this.$http.post("/api/v1/customers/updateZipCode",n)},n.prototype.checkAddressRestriction=function(n){return this.$http.post("/api/v1/geoRestrictions/checkAddressRestriction",n)},n.prototype.editMailingAddress=function(n){return this.$http.post("/api/v1/address/massMailingAddressCleansing",n)},n.prototype.getCart=function(n){return this.$http.get("/api/v1/carts/"+n)},n.prototype.updateCartItemsWithVoucherContext=function(n,t){return this.$http.get("/api/v1/carts/"+n+"/apply-voucher-applicable-cartline-items",t)},n.prototype.cleanseAddress=function(n){return this.$http.post("/api/v1/address/cleanseAddress",n)},n.prototype.validateZipCode=function(n){return this.$http.get("/api/v1/zip-codes/"+n)},n.prototype.emptyCart=function(n){return this.$http.delete("/api/v1/carts/"+n+"/items")},n.prototype.updateItemQuantity=function(n,t,i){return this.$http.put("/api/v1/carts/"+n+"/items/"+t+"/quantity",{quantity:i})},n.prototype.saveCartForLater=function(n){return this.$http.post("/api/v1/carts/"+n+"/save-for-later-list/items","")},n.prototype.updateCartPackingNote=function(n,t){return this.$http.put("/api/v1/carts/"+n+"/packing-note/",t)},n.prototype.canCheckout=function(n){return this.$http.get("/api/v1/carts/"+n+"/checkout")},n.prototype.getShippingTaxes=function(n,t){return this.$http.get("/api/v1/carts/"+n+"/shipping-taxes-edd",t)},n.prototype.removeCartLine=function(n,t){return this.$http.delete("/api/v1/carts/"+n+"/items/"+t)},n.prototype.updateCartLine=function(n,t,i){return this.$http.put("/api/v1/carts/"+n+"/items/"+t,i)},n.prototype.validateCartLineQuantity=function(n,t,i){return this.$http.get("/api/v1/carts/"+n+"/items/"+t+"/validate/quantity",i)},n.prototype.allowBackorder=function(n,t){return this.$http.put("/api/v1/carts/"+n+"/items/"+t+"/allowbackorder","")},n.prototype.setEmailSentForForgotPassword=function(){return this.$http.post("/MyAccount/CreatePassword",{})},n.prototype.addLinesToCart=function(n){return this.$http.post("/api/v1/carts/add-lines-to-cart",n)},n.prototype.getQuickViewForMaterial=function(n){return this.$http.get("/api/v1/quickView/"+n)},n.prototype.getQuickViewDataForMaterial=function(n){return this.$http.get("/api/v1/quickView?materialBaseNumber="+n)},n.prototype.getWarningMaterials=function(n,t){return this.$http.get("/api/v1/checkout/warning-materials?cookieCartId="+n+"&shipToId="+t)},n.prototype.validateEmployeeIdentifier=function(n,t){return this.$http.get("/api/v1/employeeAuthenticate/validateEmployee?customerAccountNumber="+n+"&employeeIdentifier="+t)},n.prototype.validateEmployeeLastName=function(n,t,i){return this.$http.get("/api/v1/employeeAuthenticate/validateEmployee?customerAccountNumber="+n+"&employeeIdentifier="+t+"&lastName="+i)},n.prototype.sendForgotSecurityCode=function(n,t){return this.$http.get("/api/v1/employeeAuthenticate/sendSecurityCode?reason=0&customerAccountNumber="+n+"&employeeEmail="+t)},n.prototype.sendLoginSecurityCode=function(n,t){return this.$http.get("/api/v1/employeeAuthenticate/sendSecurityCode?reason=1&customerAccountNumber="+n+"&employeeEmail="+t)},n.prototype.sendBuyerSecurityCodeEmail=function(n){return this.$http.get("/api/v1/customers/sendSecurityCodeEmail?email="+n)},n.prototype.validateEmployeeSecurityCode=function(n,t,i){return this.$http.get("/api/v1/employeeAuthenticate/validateEmployee?customerAccountNumber="+n+"&employeeIdentifier="+t+"&securityCode="+i)},n.prototype.validateEmailAndSecurityCode=function(n,t,i){return this.$http.get("/api/v1/customers/validateEmailAndSecurityCode?buyerIdentifier="+n+"&securityCode="+t+"&identifierToken="+i)},n.prototype.validateEmployeeEmailAndSecurityCode=function(n,t,i){return this.$http.get("/api/v1/employeeAuthenticate/validateSecurityCode?customerAccountNumber="+n+"&employeeEmail="+t+"&securityCode="+i)},n.prototype.hasUserAgreementAccepted=function(n){return this.$http.get("/api/v1/customers/getUserAgreementStatus?buyerIdentifier="+n)},n.prototype.registerEmployee=function(n){return this.$http.post("/api/v1/employeeAuthenticate/registerEmployee",n)},n.prototype.resetEmployeePassword=function(n,t){return this.$http.post("/api/v1/employeeAuthenticate/resetPassword",n,{headers:{__RequestVerificationToken:t}})},n.prototype.authenticateEmployee=function(n,t){return this.$http.post("/api/v1/employeeAuthenticate/login",n,{headers:{__RequestVerificationToken:t}})},n.prototype.changeEmployeePassword=function(n){return this.$http.post("/api/v1/employeeAuthenticate/change-password",{NewPassword:n.newPassword,OldPassword:n.oldPassword})},n.prototype.getEmployeeAddresses=function(){return this.$http.get("/api/v1/employeeAddress/addresses")},n.prototype.getEmployeeAddressesByGuid=function(n){return this.$http.get("/api/v1/employeeAddress/addresses/"+n)},n.prototype.getEmployeeAddressById=function(n){return this.$http.get("/api/v1/employeeAddress/address/"+n)},n.prototype.addOrEditEmployeeShippingLocation=function(n){return this.$http.post("/api/v1/employeeAddress/shipping-locations",n)},n.prototype.addOrEditEmployeeShippingLocationByGuid=function(n,t){return this.$http.post("/api/v1/employeeAddress/shipping-locations/"+t,n)},n.prototype.removeEmployeeShippingLocation=function(n){return this.$http.delete("/api/v1/employeeAddress/shipping-location/"+n)},n.prototype.removeEmployeeShippingLocationByGuid=function(n,t){return this.$http.delete("/api/v1/employees/"+t+"/shipping-location/"+n)},n.prototype.setEmployeeShippingLocationAsDefault=function(n){return this.$http.put("/api/v1/employeeAddress/shipping-location/"+n,null)},n.prototype.getEmployeeHasTestModeCatalog=function(){return this.$http.get("/api/v1/employee/hasTestModeCatalog")},n.prototype.getEmployeeHasReadOnlyAddress=function(){return this.$http.get("/api/v1/employee/hasReadOnlyAddress")},n.prototype.getVoucherContext=function(){return this.$http.get("/api/v1/employeeVoucher/getVoucherContext")},n.prototype.getEmployeeVoucher=function(n){return this.$http.get("/api/v1/employeeVoucher/getVoucher?voucherGuid="+n)},n.prototype.getEmployeeVoucherData=function(n){return this.$http.get("/api/v1/employeeVoucher/getVoucherData?voucherGuid="+n)},n.prototype.getEmployeeVouchers=function(){return this.$http.get("/api/v1/employeeVoucher/getVouchers")},n.prototype.setEmployeeVoucher=function(n){return this.$http.put("/api/v1/employeeVoucher/setVoucher/"+n,null)},n.prototype.unsetEmployeeVoucher=function(n){return this.$http.put("/api/v1/employeeVoucher/unsetVoucher/"+n,null)},n.prototype.getEmployeeVoucherActivity=function(n){return this.$http.get("/api/v1/employeeVoucher/"+n+"/getActivity")},n.prototype.debitEmployeeVoucher=function(n){return this.$http.put("/api/v1/employeeVoucher/debitVoucher",n)},n.prototype.creditEmployeeVoucher=function(n){return this.$http.put("/api/v1/employeeVoucher/creditVoucher",n)},n.prototype.resetEmployeeVoucher=function(n){return this.$http.put("/api/v1/employeeVoucher/resetVoucher",n)},n.prototype.manualEnrollmentVoucher=function(n,t){return this.$http.post("/api/v1/employeeVoucher/manualEnrollmentVoucher",{employeeId:n,voucherProgramId:t})},n.prototype.getAllNamesForManualEnrollment=function(n){return this.$http.get("/api/v1/employeeVoucher/getAllNamesForManualEnrollment?employeeId="+n)},n.prototype.getPaymetricResponsePacket=function(n){return this.$http.get("/checkout/GetPaymetricResponsePacket?accessToken="+n)},n.prototype.getAccessToken=function(){return this.$http.get("/checkout/GenerateAccessToken")},n.prototype.createBuyer=function(n){return this.$http.post(window.location.protocol+"//"+window.location.host+"/api/v1/customers/createBuyer",n)},n.prototype.assignBuyersToShipTo=function(n,t,i){return this.$http.post("/api/v1/address/assignBuyersToShipToAddress",{shipToCustomerId:n,shipToDisplayName:t,buyerShipToAssignments:i})},n.prototype.saveBillingData=function(n){return this.$http.post("/api/v1/customers/updateBillingData",n)},n.prototype.updateApprovalGroup=function(n){return this.$http.post("/api/v1/groupApprovals/updateGroup",n)},n.prototype.getOrdersPendingApproval=function(n){var t=JSON.stringify(n);return this.$http.get("/api/v1/orderApproval/pending-orders?request="+t)},n.prototype.approvePendingOrder=function(n,t){return this.$http.post("/api/v1/orderApproval/approve",{OrderNumber:n,PONumber:t})},n.prototype.rejectPendingOrder=function(n,t){return this.$http.post("/api/v1/orderApproval/reject",{OrderNumber:n,Notes:t})},n.prototype.addEditGroup=function(n){return this.$http.post("/api/v1/groupApprovals/groups",n)},n.prototype.deleteGroup=function(n){return this.$http.post("/api/v1/groupApprovals/deleteGroup/"+n,"")},n.prototype.getEmployeesPaginated=function(n){return this.$http.post("/api/v1/employee/getAllPaginated",n)},n.prototype.getVoucherMaterials=function(n){return this.$http.get("/api/v1/employeeVoucher/getVoucherMaterials?collectionCode="+n)},n.prototype.editVoucherProgram=function(n){return this.$http.post("/api/v1/voucherPrograms/updateVoucherProgram",n)},n.prototype.addEditEmployee=function(n){return this.$http.post("/api/v1/employee",n)},n.prototype.assignShipTosToBuyer=function(n){return this.$http.post("/api/v1/address/assignShipTosToBuyer",n)},n.prototype.loginAsEmployee=function(n){return this.$http.post("/api/v1/employeeAuthenticate/impersonate",{EmployeeIdentifier:n})},n.prototype.getBuyerShipTos=function(n){return this.$http.get("/api/v1/address/getBuyerShipTos/"+n)},n.prototype.selectRedwingVoucher=function(n){return this.$http.post("/redwingVoucher/initiateRedwingVoucher",{RedwingApiKey:n})},n.prototype.recordRedwingVoucher=function(n){return this.$http.post("api/v1/redwingVoucher/recordRequest",n)},n.prototype.resetLastLoginDate=function(n){return this.$http.post("/api/v1/employeeVoucher/resetLastLoginDate",{EmployeeGuid:n})},n}();t.$inject=["$http","$log"];n.ApiService=t;angular.module("ns").service("apiService",t)}(ns||(ns={})),function(n){"use strict";n.factory("cookieHandlerService",function(){function n(n,t,i){var r=n.split(t);return r.join(i)}return String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"")},{setCookie:function(n,t,i){var r=i.expires!==undefined?i.expires:"",u=typeof r;u==="string"&&r!==""?r=new Date(r):u==="number"&&(r=new Date(+new Date+864e5*r));r!==""&&"toGMTString"in r&&(r=";expires="+r.toGMTString());var f=i.path?";path="+i.path:"",e=i.domain?";domain="+i.domain:"",o=i.secure?";secure":"",s=i.sameSite?";SameSite="+i.sameSite:"";document.cookie=n+"="+t+r+f+e+o+s},getCookie:function(n){var i="",r=" "+document.cookie+";",f=" "+n+"=",t=r.indexOf(f),u;return t!=-1&&(t+=f.length,u=r.indexOf(";",t),n=="NSPunchOut"?(i=decodeURI(r.substring(t,u)),i.indexOf("SessionKey",0)<0&&console.log("Error Reading PunchOut Cookie!")):i=decodeURI(r.substring(t,u))),i},getCookieMultiValue:function(n,t){var f=this.getCookie(n),u,i,r;if(f=="")return"";for(u=f.split("&"),i=0;i<u.length;i++)if(r=u[i].split("="),r.length>1){if(r[0]==t)return r[1].toString()}else return"";return""},removeCookieKeyValue:function(n,t,i){var r=this.getCookie(n),u,f;r.trim()!=""&&(u=r.indexOf(t),f=r.indexOf("&",u),r=f!=-1?r.replace(r.substr(u,f)+"&",""):r.replace("&"+r.substr(u),""),this.setCookie(n,r,i))},setCookieMultiValue:function(t,i,r,u){var s=this.getCookie(t),e,f,h,o;if(s.trim()==""){this.setCookie(t,i+"="+r,u);return}e=this.getCookieMultiValue(t,i,u);f=s.trim();e==""?f+="&"+i+"="+r:f.substr(0,i.length+1)==i+"="?(h=i.length+1+this.getCookieMultiValue(t,i).length+1,f=f.substr(h),f.trim()==""?f=i+"="+r:f+="&"+i+"="+r):(o="&"+i+"="+e,f.indexOf(o)!=-1&&(f=n(f,o,""),f.trim()==""?f=i+"="+r:f+="&"+i+"="+r));this.setCookie(t,f,u)},removeCookie:function(n,t){this.setCookie(n,"",t)}}})}(angular.module("ns")),function(n){"use strict";var t=function(){function n(n,t,i){this.cookieHandlerService=n;this.apiService=t;this.loggerFactory=i;this.nsCookieName="NS";this.nsPriorityCodeCookieName="NSPCode";this.nsZipCodeCookieName="NSZipCode";this.zipCodeKey="ZipCode";this.cartKey="CartID";this.priorityCodeKey="PCode";this.dateAddedKey="PCDate";this.priorityCodeIsManuallyAdded="IsManuallyAdded";this.displayTechnicalNotes="DisplayTechnicalNotes";this.nsPunchOutCookieName="NSPunchOut";this.nsPunchOutCartKey="SessionKey";this.nsPunchOutLevel2Key="Level2";this.cookieOptions={expires:90,path:"/",domain:this.getDomain()};this.deleteOptions={expires:-1,domain:this.getDomain(),path:"/"};this.deleteDomainOptions={expires:-1,domain:this.getMainDomain(),path:"/"};this.logger=i.getBackendLogger("CookieService");this.removeAllDomainCookiesWhileOnSubDomain()}return n.prototype.getCookieValue=function(n,t){var f,e,r,u,o=cookie.get(n),i;if(o)for(u=o.split(";"),i=0;i<u.length;i++)if(r=u[i].split("="),f=r[0],e=r[1],t===f)return e;return null},n.prototype.getDomain=function(){var n=window.location.host,t;return n.indexOf("localhost")!==-1?null:n.indexOf("punchout")!==-1?"."+n.substring(n.indexOf("punchout")):(t=n.split("."),"."+t[t.length-2]+"."+t[t.length-1])},n.prototype.getMainDomain=function(){var t=window.location.host,n;return t.indexOf("localhost")!==-1?null:(n=t.split("."),"."+n[n.length-2]+"."+n[n.length-1])},n.prototype.isCookieEmpty=function(n){return n==="00000000-0000-0000-0000-000000000000"?!0:!1},n.prototype.removeAllDomainCookiesWhileOnSubDomain=function(){this.deleteOptions.domain!=this.deleteDomainOptions.domain&&(this.cookieHandlerService.removeCookie(this.nsCookieName,this.deleteDomainOptions),this.cookieHandlerService.removeCookie(this.nsPriorityCodeCookieName,this.deleteDomainOptions),this.cookieHandlerService.removeCookie(this.nsZipCodeCookieName,this.deleteDomainOptions),this.cookieHandlerService.removeCookie(this.nsPunchOutCookieName,this.deleteDomainOptions))},n.prototype.checkAuthenticationCookie=function(){return this.apiService.checkAuthenticationCookie()},n.prototype.setCartCookie=function(n){this.cookieOptions.sameSite="None";window.location.host.indexOf("localhost")===-1&&(this.cookieOptions.secure=!0);this.cookieHandlerService.setCookieMultiValue(this.nsCookieName,this.cartKey,n,this.cookieOptions)},n.prototype.getCartCookie=function(){var n,t=this.getPunchOutCookie();return t!=null&&t!==""?(n=this.cookieHandlerService.getCookieMultiValue(this.nsPunchOutCookieName,this.nsPunchOutCartKey),this.isCookieEmpty(n))?null:n:(n=this.cookieHandlerService.getCookieMultiValue(this.nsCookieName,this.cartKey),this.isCookieEmpty(n))?null:n},n.prototype.getPunchOutCookie=function(){return this.cookieHandlerService.getCookieMultiValue(this.nsPunchOutCookieName,this.nsPunchOutCartKey)},n.prototype.isPunchOutLevel2Cookie=function(){return this.cookieHandlerService.getCookieMultiValue(this.nsPunchOutCookieName,this.nsPunchOutLevel2Key)==="True"},n.prototype.setSavedForLaterCookie=function(n){this.setCartCookie(n)},n.prototype.getSavedForLaterCookie=function(){return this.getCartCookie()},n.prototype.slideExpirationDates=function(){var n=this.getCartCookie();n&&this.setCartCookie(n)},n.prototype.setPriorityCodeCookie=function(n){this.cookieHandlerService.setCookieMultiValue(this.nsPriorityCodeCookieName,this.priorityCodeKey,n,this.cookieOptions)},n.prototype.setPriorityCodeIsManuallyAdded=function(n){this.cookieHandlerService.setCookieMultiValue(this.nsPriorityCodeCookieName,this.priorityCodeIsManuallyAdded,n,this.cookieOptions)},n.prototype.setDateAddedPriorityCodeCookie=function(n){this.cookieHandlerService.setCookieMultiValue(this.nsPriorityCodeCookieName,this.dateAddedKey,n,this.cookieOptions)},n.prototype.getPriorityCodeCookie=function(){return this.cookieHandlerService.getCookieMultiValue(this.nsPriorityCodeCookieName,this.priorityCodeKey)},n.prototype.getPriorityCodeIsManullyAdded=function(){var n=this.cookieHandlerService.getCookieMultiValue(this.nsPriorityCodeCookieName,this.priorityCodeIsManuallyAdded);return n===undefined?!0:n},n.prototype.removeDateAddedPriorityCodeCookie=function(){this.cookieHandlerService.removeCookieKeyValue(this.nsPriorityCodeCookieName,this.dateAddedKey,this.cookieOptions)},n.prototype.removePriorityCodeCookie=function(){this.cookieHandlerService.removeCookie(this.nsPriorityCodeCookieName,this.deleteOptions)},n.prototype.removeCartCookie=function(){this.cookieHandlerService.removeCookie(this.nsCookieName,this.deleteOptions)},n.prototype.setDisplayTechnicalNotesCookie=function(n){this.cookieHandlerService.setCookie(this.displayTechnicalNotes,n,this.cookieOptions)},n.prototype.getDisplayTechnicalNotesCookie=function(){return this.cookieHandlerService.getCookie(this.displayTechnicalNotes)},n.prototype.setZipCodeCookie=function(n){this.cookieHandlerService.setCookieMultiValue(this.nsZipCodeCookieName,this.zipCodeKey,n,this.cookieOptions)},n.prototype.getZipCodeValue=function(){return this.cookieHandlerService.getCookieMultiValue(this.nsZipCodeCookieName,this.zipCodeKey)},n}();t.$inject=["cookieHandlerService","apiService","loggerFactory"];n.CookieService=t;angular.module("ns").service("cookieService",t)}(ns||(ns={})),function(n){var t=function(){function n(){}return n.prototype.getCurrentDate=function(){return new Date},n.prototype.getUTCDate=function(n){return new Date(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds())},n.prototype.toUTCString=function(n){return n.toUTCString()},n.prototype.getFormatedUTCCurrentDate=function(){var n=moment().utc();return n.format("M/D/YYYY h:mm:ss A")},n.prototype.getEstimatedShippingDate=function(n){var i=n.getDay(),t=n.getHours();switch(i){case 0:return n.setDate(n.getDate()+1);case 1:case 2:case 3:case 4:return t>0&&t<19?n:n.setDate(n.getDate()+1);case 5:return t>0&&t<19?n:n.setDate(n.getDate()+3);case 6:return n.setDate(n.getDate()+2);default:return n}},n.prototype.createDateWith1IndexedMonth=function(n,t,i){return i||(i=1),new Date(n,t-1,i)},n}();n.DateService=t;angular.module("ns").service("dateService",t)}(ns||(ns={}));EmailValidationService=function(){function n(){}return n.prototype.isEmail=function(n){return!!n&&n.length>5&&n.indexOf("@")>-1&&n.indexOf(".")>-1},n}();typeof window!="object"||!window.document||typeof process!="undefined"?module.exports={EmailValidationService:EmailValidationService}:angular.module("ns").service("emailValidationService",EmailValidationService),function(n){var t=function(){function n(n,t){this.$rootScope=n;this.$log=t;this.shouldLogEvents=!1}return n.prototype.logEvents=function(){this.shouldLogEvents=!0},n.prototype.on=function(n,t){var i=this;this.callForAllEvents(n,function(n){i.addEventListener(n,t)})},n.prototype.trigger=function(n){for(var r=this,i=[],t=1;t<arguments.length;t++)i[t-1]=arguments[t];this.callForAllEvents(n,function(n){r.triggerEvent(n,i)})},n.prototype.addEventListener=function(n,t){this.$rootScope.$on(n,t)},n.prototype.triggerEvent=function(n){for(var i=[],t=1;t<arguments.length;t++)i[t-1]=arguments[t];this.shouldLogEvents&&this.$log.debug("Event: "+n);this.$rootScope.$broadcast(n,i)},n.prototype.callForAllEvents=function(n,t){if(_===undefined){this.$log.debug("_ is undefined");return}_.isArray(n)?_.each(n,function(n){t(n)}):t(n)},n}();t.$inject=["$rootScope","$log"];n.EventsService=t;angular.module("ns").service("eventsService",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t,i){this.$location=n;this.$anchorScroll=t;this.$window=i}return n.prototype.focusErrorField=function(n){if(n){var t=this.getFirstFieldWithError(n),i=this.$location.hash();this.$location.hash(t.attr("id"));this.$anchorScroll();this.$location.hash(i);this.setCursor(t);t.focus()}},n.prototype.focusElement=function(n){var t,i,r;n&&(t=this.$location.hash(),this.$location.hash(n),this.$anchorScroll(),i=document.getElementById(n),r=angular.element(i),r.focus(),this.$location.hash(t))},n.prototype.focusScrollErrorField=function(n){if(n){var t=this.getFirstFieldWithError(n),i=document.getElementById(t.attr("id"));i.scrollIntoView({block:"center"});this.setCursor(t);t.focus()}},n.prototype.getFirstFieldWithError=function(n){var t=angular.element("[name='"+n.$name+"']").find("input.ng-invalid:visible:first");return t&&t.length>0?t:angular.element("[name='"+n.$name+"']").find("select.ng-invalid")},n.prototype.valueContainsDash=function(n){return n.indexOf(" - ")>-1},n.prototype.getLengthWithoutDash=function(n){var t=n.replace(/ - /g,"").trim();return t.length},n.prototype.setCursor=function(n){var t=n.val(),i,r;t&&n[0].tagName==="INPUT"&&(i=t.trim().length,this.valueContainsDash(t)?(r=this.getLengthWithoutDash(t),n[0].setSelectionRange(r,r)):n[0].setSelectionRange(i,i))},n}(),i;t.$inject=["$location","$anchorScroll"];n.FocusService=t;angular.module("ns").service("focusService",t);i=function(){function n(n){var t=this;this.focusService=n;this.restrict="A";this.require="^form";this.link=function(n,i,r,u){i.on("submit",function(){t.validate(u)})}}return n.prototype.isFormSubmitted=function(n){return n.$submitted||n.$$parentForm&&n.$$parentForm.$submitted},n.prototype.formIsInvalid=function(n){return n.$invalid||n.$$parentForm&&n.$$parentForm.$invalid},n.prototype.validate=function(n){this.formIsInvalid(n)&&this.isFormSubmitted(n)&&this.focusService.focusScrollErrorField(n)},n.factory=function(){var t=function(t){return new n(t)};return t.$inject=["focusService"],t},n}();n.FocusErrorDirective=i;angular.module("ns").directive("focusError",i.factory())}(ns||(ns={})),function(n){"use strict";n.factory("functionUtils",["$timeout",function(n){function t(t){n(t)}function i(n){return _.throttle(n,100,{trailing:!1})}function r(n){return _.throttle(n,500,{leading:!1})}return{runLast:t,throttle:i,waitForMore:r}}])}(angular.module("ns")),function(n){var t=function(){function n(){}return n.displayMinimumQuantity=function(n){return n.minimumQuantity>1},n.isAboveMinimumQuantity=function(n){return n.minimumQuantity<=n.quantity},n.isValidQuantity=function(n){return n.quantity%n.roundingProfile==0},n}();n.MinimumQuantityValidator=t}(common||(common={})),function(n){var t=function(){function t(){this.angularModule=angular.module("ns")}return t.prototype.createModelWithData=function(n,t){var i=t();return n&&i.update(n),i},t.prototype.createOrderConfirmationKey=function(t){return this.createModelWithData(t,function(){return new n.OrderConfirmationKey})},t.prototype.createPurchaseOrder=function(t){return new n.PurchaseOrder(t.purchaseOrderNumber,t.isDefault)},t.prototype.createCart=function(t){var i=this;return this.createModelWithData(t,function(){var r=new n.Cart;return r.setShippingAndHandling(i.createShippingAndHandling(t)),r.setTaxes(i.createTaxes(t)),r.setDeliveryDates(i.createEstimatedDeliveryDate(t)),r})},t.prototype.createCartLine=function(t){return this.createModelWithData(t,function(){return new n.CartLine})},t.prototype.createShippingAndHandling=function(t){return this.createModelWithData(t,function(){return new n.ShippingAndHandling})},t.prototype.createEstimatedDeliveryDateRange=function(t){return this.createModelWithData(t,function(){return new n.EstimatedDeliveryDateRange})},t.prototype.createItemEstimatedDeliveryDate=function(t){return new n.ItemEstimatedDeliveryDate(t)},t.prototype.createEstimatedDeliveryDate=function(t){var i=this;return this.createModelWithData(t,function(){var r=new n.EstimatedDeliveryDate,u;return r.setRange(i.createEstimatedDeliveryDateRange(t)),u=[],t&&(u=_.map(t.itemsDeliveryDates,function(n){return i.createItemEstimatedDeliveryDate(n)})),r.setItemsDelivery(u),r})},t.prototype.createTaxes=function(t){return this.createModelWithData(t,function(){return new n.Taxes})},t.prototype.createVoucherCoverage=function(t){return this.createModelWithData(t,function(){return new n.VoucherCoverage})},t.prototype.createDeliveryType=function(t,i){var r=new n.DeliveryType(t,i);return r.setShippingAndHandling(this.createShippingAndHandling()),r.setEstimatedDeliveryDates(this.createEstimatedDeliveryDate()),r},t.prototype.createShippingMethod=function(t,i,r,u,f){return new n.ShippingMethod(t,i,r,u,f)},t.prototype.createShippingCondition=function(t,i,r,u){return new n.ShippingCondition(t,i,r,u)},t.prototype.createDeliveryMethod=function(t,i,r){switch(i){case"FedEx":return new n.DeliveryMethod(t,i);case"UPS":return new n.DeliveryMethod(t,i);case"FedExCollect":return new n.FedExCollectDeliveryMethod(t,i,r);case"UPSCollect":return new n.UpsCollectDeliveryMethod(t,i,r);case"Other":return new n.DeliveryMethodWithInfo(t,i,r);case"Pick-up":return new n.BranchPickupDeliveryMethod(t,i,r);default:return new n.DeliveryMethod(t,i)}},t.prototype.createUser=function(t){return new n.User(t)},t.prototype.createPriorityCode=function(t){return this.createModelWithData(t,function(){return new n.PriorityCode})},t.prototype.createAddress=function(t){return this.createModelWithData(t,function(){return new n.Address})},t.prototype.createShippingAddress=function(t){return this.createModelWithData(t,function(){return new n.ShippingAddress})},t.prototype.createSoldToAddress=function(t){return this.createModelWithData(t,function(){return new n.SoldToAddress})},t.prototype.createBillToAddress=function(t){return this.createModelWithData(t,function(){return new n.BillToAddress})},t.prototype.createCleansingData=function(t){return this.createModelWithData(t,function(){return new n.CleansingData})},t.prototype.createShippingMethodRule=function(t,i){return new n.SelectDefaultShippingMethodRule(t,i)},t.prototype.createPayment=function(t,i){return new n.Payment(t,i)},t.prototype.createProduct=function(t){return this.createModelWithData(t,function(){return new n.Product})},t.prototype.createProductDetails=function(){return new n.ProductDetails},t.prototype.createCheckout=function(t){return new n.Checkout(t)},t.prototype.createChangeEmailAndPassword=function(){return new n.ChangeEmailAndPassword},t.prototype.createAddressCleansedResult=function(){return new n.AddressCleansed},t.prototype.createContactPreferences=function(t){return new n.ContactPreferences(t)},t.prototype.createAdminRoleManager=function(t,i,r){return new n.RoleManagement(t,i,r)},t.prototype.createMailingAddress=function(t){return this.createModelWithData(t,function(){return new n.MailingAddress})},t.prototype.createEblastProduct=function(t){var i=this.createModelWithData(t,function(){return new n.EblastProduct});return i.materialBaseSummary=this.createProduct(i.materialBaseSummary),i},t.prototype.createCustomBillingInfo=function(t){return new n.CustomBilling(t)},t.prototype.createVoucherShopItem=function(t,i){var f=this,r,u;return i.vouchers?(r=_.map(i.vouchers,function(n){return f.createVoucherShopItem(t,n)}),u=_.find(r,function(n){return n.consumedQuantity&&n.consumedQuantity!==0}),new n.VoucherShopGroup(i.name,i.displayOrder,r,u?u.id():undefined)):new n.VoucherShopVoucher(i.name,i.displayOrder,i.voucherGuid,i.collectionCode,i.consumedQuantity,i.maxQuantity,i.displayDollarPrice,t&&i.hideVoucherQuantityCount)},t}();t.$inject=[];n.ModelsFactory=t;angular.module("ns").service("modelsFactory",t)}(ns||(ns={})),function(n){"use strict";var t=function(){function n(n,t){this.$window=n;this.configs=t}return n.prototype.isCheckoutPage=function(){return String(this.$window.location.href).toLowerCase().indexOf("/checkout")!==-1},n.prototype.isAddressesPage=function(){var n=this.$window.location.href;return String(this.$window.location.href).toLowerCase().indexOf("/addressshipmethods")!==-1||this.$window.location.href.indexOf("Employee/AddressShipping")!==-1},n.prototype.isAddressCleansingPage=function(){return String(this.$window.location.href).toLowerCase().indexOf("/addresscleansing")!==-1},n.prototype.goToPrevNonCheckoutPage=function(){this.goToPrevPage()},n.prototype.goToPrevNonMyListPage=function(){this.goToPrevPage()},n.prototype.goToPrevNonCartPage=function(n){var t,i,r,u,f;if(n){this.goToHomePage();return}if(this.$window.document.referrer&&String(this.$window.document.referrer.toLowerCase()).indexOf("login")===-1){t=this.$window.document.referrer;i=t.toLowerCase().indexOf("prioritycode");i===-1||(r=t.substr(0,i-1),u=t.toLowerCase().indexOf("&",i+1),u===-1?t=r:(f=t.substr(u,t.length),t=r+f));this.$window.location.href=t;return}this.$window.location.href="/"},n.prototype.goToCheckOut=function(){this.$window.location.href=$("body").hasClass("ie8")?"/Cart/Checkout":"/Checkout"},n.prototype.goToPunchOut=function(){this.$window.location.href=this.configs.punchoutUrl+"Cart/CheckOut/PunchOut"},n.prototype.goToNotificationCenter=function(){this.$window.location.href=this.configs.navCenterUrl},n.prototype.goToCart=function(){this.$window.location.href="/Cart"},n.prototype.goToLoginFromPreviousPage=function(){this.$window.location.href="/MyAccount/Login/?ReturnUrl="+this.$window.location.pathname},n.prototype.goToNewLogin=function(){this.$window.location.href="/MyAccount/Login"},n.prototype.goToRegistrationConfirmation=function(){this.$window.location.href="/MyAccount/Registrationconfirmation"},n.prototype.goOmniaToRegistrationConfirmation=function(){this.$window.location.href="/Omnia/OmniaEmailSignupConfirmation"},n.prototype.goPrivacyOptionsSubmitRequestConfirmation=function(n){this.$window.location.href="/PrivacyOptions/SubmitRequestConfirmation?requestEmail="+n},n.prototype.reloadPage=function(){this.$window.location.reload()},n.prototype.getReturnUrl=function(){var n=this.$window.location.href.split("?ReturnUrl=");return n.length===2?n[1].replace("%2f","/"):null},n.prototype.goToAccountOverview=function(){this.$window.location.href="/MyAccount"},n.prototype.goToOrderConfirmationPage=function(){this.$window.location.href="/OrderConfirmation"},n.prototype.goToQuickShopPage=function(n){this.$window.location.href="/Cart/Quick-Shop/?cartId="+n},n.prototype.getParameterByName=function(n,t){t||(t=window.location.href);n=n.replace(/[\[\]]/g,"\\$&");var r=new RegExp("[?&]"+n+"(=([^&#]*)|&|#|$)"),i=r.exec(t);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null},n.prototype.goToHomePage=function(){this.$window.location.href="/"},n.prototype.goToForgotPassword=function(){this.$window.location.href="/MyAccount/ForgotPassword"},n.prototype.goToEmployeeForgotPassword=function(n){this.$window.location.href="/Employee/ForgotPassword?customerLoginUriKey="+n},n.prototype.goToVoucherHub=function(){this.$window.location.href="/Employee/VoucherHub"},n.prototype.goToRedwingVoucherPage=function(){this.$window.location.href="/RedwingVoucher"},n.prototype.goToVoucherShop=function(){this.$window.location.href="/Employee/VoucherShop"},n.prototype.goToCollection=function(n){this.$window.location.href="/Search/?collection="+n},n.prototype.goToEmployeeLogin=function(n){this.$window.location.href="/Employee/Login/"+n},n.prototype.getCurrentUrl=function(){return this.$window.location.origin},n.prototype.getCurrentLocationPathName=function(){return this.$window.location.pathname},n.prototype.goToPrevPage=function(){if(this.$window&&this.$window.location){var n=String(this.$window.document.referrer).toLowerCase().indexOf("/login")!==-1;this.$window.location.href=this.$window.document.referrer?n?"/":this.$window.document.referrer:"/"}},n}();t.$inject=["$window","configs"];n.NavigationService=t;angular.module("ns").service("navigationService",t)}(ns||(ns={}));base64={};base64.PADCHAR="=";base64.ALPHA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";base64.makeDOMException=function(){var n;try{return new DOMException(DOMException.INVALID_CHARACTER_ERR)}catch(t){return n=new Error("DOM Exception 5"),n.code=n.number=5,n.name=n.description="INVALID_CHARACTER_ERR",n.toString=function(){return"Error: "+n.name+": "+n.message},n}};base64.getbyte64=function(n,t){var i=base64.ALPHA.indexOf(n.charAt(t));if(i===-1)throw base64.makeDOMException();return i};base64.decode=function(n){var i,e,t,r,u,f;if(n=""+n,i=base64.getbyte64,u=n.length,u===0)return n;if(u%4!=0)throw base64.makeDOMException();for(e=0,n.charAt(u-1)===base64.PADCHAR&&(e=1,n.charAt(u-2)===base64.PADCHAR&&(e=2),u-=4),f=[],t=0;t<u;t+=4)r=i(n,t)<<18|i(n,t+1)<<12|i(n,t+2)<<6|i(n,t+3),f.push(String.fromCharCode(r>>16,r>>8&255,r&255));switch(e){case 1:r=i(n,t)<<18|i(n,t+1)<<12|i(n,t+2)<<6;f.push(String.fromCharCode(r>>16,r>>8&255));break;case 2:r=i(n,t)<<18|i(n,t+1)<<12;f.push(String.fromCharCode(r>>16))}return f.join("")};base64.getbyte=function(n,t){var i=n.charCodeAt(t);if(i>255)throw base64.makeDOMException();return i};base64.encode=function(n){var o;if(arguments.length!==1)throw new SyntaxError("Not enough arguments");var e=base64.PADCHAR,i=base64.ALPHA,f=base64.getbyte,r,t,u=[];if(n=""+n,o=n.length-n.length%3,n.length===0)return n;for(r=0;r<o;r+=3)t=f(n,r)<<16|f(n,r+1)<<8|f(n,r+2),u.push(i.charAt(t>>18)),u.push(i.charAt(t>>12&63)),u.push(i.charAt(t>>6&63)),u.push(i.charAt(t&63));switch(n.length-o){case 1:t=f(n,r)<<16;u.push(i.charAt(t>>18)+i.charAt(t>>12&63)+e+e);break;case 2:t=f(n,r)<<16|f(n,r+1)<<8;u.push(i.charAt(t>>18)+i.charAt(t>>12&63)+i.charAt(t>>6&63)+e)}return u.join("")},function(n){var t=function(){function n(){this.nsHost="northernsafety"}return n.prototype.isNsiHost=function(n){var t=this.extractHost(n);return this.substringIsPresent(t,this.nsHost)},n.prototype.substringIsPresent=function(n,t){var i,r;if(!n||!t||t.length>n.length)return!1;for(i=0;i<n.length;i++){if(r=n.substring(i,t.length+i),r===t)return!0;if(i>=n.length-r.length)return!1}return!1},n.prototype.extractHost=function(n){try{var t=document.createElement("a");return t.href=n,t.hostname}catch(i){return null}},n}();n.UrlService=t;angular.module("ns").service("urlService",t)}(ns||(ns={})),function(){var n=function(){function n(){this.templateUrl="/js/ns/common/components/spinner.html";this.controllerAs="ctrl";this.controller=t;this.bindings={isSpinning:"<",buttonIndex:"<",selectedIndex:"<"}}return n}(),t=function(){function n(){}return n.prototype.isThisButtonSpinning=function(n){return this.buttonIndex?this.isSpinning&&this.buttonIndex===n:this.isSpinning},n}();angular.module("ns").component("spinner",new n)}(ns||(ns={})),function(){var n=function(){function n(){this.bindings={creditCard:"<",onRemoveCreditCard:"&"};this.templateUrl="js/ns/common/components/credit-card/credit-card-delete-message.html"}return n}();angular.module("ns").component("creditCardDeleteMessage",new n)}(ns||(ns={})),function(){var n=function(){function n(){this.templateUrl="/js/ns/common/components/light-box/change-billTo-address.html"}return n}();angular.module("ns").component("changeBillToAddress",new n)}(lightBox||(lightBox={})),function(){var n=function(){function n(){this.templateUrl="/js/ns/common/components/light-box/change-company-name.html"}return n}();angular.module("ns").component("changeCompanyName",new n)}(lightBox||(lightBox={})),function(){var n=function(){function n(){this.templateUrl="/js/ns/common/components/light-box/change-name.html"}return n}();angular.module("ns").component("changeName",new n)}(lightBox||(lightBox={})),function(n){var t=function(){function n(n){this.initialData=n;this.contactMessagePhoneNumber=this.initialData.contactMessagePhoneNumber;this.initialData.userInfo&&this.initialData.userInfo.isEmployeeUser||this.initialData.displaySolutionsGroupInfo?(this.workingHours="8:00 am - 5:00 pm ET",this.email="mailto:solutionsgroup@orrsafety.com"):(this.workingHours="7:30 am - 7:00 pm ET",this.email="mailto:customerservice@northernsafety.com")}return n}();t.$inject=["initialData","featureData"];n.ContactMessageController=t}(LightBox||(LightBox={})),function(n){var t=function(){function t(){this.templateUrl="/js/ns/common/components/light-box/contact-message-without-live-chat.html";this.controller=n.ContactMessageController;this.controllerAs="controller"}return t}();angular.module("ns").component("contactMessageWithoutLiveChat",new t)}(LightBox||(LightBox={})),function(n){var t=function(){function t(){this.templateUrl="/js/ns/common/components/light-box/contact-message.html";this.controller=n.ContactMessageController;this.controllerAs="controller"}return t}();angular.module("ns").component("contactMessage",new t)}(LightBox||(LightBox={})),function(){var n=function(){function n(){this.templateUrl="/js/ns/common/components/light-box/custom-products.html"}return n}();angular.module("ns").component("customProducts",new n)}(lightBox||(lightBox={})),function(){var t=function(){function t(){this.templateUrl="/js/ns/common/components/materials/material-quantity.component.html";this.controllerAs="ctrl";this.controller=n;this.bindings={product:"=",maximumQuantity:"<",displayUnitOfMeasureQuantityOptions:"<"}}return t}(),n=function(){function n(n){this.eventsService=n;this.minQuantity=1;this.quantityOptions=[];this.eventsService.on(events.MaterialQuantityComponentEvents.ResetSelectedQuantity,this.onResetSelectedQuantity.bind(this))}return Object.defineProperty(n.prototype,"selectedQuantity",{get:function(){return this.selectedOption?this.selectedOption.value:this.minQuantity},enumerable:!0,configurable:!0}),n.prototype.$onChanges=function(){this.displayUnitOfMeasureQuantityOptions?this.setUOMDefaultOption():this.setOptions()},n.prototype.onSelectedQuantityChange=function(){this.product&&(this.product.quantity=this.selectedOption?this.selectedOption.value:this.getMaxOption().value)},n.prototype.shouldShowControls=function(){if(!this.product)return!1;return!this.product.isProductUnavailable||!this.product.isSelectedProductUnavailable||this.product.availableForBackorderOnly===!0},n.prototype.lessOrEqual=function(n,t){return t>=n},n.prototype.setOptions=function(){this.populateOptions();this.selectedOption=this.getMaxOption();this.onSelectedQuantityChange()},n.prototype.getMaxOption=function(){var n=this.maximumQuantity?this.maximumQuantity:this.product&&this.product.quantity?this.product.quantity:this.minQuantity,t=this.quantityOptions.some(function(){return!0}),i=this.quantityOptions.filter(function(t){return t.value===n})[0];return!t||!i?{label:"",value:0,id:this.createId()}:this.quantityOptions.filter(function(t){return t.value===n})[0]},n.prototype.onResetSelectedQuantity=function(){this.displayUnitOfMeasureQuantityOptions?this.setUOMDefaultOption():this.setOptions()},n.prototype.populateOptions=function(){for(var i,t=[],n=this.minQuantity;n<=this.maximumQuantity;n++)t.push({label:n.toString(),value:n,id:this.createId()});this.quantityOptions.splice(0,this.quantityOptions.length);(i=this.quantityOptions).push.apply(i,t)},n.prototype.setUOMDefaultOption=function(){this.product.quantity=0},n.prototype.createId=function(){return Math.random().toString()},n}();n.$inject=["eventsService"];angular.module("ns").component("materialQuantity",new t)}(ns||(ns={})),function(){var t=function(){function t(){this.bindings={videoId:"<",showVideo:"=?showVideo",materialId:"<"};this.templateUrl="/js/ns/common/components/materials/material-video.html";this.controllerAs="controller";this.controller=n}return t}(),n=function(){function n(n,t){var i=this;this.$sce=t;this.showVideo=!1;$("div[id^='material-video-modal']").on("hide.bs.modal",function(){n(function(){i.showVideo=!1})})}return n}();n.$inject=["$timeout","$sce"];angular.module("ns").component("materialVideo",new t)}(Materials||(Materials={})),function(){var t=function(){function t(){this.bindings={item:"<"};this.controller=n;this.templateUrl="/js/ns/common/components/materials/stock-status.component.html";this.controllerAs="controller"}return t}(),n=function(){function n(n,t){var i=this;this.analyticsService=n;this.$scope=t;this.$onInit=function(){this.setFlags();this.trackOutOfStock()};t.$watch(function(){return i.item.selectedStyleNotAvailable},this.setFlags.bind(this));t.$watch(function(){return i.item.materialBaseNumber},this.setFlags.bind(this));t.$watch(function(){return i.item.isDropShip},this.setFlags.bind(this));t.$watch(function(){return i.item.isSpecialOrder},this.setFlags.bind(this));t.$watch(function(){return i.item.quantityInStock},this.setFlags.bind(this));t.$watch(function(){return i.item.isRestricted},this.setFlags.bind(this));t.$watch(function(){return i.item.isProductUnavailable},this.setFlags.bind(this));t.$watch(function(){return i.item.availableForBackorderOnly},this.setFlags.bind(this))}return n.prototype.trackOutOfStock=function(){this.isMaterialStockStatusOutOfStock&&this.analyticsService.trackIsMaterialOutOfStock(this.item)},n.prototype.setFlags=function(){if(this.setAllFlagsToFalse(),this.item.availableForBackorderOnly!=null){this.setFlagsForAvailableForBackorderOnly();return}if(this.item.isProductUnavailable||this.item.isSelectedProductUnavailable){this.isMaterialUnavailable=!0;return}if(this.item.selectedStyleNotAvailable){this.selectedStyleNotAvailable=!0;return}this.isMaterialGeoRestricted=!!this.item.isRestricted;this.selectedStyleNotAvailable=!1;this.isMaterialStockStatusDropShip=this.item.isDropShip&&!this.item.isSpecialOrder&&!this.isMaterialGeoRestricted;this.isMaterialStockStatusBackorder=this.item.backorderAllowed&&this.item.isEligibleForBackorder&&!this.isMaterialGeoRestricted;this.isMaterialStockStatusLimited=this.item.isClearance&&!this.isMaterialGeoRestricted;this.isMaterialStockStatusCustom=this.item.isCustomizable&&!this.isMaterialGeoRestricted;this.isMaterialStockStatusSpecialOrder=!this.item.isClearance&&this.item.isSpecialOrder&&!this.isMaterialGeoRestricted;this.isMaterialStockStatusOutOfStock=!this.item.isProductUnavailable&&this.item.quantityInStock<=0&&!this.item.isRestricted&&!(this.item.isDropShip||this.item.backorderAllowed&&this.item.isEligibleForBackorder||this.item.isClearance||this.item.isCustomizable||this.item.isSpecialOrder);this.isMaterialStockStatusInStock=!this.item.isSelectedProductUnavailable&&this.item.quantityInStock>0&&!(this.item.isDropShip||this.item.backorderAllowed&&this.item.isEligibleForBackorder||this.item.isClearance||this.item.isCustomizable||this.item.isSpecialOrder||!!this.item.isRestricted)},n.prototype.setFlagsForAvailableForBackorderOnly=function(){this.item.availableForBackorderOnly&&(this.hasExtendedLeadTime=!0);this.item.availableForBackorderOnly===!1&&(this.isMaterialUnavailable=!0)},n.prototype.setAllFlagsToFalse=function(){this.selectedStyleNotAvailable=!1;this.isMaterialStockStatusDropShip=!1;this.isMaterialStockStatusBackorder=!1;this.isMaterialStockStatusLimited=!1;this.isMaterialStockStatusCustom=!1;this.isMaterialStockStatusSpecialOrder=!1;this.isMaterialStockStatusOutOfStock=!1;this.isMaterialStockStatusInStock=!1;this.isMaterialGeoRestricted=!1;this.isMaterialUnavailable=!1;this.hasExtendedLeadTime=!1},n}();n.$inject=["analyticsService","$scope"];angular.module("ns").component("stockStatus",new t)}(ns||(ns={})),function(){var t=function(){function t(){this.bindings={product:"<",pageType:"<"};this.templateUrl="/js/ns/common/components/materials/video-icon.html";this.controllerAs="controller";this.controller=n}return t}(),n=function(){function n(n){this.analyticsService=n}return n.prototype.trackVideo=function(n,t,i){this.analyticsService.trackVideo(n,t,i)},n}();n.$inject=["analyticsService"];angular.module("ns").component("videoIcon",new t)}(Materials||(Materials={})),function(){var n=function(){function n(){this.bindings={phoneNumberSupport:"@",imageSrc:"@"};this.templateUrl="../js/ns/common/components/need-help/need-help.html"}return n}();angular.module("ns").component("needHelp",new n)}(ns||(ns={})),function(n){"use strict";n.directive("aDisabled",function(){return{compile:function(n,t){var i=!t.aDisabled&&t.ngClick;return t.ngClick=i?"ng-click":"!("+t.aDisabled+") && ("+t.ngClick+")",function(n,t,i){n.$watch(i.aDisabled,function(n){n!==undefined&&(t.toggleClass("disabled",n),n?t.attr("disabled","disabled"):t.removeAttr("disabled"))})}}}})}(angular.module("ns")),function(n){"use strict";n.directive("addHasErrorClass",function(){return{restrict:"A",require:"^form",link:function(n,t,i,r){function u(n){return n&&n[i.fieldName]&&n[i.fieldName].$invalid}function f(n){return n.$submitted||!!(n.$$parentForm&&n.$$parentForm.$submitted)}n.$watch(function(){return f(r)&&u(r)},function(n){t.toggleClass("has-error",n)})}}})}(angular.module("ns")),function(){var n=function(){function n(){this.restrict="A";this.scope={altImageUrl:"@"}}return n.instance=function(){return new n},n.prototype.link=function(n,t,i){n.$watch(function(){return i.ngSrc},function(i){i||t.attr("src",n.altImageUrl)});t.bind("error",function(){t.attr("src",n.altImageUrl)})},n}();angular.module("ns").directive("altImageUrl",n.instance)}(ns||(ns={})),function(n){"use strict";n.directive("btnSpin",["$timeout",function(n){return{restrict:"A",link:function(t,i,r){var f=i.text(),o=r.pad,s=$("html").hasClass("ie8"),u=r.resetModal,e;i.click(function(){var i=r.processText,n,t;i===undefined&&(i=f);s?$(this).attr("disabled","disabled"):$(this).html('<i class="fa fa-fw fa-spinner fa-spin"><\/i>').attr("disabled","disabled");o==="true"&&$(this).css("padding","10px 0");n=r.itemLine;n!=undefined&&($(n).addClass("removed").find("a").attr("disabled","disabled").addClass("disabled-link"),$(n).find("input").attr("disabled","disabled"));t=r.disableClass;t!=undefined&&$(t).attr("disabled","disabled")});e=r.resetAction;e!=undefined&&t.$on(e,function(){n(function(){i.html(f).removeAttr("disabled");o==="true"&&i.css("padding","10px");u!=undefined&&$(".fv-modal-stack-"+u).hasClass("in")&&($(".fv-modal-stack-"+u).modal("hide"),$(".modal-backdrop.fv-modal-stack-"+u).remove(),$("body").data("open-modals",$("body").data("open-modals")-1),$("body").data("open-modals")<1&&$("body").removeClass("modal-open"))})});u!=undefined&&t.$on(events.GenericEvents.DoNotCloseModal,function(){i.html(f).removeAttr("disabled");i.parents(".modal").animate({scrollTop:0},500)})}}}]);n.directive("btnSpinForm",["$timeout",function(n){return{require:"^form",restrict:"A",link:function(t,i,r,u){var e=i.html(),s=r.pad,c=$("html").hasClass("ie8"),l=i.parents("form").first(),h=!1,f=r.resetModal,o;i.click(function(){var i=r.processText,n,t;return i===undefined&&(i=e),u.$valid&&(c?$(this).attr("disabled","disabled"):$(this).html('<i class="fa fa-fw fa-spinner fa-spin"><\/i>').attr("disabled","disabled"),s==="true"&&$(this).css("padding","10px 0"),l.triggerHandler("submit"),h=!0),n=r.itemLine,n!=undefined&&($(n).addClass("removed").find("a").attr("disabled","disabled").addClass("disabled-link"),$(n).find("input").attr("disabled","disabled")),t=r.disableClass,t!=undefined&&$(t).attr("disabled","disabled"),!h});o=r.resetAction;o!=undefined&&t.$on(o,function(){n(function(){i.html(e).removeAttr("disabled");s==="true"&&i.css("padding","10px");f!=undefined&&$(".fv-modal-stack-"+f).hasClass("in")&&($(".fv-modal-stack-"+f).modal("hide"),$(".modal-backdrop.fv-modal-stack-"+f).remove(),$("body").data("open-modals",$("body").data("open-modals")-1),$("body").data("open-modals")<1&&$("body").removeClass("modal-open"))})});f!=undefined&&t.$on(events.GenericEvents.DoNotCloseModal,function(){i.html(e).removeAttr("disabled");i.parents(".modal").animate({scrollTop:0},500)})}}}])}(angular.module("ns")),function(n){"use strict";n.directive("buttonSpinner",["loggerFactory",function(n){return{restrict:"A",scope:{promise:"&buttonSpinner"},link:function(t,i,r){var s=n.getBackendLogger("ButtonSpinnerLogger"),f=i.html(),c=r.processText,e=r.pad,u=r.itemLine,h=r.disableClass,o=r.resetModal;i.on("click",function(){t.$apply(function(){var n;startSpinner(i,r,f,c);e==="true"&&i.css("padding","1px 0");u!=undefined&&($(u).addClass("removed"),$(u).find("a").attr("disabled","disabled").addClass("disabled-link"),$(u).find("input").attr("disabled","disabled"));h!=undefined&&$(h).attr("disabled","disabled");t.$on("reset-update-spinner",function(){stopSpinner(i,r,f,e);u!=undefined&&($(u).removeClass("removed"),$(u).find("a").removeAttr("disabled").removeClass("disabled-link"),$(u).find("input").removeAttr("disabled"));return});o!=undefined?(n=t.promise(),n!=undefined?n.then(function(){closeModal(o)},function(){modalTop(i)}):closeModal(o),handlePromise(n,u,i,r,f,e,s)):(n=t.promise(),handlePromise(n,u,i,r,f,e,s))})})}}}])}(angular.module("ns")),function(){var t=function(){function t(){this.restrict="A";this.templateUrl="/js/ns/common/directives/buy-now.html";this.scope={buttonText:"@",listType:"@",pageType:"@",product:"=",isTextLink:"@"};this.controller=n;this.controllerAs="buyNowController"}return t.instance=function(){return new t},t}(),n;angular.module("ns").directive("buyNow",t.instance);n=function(){function n(n,t,i){this.$scope=n;this.productService=t;this.apiService=i;this.buttonText=n.buttonText;this.listType=n.listType;this.pageType=n.pageType}return n.prototype.setSelectedProduct=function(){this.listType&&(window.GANEventConstants.actionField=this.listType);this.pageType&&(window.GANEventConstants.category=this.pageType);var n=this.$scope.product;this.productService.updateProductInformation(n);n.stockStatuses.length===0&&this.loadStockStatus(n.materialBaseNumber)},n.prototype.loadStockStatus=function(n){var t=this,i;this.productService.loadingMaterialNumber=n;i=this.apiService.getQuickViewForMaterial(n);i.then(function(n){var i=n.data;t.productService.loadingMaterialNumber===i.materialBaseNumber&&(t.productService.updateProductQuickViewMetadata(i),t.productService.loadingMaterialNumber=null)}).catch(function(){t.productService.loadingMaterialNumber=null})},n}();n.$inject=["$scope","productService","apiService"]}(ns||(ns={})),function(n){"use strict";n.directive("cancelSelection",function(){return{restrict:"A",scope:{appliedItemId:"=cancelSelection"},link:function(n,t){t.bind("click",function(){if(t.closest(".tab-pane").find(".btn.ship-location-option.active").removeClass("active"),n.appliedItemId){var i=$("#"+n.appliedItemId);i&&i.parent().addClass("active")}})}}})}(angular.module("ns")),function(n){n.directive("checkoutErrors",function(){return{restrict:"A",templateUrl:"/js/ns/common/directives/checkout-errors.html",scope:{checkoutErrors:"=checkoutErrors"}}})}(angular.module("ns")),function(n){n.directive("customModal",function(){return{restrict:"A",templateUrl:"/js/ns/common/directives/custom-modal.html",transclude:!0,scope:{modalTitle:"@",hideCloseButton:"@"},link:function(n,t,i){function f(n,t){var i;n.on("show.bs.modal",function(r){var f,u;i=$(r.relatedTarget);t.modalTitle===undefined&&n.find(".modal-title").text(i.attr("title"));i.attr("w")!==undefined&&(f=parseInt(i.attr("w")),f>699&&n.find(".modal-dialog").addClass("modal-lg"));u=n.attr("id");u&&u.indexOf("jqm")>-1&&($("#info-tab").hasClass("active")||$("#info-tab > a").click(),$("#material-additional-collapse").hasClass("in")||$('a[aria-controls="material-additional"').click())});n.on("shown.bs.modal",function(){($("body").data("open-modals")<0&&$("body").data("open-modals",0),$(this).hasClass("fv-modal-stack"))||($(this).addClass("fv-modal-stack").addClass("fv-modal-stack-"+$(this).attr("id")),$("body").data("open-modals",$("body").data("open-modals")+1),$(this).css("z-index",1040+10*$("body").data("open-modals")),$(".modal-backdrop").not(".fv-modal-stack").css("z-index",1039+10*$("body").data("open-modals")).addClass("fv-modal-stack-"+$(this).attr("id")),$(".modal-backdrop").not("fv-modal-stack").addClass("fv-modal-stack"),$("body").hasClass("ie10")&&$(".modal-backdrop").css("position","absolute").css("height","10000%"))});n.on("hide.bs.modal",function(){var t=n.attr("id"),r,u;t&&t.indexOf("jqm")>-1&&(r=i.closest(".tab-pane").attr("id"),u=$(".ns-tabs").find('a[aria-controls="'+r+'"]'),u.click())})}var u,r;t.addClass("modal");t.attr("role","dialog");t.attr("tabindex","-1");u=i.modalTitle;u!=undefined&&(n.modalTitle=i.modalTitle);i.hideCloseButton!=undefined&&(n.hideCloseButton=i.hideCloseButton);r=i.modalSize;r!=undefined&&(n.modalSize=r);t.on("hidden.bs.modal",function(){$(this).removeClass("fv-modal-stack");f(t,n);$("body").data("open-modals",$("body").data("open-modals")-1);var i=$(".modal-backdrop").first();i.hasClass("in")&&$("body").addClass("modal-open")});f(t,n);$("body").data("open-modals")<0&&$("body").data("open-modals",0)}}})}(angular.module("ns")),function(){var n=function(){function n(){var n=this;this.restrict="A";this.link=function(t,i,r){var u=angular.element(i),e=u.parents(".popover-container"),o="bottom",s="manual",f=!1;n.htmlElementIsValid(u)&&(r.popoverDirection!=null&&(o=r.popoverDirection),r.popoverTrigger!=null&&(s=r.popoverTrigger),u.popover({trigger:s,html:!0,content:r.popoverHtml,placement:o,container:e,viewport:e}).click(function(t){f=!f;f&&n.hideAllPopovers(u);t.stopPropagation();u.popover("toggle")}),angular.element("html").click(function(){u.popover("hide");f=!1}))}}return n.instance=function(){return new n},n.prototype.htmlElementIsValid=function(n){return n&&n.popover&&typeof n.popover=="function"},n.prototype.hideAllPopovers=function(n){angular.element("[custom-popover]").each(function(){n.popover("hide")})},n}();angular.module("ns").directive("customPopover",n.instance)}(ns||(ns={})),function(n){"use strict";n.directive("customSelect",["$timeout",function(n){return{restrict:"AC",scope:{stateCode:"=customSelect"},link:function(t,i){t.$watch("stateCode",function(r,u){n(function(){t.stateCode||u===""?i.data("selectpicker")&&(i.selectpicker("val",t.stateCode),i.siblings(".bootstrap-select").removeClass("has-error")):i.selectpicker("refresh")},0)})}}}])}(angular.module("ns")),function(n){"use strict";n.directive("enterKeypress",function(){return{link:function(n,t,i){t.bind("keydown keypress",function(t){t.which===13&&(n.$apply(function(){n.$eval(i.enterKeypress)}),t.preventDefault())})}}})}(angular.module("ns")),function(){"use strict";var n=function(){function n(n,t){var i=this;this.$timeout=n;this.loggerFactory=t;this.restrict="C";this.require="?ngModel";this.link=function(n,t,r,u){u&&i.$timeout(function(){n.$watch(function(){return u.$modelValue},function(){i.logger.debug("Element id "+t.context.id+", element class "+t.context.class);t.selectpicker("refresh")})})};this.logger=t.getBackendLogger("SelectPickerDirective")}return n.factory=function(){var t=function(t,i){return new n(t,i)};return t.$inject=["$timeout","loggerFactory"],t},n}();angular.module("ns").directive("selectpicker",n.factory())}(ns||(ns={})),function(n){"use strict";n.directive("imageLoader",["configs",function(){return{restrict:"A",scope:{ngSrc:"@"},link:function(n,t){var i=$(t).parents(".image-parent").find(".image-loader");t.on("load",function(){i.addClass("hidden");i.removeClass("shown");t.show()});t.on("error",function(){i.addClass("hidden");i.removeClass("shown");t.show()});n.$watch("ngSrc",function(){i.addClass("shown");i.removeClass("hidden");t.hide()})}}}])}(angular.module("ns")),function(n){"use strict";n.directive("imgSrcAzureReplace",["AzureUrl",function(n){return{scope:{imgSrcAzureReplace:"="},link:function(t,i,r){var u=n+"static/"+r.imgSrcAzureReplace;i.attr("src",u)}}}])}(angular.module("ns")),function(n){"use strict";n.directive("imgUrlError",["configs",function(n){return{link:function(t,i){i.on("error",function(){i.attr("src",n.imgUrlError)})}}}])}(angular.module("ns")),function(n){"use strict";n.directive("inputReturn",function(){return{restrict:"A",link:function(n,t){var i=t.parents(".input-wrapper");t.keypress(function(n){return n.which&&n.which==13||n.keyCode&&n.keyCode==13?(i.find(".input-btn").click(),!1):!0})}}})}(angular.module("ns")),function(n){n.directive("integerRequired",function(){return{restrict:"A",require:"?ngModel",link:function(n,t,i,r){r&&r.$parsers.unshift(function(n){return n?(parseInt(n)>2147483647?r.$dirty&&r.$setValidity("integerRequired",!1):r.$setValidity("integerRequired",!0),n):(r.$setValidity("integerRequired",!0),n)})}}})}(angular.module("ns")),function(n){n.directive("phoneMask",["loggerFactory","functionUtils",function(n){var r=n.getBackendLogger("PhoneNumberMaskDirectiveLogger"),t=function(n,t){if(t){var i=t.split(" ").join("");n.$setViewValue(i);n.$render()}},i=function(){var n=window.navigator.userAgent.toLowerCase();return n.indexOf("phantomjs")!==-1};return{restrict:"A",require:"ngModel",link:function(n,r,u,f){r.inputmask({mask:"999-999-9999",placeholder:" "});f.$parsers.unshift(function(n){if(i()||t(f,n),n&&n!=""){var r=n.replace(/\s+/g,"");f.$setValidity("phoneLengthValidation",r.length==12)}else f.$setValidity("phoneLengthValidation",!0);return n});f.$formatters.unshift(function(n){if(i()||t(f,n),n&&n!=""){var r=n.replace(/\s+/g,"");f.$setValidity("phoneLengthValidation",r.length==12)}else f.$setValidity("phoneLengthValidation",!0);return n})}}}]);n.directive("zipCodeMask",["addressService",function(n){var t=function(n){return n?{mask:"a9a 9a9",placeholder:" "}:{mask:"99999[-9999]",placeholder:" ",greedy:!1}};return{require:["?ngModel","^stateCode"],link:function(i,r,u,f){var e=f[0],o=f[1];o.onStateChange(function(i){var u,f,o;if(!i){r.inputmask({mask:"",placeholder:" "});return}u=n.stateCodeIsCanadian(i);f=t(u);u?r.attr("type","text"):r.attr("type","tel");r.inputmask(f);e.$modelValue&&(r.val(e.$modelValue),o=r.val(),e.$setViewValue(o))})}}}]);n.directive("poAlfanumericMask",function(){return{link:function(n,t){t.inputmask({mask:"*{1,30}",placeholder:" "})}}});n.directive("upsCollectAccountNumberMask",function(){return{restrict:"A",require:"?ngModel",link:function(n,t,i,r){function u(){var n=t.val();r.$setViewValue(n)}t.inputmask({mask:"******",placeholder:"",definitions:{"*":{validator:"[0-9A-Za-z]",cardinality:1,casing:"upper"}}});t.on("blur keyup change",function(){n.$apply(u)})}}});n.directive("fedExCollectAccountNumberMask",function(){return{restrict:"A",require:"?ngModel",link:function(n,t,i,r){function u(){var n=t.val();r.$setViewValue(n)}t.inputmask({mask:"9",repeat:"9",greedy:!1,clearMaskOnLostFocus:!0}).attr("type","tel");t.on("blur keyup change",function(){n.$apply(u)})}}})}(angular.module("ns"));angular.module("ns").directive("ngLazyimage",["eventsService",function(n){return{restrict:"A",scope:{url:"=",alt:"=",fallback:"="},link:function(t,i){n.on(events.LazyEvents.LoadDetected,function(){var r=function(n){var i=new Image;return i.src=n,i.alt=t.alt,i.classList.add("img-responsive"),i.loading&&(i.loading="lazy"),i.decoding&&(i.decoding="async"),i.onerror=function(){i.src=t.fallback},i},n;i[0].dataset.elementLoaded||(n=r(t.url),i.prepend(n),i[0].dataset.elementLoaded=!0)})}}}]);angular.module("ns").directive("ngLoadhide",["eventsService",function(n){return{restrict:"A",link:function(t,i){n.on(events.LazyEvents.LoadDetected,function(){i.addClass("display-none")})}}}]);angular.module("ns").directive("ngLoadshow",["eventsService",function(n){return{restrict:"A",scope:{callback:"&"},link:function(t,i){angular.element(document).ready(function(){var t=setInterval(function(){document.readyState==="complete"&&(clearInterval(t),i.removeClass("display-none"),n.trigger(events.LazyEvents.LoadDetected))},100)})}}}]),function(){var n=function(){function n(n){this.node=n}return n.prototype.getPosition=function(){return this.node.selectionStart},n.prototype.setPosition=function(n){this.node.selectionStart=n;this.node.selectionEnd=n},n}(),t=function(){function n(){this.restrict="A";this.require="?ngModel"}return n.instance=function(){return new n},n.prototype.link=function(n,t,r,u){u&&(t.attr("type","tel"),u.$parsers.unshift(function(n){var f=new i(t.get(0)),r=f.filterInputValue(n);return r!==undefined&&(u.$setViewValue(r),u.$render()),r}))},n}(),i=function(){function t(t){this.nodeElement=t;this.cursor=new n(this.nodeElement)}return t.prototype.filterInputValue=function(n){if(!n)return"";var t=this.returnOnlyDigits(n),i=this.cursor.getPosition(),r=n.length-t.length,u=i-r;return this.cursor.setPosition(u),t},t.prototype.isDigit=function(n){return!isNaN(n)&&n!==" "},t.prototype.returnOnlyDigits=function(n){return n.split("").filter(this.isDigit).join("")},t}();angular.module("ns").directive("onlyNumbers",t.instance)}(ns||(ns={}));angular.module("ns").directive("ngPlaceholder",["eventsService",function(n){return{restrict:"A",scope:{placeholderUrl:"=",fallback:"="},link:function(t,i){function r(){var n=document.createElement("canvas");return(n.getContext&&n.getContext("2d"))?n.toDataURL("image/webp").indexOf("data:image/webp")==0:!1}n.on(events.LazyEvents.LoadDetected,function(){var u=!1,n=i[0],o=n.src,f={width:Math.floor(n.getBoundingClientRect().width)+"px",height:Math.floor(n.getBoundingClientRect().height)+"px"},e={width:n.style.width,height:n.style.height};setTimeout(function(){n.src=t.placeholderUrlWebp&&r()?t.placeholderUrlWebp:t.placeholderUrl},110);n.decoding&&(n.decoding="async");n.onerror=function(){u=!0;n.style.width=f.width;n.style.height=f.height;n.src=t.fallback};n.onload=function(){u&&(n.style.width=e.width,n.style.height=e.height)}})}}}]),function(n){n.directive("poBoxValidation",["addressService",function(n){return{restrict:"A",require:"ngModel",scope:{stateCode:"=poBoxValidation"},link:function(t,i,r,u){var f=function(t,i){var r={stateCode:t,street1:i},f=n.streetAddressContainsPoBox(r);u.$setValidity("poboxValidation",!f)};t.$watch("stateCode",function(n){f(n,i.val())});u.$parsers.unshift(function(n){return f(t.stateCode,n),n});u.$formatters.unshift(function(n){return f(t.stateCode,n),n})}}}])}(angular.module("ns")),function(n){"use strict";n.directive("scrollOnShow",["$timeout","$anchorScroll",function(n,t){return{restrict:"A",link:function(i,r,u){u.ngShow&&i.$watch(u.ngShow,function(i){i&&n(function(){t.yOffset=120;t(r[0].id)},0)})}}}])}(angular.module("ns")),function(n){"use strict";n.directive("showErrorMsg",function(){return{restrict:"A",require:"^form",link:function(n,t,i,r){function u(n){return n.$submitted||n.$$parentForm&&n.$$parentForm.$submitted}function f(n,t){return!!r[t.fieldName]&&r[t.fieldName].$error[t.errorName]}n.$watch(function(){return f(r,i)&&u(r)&&(i.errorName==="required"||!r[i.fieldName].$error.required)},function(n){t.toggleClass("hide",!n)})}}})}(angular.module("ns")),function(n){"use strict";n.directive("showErrorMsgOnSubmit",function(){return{restrict:"A",require:"^form",link:function(n,t,i,r){n.$watch(function(){return r[i.fieldName].$error[i.errorName]&&r.$submitted&&!r[i.fieldName].$error.required},function(n){t.toggleClass("hide",!n)})}}})}(angular.module("ns")),function(n){n.directive("spin",function(){return{restrict:"A",scope:{spin:"="},link:function(n,t,i){n.$watch("spin",function(){if(n.spin){var r=i.spinText;t.html('<i class="spinner-element fa fa-fw fa-spinner fa-spin"><\/i><span class="spinner-text">'+r+"<\/span>")}else t.find(".spinner-element").remove(),t.find(".spinner-text").remove()})}}})}(angular.module("ns")),function(n){n.directive("stateCode",function(){return{restrict:"A",scope:{stateCode:"="},priority:3,controller:["$scope",function(n){this.onStateChange=function(t){n.$watch("stateCode",function(n){t&&t(n)})}}]}})}(angular.module("ns"));angular.module("ns").directive("submenuMouseEvents",["$timeout",function(n){return function(t,i){var r="",u=function(n){var t=$("#"+$(n).data("submenuId"));$(n).removeClass("active");t.hide()},f=function(n){var t=$("#"+$(n).data("submenuId")),i=$("#products-menu").outerHeight(),r=$("#products-menu").outerWidth();$(n).addClass("active");t.css({top:-1,left:r-3,height:i-4}).show()};i.on("mouseover focusin",function(){r&&n.cancel(r);r=n(function(){f(i)},150,i)});i.on("mouseout focusout",function(){r&&n.cancel(r);r=n(function(){u(i)},150,i)})}}]),function(){"use strict";var n=function(){function n(){this.restrict="A"}return n.instance=function(){return new n},n.prototype.link=function(n,t){t.on("click",function(){var n=t.parents("form").first();n&&n.submit()})},n}();angular.module("ns").directive("submitForm",n.instance)}(ns||(ns={})),function(n){var t=function(){function n(n){this.$compile=n;this.formatElement=function(n,t,i,r){var o=n.$eval(i.textCollapseMaxLength),u=i.urlHref,f=i.textUrlDisplay,e;if(r.toString().length>o){var h=String(r).substring(0,o),c=String(r).substring(o,r.toString().length),l=this.$compile("<span>"+h+"<\/span>")(n),a=this.$compile("<span ng-if='collapsed'>"+c+"<\/span>")(n),v=this.$compile('<span ng-if="!collapsed">... <\/span>')(n),s=this.$compile('<br ng-if="collapsed">')(n),y=this.$compile('<a class="collapse-text-toggle" ng-click="toggle()"><strong>{{collapsed ? "Read less " : "Read more "}}<i ng-class="{\'fa fa-angle-up\': collapsed, \'fa fa-angle-down\': !collapsed }"><\/i><\/strong><\/a>')(n);t.empty();t.append(l);t.append(a);this.shouldDisplayUrl(u,f)&&(e=this.$compile("<span ng-if='collapsed'> - <a href=\""+u+'" target= "_blank"> <strong>'+f+"<\/strong><\/a><\/span>")(n),t.append(e));t.append(v);t.append(s);t.append(s);t.append(y)}else t.empty(),t.append(r.toString()),this.shouldDisplayUrl(u,f)&&(e=this.$compile('<span> - <a href="'+u+'" target= "_blank"> <strong>'+f+"<\/strong><\/a><\/span>")(n),t.append(e))}}return n.prototype.shouldDisplayUrl=function(n,t){return n!==""&&t!==""},n}(),i;t.$inject=["$compile"];n.TextCollapseController=t;i=function(){function n(){this.restrict="A";this.scope=!0;this.controllerAs="textCollapseController";this.controller=t}return n.instance=function(){return new n},n.prototype.link=function(n,t,i,r){n.collapsed=!1;n.toggle=function(){n.collapsed=!n.collapsed};i.$observe("textCollapseText",function(u){r.formatElement(n,t,i,u)})},n}();angular.module("ns").directive("textCollapse",i.instance);angular.module("ns").controller("textCollapseController",t)}(ns||(ns={}));angular.module("ns").directive("windowSize",["$window",function(n){return function(t){t.windowHeight=undefined;t.windowWidth=undefined;t.extraSmallScreenBreakpointPx=768;t.smallScreenBreakpointPx=992;t.isSmallScreen=function(){return t.windowWidth<t.smallScreenBreakpointPx};t.isLargeScreen=function(){return t.windowWidth>=t.smallScreenBreakpointPx};t.getWindowDimensions=function(){return{h:window.innerHeight,w:window.innerWidth}};t.$watch(t.getWindowDimensions,function(n){t.windowHeight=n.h;t.windowWidth=n.w},!0);var i=function(){$("#left-menu-mobile").offcanvas("hide");document.body.style.removeProperty("left");document.body.style.removeProperty("padding-right")},r=function(){$("#right-menu-mobile").offcanvas("hide");document.body.style.removeProperty("right");document.body.style.removeProperty("padding-left")},u=function(){var n=document.body;t.isLargeScreen()&&n.classList.contains("canvas-slid")&&(n.classList.remove("canvas-slid"),n.style.left!==""?i():r())};angular.element(n).bind("resize",function(){u();t.$apply()})}}]),function(n){var t=function(){function n(){}return n}();t.ContactUpdated="account:contact-updated";n.MyAccountEvents=t}(events||(events={})),function(n){var t=function(){function n(){}return n}();t.SelectedAddressChanged="addressService:selected-address-changed";t.AddressbookLoaded="addressService:addressBook-loaded";t.AddressForEditChanged="addressService:selected-address-for-edit-changed";t.SelectedAddressUpdated="addressService:selected-address-updated";t.AddressCleansed="addressService:address-cleansed";t.MailingAddressSaved="addressService:mailing-address-saved";t.MailingAddressUpdated="addressService:mailing-address-updated";t.SubmitCleansedAddress="addressService:submit-cleansed-address";t.CleansedResultUpdated="addressService:cleansed-result-updated";t.BillingAddressSaved="addressService:billing-address-saved";t.AddressRemoved="addressService:address-removed";n.AddressesEvents=t}(events||(events={})),function(n){var t=function(){function n(){}return n}();t.CartLoaded="cartService:cart-loaded";t.CartUpdated="cartService:cart-updated";t.PriorityCodeUpdated="cartService:priority-code-updated";t.UpdateCart="cart:updateCartNeededFromService";t.UpdateCartLineRestriction="cart:update-cartLine-restriction";t.UpdateDeliveryCost="cart:updateDeliveryCostNeeded";n.CartEvents=t}(events||(events={})),function(n){var t=function(){function n(){}return n}();t.Login="employee:login";t.PasswordReset="employee:password-reset";n.EmployeeEvents=t}(events||(events={})),function(n){var t=function(){function n(){}return n}();t.PasswordForgot="forgotPassword:password-forgot";t.PasswordReset="forgotPassword:password-reset";t.AccountActivate="forgotPassword:account-activate";n.ForgotPasswordEvents=t}(events||(events={})),function(n){var t=function(){function n(){}return n}();t.DoNotCloseModal="doNotCloseModal";n.GenericEvents=t}(events||(events={})),function(n){var t=function(){function n(){}return n}();t.ZipCodeUpdated="geoRestrictions:zipcode-updated";t.CheckRestriction="geoRestrictions:check-restriction";t.ResetZipCodeForm="geoRestrictions:reset-zip-code-form";n.GeoRestrictionsEvents=t}(events||(events={})),function(n){var t=function(){function n(){}return n}();t.LoadDetected="lazy:load-detected";n.LazyEvents=t}(events||(events={})),function(n){var t=function(){function n(){}return n}();t.ResetSelectedQuantity="material-quantity:reset-selected-quantity";n.MaterialQuantityComponentEvents=t}(events||(events={})),function(n){var t=function(){function n(){}return n}();t.EvaluateSelectedOptions="product-character-sets:evaluate-selected-options";t.CharacterSetsSelected="product-character-sets:data-selected";t.ResetOptions="product-character-sets:reset-options";t.ResetCharacterSetsForVoucher="product-character-sets:reset-character-sets-for-voucher";n.ProductCharacterSetsComponentEvents=t}(events||(events={})),function(n){var t=function(){function n(){}return n}();t.ProductUpdated="productService:product-updated";t.ProductAddedToCart="productService:product-added";t.ProductStylesReviewed="productService:product-styles-reviewed";n.ProductEvents=t}(events||(events={})),function(n){var t=function(){function n(){}return n}();t.ResetMessages="product-messages:reset-messages";n.ProductMessagesComponentEvents=t}(events||(events={})),function(n){var t=function(){function n(){}return n}();t.ItemAdded="saved-for-later:item-added";t.CartAdded="saved-for-later:cart-added";t.ItemRemoved="saved-for-later:item-removed";t.EmptySaveForLater="saved-for-later-items:deleted";n.SaveForLaterEvents=t}(events||(events={})),function(n){var t=function(){function n(){}return n}();t.ShippingMethodChanged="shippingMethodsService:shipping-method-changed";t.ShippingConditionChanged="shippingMethodsService:shipping-condition-changed";t.CalculatingTotals="shEddTaxService:calculating-totals";t.CalculatedTotalsFailed="shEddTaxService:calculated-totals-failed";t.CalculatedTotals="shEddTaxService:calculated-totals";n.ShippingEvents=t}(events||(events={})),function(n){var t=function(){function n(){}return n}();t.StopSpinner="stop-spinner";t.ResetAddSpinner="reset-add-spinner";t.ResetAddToCartSpinner="reset-addToCart-spinner";t.ResetAddToCartAndPunchOutSpinner="reset-addToCartAndPunchOut-spinner";t.ResetQuickShopAddSpinner="reset-quickShopAdd-spinner";n.SpinnerEvents=t}(events||(events={})),function(n){var t=function(){function n(){}return n}();t.VoucherSelected="voucher-hub:voucher-selected";t.BeginExitVoucher="voucher-hub:begin-exit-context";n.VoucherHubEvents=t}(events||(events={})),function(n){var t=function(){function n(){}return n}();t.OpenCartMaterialModal="voucher-shop:open-cart-material-modal";t.MaterialUncarted="voucher-shop:uncarted-material";t.ChangeVoucherConfirmationModalOpened="voucher-shop:open-change-voucher-confirmation-modal";t.GroupVoucherSelectedChanged="voucher-shop:group-voucher-selected-changed";t.VoucherExhausted="voucher-shop:voucher-exhausted";n.VoucherShopEvents=t}(events||(events={})),function(n){var t=function(){function n(){}return n}();t.BannerLoaded="voucher-top-bar:banner-loaded";n.VoucherTopBarEvents=t}(events||(events={})),function(n){var t;(function(n){var t=function(){function n(){}return n.factory=function(){return function(n){var t=n.slice(),i=_.find(t,function(n){return n.isSameAsBilling}),r;return i&&i.containsPoBox&&(r=t.indexOf(i),r!==-1&&t.splice(r,1)),t}},n}();n.AddressBookFilter=t;angular.module("ns").filter("addressesForAddressBook",t.factory)})(t=n.filters||(n.filters={}))}(common||(common={})),function(n){var t;(function(n){var t=function(){function n(){}return n.factory=function(n){return function(t,i,r){for(var e=!1,o=!1,s="",h="",f=n("ecommerceMaterialDetailsUrl"),c,u=0;u<t.length;++u)c=t[u].toLowerCase(),c.indexOf("cp")!==-1&&(e=!0,s=t[u]),c.indexOf("sp")!==-1&&(o=!0,h=t[u]);return e&&o?'\'Add <a class="bold" href="'+f(s,i,r)+'">Your Logo<\/a> or add a <a class="bold" href="'+f(h,i,r)+"\">Safety Message<\/a> to this product!'":e?'\'Add <a class="bold" href="'+f(s,i,r)+"\">Your Logo<\/a> to this product!'":o?'\'Add <a class="bold" href="'+f(h,i,r)+"\">Your Safety Message<\/a> to this product!'":""}},n}();n.CustomMaterialMessageFilter=t;angular.module("ns").filter("customMaterialMessage",["$filter",function(n){return t.factory(n)}])})(t=n.filters||(n.filters={}))}(common||(common={})),function(n){var t;(function(n){var t=function(){function n(){}return n.factory=function(){return function(n,t,i){if(t||i){var r="";return t&&(r+=t.trim()+" "),i&&(r+=i.trim()),r&&(r=r.replace(/\s\s+/g," "),r=r.replace(/[^\w\s/]/gi,""),r=r.replace(/&/g,"-"),r=r.replace(/–/g,"-"),r=r.replace(/[\/]/g,"-"),r=r.replace(/\s/g,"-"),r=r.replace(/-+/g,"-"),r=r.trim()),"/Product/"+n+"/"+r}return"/Product/"+n}},n}();n.MaterialDetailsUrlFilter=t;angular.module("ns").filter("ecommerceMaterialDetailsUrl",t.factory)})(t=n.filters||(n.filters={}))}(common||(common={})),function(n){var t;(function(){angular.module("ns").filter("ecommerceCheckoutUrl",[function(){return function(){return"/Cart/Checkout"}}])})(t=n.filters||(n.filters={}))}(common||(common={})),function(n){var t;(function(n){var t=function(){function n(){}return n.factory=function(){return function(n){return n?n.replace(/'/g,"&#39;"):""}},n}();n.EscapeApostropheFilter=t;angular.module("ns").filter("escapeApostrophe",t.factory)})(t=n.filters||(n.filters={}))}(common||(common={})),function(n){var t;(function(n){function t(){return function(n){return n?n.replace(/[^\d]+/g,"").replace(/(\d{3})(\d{3})(\d{0,4})/,"$1-$2-$3"):n}}n.formatPhoneNumber=t;angular.module("ns").filter("formatPhoneNumber",t)})(t=n.filters||(n.filters={}))}(common||(common={})),function(n){var t;(function(n){var t=function(){function n(){}return n.factory=function(n){return function(t,i){var r="FREE";return i?r:t!==0?n(t):r}},n}();n.FreeFilter=t;angular.module("ns").filter("free",["currencyFilter",function(n){return t.factory(n)}])})(t=n.filters||(n.filters={}))}(common||(common={})),function(n){var t;(function(n){var i=function(){function n(){}return n.factory=function(n){return function(t){return t!=null?n.imageUrl+"homead/"+t+".jpg":n.imageUrl+"homead/0.jpg"}},n}(),t;n.HomeAdImageFilter=i;t=function(){function n(){}return n.factory=function(n){return function(t){return t!=null?n.imageUrl+"homead/"+t+"sm.jpg":n.imageUrl+"homead/0.jpg"}},n}();n.HomeAdImageSmallFilter=t;angular.module("ns").filter("homeAdImageUrl",["configs",function(n){return i.factory(n)}]);angular.module("ns").filter("homeAdImageSmallUrl",["configs",function(n){return t.factory(n)}])})(t=n.filters||(n.filters={}))}(common||(common={})),function(n){var t;(function(n){var t=function(){function n(){}return n.factory=function(n,t){return function(i){var o=t("ecommerceMaterialDetailsUrl"),u=i.match(/\[\#[0-9]+\]/g),r;if(!u)return n.trustAsHtml(i);for(r=0;r<u.length;++r){var f=u[r],e=f.replace("[#","").replace("]",""),s=o(e,null,null);i=i.replace(f,'<a href="'+s+'">'+e+"<\/a>")}return n.trustAsHtml(i)}},n}();n.MaterialBaseNumberInBracketsUrlFilter=t;angular.module("ns").filter("materialBaseNumberInBracketsUrl",["$sce","$filter",function(n,i){return t.factory(n,i)}])})(t=n.filters||(n.filters={}))}(common||(common={})),function(n){var t;(function(n){var u=function(){function n(){}return n.factory=function(n){return function(t){return t!=null?n.imageUrl+"image100/material/"+t+".jpg":n.imageUrl+"image100/material/0.jpg"}},n}(),t,i,r;n.MaterialImageUrlFilter=u;angular.module("ns").filter("materialImageUrl",["configs",function(n){return u.factory(n)}]);t=function(){function n(){}return n.factory=function(n){return function(t){return t?n.imageUrl+"image250/material/"+t+".jpg":n.imageUrl+"image250/material/0.jpg"}},n}();n.MaterialImageUrlMediumFilter=t;angular.module("ns").filter("materialImageUrlMedium",["configs",function(n){return t.factory(n)}]);i=function(){function n(){}return n.factory=function(n){return function(t){return t!=null?n.imageUrl+"image400/material/"+t+".jpg":n.imageUrl+"image400/material/0.jpg"}},n}();n.MaterialImageUrlLargeFilter=i;angular.module("ns").filter("materialImageUrlLarge",["configs",function(n){return i.factory(n)}]);r=function(){function n(){}return n.factory=function(n){return function(t){return t!=null?n.imageUrl+"image800/material/"+t+".jpg":n.imageUrl+"image400/material/0.jpg"}},n}();n.MaterialImageUrlXlFilter=r;angular.module("ns").filter("materialImageUrlXL",["configs",function(n){return r.factory(n)}])})(t=n.filters||(n.filters={}))}(common||(common={})),function(n){var t;(function(n){var t=function(){function n(){}return n.factory=function(){return function(n,t,i,r){if(!n)return"";if((i=parseInt(i,10),!i)||n.length<=i)return n;if(n=n.substr(0,i),t){var u=n.lastIndexOf(" ");u!==-1&&(n=n.substr(0,u))}return n+(r||" …")}},n}();n.MaxLengthFilter=t;angular.module("ns").filter("maxLength",t.factory)})(t=n.filters||(n.filters={}))}(common||(common={})),function(n){var t;(function(n){var t=function(){function n(){}return n.factory=function(n){return function(t){var r,u;t||(t=0);var f=t,e=5-f,i="";for(r=0;r<f;r++)i+='<div class="full-star"><\/div>';for(u=0;u<e;u++)i+='<div class="empty-star"><\/div>';return n.trustAsHtml(i)}},n}();n.RatingStarsFilter=t;angular.module("ns").filter("ratingStars",["$sce",function(n){return t.factory(n)}])})(t=n.filters||(n.filters={}))}(common||(common={})),function(n){var t;(function(n){var t=function(){function n(){}return n.factory=function(){return function(n,t){if(!n)return n;var i=n.slice().reverse();return i.length>t&&(i=i.slice(0,t)),i}},n}();n.ReduceCollectionFilter=t;angular.module("ns").filter("reduceCollection",t.factory)})(t=n.filters||(n.filters={}))}(common||(common={})),function(n){var t;(function(n){var t=function(){function n(){}return n.factory=function(){return function(n){return n?n.replace(/ /g,""):""}},n}();n.RemoveWhitespaceFilter=t;angular.module("ns").filter("removeWhitespace",t.factory)})(t=n.filters||(n.filters={}))}(common||(common={})),function(n){var t;(function(){angular.module("ns").filter("shippingMethod",["shippingMethodsService",function(n){return function(t,i){return n.getDisplayText(t,i)}}])})(t=n.filters||(n.filters={}))}(common||(common={})),function(n){var t;(function(){angular.module("ns").filter("shippingAddressContainsPoBox",["addressService",function(n){return function(t){var i=t.slice();return _.each(i,function(t){t.containsPoBox=n.streetAddressContainsPoBox(t)}),i}}])})(t=n.filters||(n.filters={}))}(common||(common={})),function(n){var t;(function(n){var t=function(){function n(){}return n.factory=function(){return function(n,t){return t?t.toLowerCase().substring(0,3)==="ups"?"http://wwwapps.ups.com/WebTracking/track?HTMLVersion=5.0&loc=en_US&trackNums="+n+"&track.y=10":t.toLowerCase().substring(0,5)==="fedex"?"http://www.fedex.com/Tracking?template_type=print&cntry_code=us&language=english&tracknumbers="+n:"":""}},n}();n.TrackingNumberFilter=t;angular.module("ns").filter("trackingNumberUrl",t.factory)})(t=n.filters||(n.filters={}))}(common||(common={})),function(n){var t;(function(){angular.module("ns").filter("trustAsHtml",["$sce",function(n){return function(t){n.trustAsHtml(t)}}])})(t=n.filters||(n.filters={}))}(common||(common={})),function(n){var t=function(){function n(n){var t=this;this.window=n;this.request=function(n){var i=t.window.requestData;return i||(i=[]),i.length===10&&i.shift(),i.push("Request at "+n.url+" of type "+n.method+". We are at "+t.window.location.href+"."),t.window.requestData=i,n}}return n}();t.$inject=["$window"];n.HttpRequestsInterceptor=t;angular.module("ns").service("httpRequestsInterceptor",t)}(ns||(ns={})),function(){var n=function(){function n(n,t){var i=this;this.$q=n;this.navigationService=t;this.responseError=function(n){return n.status===401&&i.navigationService.goToLoginFromPreviousPage(),i.$q.reject(n)}}return n}();n.$inject=["$q","navigationService"];angular.module("ns").service("unauthorizedCallResponseInterceptor",n)}(ns||(ns={})),function(){"use strict";var n=function(){function n(){this.restrict="A";this.require="ngModel";this.scope={fieldToMatch:"=",doFieldsMatch:"&"};this.link=function(n,t,i,r){var u=function(n,t){return n?!!n&&n===t:!0};n.$watch("fieldToMatch",function(){r.$dirty&&r.$setValidity("fieldsDontMatch",u(n.fieldToMatch,t.val()))});r.$parsers.unshift(function(t){return r.$setValidity("fieldsDontMatch",u(n.fieldToMatch,t)),t});r.$formatters.unshift(function(t){return r.$setValidity("fieldsDontMatch",u(n.fieldToMatch,t)),t})}}return n.instance=function(){return new n},n}();angular.module("ns").directive("fieldsMustMatch",n.instance)}(ns||(ns={})),function(n){"use strict";n.directive("zipcodeLengthValidation",["addressService",function(n){var t=function(n){return n.split(" ").join("").length===5||n.split(" ").join("").length===10},i=function(n){return n.split(" ").join("").length===6},r=function(r,u,f){if(r&&u&&f){var e=n.stateCodeIsCanadian(u),o=e?i(f):t(f);e||(r.$setViewValue(f.split(" ").join("")),r.$render());r.$setValidity("customLengthValidation",o)}};return{restrict:"A",require:["?ngModel","^stateCode"],priority:2,link:function(n,t,i,u){var f=u[0],c=u[1],e="",o="",s=function(){r(f,o,e)},h=function(n){return e=n,s(),n},l=function(n){o=n;s()};f.$parsers.unshift(h);f.$formatters.unshift(h);c.onStateChange(l)}}}])}(angular.module("ns")),function(n){"use strict";function t(n,t,i){this.startsWith=n;this.pattern=t;this.typeCode=i}function r(){var i=new t,n;return i.isMatch=function(){return!0},i.patternIsValid=function(){return!1},n=new t,n.isMatch=function(n){return!n},n.patternIsValid=function(){return!1},{noCardNumber:n,americanExpress:new t("3",/^3[47]/,"3000"),visa:new t("4",/^4/,"4000"),masterCard:new t("5",/^5[1-5]/,"5000"),discover:new t("6",/^(6011|65|64[4-9]|622)/,"6000"),otherCard:i}}var i=function(){var n=new Date;return n.setDate(1),n.setHours(0,0,0,0),n};t.prototype={isMatch:function(n){return this.startsWith===n.charAt(0)},patternIsValid:function(n){return this.pattern.test(n)}};n.directive("ccNumber",function(){var t=r(),i=function(n){for(var i=n.length,r=0,u=[[0,1,2,3,4,5,6,7,8,9],[0,2,4,6,8,1,3,5,7,9]],t=0;i--;)t+=u[r][parseInt(n.charAt(i),10)],r^=1;return t%10==0&&t>0},u=function(n){return!!n&&n.length>=13&&n.length<=16},f=function(n,t){return u(n)&&t.patternIsValid(n)&&i(n)},n=function(n,i,r){if(!i.creditCardToSave.isEdit){var u=_.find(t,function(n){return n.isMatch(r)});i.creditCardToSave&&(i.creditCardToSave.typeCode=u.typeCode);n.$setValidity("creditCardInvalid",f(r,u))}};return{restrict:"A",require:"ngModel",scope:{creditCardToSave:"=ccNumber"},link:function(t,i,r,u){u.$parsers.unshift(function(i){return n(u,t,i),i});u.$formatters.unshift(function(i){return n(u,t,i),i})}}});n.directive("ccExpMonth",["dateService",function(n){return{restrict:"A",require:"ngModel",link:function(t,r,u,f){f.$parsers.unshift(function(r){var s,e,o;return r&&(s=u.expyear,s&&(e=n.createDateWith1IndexedMonth(s,r,1),o=i(),t.addCreditCardForm&&t.addCreditCardForm.expirationMonth&&t.addCreditCardForm.expirationYear&&(t.addCreditCardForm.expirationYear.$setValidity("expirationDateInvalid",e>=o),t.addCreditCardForm.expirationMonth.$setValidity("expirationDateInvalid",e>=o)),t.editCreditCardForm&&t.editCreditCardForm.expirationMonth&&t.editCreditCardForm.expirationYear&&(t.editCreditCardForm.expirationYear.$setValidity("expirationDateInvalid",e>=o),t.editCreditCardForm.expirationMonth.$setValidity("expirationDateInvalid",e>=o)),f.$setValidity("expirationDateInvalid",e>=o))),r})}}}]);n.directive("ccExpYear",["dateService",function(n){return{restrict:"A",require:"ngModel",link:function(t,r,u,f){f.$parsers.unshift(function(r){var s;if(r&&(s=u.expmonth-1,s>=0)){var h=r,e=n.createDateWith1IndexedMonth(h,u.expmonth,1),o=i();t.addCreditCardForm&&t.addCreditCardForm.expirationMonth&&t.addCreditCardForm.expirationMonth.$setValidity("expirationDateInvalid",e>=o);t.editCreditCardForm&&t.editCreditCardForm.expirationMonth&&t.editCreditCardForm.expirationMonth.$setValidity("expirationDateInvalid",e>=o);f.$setValidity("expirationDateInvalid",e>=o)}return r})}}}])}(angular.module("ns")),function(n){"use strict";n.directive("creditCardIcon",function(){return{restrict:"A",templateUrl:"/js/ns/credit-cards/credit-card-icon.html",scope:{typeCode:"="}}})}(angular.module("ns")),function(n){var t=function(){function n(){this.id=null;this.lastFourDigits=null;this.expirationYear=null;this.expirationMonth=null;this.token=null;this.typeCode=null;this.cvv=null;this.ownerName=null;this.expirationDate=null;this.isDefault=null;this.saveForFutureUse=null}return n.prototype.update=function(n){this.id=n.id;this.lastFourDigits=n.lastFourDigits;this.expirationYear=n.expirationYear;this.expirationMonth=n.expirationMonth;this.token=n.token;this.typeCode=n.typeCode;this.cvv=n.cvv;this.ownerName=n.ownerName;this.expirationDate=n.expirationDate;this.isDefault=n.isDefault;this.saveForFutureUse=n.saveForFutureUse},n}();n.CreditCard=t}(ns||(ns={})),function(n){var t=function(){function t(n,t,i,r,u,f,e){this.deferrer=f;this.featureData=e;this.initialData=n;this.apiService=i;this.eventsService=r;this.dateService=u;this._editedCreditCard={};this.creditCardToRemove=null;this._payment=this.initialData.checkout?t.createPayment(this.initialData.checkout,this.featureData):t.createPayment({},this.featureData);this.setSelectedCreditCardOnUserCreditCards();this.setPreExistingCreditCardsAsSavedForFutureUse()}return Object.defineProperty(t.prototype,"editedCreditCard",{get:function(){return this._editedCreditCard},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"payment",{get:function(){return this._payment},enumerable:!0,configurable:!0}),t.prototype.findCreditCardByToken=function(n){return this.payment.getUserCreditCardByToken(n)},t.prototype.isEditedCreditCardADuplicate=function(){var n=this._editedCreditCard.token,t=this.findCreditCardByToken(n);return!!t},t.prototype.isCreditCard=function(){return this.payment.isSelectedPaymentMethod(n.PaymentMethods.creditCard)},t.prototype.isAmericanExpressCreditCard=function(n){return n&&n.typeCode==="3000"},t.prototype.isCreditCardDefaultPaymentMethod=function(n){return this.payment.isDefaultCreditCard(n)},t.prototype.isAppliedCreditCardDefault=function(){return this.payment.isAppliedCreditCardDefaultPaymentMethod()},t.prototype.markEditedCreditCardAsDuplicate=function(){this._editedCreditCard.isDuplicate=!0},t.prototype.setCreditCardAsPaymentMethod=function(){this.payment.setPaymentMethod(n.PaymentMethods.creditCard)},t.prototype.getUserCreditCards=function(){return this.payment._userCreditCards},t.prototype.startCreatingNewCreditCard=function(){this._editedCreditCard={}},t.prototype.saveEditedCreditCard=function(){var n=this;return this.addOrEditCreditCard(this._editedCreditCard).then(function(t){var i=t.data.resultObject.creditCardDetails,r=t.data.resultObject.defaultPaymentInfo;i.cvv=n._editedCreditCard.cvv;i.saveForFutureUse=!0;i.expirationDate=n.dateService.createDateWith1IndexedMonth(i.expirationYear,i.expirationMonth);n.payment._userCreditCards.push(i);r&&(n.setDefaultOnUserCreditCards(r.creditCardId),i.isDefault=n._editedCreditCard.isDefault,n.setPaymentAndDefaultPaymentInfo(r.creditCardId,r.paymentMethod));n.setSelectedCreditCard(i);n._editedCreditCard={}})},t.prototype.saveCreditCard=function(){var n=this;return this.addOrEditCreditCard(this._editedCreditCard).then(function(t){var i=t.data.resultObject.creditCardDetails,r=t.data.resultObject.defaultPaymentInfo,u,f;i.isSelected=!0;i.cvv=n._editedCreditCard.cvv;i.saveForFutureUse=!0;i.expirationDate=n.dateService.createDateWith1IndexedMonth(i.expirationYear,i.expirationMonth);u=_.indexOf(n.payment._userCreditCards,n._editedCreditCard);u===-1&&(f=n.findCreditCardByToken(n._editedCreditCard.token),f&&(u=_.indexOf(n.payment._userCreditCards,f)));n.payment._userCreditCards[u]=i;r&&(n.setDefaultOnUserCreditCards(r.creditCardId),n.setPaymentAndDefaultPaymentInfo(r.creditCardId,r.paymentMethod));n.updateUserCreditCardsAfterEdit(i);n.setSelectedCreditCard(i)})},t.prototype.addOrEditCreditCardV3=function(n){return this.apiService.addOrEditCreditCard({id:n.id,token:n.token,typeCode:n.typeCode,numberLastFour:n.lastFourDigits,cvv:n.cvv,holderName:n.ownerName,expirationMonth:n.expirationMonth,expirationYear:n.expirationYear,isDefault:n.isDefault})},t.prototype.saveCreditCardV3=function(n){var t=this,i;return(this._editedCreditCard.token=n.Token,this._editedCreditCard.typeCode=this.convertCardType(n.CardType),this._editedCreditCard.lastFourDigits=n.LastFour,this._editedCreditCard.cvv=n.Cvv,this._editedCreditCard.ownerName=n.OwnerName,this._editedCreditCard.expirationMonth=n.ExpirationMonth,this._editedCreditCard.expirationYear=n.ExpirationYear,this.isEditedCreditCardADuplicate())?(i=this.deferrer.defer(),i.reject(),i.promise):this.isEditedCreditCardForFutureUse()?this.addOrEditCreditCardV3(this._editedCreditCard).then(function(n){var i=n.data.resultObject.creditCardDetails,r=n.data.resultObject.defaultPaymentInfo;i.cvv=t._editedCreditCard.cvv;i.saveForFutureUse=t._editedCreditCard.saveForFutureUse;i.expirationDate=t.dateService.createDateWith1IndexedMonth(i.expirationYear,i.expirationMonth);t.payment._userCreditCards.push(i);r&&(t.setDefaultOnUserCreditCards(r.creditCardId),i.isDefault=t._editedCreditCard.isDefault,t.setPaymentAndDefaultPaymentInfo(r.creditCardId,r.paymentMethod));t.setSelectedCreditCard(i);t._editedCreditCard={}}):this.addEditedCreditCardAsUnsavedV3()},t.prototype.convertCardType=function(n){switch(n){case"vi":return"4000";case"mc":return"5000";case"di":return"6000";case"ax":return"3000";default:return""}},t.prototype.getAppliedCreditCard=function(){return this.payment.appliedCreditCard},t.prototype.getCreditCardToRemove=function(){return this.creditCardToRemove!=null?this.creditCardToRemove:this.payment.appliedCreditCard},t.prototype.getAppliedCreditCardId=function(){return this.payment.appliedCreditCard.id},t.prototype.getSelectedCreditCard=function(){return this.payment.selectedCreditCard},t.prototype.isExpiredCreditCard=function(){return this.payment.isSelectedPaymentMethod(n.PaymentMethods.creditCard)&&this.payment.appliedCreditCard.isExpired},t.prototype.hasNoCreditCards=function(){return this.payment.isSelectedPaymentMethod(n.PaymentMethods.creditCard)&&(!this.payment.appliedCreditCard||!this.payment._userCreditCards||this.payment._userCreditCards.length===0)},t.prototype.isTrusted=function(){return this.payment.isSelectedPaymentMethod(n.PaymentMethods.creditCard)&&this.payment.appliedCreditCard&&this.payment.appliedCreditCard.isTrusted},t.prototype.hasCvv=function(){return this.payment.appliedCreditCard&&this.payment.appliedCreditCard!=null&&this.payment.appliedCreditCard.cvv&&(this.isAmericanExpressCreditCard(this.payment.appliedCreditCard)&&String(this.payment.appliedCreditCard.cvv).length===4||!this.isAmericanExpressCreditCard(this.payment.appliedCreditCard)&&String(this.payment.appliedCreditCard.cvv).length===3)},t.prototype.isEditedCreditCardForFutureUse=function(){return this._editedCreditCard.saveForFutureUse},t.prototype.setEditedCreditCardHasError=function(){this._editedCreditCard.hasError=!0},t.prototype.addUnsavedCreditCard=function(t){var i=new n.CreditCard;i.ownerName=t.ownerName;i.typeCode=t.typeCode;i.token=t.token;i.lastFourDigits=t.number.slice(-4);i.expirationYear=t.expirationYear;i.expirationMonth=t.expirationMonth;i.cvv=t.cvv;i.saveForFutureUse=!1;i.expirationDate=this.dateService.createDateWith1IndexedMonth(t.expirationYear,t.expirationMonth);this.removePreviouslyUnsavedCreditCard();this.payment._userCreditCards.push(i);this.setSelectedCreditCard(i)},t.prototype.addUnsavedCreditCardV3=function(t){var r=this.deferrer.defer(),i=new n.CreditCard;return i.ownerName=t.ownerName,i.typeCode=t.typeCode,i.token=t.token,i.lastFourDigits=t.lastFourDigits,i.expirationYear=t.expirationYear,i.expirationMonth=t.expirationMonth,i.cvv=t.cvv,i.saveForFutureUse=!1,i.expirationDate=this.dateService.createDateWith1IndexedMonth(t.expirationYear,t.expirationMonth),this.removePreviouslyUnsavedCreditCard(),this.payment._userCreditCards.push(i),this.setSelectedCreditCard(i),this.setCreditCardAsPaymentMethod(),this._editedCreditCard={},r.resolve(!0),r.promise},t.prototype.addEditedCreditCardAsUnsavedV3=function(){return this.addUnsavedCreditCardV3(this._editedCreditCard)},t.prototype.addEditedCreditCardAsUnsaved=function(){this.addUnsavedCreditCard(this._editedCreditCard);this._editedCreditCard={}},t.prototype.resetExpirationDateForEditedCreditCard=function(){var n=this;_.each(this.payment._userCreditCards,function(t,i){t.id===n._editedCreditCard.id&&(n.payment._userCreditCards[i]=n._editedCreditCard,n.setSelectedCreditCard(n._editedCreditCard))})},t.prototype.editCreditCard=function(n){this._editedCreditCard=angular.copy(n);this.editedCreditCard.isExpired||(this.editedCreditCard.expirationMonth=this.editedCreditCard.expirationMonth.toString(),this.editedCreditCard.expirationYear=this.editedCreditCard.expirationYear.toString());this.editedCreditCard.number="********"+this.editedCreditCard.lastFourDigits;this.editedCreditCard.isEdit=!0},t.prototype.editSelectedCreditCard=function(){var n=this.getSelectedCreditCard();this.editCreditCard(n)},t.prototype.tokenizationFailed=function(){this.paymetricConnectionError||this.setEditedCreditCardHasError();this.tokenizationDeferrer.resolve(!1)},t.prototype.tokenizationSucceeded=function(n){this._editedCreditCard.token=n;this.addCreditCard()},t.prototype.addCreditCard=function(){var n=this;this.isEditedCreditCardADuplicate()?(this.markEditedCreditCardAsDuplicate(),this.tokenizationDeferrer.resolve(!1)):this.isEditedCreditCardForFutureUse()?this.saveEditedCreditCard().then(function(){n.tokenizationDeferrer.resolve(!0)}).catch(function(){n.tokenizationDeferrer.reject()}):(this.addEditedCreditCardAsUnsaved(),this.tokenizationDeferrer.resolve(!0))},t.prototype.resetTokenizationErrors=function(){this._editedCreditCard.hasError=!1;this._editedCreditCard.isDuplicate=!1;this._editedCreditCard.hasTimeoutError=!1},t.prototype.updateUiAfterRemoveCreditCard=function(n){this.payment.removeUserCreditCard(n);this.setSelectedCreditCardOnUserCreditCards()},t.prototype.removeCreditCard=function(n){var t=this;if(n.saveForFutureUse)return this.apiService.removeCreditCard(n.id).then(function(i){t.eventsService.trigger("credit-card-removed");i.data&&i.data.resultObject.defaultPaymentInfo&&t.setPaymentAndDefaultPaymentInfo(i.data.resultObject.defaultPaymentInfo.creditCardId,i.data.resultObject.defaultPaymentInfo.paymentMethod);t.updateUiAfterRemoveCreditCard(n)});this.updateUiAfterRemoveCreditCard(n);this.eventsService.trigger("credit-card-removed");this._editedCreditCard={}},t.prototype.userHasSavedCreditCards=function(){return this.payment.userHasSavedCreditCards()},t.prototype.setSelectedCreditCard=function(n){this.payment.applyCreditCard(n)},t.prototype.setDefaultOnUserCreditCards=function(n){var t=this;this.userHasSavedCreditCards()&&_.each(this.payment._userCreditCards,function(i,r){t.payment._userCreditCards[r].isDefault=n&&t.payment._userCreditCards[r].id===n?!0:!1})},t.prototype.setCreditCardAsDefaultPayment=function(){var n=this;this.apiService.setCreditCardAsDefaultPayment(this.payment.appliedCreditCard.id).then(function(t){t.data.success&&(n.setPaymentAndDefaultPaymentInfo(n.payment.appliedCreditCard.id),n.setDefaultOnUserCreditCards(n.payment.appliedCreditCard.id))})},t.prototype.setPaymentAndDefaultPaymentInfo=function(n,t){this.payment.setDefaultPaymentMethod(n,t);this.payment.setPaymentMethod(t)},t.prototype.setPreExistingCreditCardsAsSavedForFutureUse=function(){var n=this.userHasSavedCreditCards();n&&_.each(this.payment._userCreditCards,function(n){n.saveForFutureUse=!0})},t.prototype.setSelectedCreditCardOnUserCreditCards=function(){var n=this;this.userHasSavedCreditCards()&&(_.each(this.payment._userCreditCards,function(t,i){n.payment._userCreditCards[i].isDefault=!1}),this.payment.isDefaultCreditCard()?this.setDefaultAsSelectedCreditCard():this.setFirstAsSelectedCreditCard())},t.prototype.setHasPaymetricConnectionError=function(){this.paymetricConnectionError=!0},t.prototype.hasPaymetricConnectionError=function(){return this.paymetricConnectionError},t.prototype.setFirstAsSelectedCreditCard=function(){this.userHasSavedCreditCards()&&(this.payment.selectCreditCard(this.payment._userCreditCards[0]),this.setAppliedCreditCard(this.payment._userCreditCards[0]))},t.prototype.setAppliedCreditCard=function(n){this.payment.applyCreditCard(n)},t.prototype.addOrEditCreditCard=function(n){return this.apiService.addOrEditCreditCard({id:n.id,token:n.token,typeCode:n.typeCode,numberLastFour:n.number.slice(-4),cvv:n.cvv,holderName:n.ownerName,expirationMonth:n.expirationMonth,expirationYear:n.expirationYear,isDefault:n.isDefault})},t.prototype.getPaymetricResponsePacket=function(n){return this.apiService.getPaymetricResponsePacket(n)},t.prototype.getAccessToken=function(){return this.apiService.getAccessToken()},t.prototype.updateUserCreditCardsAfterEdit=function(n){var t=this;return _.each(this.payment._userCreditCards,function(i,r){i.id===n.id&&(t.payment._userCreditCards[r]=n)})},t.prototype.removePreviouslyUnsavedCreditCard=function(){var t=_.findWhere(this.payment._userCreditCards,{saveForFutureUse:!1}),n;t&&(n=this.payment._userCreditCards.indexOf(t),n>-1&&this.payment._userCreditCards.splice(n,1))},t.prototype.setDefaultAsSelectedCreditCard=function(){var n=this.getDefaultCreditCard();n&&(n.isDefault=!0);this.payment.applyCreditCard(n)},t.prototype.getDefaultCreditCard=function(){return this.payment.getDefaultUserCreditCard()},t}();t.$inject=["initialData","modelsFactory","apiService","eventsService","dateService","$q","featureData"];n.CreditCardService=t;angular.module("ns").service("creditCardService",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t,i,r,u,f,e,o){this.eventsService=n;this.initialData=t;this.creditCardService=i;this.focusService=r;this.apiService=u;this.analyticsService=f;this.userService=e;this.cartService=o;this.accessToken="";this.iFrameUrl="";this.init()}return n.prototype.init=function(){var n=this;this.eventsService.on("Order-Submitted",function(){n.orderSubmitted=!0})},n.prototype.resetForm=function(n){n&&(n.$submitted=!1)},Object.defineProperty(n.prototype,"editedCreditCard",{get:function(){return this.creditCardService.editedCreditCard},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"disableCreditCardSave",{get:function(){return this.creditCardService.isEditedCreditCardForFutureUse()},enumerable:!0,configurable:!0}),n.prototype.isCreditCard=function(){return this.creditCardService.isCreditCard()},n.prototype.isAmericanExpressCreditCard=function(n){return this.creditCardService.isAmericanExpressCreditCard(n)},n.prototype.isDuplicate=function(){return this.creditCardService.isEditedCreditCardADuplicate()},n.prototype.isBeingEdited=function(){return this.creditCardService.editedCreditCard.isEdit},n.prototype.isAppliedCreditCardDefault=function(){return this.creditCardService.isAppliedCreditCardDefault()},n.prototype.getSelectedCreditCard=function(){return this.creditCardService.getSelectedCreditCard()},n.prototype.setSelectedCreditCard=function(n){this.creditCardService.setSelectedCreditCard(n);this.analyticsService.trackEditCartOrCheckout("Payment Information: Select credit card");$("#wallet").modal("hide")},n.prototype.setCreditCardAsPaymentMethod=function(){this.creditCardService.setCreditCardAsPaymentMethod();this.analyticsService.trackEditCartOrCheckout("Payment Information: Select credit card section")},n.prototype.getAppliedCreditCard=function(){return this.creditCardService.getAppliedCreditCard()},n.prototype.getCreditCardToRemove=function(){return this.creditCardService.getCreditCardToRemove()},n.prototype.setCreditCardAsDefaultPayment=function(){this.creditCardService.setCreditCardAsDefaultPayment()},n.prototype.getUserCreditCards=function(){return this.creditCardService.getUserCreditCards()},n.prototype.userHasSavedCreditCards=function(){return this.creditCardService.userHasSavedCreditCards()},n.prototype.prepareForRemovingCreditCard=function(n){n!=null?this.creditCardService.creditCardToRemove=n:(this.creditCardService.creditCardToRemove=this.creditCardService.getAppliedCreditCard(),this.checkAuthenticationCookieThenShowModal("#creditCardDelete"))},n.prototype.removeCreditCard=function(n,t){this.creditCardService.removeCreditCard(n);t!==!1&&this.analyticsService.trackEditCartOrCheckout("Payment Information: Remove selected credit card")},n.prototype.resetCreditCardForm=function(n){this.resetForm(n);this.creditCardService.resetTokenizationErrors()},n.prototype.createNewCreditCardObject=function(n){var t=this;this.checkAuthenticationCookie().then(function(){t.creditCardService.getAccessToken().then(function(i){var r=i.data;t.accessToken=r.AccessToken;t.iFrameUrl=r.IFrameUrl;$("#paymetricV3").attr("src",t.iFrameUrl);$(n).modal("show");t.analyticsService.trackPaymentInformationAddNewCard();t.creditCardService.startCreatingNewCreditCard()})})},n.prototype.setAddCreditCardFormScope=function(n){this.addCreditCardFormScope=n},n.prototype.setEditCreditCardFormScope=function(n){this.editCreditCardFormScope=n},n.prototype.startEditingCreditCard=function(n){var t=this;this.checkAuthenticationCookieThenShowModal("#editCreditCard").then(function(){t.creditCardService.editCreditCard(n)})},n.prototype.startEditingSelectedCreditCard=function(n){var t=this;this.checkAuthenticationCookie().then(function(){$(n).modal("show");t.creditCardService.editSelectedCreditCard()})},n.prototype.editCreditCard=function(n){var t=this;if(n.$setSubmitted(),n.$invalid){this.focusService.focusErrorField(n);return}this.analyticsService.trackEditCartOrCheckout("Payment Information: Edit credit card");this.creditCardService.isEditedCreditCardForFutureUse()?this.creditCardService.saveCreditCard().then(function(){t.eventsService.trigger("credit-card-saved");$("#wallet").modal("hide")}):(this.creditCardService.resetExpirationDateForEditedCreditCard(),this.eventsService.trigger("credit-card-saved"),$("#wallet").modal("hide"))},n.prototype.addCreditCardV3=function(){var n=this;window.$XIFrame.validate({iFrameId:"paymetricV3",targetUrl:n.iFrameUrl,onValidate:function(t){t?window.$XIFrame.submit({iFrameId:"paymetricV3",targetUrl:n.iFrameUrl,onSuccess:function(){n.creditCardService.getPaymetricResponsePacket(n.accessToken).then(function(t){var i=t.data;n.creditCardService.saveCreditCardV3(i).then(function(){n.cancelAddCreditCardV3("#addCreditCard");$("#wallet").modal("hide");n.accessToken="";n.iFrameUrl="";n.analyticsService.trackPaymentInformationSubmitNewCard(i,n.cartService?n.cartService.getCart().cartLines:[]);n.analyticsService.trackEditCartOrCheckout("Payment Information: Add credit card");n.eventsService.trigger("credit-card-saved")}).catch(function(){n.eventsService.trigger(events.GenericEvents.DoNotCloseModal)})})},onError:function(t){console.log(t);n.eventsService.trigger(events.GenericEvents.DoNotCloseModal)}}):n.eventsService.trigger(events.GenericEvents.DoNotCloseModal)}})},n.prototype.cancelAddCreditCardV3=function(n){$(n).modal("hide")},n.prototype.hasPaymetricConnectionError=function(){return this.creditCardService.hasPaymetricConnectionError()},n.prototype.checkAuthenticationCookieThenHideModal=function(n){var t=this;return this.apiService.checkAuthenticationCookie().then(function(){t.editedCreditCard.cvv="";$(n).modal("hide")})},n.prototype.checkAuthenticationCookieThenShowModal=function(n){return this.apiService.checkAuthenticationCookie().then(function(){$(n).modal("show")})},n.prototype.checkAuthenticationCookie=function(){return this.apiService.checkAuthenticationCookie()},n.prototype.isCreditCardDefaultPaymentMethod=function(n){return this.creditCardService.isCreditCardDefaultPaymentMethod(n)},n.prototype.isEmployeeUser=function(){return this.userService.user.isEmployeeUser},n}();t.$inject=["eventsService","initialData","creditCardService","focusService","apiService","analyticsService","userService","cartService"];n.CreditCardController=t;angular.module("ns").controller("creditCardCtrl",t)}(ns||(ns={})),function(n){var t=function(){function n(n){(this.dealsEndDateData=n,n.dealsEndDate)&&(this.dealsEndDateInMilliseconds=this.dealsEndDateData.dealsEndDate.endDateInMilliseconds,this.dealsAreAvailable=this.dealsEndDateData.dealsEndDate.areDealsAvailable,this.month=this.dealsEndDateData.dealsEndDate.month,this.day=this.dealsEndDateData.dealsEndDate.day,this.year=this.dealsEndDateData.dealsEndDate.year)}return n}();t.$inject=["dealsEndDateData"];n.CountDownTimerController=t;angular.module("timer").controller("countDownTimerController",t)}(Timer||(Timer={})),function(n){var t=function(){function t(){this.templateUrl="/js/ns/deals-timer/components/count-down-timer.html";this.controller=n.CountDownTimerController;this.controllerAs="timerController"}return t}();angular.module("ns").component("countDownTimer",new t)}(Timer||(Timer={})),function(n){var t=function(){function n(){this.title=null;this.url=null;this.materialBaseSummary=null}return n.prototype.update=function(n){this.title=n.title;this.url=n.url;this.materialBaseSummary=n.materialBaseSummary},n}();n.EblastProduct=t}(ns||(ns={})),function(n){var t=function(){function n(n){this.eblastData=n;this.nsProducts=n.NSProducts;this.eblastImage=n.eblastImage}return n}();t.$inject=["eblastData"];n.EblastService=t;angular.module("ns").service("eblastService",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t,i){this.eblastService=n;this.configs=t;this.modelsFactory=i;this.pageType="Eblast Page";this.listType="Eblast Products";this.nsProducts=_.map(n.nsProducts,function(n){return i.createEblastProduct(n)});this.eblastImage=t.imageUrl+"eblast/"+n.eblastImage+".jpg"}return n.prototype.trackProductPosition=function(n){return this.nsProducts.indexOf(n)+1},n}();t.$inject=["eblastService","configs","modelsFactory"];n.EblastController=t;angular.module("ns").controller("eblastController",t)}(ns||(ns={})),function(n){"use strict";var t=function(){function n(){this.email=""}return n}();n.EmailSignup=t}(ns||(ns={})),function(n){"use strict";var t=function(){function n(n,t){this.$scope=n;this.analyticsService=t;this.emailPattern=/^([A-Za-z0-9/'_\-\.\+])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,18})$/}return n.prototype.submitEmail=function(n,t){if(t.$invalid)return t.$setSubmitted(),n.preventDefault(),!1;this.analyticsService.trackExclusiveWeeklyEmailDealsSignUp()},n}(),i;t.$inject=["$scope","analyticsService"];n.EmailSignupController=t;i=function(){function n(){this.restrict="A";this.scope={id:"=signupId"};this.controller=t;this.controllerAs="controller";this.templateUrl="/js/ns/email-signup/email-signup.html";this.replace=!0}return n.instance=function(){return new n},n}();angular.module("ns").directive("emailSignup",i.instance)}(ns||(ns={})),function(){var n=function(){function n(n,t,i){this.initialData=n;this.$rootScope=t;this.analyticsService=i;this.reCaptchaVersionThreePublicKey=n.reCaptchaVersionThreePublicKey}return n.prototype.submitForm=function(){var n=$("#email-us-form");n.valid()?(this.analyticsService.trackContactUsSubmit(),grecaptcha.execute(this.reCaptchaVersionThreePublicKey,{action:"/EmailUs"}).then(function(t){$("#ReCaptchaToken").val(t);n.submit()})):this.$rootScope.$broadcast("reset-email-us-form")},n}();n.$inject=["initialData","$rootScope","analyticsService"];angular.module("ns").controller("emailUsController",n)}(ns||(ns={}));EmployeeForgotPasswordController=function(){function n(n,t,i,r,u,f,e,o){var s=this;this.$scope=n;this.$window=t;this.$timeout=i;this.customerDetailsData=r;this.apiService=u;this.passwordValidationService=f;this.navigationService=e;this.emailValidationService=o;this.passwordInputId="employee-password";this.processState="Initial";this.processInputs={employeeEmail:undefined,securityCode:undefined,password:undefined,passwordConfirm:undefined};this.processOutputs={isEmailMalformed:undefined,isSecurityCodeValid:undefined,isSecurityCodeResent:undefined,isPasswordEmpty:undefined,isPasswordConfirmEmpty:undefined,isPasswordConfirmNonMatching:undefined,passwordRequirementsMet:!0,passwordResetServerError:undefined,isPasswordResetComplete:undefined};this.isSubmitting=!1;this.isEmailWellFormed=function(n){return n===void 0&&(n=s.processInputs.employeeEmail),s.emailValidationService.isEmail(n)};this.isSecurityCodeWellFormed=function(){return!!s.processInputs&&!!s.processInputs.securityCode&&s.processInputs.securityCode.length===6}}return n.prototype.isEmailInvalid=function(n){return n===void 0&&(n=this.processOutputs),n.isEmailMalformed},n.prototype.isSecurityCodeSent=function(n){return n===void 0&&(n=this.processState),n==="SecurityCodeSent"||n==="SecurityCodeIsValidated"},n.prototype.isSecurityCodeInvalid=function(){return this.processOutputs.isSecurityCodeValid===!1},n.prototype.getPasswordErrorMessage=function(n){return n?undefined:"This is a required field"},n.prototype.isPasswordResetComplete=function(){return this.processState==="PasswordResetComplete"},n.prototype.resendSecurityCode=function(){var n=this;this.processOutputs.isSecurityCodeResent=!1;this.apiService.sendForgotSecurityCode(this.customerDetailsData.accountNumber,this.processInputs.employeeEmail).then(function(){n.processOutputs.isSecurityCodeResent=!0})},n.prototype.submit=function(){var n=this;if(this.processState==="Initial"&&(this.isEmailWellFormed()===!1?(this.resetProcessEmailOutputs(),this.processOutputs.isEmailMalformed=!0,this.getNextEmployeePasswordResetProcessState()):(this.isSubmitting=!0,this.resetProcessEmailOutputs(),this.apiService.sendForgotSecurityCode(this.customerDetailsData.accountNumber,this.processInputs.employeeEmail).then(function(){n.getNextEmployeePasswordResetProcessState()}).finally(function(){n.isSubmitting=!1}))),this.processState==="SecurityCodeSent"&&(this.isSecurityCodeWellFormed()===!1?this.processOutputs.isSecurityCodeValid=!1:(this.isSubmitting=!0,this.apiService.validateEmployeeEmailAndSecurityCode(this.customerDetailsData.accountNumber,this.processInputs.employeeEmail,this.processInputs.securityCode).then(function(t){if(n.processOutputs.isSecurityCodeValid=t.data.isValid,n.getNextEmployeePasswordResetProcessState(),n.processOutputs.isSecurityCodeValid===!0){n.$scope.$watch(function(){return n.processInputs.password},function(){return n.generatePasswordValidationPopover()});var i=function(){n.processInputs.password="";var t=n.$window.document.getElementById(n.passwordInputId);t.focus();n.$window.document.getElementById("employee-password-confirm").focus();t.focus()}.bind(n);n.queueAction(i)}}).finally(function(){n.isSubmitting=!1}))),this.processState==="SecurityCodeIsValidated"){if(this.resetProcessPasswordOutputs(),!this.processInputs.password||!this.processInputs.passwordConfirm||this.processInputs.password!==this.processInputs.passwordConfirm){this.processOutputs.isPasswordEmpty=!this.processInputs.password;this.processOutputs.isPasswordConfirmEmpty=!this.processInputs.passwordConfirm;this.processOutputs.isPasswordConfirmNonMatching=this.processInputs.password!==this.processInputs.passwordConfirm;return}this.isSubmitting=!0;this.apiService.resetEmployeePassword({customerAccountNumber:this.customerDetailsData.accountNumber,employeeEmail:this.processInputs.employeeEmail,securityCode:this.processInputs.securityCode,password:this.processInputs.password,passwordConfirm:this.processInputs.passwordConfirm},this.antiForgeryToken).then(function(t){if(!t.data.isValid||t.data.reasonCode!==200){n.processOutputs.passwordResetServerError=t.data.reasonMessage;return}n.processOutputs.isPasswordResetComplete=!0;n.getNextEmployeePasswordResetProcessState()}).finally(function(){n.isSubmitting=!1})}},n.prototype.navigateToEmployeeLogin=function(){this.navigationService.goToEmployeeLogin(this.customerDetailsData.url)},n.prototype.queueAction=function(n){this.$timeout(n,0,!1)},n.prototype.resetProcessEmailOutputs=function(){this.processOutputs.isEmailMalformed=undefined},n.prototype.resetProcessPasswordOutputs=function(){this.processOutputs.isPasswordEmpty=undefined;this.processOutputs.isPasswordConfirmEmpty=undefined;this.processOutputs.isPasswordConfirmNonMatching=undefined;this.processOutputs.passwordResetServerError=undefined},n.prototype.getNextEmployeePasswordResetProcessState=function(){if(this.processState==="Initial")this.processState=this.processOutputs.isEmailMalformed?"Initial":"SecurityCodeSent";else if(this.processState==="SecurityCodeSent")this.processState=this.processOutputs.isSecurityCodeValid?"SecurityCodeIsValidated":"SecurityCodeSent";else if(this.processState==="SecurityCodeIsValidated")this.processState=this.processOutputs.isPasswordResetComplete===!0?"PasswordResetComplete":"SecurityCodeIsValidated";else throw new Error("Unexpected state");},n.prototype.generatePasswordValidationPopover=function(){var n=this.passwordValidationService.popoverSettings(this.processInputs.password,"#"+this.passwordInputId,"#PasswordInputWrapper",this.processOutputs);$("#"+this.passwordInputId).popover(n)},n.prototype.onPasswordInputFocus=function(){this.processOutputs.isPasswordEmpty=!1;this.passwordValidationService.generatePasswordValidationHtmlContent(this.processInputs.password,"#"+this.passwordInputId,"#PasswordInputWrapper",this.processOutputs)},n}();EmployeeForgotPasswordController.$inject=["$scope","$window","$timeout","customerDetailsData","apiService","passwordValidationService","navigationService","emailValidationService"];typeof window!="object"||!window.document||typeof process!="undefined"?module.exports={EmployeeForgotPasswordController:EmployeeForgotPasswordController}:angular.module("ns").controller("employeeForgotPasswordController",EmployeeForgotPasswordController);EmployeeLoginController=function(){function n(n,t,i,r,u,f,e,o,s,h){var c=this;this.customerDetails=n;this.$scope=t;this.$window=i;this.apiService=r;this.eventsService=u;this.navigationService=f;this.passwordValidationService=e;this.emailValidationService=o;this.featureData=s;this.analyticsService=h;this.processInputs={employeeIdentifier:null,lastName:null,securityCode:null,password:"",passwordConfirm:"",emailAddress:null,mobileNumber:null};this.processOutputs={HasError:!1,ErrorMessage:null,ContextualMessage:null,IsNotRegistered:undefined,EmployeeIsValid:null,LastNameValid:null,WithoutEmailAddress:null,WithoutMobileNumber:null,passwordRequirementsMet:!0,securityCodeValid:!1,shouldDisplayPasswordResetLink:undefined,isCodeResent:!1};this.isUsingEmailForLogin=function(){return c.emailValidationService.isEmail(c.processInputs.employeeIdentifier)};this.isFirstEmailLogin=function(){return c.isUsingEmailForLogin()===!0&&c.processOutputs.IsNotRegistered===!0};this.isFirstEmployeeNumberLogin=function(){return c.isUsingEmailForLogin()===!1&&c.processOutputs.IsNotRegistered===!0};this.isSecondFactorValid=function(){return c.processOutputs.LastNameValid===!0||c.processOutputs.securityCodeValid===!0};this.shouldHideSecurityParagraph=function(){return c.featureData.hideSecurityParagraphAfterValidation}}return n.prototype.onPasswordInputFocus=function(){this.processOutputs.IsNotRegistered===!0&&this.passwordValidationService.generatePasswordValidationHtmlContent(this.processInputs.password,"#employee-password","#PasswordInputWrapper",this.processOutputs)},n.prototype.generatePasswordValidationPopover=function(){var n=this.passwordValidationService.popoverSettings(this.processInputs.password,"#employee-password","#PasswordInputWrapper",this.processOutputs);$("#employee-password").popover(n)},n.prototype.sendCodeToEmail=function(n){var t=this;n===void 0&&(n=!1);this.processOutputs.isCodeResent=!1;this.apiService.sendLoginSecurityCode(this.customerDetails.accountNumber,this.processInputs.employeeIdentifier).then(function(){n===!0&&(t.processOutputs.isCodeResent=!0)})},n.prototype.submit=function(n){var t=this,i,r;if(n.$setSubmitted(),this.processOutputs.HasError=!1,n.$invalid){this.eventsService.trigger(events.EmployeeEvents.Login);return}if(n.$setPristine(),i=function(){return t.processOutputs.LastNameValid===!0||t.processOutputs.securityCodeValid===!0},this.processOutputs.EmployeeIsValid&&this.processOutputs.IsNotRegistered&&i()){this.apiService.registerEmployee({customerAccountNumber:this.customerDetails.accountNumber,employeeIdentifier:this.processInputs.employeeIdentifier,lastName:this.processInputs.lastName,securityCode:this.processInputs.securityCode,password:this.processInputs.password,passwordConfirm:this.processInputs.passwordConfirm,emailAddress:this.processInputs.emailAddress,mobileNumber:this.processInputs.mobileNumber}).then(function(n){return t.onRegisterEmployeeResponse(n.data)});return}if(this.processOutputs.IsNotRegistered){r=this.isUsingEmailForLogin()===!0?this.apiService.validateEmployeeSecurityCode(this.customerDetails.accountNumber,this.processInputs.employeeIdentifier,this.processInputs.securityCode):this.apiService.validateEmployeeLastName(this.customerDetails.accountNumber,this.processInputs.employeeIdentifier,this.processInputs.lastName);r.then(function(i){return t.onValidateEmployeeResponse(i.data,n)});return}if(this.processOutputs.EmployeeIsValid){this.authenticateEmployee();return}this.analyticsService.trackLoginFail();this.apiService.validateEmployeeIdentifier(this.customerDetails.accountNumber,this.processInputs.employeeIdentifier).then(function(i){t.onValidateEmployeeResponse(i.data,n)})},n.prototype.navigateToForgotPassword=function(){this.navigationService.goToEmployeeForgotPassword(this.$window.location.pathname.split("/").pop())},n.prototype.shouldDisplayPasswordResetLink=function(){return!!this.processOutputs.shouldDisplayPasswordResetLink},n.prototype.isCustomFieldsFlagActive=function(){return this.featureData.voucher_CustomFieldsForEmployeeLoginPage},n.prototype.isCaptureEmployeeMobileNumberActive=function(){return this.featureData.ecom_CaptureEmployeeMobileNumber},n.prototype.getEmployeeIdLabel=function(){return this.featureData.voucher_CustomFieldsForEmployeeLoginPage?this.customerDetails.employeeIdLabel?this.customerDetails.employeeIdLabel:"Employee Number or Email Address":"Enter Employee Number or Email Address"},n.prototype.onValidateEmployeeResponse=function(n,t){var i=this,r,u,f;typeof this.processOutputs.shouldDisplayPasswordResetLink=="undefined"&&(this.processOutputs.shouldDisplayPasswordResetLink=n.reasonCode===voucher.ValidateEmployeeCodes.EmployeeIsValid);r=function(){n.isValid===!0&&(i.processOutputs.EmployeeIsValid=!0);n.reasonCode===voucher.ValidateEmployeeCodes.NotRegistered&&(i.processOutputs.IsNotRegistered=!0,i.processOutputs.ContextualMessage=i.isUsingEmailForLogin()===!0?"This is your first login. To complete the authentication process, please verify your email address.":"This is your first login. To complete the authentication process, please provide your Last name.",i.isUsingEmailForLogin()===!0&&i.sendCodeToEmail())};r();u=function(){return i.processOutputs.IsNotRegistered===!0&&n.isValid===!0};u()&&(f=function(){i.processInputs.lastName?i.processOutputs.LastNameValid=!0:i.processInputs.securityCode&&(i.processOutputs.securityCodeValid=!0);i.featureData.ecom_CaptureEmployeeMobileNumber?n.reasonCode===voucher.ValidateEmployeeCodes.EmployeeIsValidWithoutEmailAddressAndMobileNumber?(i.processOutputs.WithoutEmailAddress=!0,i.processOutputs.WithoutMobileNumber=!0):n.reasonCode===voucher.ValidateEmployeeCodes.EmployeeIsValidWithoutEmailAddress?i.processOutputs.WithoutEmailAddress=!0:n.reasonCode===voucher.ValidateEmployeeCodes.EmployeeIsValidWithouMobileNumber&&(i.processOutputs.WithoutMobileNumber=!0):n.reasonCode===voucher.ValidateEmployeeCodes.EmployeeIsValidWithoutEmailAddress&&(i.processOutputs.WithoutEmailAddress=!0);i.processOutputs.ContextualMessage="This is your first login. To complete the authentication process, please set a password";i.$scope.$watch(function(){return i.processOutputs.passwordRequirementsMet},function(){t.employeePassword.$setValidity("passwordRequirementsMet",i.processOutputs.passwordRequirementsMet)});i.$scope.$watch(function(){return i.processInputs.password},function(){i.generatePasswordValidationPopover()})},f());this.handleEmployeeValidationErrors(n);this.eventsService.trigger(events.EmployeeEvents.Login)},n.prototype.handleEmployeeValidationErrors=function(n){if(n.reasonCode===voucher.ValidateEmployeeCodes.EmployeeNumberNotFound){var t="";t=this.featureData.voucher_CustomFieldsForEmployeeLoginPage&&this.customerDetails.employeeIdLabel?this.customerDetails.employeeIdLabel:"Employee Number or Email Address";this.processOutputs.ErrorMessage="We are unable to validate the "+t+" provided.";this.processOutputs.HasError=!0}n.reasonCode===voucher.ValidateEmployeeCodes.FirstLastNameNotMatch&&(this.processOutputs.ErrorMessage="We are unable to validate the Employee Last Name provided.",this.processOutputs.HasError=!0);n.reasonCode===voucher.ValidateEmployeeCodes.SecurityCodeNotMatched&&(this.processOutputs.ErrorMessage="We are unable to validate the Security Code provided.",this.processOutputs.HasError=!0)},n.prototype.onRegisterEmployeeResponse=function(n){if(n.reasonCode===ns.RegistrationResultCodes.RegistrationCompleted){this.authenticateEmployee();return}n.reasonCode===ns.RegistrationResultCodes.InvalidPassword&&(this.processOutputs.ErrorMessage="The Password provided did not met the validation criteria.",this.processOutputs.HasError=!0);n.reasonCode===ns.RegistrationResultCodes.PasswordNotMatch&&(this.processOutputs.ErrorMessage="We are unable to match the Password provided with the Password Confirmation.",this.processOutputs.HasError=!0);n.reasonCode===ns.RegistrationResultCodes.RegistrationFailed&&(this.processOutputs.ErrorMessage="We are unable to complete registration for the Employee provided.",this.processOutputs.HasError=!0);this.eventsService.trigger(events.EmployeeEvents.Login)},n.prototype.authenticateEmployee=function(){var n=this,t=202;this.apiService.authenticateEmployee({customerAccountNumber:this.customerDetails.accountNumber,employeeIdentifier:this.processInputs.employeeIdentifier,password:this.processInputs.password},this.antiForgeryToken).then(function(i){i.status===t?(n.analyticsService.trackLogin(),n.navigationService.goToVoucherHub()):n.onEmployeeLoginError()}).catch(function(){return n.onEmployeeLoginError()})},n.prototype.onEmployeeLoginError=function(){this.analyticsService.trackLoginFail();this.processOutputs.ErrorMessage="We are unable to Login the Employee provided.";this.processOutputs.HasError=!0;this.eventsService.trigger(events.EmployeeEvents.Login)},n}();EmployeeLoginController.$inject=["customerDetailsData","$scope","$window","apiService","eventsService","navigationService","passwordValidationService","emailValidationService","featureData","analyticsService"];typeof window!="object"||!window.document||typeof process!="undefined"?module.exports={EmployeeLoginController:EmployeeLoginController}:angular.module("ns").controller("employeeLoginController",EmployeeLoginController),function(n){var t;(function(n){n[n.RegistrationCompleted=200]="RegistrationCompleted";n[n.PasswordNotMatch=400]="PasswordNotMatch";n[n.RegistrationFailed=401]="RegistrationFailed";n[n.InvalidPassword=402]="InvalidPassword"})(t=n.RegistrationResultCodes||(n.RegistrationResultCodes={}))}(ns||(ns={}));SecurityCodeMessageSentComponent=function(){function n(){this.templateUrl="/js/ns/employee/security-code-sent-message.html";this.controllerAs="ctrl";this.controller=SecurityCodeMessageSentController;this.bindings={}}return n}();SecurityCodeMessageSentController=function(){function n(){}return n}();typeof window!="object"||!window.document||typeof process!="undefined"?module.exports={SecurityCodeMessageSentController:SecurityCodeMessageSentController}:angular.module("ns").component("securityCodeSentMessage",new SecurityCodeMessageSentComponent),function(n){var t;(function(n){n[n.EmployeeIsValid=200]="EmployeeIsValid";n[n.NotRegistered=201]="NotRegistered";n[n.EmployeeIsValidWithoutEmailAddress=202]="EmployeeIsValidWithoutEmailAddress";n[n.EmployeeIsValidWithouMobileNumber=203]="EmployeeIsValidWithouMobileNumber";n[n.EmployeeIsValidWithoutEmailAddressAndMobileNumber=204]="EmployeeIsValidWithoutEmailAddressAndMobileNumber";n[n.EmployeeNumberNotFound=404]="EmployeeNumberNotFound";n[n.FirstLastNameNotMatch=405]="FirstLastNameNotMatch";n[n.SecurityCodeNotMatched=406]="SecurityCodeNotMatched"})(t=n.ValidateEmployeeCodes||(n.ValidateEmployeeCodes={}))}(voucher||(voucher={})),function(n){var t=function(){function n(n,t,i){this.homepageData=n;this.modelsFactory=t;this.analyticsService=i;this.featuredProducts=_.map(n.featuredProducts,function(n){return t.createProduct(n)});this.homeAds=n.homeAds;this.analyticsService.trackProductImpression(this.featuredProducts,"Homepage: Featured Products")}return n}();t.$inject=["homepageData","modelsFactory","analyticsService"];n.HomePageService=t;angular.module("ns").service("homepageService",t)}(ns||(ns={})),function(n){var t=function(){function t(t,i,r,u){this.homePageService=t;this.punchOutService=i;this.analyticsService=r;this.eventsService=u;this.mobileBreakpointPx=576;this.featuredProducts=t.featuredProducts;this.homeAds=t.homeAds;this.analyticsService=r;this.pageType="Homepage";this.listType=n.ProductListTypes.FeaturedProducts;this.canTriggerEventMobile=window.innerWidth>=this.mobileBreakpointPx;this.canTriggerEventDesktop=window.innerWidth<this.mobileBreakpointPx;this.initResizeWatcher();this.analyticsService.trackViewItemListEvent(this.featuredProducts,this.pageType+": "+this.listType)}return t.prototype.initResizeWatcher=function(){var n=this;window.addEventListener("resize",function(){(window.innerWidth<n.mobileBreakpointPx&&n.canTriggerEventMobile||window.innerWidth>=n.mobileBreakpointPx&&n.canTriggerEventDesktop)&&(n.canTriggerEventMobile=!n.canTriggerEventMobile,n.canTriggerEventDesktop=!n.canTriggerEventDesktop,n.eventsService.trigger(events.LazyEvents.LoadDetected))})},t.prototype.getFeaturedProductsSubset=function(n){for(var t=this.featuredProducts.slice(n*3,n*3+3),i=0;i<t.length;i++)t[i].isAvailableForPickup=_.every(t[i].availabilitiesForPickup,function(n){return n.isAvailableForPickup===!0});return t},t.prototype.trackProductPosition=function(n){return this.featuredProducts.indexOf(n)+1},t.prototype.isPunchOutSession=function(){return this.punchOutService.isPunchOutSession()},t.prototype.trackOshaBannerClick=function(){this.analyticsService.trackExternalLinkClick("https://www.osha.com/")},t.prototype.trackArticleView=function(){this.analyticsService.trackArticleView()},t.prototype.trackSelectPromotion=function(n,t,i,r){this.trackPromotionEvent("select_promotion",n,t,i,r)},t.prototype.trackViewPromotion=function(n,t,i,r){this.trackPromotionEvent("view_promotion",n,t,i,r)},t.prototype.trackPromotionEvent=function(t,i,r,u,f){var e=new n.TrackedAdDetails;e.creativeName=i;e.promoCode=r;e.promoName=u;e.creativeSlot=f;this.analyticsService.trackPromotionEvent(t,e)},t}();t.$inject=["homepageService","punchOutService","analyticsService","eventsService","$scope"];n.HomePageController=t;angular.module("ns").controller("homepageController",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t){this.$attrs=n;this.analyticsService=t;this.type=this.$attrs.type;this.analyticsService.trackMarketingLandingPage(this.type)}return n}();t.$inject=["$attrs","analyticsService"];n.LandingPageController=t;angular.module("ns").controller("landingPageController",t)}(ns||(ns={})),function(n){var t=function(){function t(n,t){this.$attrs=n;this.analyticsService=t}return t.prototype.trackBannerClick=function(n){this.analyticsService.trackExternalLinkClick(n)},t.prototype.trackPromotionEvent=function(t,i,r,u,f){var e=new n.TrackedAdDetails;e.creativeName=i;e.creativeSlot=r;e.promoCode=u;e.promoName=f;this.analyticsService.trackPromotionEvent(t,e)},t}();t.$inject=["$attrs","analyticsService"];n.LandingPageBannerSectionController=t;angular.module("ns").controller("landingPageBannerSectionController",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t){this.$attrs=n;this.analyticsService=t;this.section=null;this.section=JSON.parse(this.$attrs.input)}return n.prototype.track=function(n){n.includes("&#39;")&&(n=n.replace("&#39;","'"));this.analyticsService.trackNavClick("Other",this.section.pageTitle+" - "+n)},n}();t.$inject=["$attrs","analyticsService"];n.LandingPageCategorySectionController=t;angular.module("ns").controller("landingPageCategorySectionController",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t){this.apiService=n;this.loggerName=t}return n.prototype.debug=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.apiService.sendLog({Message:t.join(),Name:this.loggerName,LogLevel:LogLevel.Debug})},n.prototype.log=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.apiService.sendLog({Message:t.join(),Name:this.loggerName,LogLevel:LogLevel.Debug})},n.prototype.info=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.apiService.sendLog({Message:t.join(),Name:this.loggerName,LogLevel:LogLevel.Info})},n.prototype.warn=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.apiService.sendLog({Message:t.join(),Name:this.loggerName,LogLevel:LogLevel.Warn})},n.prototype.error=function(){for(var i,r,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];i=n[n.length-1];r=n.slice(0,n.length-1);this.apiService.sendLog({Message:r.join(),Name:this.loggerName,LogLevel:LogLevel.Error,Exception:i})},n}();n.BackendLogger=t}(ns||(ns={})),function(n){var t=function(){function n(n,t,i){this.$log=n;this.logSettings=t;this.loggerName=i}return n.prototype.debug=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.logSettings.canLog(this.loggerName,LogLevel.Debug)&&this.writeToLog(this.$log.debug,t)},n.prototype.error=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.logSettings.canLog(this.loggerName,LogLevel.Error)&&this.writeToLog(this.$log.error,t)},n.prototype.info=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.logSettings.canLog(this.loggerName,LogLevel.Info)&&this.writeToLog(this.$log.info,t)},n.prototype.log=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.logSettings.canLog(this.loggerName,LogLevel.Info)&&this.writeToLog(this.$log.log,t)},n.prototype.warn=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this.logSettings.canLog(this.loggerName,LogLevel.Warn)&&this.writeToLog(this.$log.warn,t)},n.prototype.writeToLog=function(n){for(var i,r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];i=[this.loggerName+":"];i.push(r);n.apply(this.$log,_.flatten(i))},n}();n.ClientLogger=t}(ns||(ns={})),function(n){var t=function(){function n(n){this.logName=n}return n.prototype.debug=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];window.chutzpah&&console.log(t)},n.prototype.error=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];window.chutzpah&&console.log(t)},n.prototype.info=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];throw new Error("Not implemented");},n.prototype.log=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];throw new Error("Not implemented");},n.prototype.warn=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];throw new Error("Not implemented");},n}();n.ConsoleLogger=t}(ns||(ns={})),function(n){var t=function(){function t(n,t,i,r){var u=this;this.$injector=n;this.$log=t;this.window=i;this.initialData=r;this.exception=function(n,t){var i;if(u.initLogger(),!u.isNotHandled(n.message)){i="Unhandled Javascript Exception: "+n.message;u.logger.error(i,t,n.stack);u.$log.error(n);var r=u.window.requestData?u.window.requestData.join("|||"):"",f=u.getUserEmail(),e="Browser name: "+navigator.appName+". Version: "+navigator.appVersion+". User Agent: "+navigator.userAgent+".\n            Last requests are: "+r+".\n            User email is: "+f;u.logger.debug(e,"Information about user browser, last request and user")}}}return t.prototype.isNotHandled=function(n){if(!n)return!0;var t=_.some(this.notHandledErrors,function(t){return n.indexOf(t)>=0});return t?!0:(this.logger.debug("We are logging exception with message : "+n),!1)},t.prototype.getUserEmail=function(){return this.initialData&&this.initialData.userInfo?this.initialData.userInfo.email:"unknown"},t.prototype.initLogger=function(){window.chutzpah?this.getConsoleLogger():this.getExceptionHandlerLogger();this.addErrorMessages()},t.prototype.addErrorMessages=function(){this.notHandledErrors=["$compile:tpload","'_' is undefined","_ is not defined","window.s_gi"]},t.prototype.getExceptionHandlerLogger=function(){if(this.logger==null){var n=this.$injector.get("loggerFactory");this.logger=n.getBackendLogger("ExceptionHandler")}},t.prototype.getConsoleLogger=function(){this.logger==null&&(this.logger=new n.ConsoleLogger("console"))},t}();t.$inject=["$injector","$log","$window","initialData"];n.ExceptionHandler=t;angular.module("ns").factory("$exceptionHandler",["$injector","$log","$window","initialData",function(n,i,r,u){return new t(n,i,r,u).exception}])}(ns||(ns={})),function(n){n[n.All=0]="All";n[n.Debug=1]="Debug";n[n.Log=2]="Log";n[n.Info=3]="Info";n[n.Warn=4]="Warn";n[n.Error=5]="Error";n[n.Fatal=6]="Fatal";n[n.None=7]="None"}(LogLevel||(LogLevel={})),function(n){var t=function(){function n(){this.savedLoggerSettings=[]}return n.prototype.canLog=function(n,t){var i=this.getLoggerSetting(n);return t>=i},n.prototype.setLogLevel=function(n,t){this.savedLoggerSettings[n]=t},n.prototype.getLoggerSetting=function(n){var t=this.savedLoggerSettings[n];return t?t:this.localStorageSettingOrDefault(n)},n.prototype.localStorageSettingOrDefault=function(n){var t=this.browserSupportsLocalStorage()?this.getSettingFromLocalStorageForLogger(n):null;return t=t?t:"None",this.getLogLevelValue(t)},n.prototype.browserSupportsLocalStorage=function(){return typeof Storage!="undefined"&&!!localStorage},n.prototype.getSettingFromLocalStorageForLogger=function(n){return localStorage.getItem("LogSettings."+n)},n.prototype.getLogLevelValue=function(n){return LogLevel[n]},n}();n.LogSettings=t;angular.module("ns").service("logSettings",t)}(ns||(ns={})),function(n){var t=function(){function t(n,t,i){this.apiService=n;this.$log=t;this.logSettings=i;this.clientLoggers=[];this.backendLoggers=[]}return t.prototype.getBackendLogger=function(t){var i=this.backendLoggers[t];return i||(i=new n.BackendLogger(this.apiService,t),this.backendLoggers[t]=i),i},t.prototype.getClientLogger=function(t){var i=this.backendLoggers[t];return i||(i=new n.ClientLogger(this.$log,this.logSettings,t),this.clientLoggers[t]=i),i},t}();t.$inject=["apiService","$log","logSettings"];n.LoggerFactory=t;angular.module("ns").service("loggerFactory",t)}(ns||(ns={})),function(n){var t=function(){function t(t,i){var r,u,f,e,s,o;if(this.$attrs=t,this.analyticsService=i,this.materialsSection={products:undefined,sectionTitle:undefined,pageTitle:undefined},this.pageType="MarketingLandingPage",this.listType="Manual Material List",r=JSON.parse(this.$attrs.input),u=[],!r){console.error("Invalid input");return}for(f=0,e=r.products;f<e.length;f++)s=e[f],o=new n.Product,o.update(s),u.push(o);this.materialsSection.sectionTitle=r.sectionTitle;this.materialsSection.pageTitle=r.pageTitle;this.materialsSection.products=u;this.analyticsService.trackViewItemListEvent(u,this.listType);window.GANEventConstants.actionField=r.sectionTitle;window.GANEventConstants.category=r.pageTitle}return t.prototype.trackProductPosition=function(n){return this.materialsSection.products.indexOf(n)+1},t}();t.$inject=["$attrs","analyticsService"];n.ManualListSectionController=t;angular.module("ns").controller("manualListSectionController",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t){this.analyticsService=n;this.urlService=t}return n.prototype.trackClick=function(n,t,i){var r=this.urlService.isNsiHost(n);r?this.analyticsService.trackNavClick("Other",t+" - "+i):this.analyticsService.trackExternalLinkClick(n)},n}();t.$inject=["analyticsService","urlService"];n.ContentSectionController=t;angular.module("ns").controller("contentSectionController",t)}(ns||(ns={})),function(n){var t=function(){function t(n,t){this.analyticsService=n;this.urlService=t}return t.prototype.trackClick=function(n,t,i){var r=this.urlService.isNsiHost(n);r?this.analyticsService.trackNavClick("Other",t+" - "+i):this.analyticsService.trackExternalLinkClick(n)},t.prototype.trackFileDownload=function(n,t){var i=n.split("/")[4].split(".")[1],r="/"+decodeURI(n.split("/")[4]);i==="pdf"&&this.analyticsService.trackFileDownload(i,r,t,n)},t.prototype.trackPromotionEvent=function(t,i,r,u,f){var e=new n.TrackedAdDetails;e.creativeName=i;e.creativeSlot=r;e.promoCode=u;e.promoName=f;this.analyticsService.trackPromotionEvent(t,e)},t}();t.$inject=["analyticsService","urlService"];n.CustomUrlController=t;angular.module("ns").controller("customUrlController",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t){this.analyticsService=n;this.urlService=t}return n.prototype.trackImage=function(n,t,i){var r=this.urlService.isNsiHost(n);r?this.analyticsService.trackNavClick("Other",t+" - Image:"+i):this.analyticsService.trackExternalLinkClick(t+" - Image:"+n)},n.prototype.trackClick=function(n,t,i){var e=this.urlService.isNsiHost(n),r,u,f;e?this.analyticsService.trackNavClick("Other",t+" - "+i):this.analyticsService.trackExternalLinkClick(n);r=n.split("/");r.indexOf(".")!=-1&&(u=r[4].split(".").pop(),f="/"+decodeURI(n.split("/")[4]),u==="pdf"&&this.trackFileDownload(n,u,f,i))},n.prototype.trackFileDownload=function(n,t,i,r){this.analyticsService.trackFileDownload(t,i,r,n)},n}();t.$inject=["analyticsService","urlService"];n.ImageAndContentSectionController=t;angular.module("ns").controller("imageAndContentSectionController",t)}(ns||(ns={})),function(n){var t=function(){function n(n){var t=this;this.analyticsService=n;setTimeout(function(){t.analyticsService.trackProductImpressionBatch(window.MLPGlobalProductImpressions)},2e3)}return n}();t.$inject=["analyticsService"];n.MarketingLandingPageController=t;angular.module("ns").controller("marketingLandingPageController",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t,i){this.analyticsService=n;this.urlService=t;this.featureData=i;this.videoTracked=!1}return n.prototype.trackVideo=function(n,t,i){this.videoTracked||(this.analyticsService.trackVideo(n,t,i),this.videoTracked=!0)},n.prototype.trackClick=function(n,t,i){var r=this.urlService.isNsiHost(n);r?this.analyticsService.trackNavClick("Other",t+" - "+i):this.analyticsService.trackExternalLinkClick(n)},n.prototype.trackVideoImpression=function(n,t){if(this.featureData.useGA4Implementation){var i=document.getElementById(t).src;this.analyticsService.trackVideoImpression(n,i)}},n}();t.$inject=["analyticsService","urlService","featureData"];n.VideoAndContentSectionController=t;angular.module("ns").controller("videoAndContentSectionController",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t,i,r,u){this.modelsFactory=n;this.apiService=t;this.cookieService=i;this.analyticsService=r;this.eventsService=u;this.product=n.createProduct()}return n.prototype.updateProductInfoAfterCharacterSetSelection=function(n,t,i,r){var u=this;r===void 0&&(r=!0);this.apiService.isMaterialNonReturnable(n.materialBaseNumber,i).then(function(t){return n.nonReturnable=t.data});this.apiService.materialCanBeAddedToCart(n.materialBaseNumber,i).then(function(i){n.isSelectedProductUnavailable=!i.data.canBeOrderedBasedOnInventory;n.availableForBackorderOnly=i.data.availableForBackorderOnly;n.updatePricingBasedOnCharacterSetSelection(t);n.updateStockStatusBasedOnCharacterSetSelection(t);n.updateAvailabilityForPickupForSelectedCharacterSet(t);r&&n.updateCurrentMinimumQuantityAndRoundingProfile(t);u.eventsService.trigger(events.ProductEvents.ProductStylesReviewed)})},n.prototype.updateProductInformation=function(n){var t=this;this.product.update(n);n.characterSets.length===0?this.apiService.materialCanBeAddedToCart(n.materialBaseNumber,n.characterSets).then(function(n){t.product.isSelectedProductUnavailable=!n.data.canBeOrderedBasedOnInventory;t.product.availableForBackorderOnly=n.data.availableForBackorderOnly;t.triggerProductUpdateEvents()}):this.triggerProductUpdateEvents()},n.prototype.updateProductQuickViewMetadata=function(n){this.product.stockStatuses=n.stockStatuses;this.product.update(this.product);this.triggerProductUpdateEvents()},n.prototype.triggerProductUpdateEvents=function(){this.eventsService.trigger(events.GeoRestrictionsEvents.CheckRestriction);this.eventsService.trigger(events.ProductEvents.ProductUpdated)},n.prototype.addProductToCart=function(n,t,i,r,u){var f=this,e;return n.updateErrorData(null),e=this.createItem(n,i,u),this.apiService.addProductToCart(e).then(function(i){i.data.isSuccess&&(f.cookieService.setCartCookie(i.data.cartCookieId),f.cookieService.slideExpirationDates(),r?console.log("Skipping AddToCart Tracking"):f.trackAddedProduct(n,t,e),f.eventsService.trigger(events.CartEvents.UpdateCart),f.eventsService.trigger(events.ProductEvents.ProductAddedToCart));n.updateErrorData(i.data);f.eventsService.trigger(events.SpinnerEvents.ResetAddToCartSpinner)}).catch(function(){f.eventsService.trigger(events.SpinnerEvents.ResetAddToCartSpinner);n.errorMessage="An error ocurred while adding the product to cart!"})},n.prototype.createItem=function(n,t,i){return{characterSetValueIds:n.getSelectedCharacterSetValueIds(),quantity:n.quantity,cartId:this.cookieService.getCartCookie()||null,allowBackOrder:t,materialBaseId:n.materialBaseId,voucherGuid:i}},n.prototype.trackAddedProduct=function(n,t,i){this.analyticsService.trackAddToCart(n,t);i.cartId||this.analyticsService.trackCartOpen(t)},n}();t.$inject=["modelsFactory","apiService","cookieService","analyticsService","eventsService"];n.ProductService=t;angular.module("ns").service("productService",t)}(ns||(ns={})),function(n){"use strict";n.directive("characterSets",function(){return{restrict:"A",templateUrl:"/js/ns/materials/character-sets/character-sets.html",scope:{material:"=characterSets",onCharacterSetsChanged:"="},controller:"characterSetsController"}});n.controller("characterSetsController",["$scope","cartService","$timeout","$rootScope",function(n,t,i){function u(){var t="",i=[];return _.each(n.material.characterSets,function(n){t=t+n.selectedValue.name+"_";i.push(n.selectedValue.id)}),{values:t.slice(0,-1),ids:i}}var r=null;n.updateStockInfoOnChSetsChange=function(){n.material.lineId!=undefined&&n.material.quantity&&n.material.quantity!=0&&t.updateStockInfoOnChSetsOrQtyChange(n.material).then(function(t){t.data&&n.material&&(n.material.isEligibleForBackorder=t.data.isEligibleForBackorder,n.material.minQtyMsg=t.data.minQtyMsg,n.material.stockMessage=t.data.message,n.material.selectedStyleNotAvailable=t.data.selectedStyleNotAvailable)})};n.updateStockInfoOnQtyChange=function(){r&&i.cancel(r);r=i(function(){},2e3);r.then(function(){n.updateStockInfoOnChSetsChange()})};n.updateInfoOnChSetsChange=function(){var t=u();if(n.onCharacterSetsChanged)n.onCharacterSetsChanged(n.material,t.values,t.ids);else n.updateStockInfoOnChSetsChange()};n.isNotValidQuantity=function(){return common.MinimumQuantityValidator.isValidQuantity(n.material)?!1:common.MinimumQuantityValidator.isAboveMinimumQuantity(n.material)?!0:!1};n.isUnderMinimumQuantity=function(){return common.MinimumQuantityValidator.isAboveMinimumQuantity(n.material)?!1:!0};n.getQuantityPerRoundingProfile=function(){return n.material.quantity/n.material.roundingProfile};n.getUnitPriceTimesQuantity=function(){return n.material.unitPrice*n.material.quantity};n.showStockStatus=function(){return t.showStockStatus(n.material)}}])}(angular.module("ns")),function(n){"use strict";n.directive("productCharacterSets",function(){return{restrict:"A",templateUrl:"/js/ns/materials/character-sets/product-character-sets.html",scope:{product:"=productCharacterSets",onCharacterSetsChanged:"=",form:"="},controller:"productCharacterSetsController"}});n.controller("productCharacterSetsController",["$scope","eventsService",function(n,t){function i(){var t="",i=[],r=0;return(n.product.characterSets.forEach(function(u){u.selectedValue?(t=t+u.selectedValue.name+"_",i.push(u.selectedValue.id),r++):n.product.showStockStatus=n.product.isCustomizable||n.product.isClearance?!0:!1}),r==n.product.characterSets.length)?{values:t.slice(0,-1),ids:i}:null}n.updateInfoOnCharacterSetChange=function(){var r=i();if(r&&n.onCharacterSetsChanged){n.product.createUnitOfMeasureData(r.values);n.onCharacterSetsChanged(n.product,r.values,r.ids)}r&&t.trigger(events.ProductCharacterSetsComponentEvents.CharacterSetsSelected,n.product,r)};n.showNoValueSelectedErrorMessage=function(){return typeof n.form=="undefined"?!1:n.form.$submitted};n.shouldEval=!1;n.isCharacterSetNotSelected=function(){return n.shouldEval&&!n.product.hasSelectedCharacterSets()};t.on(events.ProductCharacterSetsComponentEvents.ResetOptions,function(){n.shouldEval=!1;n.form.$setPristine()})}])}(angular.module("ns")),function(n){"use strict";n.directive("voucherProductCharacterSets",function(){return{restrict:"A",templateUrl:"/js/ns/materials/character-sets/voucher-character-sets.html",scope:{product:"=voucherProductCharacterSets",onCharacterSetsChanged:"=",form:"="},controller:"voucherProductCharacterSetsController"}});n.controller("voucherProductCharacterSetsController",["$scope","eventsService","$timeout",function(n,t,i){function r(){var t=[];return n.product.voucherActiveMaterialsWithCharacterSets.forEach(function(n){var i={value:n.value,key:n.key,ids:n.charSetIds};t.push(i)}),t}function u(){var t="",r=[],u=0,f=n.selectedValue.key.split("|"),e=n.selectedValue.ids.split("|"),i=0;return(f.forEach(function(t){var u=e[i],r=n.product.characterSets.filter(function(n){return n.id===u})[0];r&&r!==null&&(r.selectedValue=r.characterSetValues.filter(function(n){return n.name===t})[0]);i=i+1}),n.product.characterSets.forEach(function(i){i.selectedValue?(t=t+i.selectedValue.name+"_",r.push(i.selectedValue.id),u++):n.product.showStockStatus=n.product.isCustomizable||n.product.isClearance?!0:!1}),u==n.product.characterSets.length)?{values:t.slice(0,-1),ids:r}:null}n.updateInfoOnCharacterSetChange=function(){var i=u();if(i&&n.onCharacterSetsChanged){n.product.createUnitOfMeasureData(i.values);n.onCharacterSetsChanged(n.product,i.values,i.ids)}i&&t.trigger(events.ProductCharacterSetsComponentEvents.CharacterSetsSelected,n.product,i)};n.showNoValueSelectedErrorMessage=function(){return typeof n.form=="undefined"?!1:n.form.$submitted};n.shouldEval=!1;n.isCharacterSetNotSelected=function(){return n.shouldEval&&!n.product.hasSelectedCharacterSets()};n.selectedValue=null;n.validStyleOptions=r();t.on(events.ProductCharacterSetsComponentEvents.ResetOptions,function(){n.shouldEval=!1;n.form.$setPristine()});t.on(events.ProductCharacterSetsComponentEvents.ResetCharacterSetsForVoucher,function(){n.validStyleOptions=r();i(function(){$("#characterSet-select-voucher-options-"+n.product.materialBaseNumber).selectpicker("refresh")},0)})}])}(angular.module("ns")),function(n){var t=function(){function n(n,t,i,r){this.productData=n;this.modelsFactory=t;this.analyticsService=i;this.eventsService=r;this.init()}return n.prototype.init=function(){this.productData.productDetails?(this.product=this.modelsFactory.createProductDetails(),this.product.update(this.productData.productDetails),this.analyticsService.trackProductImpression(this.productData.productDetails.relatedProducts.reverse(),"Product Details: Related Items"),this.analyticsService.trackProductDetails(this.productData.productDetails),this.eventsService.trigger(events.GeoRestrictionsEvents.CheckRestriction)):this.product=this.modelsFactory.createProduct()},n.prototype.trackThankYouForReview=function(){this.analyticsService.trackThankYouForReview(this.product)},n}();t.$inject=["productData","modelsFactory","analyticsService","eventsService"];n.ProductDetailsService=t;angular.module("ns").service("productDetailsService",t)}(ns||(ns={})),function(n){var t=function(){function t(t,i,r,u,f,e,o,s,h,c,l){this.$scope=t;this.$rootScope=i;this.$location=r;this.$anchorScroll=u;this.productDetailsService=f;this.productService=e;this.userService=o;this.featureData=s;this.productRestrictionsService=h;this.analyticsService=c;this.punchOutService=l;this.allowReturns=!1;this.addToCart=function(n){if(this.scrollToMaterialMessages(),n.$valid&&!this.productDetails.isRestricted&&common.MinimumQuantityValidator.isAboveMinimumQuantity(this.productDetails)&&common.MinimumQuantityValidator.isValidQuantity(this.productDetails))return this.productService.addProductToCart(this.productDetails,"Product Page",!1);this.$rootScope.$broadcast("reset-addToCart-spinner")};t.youMayAlsoLikeTitle=n.ProductListTypes.YouMayAlsoLike;this.loadLargeImage=!1;this.productDetails=this.productDetailsService.product;this.activeImage=this.initializeActiveImage();this.updateProductInfoAfterCharacterSetSelection=this.productService.updateProductInfoAfterCharacterSetSelection.bind(this.productService);this.featuredProductPlaceholderPNG="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAYAAACI7Fo9AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEISURBVHgB7cABAQAAAIIg/69uSFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHwa0bcAASOId/EAAAAASUVORK5CYII=";this.allowReturns=this.userService.user.allowReturns}return t.prototype.isPunchOutLevel2Session=function(){return this.punchOutService.isPunchOutLevel2Session()},t.prototype.addProductToCart=function(n){if(n.$setSubmitted(),this.productDetails.materialWarning&&!this.productDetails.materialWarningAccepted){this.productDetails.materialWarningVisible=!0;this.$rootScope.$broadcast("reset-addToCart-spinner");this.scrollToMaterialMessages();return}this.isAddToCartAllowed()?this.addToCart(n):this.$rootScope.$broadcast("reset-addToCart-spinner")},t.prototype.addProductToCartAndPunchOut=function(n){var t=this,i;if(n.$setSubmitted(),this.productDetails.materialWarning&&!this.productDetails.materialWarningAccepted){this.productDetails.materialWarningVisible=!0;this.$rootScope.$broadcast("reset-addToCartAndPunchOut-spinner");this.scrollToMaterialMessages();return}this.isAddToCartAllowed()?(i=this.addToCart(n),i?i.then(function(){t.punchOutService.punchOutBuildCart().then(function(n){var f,u,i,r;if(n&&(n.punchOutType==="CXML"&&(f='<form action="'+n.hooK_URL+'" method="post" name="punchOutFormCXML" id="punchOutFormCXML">\n                                                        <input type="hidden" name="'+n.cxmlEncoding+'" value="'+n.cxml+'" />\n                                                    <\/form>',t.punchOutService.deletePunchOutSession(),$(f).appendTo("body").submit()),n.punchOutType==="OCI")){for(u='<form action="'+n.hooK_URL+'" method="post" name="punchOutFormOCI" id="punchOutFormOCI">\n                                                        <input type="hidden" name="~OkCode" value="'+n.ociModel.header.okCode+'"/>\n                                                        <input type="hidden" name="~target" value="'+n.ociModel.header.target+'"/>\n                                                        <input type="hidden" name="~CALLER" value="'+n.ociModel.header.caller+'"/>\n                                                        <input type="hidden" name="_charset_" value="UTF-8">\n                                                        <input type="hidden" name="_char_" value="text/html">',i=0,r=1;i<n.ociModel.items.length;i++,r++)u+='<input type="hidden" name="NEW_ITEM-DESCRIPTION['+r+']" value="'+n.ociModel.items[i].description+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-MATNR['+r+']" value="'+n.ociModel.items[i].productMaster+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-MATGROUP['+r+']" value="'+n.ociModel.items[i].productGroup+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-QUANTITY['+r+']" value="'+n.ociModel.items[i].quantity+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-UNIT['+r+']" value="'+n.ociModel.items[i].unitOfMeasure+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-PRICE['+r+']" value="'+n.ociModel.items[i].price+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-PRICEUNIT['+r+']" value="'+n.ociModel.items[i].priceUnit+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-CURRENCY['+r+']" value="'+n.ociModel.items[i].currency+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-LEADTIME['+r+']" value="'+n.ociModel.items[i].leadTime+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-VENDOR['+r+']" value="'+n.ociModel.items[i].vendor+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-VENDORMAT['+r+']" value="'+n.ociModel.items[i].vendorProductNumber+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-MANUFACTCODE['+r+']" value="'+n.ociModel.items[i].manufacturerCode+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-MANUFACTMAT['+r+']" value="'+n.ociModel.items[i].manufacturerProductNumber+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-CONTRACT['+r+']" value="'+n.ociModel.items[i].contractNumber+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-CONTRACT_ITEM['+r+']" value="'+n.ociModel.items[i].itemOfAContract+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-SERVICE['+r+']" value="'+n.ociModel.items[i].serviceFlag+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-EXT_QUOTE_ID['+r+']" value="'+n.ociModel.items[i].quotation+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-EXT_QUOTE_ITEM['+r+']" value="'+n.ociModel.items[i].quotationItem+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-EXT_PRODUCT_ID['+r+']" value="'+n.ociModel.items[i].productID+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-LONGTEXT_'+r+':132[]" value="'+n.ociModel.items[i].description_LongText+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-CUST_FIELD1['+r+']" value="'+n.ociModel.items[i].customerSpecific1+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-CUST_FIELD2['+r+']" value="'+n.ociModel.items[i].customerSpecific2+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-CUST_FIELD3['+r+']" value="'+n.ociModel.items[i].customerSpecific3+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-CUST_FIELD4['+r+']" value="'+n.ociModel.items[i].customerSpecific4+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-CUST_FIELD5['+r+']" value="'+n.ociModel.items[i].customerSpecific5+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-ATTACHMENT['+r+']" value="'+n.ociModel.items[i].attachmentURL+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-ATTACHMENT_TITLE['+r+']" value="'+n.ociModel.items[i].attachmentTitle+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-ATTACHMENT_PURPOSE['+r+']" value="'+n.ociModel.items[i].attachmentPurpose+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-EXT_SCHEMA_TYPE['+r+']" value="'+n.ociModel.items[i].externalSchemaType+'"/>\n                                                        <input type="hidden" name="NEW_ITEM-EXT_CATEGORY_ID['+r+']" value="'+n.ociModel.items[i].externalCategoryID+'"/>';u+="<\/form>";t.punchOutService.deletePunchOutSession();$(u).appendTo("body").submit()}t.$rootScope.$broadcast("reset-addToCartAndPunchOut-spinner")}).catch(function(){t.$rootScope.$broadcast("reset-addToCartAndPunchOut-spinner")})}):this.$rootScope.$broadcast("reset-addToCartAndPunchOut-spinner")):this.$rootScope.$broadcast("reset-addToCartAndPunchOut-spinner")},t.prototype.isAddToCartAllowed=function(){return!this.shouldDisplayProductRestrictions()||this.shouldDisplayProductRestrictions()&&this.productDetails.isRestricted===!1},t.prototype.scrollToMaterialMessages=function(){var t=$("#globalbanner").length!==0,n;n=$("#material-messages").offset()&&$("#material-messages").offset().top?$("#material-messages").offset().top:100;t&&(n-=70);$("html, body").animate({scrollTop:n-70},500)},t.prototype.initializeActiveImage=function(){var n={imageID:0,width:0,height:0};return this.productDetails.thumbnailImageId&&(n=_.findWhere(this.productDetails.materialImages,{imageID:this.productDetails.thumbnailImageId}),n=this.initializeActiveImageIfNull(n)),n},t.prototype.initializeActiveImageIfNull=function(n){return n||(n={imageID:this.productDetails.thumbnailImageId,width:400,height:400}),n},t.prototype.isProductReviewTabActive=function(){var n="product-reviews"==this.$location.hash(),t;return n&&(t=this.$location.hash(),this.$location.hash("material-tabs-accordion"),this.$anchorScroll(),this.$anchorScroll.yOffset=50,this.$location.hash("material-tabs"),this.$anchorScroll(),this.$location.hash(t),this.$anchorScroll.yOffset=0),n},t.prototype.displayMinimumQuantity=function(){return common.MinimumQuantityValidator.displayMinimumQuantity(this.productDetails)},t.prototype.showRestrictedProductMsg=function(){var n=this.userService.user;return n?(n.isLevelOneRestricted||n.isLevelTwoRestricted)&&!this.productDetails.isQuoted:!1},t.prototype.showProp65LabelLink=function(){var t=this.userService.user.customerType;return t===n.AccountType.Reseller},t.prototype.showCustomMessage=function(){return this.productDetails.isCustomizable||this.productDetails.customizedMaterialBaseNumbers.length>0},t.prototype.showHeading=function(){return this.productDetails.heading!==""&&!this.productDetails.isCustomizable},t.prototype.updateActiveImageId=function(n){this.activeImage=n;this.loadLargeImage=($("#material-image-zoomed").data("bs.modal")||{}).isShown},t.prototype.isActiveImage=function(n){return n===this.activeImage.imageID},t.prototype.hasLargeImage=function(){return this.activeImage.width>799},t.prototype.nextImage=function(){var n=this.productDetails.materialImages[0],i=this.productDetails.materialImages.length,t=this.productDetails.materialImages.indexOf(this.activeImage);t<i-1&&(n=this.productDetails.materialImages[t+1]);this.updateActiveImageId(n)},t.prototype.prevImage=function(){var i=this.productDetails.materialImages.length,n=this.productDetails.materialImages[i-1],t=this.productDetails.materialImages.indexOf(this.activeImage);t>0&&(n=this.productDetails.materialImages[t-1]);this.updateActiveImageId(n)},t.prototype.showAdditionalInfoTab=function(){return this.productDetails.additionalInfoMessages.length>0},t.prototype.showKitContents=function(){return this.productDetails.kitContents.length>0},t.prototype.showYmal=function(){var n=this.userService.user;return n?!n.isLevelThreeRestricted:!0},t.prototype.trackProductDetailsPageEvent=function(n){this.analyticsService.trackProductDetailsPageEvent(this.productDetails,n)},t.prototype.trackFileDownload=function(n,t){var i="/"+t+".pdf";this.analyticsService.trackFileDownload("pdf",i,t,n)},t.prototype.shouldLoadLargeImage=function(){return!this.hasLargeImage()&&this.loadLargeImage},t.prototype.shouldLoadXLImage=function(){return this.hasLargeImage()&&this.loadLargeImage},t.prototype.shouldDisplayProductRestrictions=function(){return this.productDetails.hasRestrictionCode()},t.prototype.shouldDisplayVoucherQuickShop=function(){return this.productDetails.voucherGuid},t.prototype.showStockStatus=function(){return this.productRestrictionsService.canShowStockStatus(this.productDetails)},t.prototype.getMessageForMissingInfo=function(){return this.productRestrictionsService.getMessageForMissingInfo(this.productDetails)},t.prototype.getLengthOfCustomMaterialOptions=function(){return this.productDetails.customMaterialNumberOptions.length},t.prototype.getCharacterSetOption=function(){return this.getFirstCustomMaterialOption().characterSetOption},t.prototype.getFirstCustomMaterialOption=function(){return this.productDetails.customMaterialNumberOptions[0]},t.prototype.trackVideo=function(n,t,i){this.analyticsService.trackVideo(n,t,i)},t.prototype.trackProductClick=function(n,t,i,r,u){this.analyticsService.trackProductClick(n,t,i,r,u)},t.prototype.trackProductQuickView=function(n,t,i){this.analyticsService.trackProductQuickView(n,t,i)},t.prototype.trackProductClickForRelatedItems=function(t){var i=this.productDetails.relatedProducts.reverse().indexOf(t)+1;this.analyticsService.trackProductClick(t,"Product Page",i,n.ProductListTypes.RelatedItems)},t.prototype.isProductOverallNonReturnable=function(){return this.productDetails.nonReturnable||this.productDetails.isDropShip||this.productDetails.isClearance||this.productDetails.isCustomizable},t.prototype.trackPrintClick=function(){this.analyticsService.trackProductPrint(this.productDetails)},t}();t.$inject=["$scope","$rootScope","$location","$anchorScroll","productDetailsService","productService","userService","featureData","productRestrictionsService","analyticsService","punchOutService"];n.ProductDetailsController=t;angular.module("ns").controller("productDetailsController",t)}(ns||(ns={})),function(n){var t=function(){function n(){}return n}();t.RelatedItems="Related Items";t.RelatedProducts="Related Products";t.YouMayAlsoLike="You may also like";t.FeaturedProducts="Featured Products";n.ProductListTypes=t;angular.module("ns").constant("productListTypeConst",t)}(ns||(ns={})),function(n){var t=function(){function t(){this.templateUrl="/js/ns/materials/details/warning-message.html";this.controller=n.ProductDetailsController;this.controllerAs="controller"}return t}();angular.module("ns").component("warningMessage",new t)}(ns||(ns={})),function(n){"use strict";var t=function(){function n(n,t,i){this.userService=n;this.apiService=t;this.cookieService=i;this.user=n.user}return n.prototype.updateZipCode=function(n){var t=this;return this.validateZipCode(n).then(function(i){return t.callbackContainsErrors(i)?!1:t.userService.updateZipCode(n)})},n.prototype.resetZipCode=function(){var n=this.getZipCodeValue();n&&this.validateZipCode(n)},n.prototype.getZipCodeValue=function(){return this.cookieService.getZipCodeValue()},n.prototype.validateZipCode=function(n){var t=this;return this.apiService.validateZipCode(n).then(function(n){return t.zipCodeInvalid=t.callbackContainsErrors(n)?!0:!1,n}).catch(function(n){return t.zipCodeInvalid=!0,n})},n.prototype.callbackContainsErrors=function(n){return n.status!==200||!n.data.success},n.prototype.setZipCodeInvalid=function(){this.zipCodeInvalid=!0},n.prototype.isZipCodeInvalid=function(){return this.zipCodeInvalid},n.prototype.checkRestriction=function(n,t){return this.apiService.checkGeographicalRestriction(n,t.restrictionCode).then(function(n){n&&(t.isRestricted=n.data)})},n.prototype.canShowStockStatus=function(n){return n?n.hasRestrictionCode()?n.showStockStatus&&this.userService.userZipCodeIsKnown():n.showStockStatus:!1},n.prototype.getMessageForMissingInfo=function(n){return n.hasRestrictionCode()?!this.userService.userZipCodeIsKnown()&&n.showStockStatus?"Enter Zip Code for Availability":!this.userService.userZipCodeIsKnown()&&!n.showStockStatus?"Enter Zip Code and Select Options to See Stock Status":this.userService.userZipCodeIsKnown()&&!n.showStockStatus?"Select Options to See Stock Status":"":"Select Options to See Stock Status"},n}();t.$inject=["userService","apiService","cookieService","$q"];n.ProductRestrictionsService=t;angular.module("ns").service("productRestrictionsService",t)}(ns||(ns={})),function(){"use strict";var t=function(){function n(){this.restrict="A";this.templateUrl="/js/ns/materials/geographical-restrictions/restriction-zipcode-form.html"}return n.instance=function(){return new n},n}(),i=function(){function t(){this.restrict="A";this.template="<div><ng-include src='restrictionsController.getTemplateUrl()'/><\/div>";this.controller=n;this.controllerAs="restrictionsController";this.replace=!0;this.scope={product:"="}}return t.instance=function(){return new t},t}(),n=function(){function n(n,t,i,r){var u=this;this.$scope=n;this.eventsService=t;this.restrictionsService=i;this.apiService=r;this.product=n.product;this.zipCode={zipCodeValue:""};this.zipCode.zipCodeValue=i.getZipCodeValue();this.checkRestriction();t.on(events.GeoRestrictionsEvents.ZipCodeUpdated,function(){u.zipCode.zipCodeValue=i.getZipCodeValue()});t.on(events.GeoRestrictionsEvents.CheckRestriction,function(){return u.checkRestriction()});t.on(events.ProductEvents.ProductUpdated,function(){return u.resetZipCodeForm()})}return n.prototype.getTemplateUrl=function(){return this.isLoading?"/js/ns/materials/geographical-restrictions/loading-restriction.html":this.product.isRestricted===undefined?"/js/ns/materials/geographical-restrictions/request-zipcode.html":this.product.isRestricted?"/js/ns/materials/geographical-restrictions/restricted-zipcode.html":this.product.isRestricted?"/js/ns/materials/geographical-restrictions/request-zipcode.html":"/js/ns/materials/geographical-restrictions/available-zipcode.html"},n.prototype.updateZipCode=function(n){var t=this;if(n.$setSubmitted(),this.zipCodeForm=n,!n.$valid){this.eventsService.trigger(events.SpinnerEvents.ResetAddSpinner);return}this.restrictionsService.updateZipCode(this.zipCode.zipCodeValue).then(function(n){return n?t.apiService.checkGeographicalRestriction(t.zipCode.zipCodeValue,t.product.restrictionCode):(t.setFormInvalidity(),n)}).then(function(n){n&&(t.product.isRestricted=n.data,t.eventsService.trigger(events.GeoRestrictionsEvents.ZipCodeUpdated));t.eventsService.trigger(events.SpinnerEvents.ResetAddSpinner)})},n.prototype.hasError=function(n){return this.zipCodeForm=n,this.zipCodeForm.$submitted&&(this.zipCodeForm.zipCode.$invalid||this.restrictionsService.isZipCodeInvalid())},n.prototype.isLoadingRestrictions=function(){return this.isLoading},n.prototype.checkRestriction=function(){var t=this,n=this.restrictionsService.getZipCodeValue();n&&this.product.hasRestrictionCode()&&(this.isLoading=!0,this.restrictionsService.checkRestriction(n,this.product).then(function(){return t.isLoading=!1}))},n.prototype.resetZipCodeForm=function(){this.zipCodeForm&&(this.zipCodeForm.$setPristine(),this.zipCode={zipCodeValue:this.restrictionsService.getZipCodeValue()})},n.prototype.setFormInvalidity=function(){this.zipCodeForm&&this.zipCodeForm.zipCode.$setValidity("pattern",!1)},n}();n.$inject=["$scope","eventsService","productRestrictionsService","apiService"];angular.module("ns").directive("productRestrictions",i.instance);angular.module("ns").directive("restrictedZipcodeForm",t.instance);angular.module("ns").controller("productRestrictionsController",n)}(ns||(ns={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}();templatePath="/js/ns/materials/messages/product-messages.html",function(n){var u=function(){function n(){this.restrict="A";this.templateUrl=templatePath;this.scope={analyticsText:"@",product:"=",shouldShowLinksAtSuccess:"<"};this.replace=!0;this.controller=i;this.controllerAs="productMessagesController"}return n.instance=function(){return new n},n}(),r,t,i;angular.module("ns").directive("productMessages",u.instance);r=function(){function n(){this.templateUrl=templatePath;this.controller=t;this.controllerAs="productMessagesController";this.bindings={product:"=",analyticsText:"<",voucherGuid:"<",shouldShowLinksOnSuccess:"<"}}return n}();t=function(){function n(n,t,i,r,u){this.userService=n;this.productService=t;this.eventsService=i;this.punchOutService=r;this.featureData=u;this.shouldShowLinksOnSuccess=!0;this.eventsService.on(events.ProductEvents.ProductAddedToCart,function(){this.orderedQuantity=this.product.quantity}.bind(this));this.eventsService.on(events.ProductMessagesComponentEvents.ResetMessages,this.onResetMessages.bind(this))}return n.prototype.isNotAllowedForPurchase=function(){return this.userService.isNotAllowedForPurchase(this.product)},n.prototype.isPunchOutSession=function(){return this.punchOutService.isPunchOutSession()},n.prototype.displayLargeOrderEmailYourRequest=function(){return this.product.quantity>10},n.prototype.addProductToCart=function(n,t){t===void 0&&(t=!1);t&&(this.product.quantity=this.product.availableQuantity);this.productService.addProductToCart(this.product,this.analyticsText,n,!1,this.voucherGuid)},n.prototype.acceptMaterialWarning=function(){var n=this;this.productService.addProductToCart(this.product,this.analyticsText,!1,!1,this.voucherGuid).then(function(){n.product.materialWarningAccepted=!0;n.product.materialWarningVisible=!1})},n.prototype.onResetMessages=function(){this.product.errorMessage=undefined;this.product.orderedQuantity=undefined},n}();t.$inject=["userService","productService","eventsService","punchOutService","featureData"];n.ProductMessagesComponentController=t;i=function(n){function t(t,i,r,u,f,e){var o=n.call(this,i,r,u,f,e)||this;return o.$scope=t,o.product=t.product,o.analyticsText=t.analyticsText,o}return __extends(t,n),t}(t);i.$inject=["$scope","userService","productService","eventsService","punchOutService","featureData"];n.ProductMessagesDirectiveController=i;angular.module("ns").controller("productMessagesController",i);angular.module("ns").component("productMessagesComponent",new r)}(ns||(ns={})),function(n){var t=function(){function t(){this.materialIndicator=null;this.pricings=[]}return t.prototype.update=function(t){this.materialIndicator=t.materialIndicator;this.pricings=_.map(t.pricings,function(t){var i=new n.MaterialPricing;return i.update(t),i})},t}();n.AvailablePricing=t}(ns||(ns={})),function(n){var t=function(){function n(){this.name=null;this.fullWebPath=null}return n.prototype.update=function(n){this.name=n.name;this.fullWebPath=n.fullWebPath},n}();n.Category=t}(ns||(ns={})),function(n){var t=function(){function n(){this.id=null;this.name=null;this.characterSetValues=[];this.selectedValue=null}return n.prototype.update=function(n){this.id=n.id;this.name=n.name;this.characterSetValues=n.characterSetValues;this.selectedValue=n.selectedValue},n}();n.CharacterSet=t}(ns||(ns={})),function(n){var t=function(){function n(){this.price=null;this.quantity=null;this.quantityRange=null}return n.prototype.update=function(n){this.price=n.price;this.quantity=n.quantity;this.quantityRange=n.quantityRange},n}();n.MaterialPricing=t}(ns||(ns={})),function(n){var t=function(){function n(){this.materialIndicator=null;this.availableForBackOrder=null;this.isDropShip=!1;this.isSpecialOrder=!1;this.isAvailable=!1;this.isTemporaryUnavailable=!1;this.quantityInStock=null;this.availableForBackOrder=null;this.materialIndicator=null;this.isDropShip=!1;this.isSpecialOrder=!1;this.isAvailable=!1;this.isTemporaryUnavailable=!1;this.quantityInStock=null}return n.prototype.update=function(n){this.availableForBackOrder=n.availableForBackOrder;this.materialIndicator=n.materialIndicator;this.isDropShip=n.isDropShip;this.isSpecialOrder=n.isSpecialOrder;this.isAvailable=n.isAvailable;this.isTemporaryUnavailable=n.isTemporaryUnavailable;this.quantityInStock=n.quantityInStock},n}();n.MaterialStockStatus=t}(ns||(ns={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var e=common.MinimumQuantityValidator,t=function(){function t(){this.materialBaseId=null;this.materialBaseNumber=null;this.imageId=null;this.brand=null;this.noBrand=null;this.materialName=null;this.characterSets=[];this.voucherActiveMaterialsWithCharacterSets=null;this.unitPrice=null;this.availableStockQuantity=null;this.quantityInStock=null;this.unitOfMeasureQuantities=null;this.restrictionCode=null;this.saleUnitName=null;this.salePluralUnitName=null;this.unitOfMeasure=null;this.quantity=1;this.minimumQuantity=1;this.roundingProfile=1;this.isQuoted=!1;this.isDropShip=!1;this.isSpecialOrder=!1;this.isCustomizable=!1;this.isNew=!1;this.isSale=!1;this.isClearance=!1;this.isSpecialOffer=!1;this.isRebate=!1;this.isAvailableForPickup=!1;this.selectedStyleNotAvailable=!1;this.materialWarningAccepted=!1;this.sdsLinks=[];this.specSheet=null;this.videoReferenceIds=[];this.showMaterialVideo=!1;this.is3MBrand=!1;this.isNsBrand=!1;this.isFreeGood=!1;this.category=new n.Category;this.voucherShopName=""}return t.prototype.update=function(n){var t,i;this.materialBaseId=n.materialBaseId;this.materialBaseNumber=n.materialBaseNumber;this.materialName=n.materialName;this.brand=n.brand;this.noBrand=n.noBrand;this.imageId=n.imageId;this.unitOfMeasure=n.unitOfMeasure;this.minimumQuantities=n.minimumQuantities;this.availableStockQuantity=n.availableStockQuantity;this.restrictionCode=n.restrictionCode;this.isRestricted=n.isRestricted;this.quantity=n.minimumQuantities&&n.minimumQuantities[0]?n.minimumQuantities[0].value:n.quantity;this.unitPrice=n.lowestPrice?n.lowestPrice:n.unitPrice;this.isNew=n.isNew;this.isSale=n.isSale;this.isClearance=n.isClearance;this.isSpecialOffer=n.isSpecialOffer;this.isRebate=n.isRebate;this.isQuoted=n.isQuoted;this.isCustomizable=n.isCustomizable;this.isDropShip=n.isDropShip;this.selectedStyleNotAvailable=n.selectedStyleNotAvailable;this.isSpecialOrder=n.isSpecialOrder;this.quantityInStock=n.quantityInStock;this.isAvailableForPickup=n.isAvailableForPickup;this.sdsLinks=n.sdsLinks;this.specSheet=n.specSheet;this.videoReferenceIds=n.videoReferenceIds;this.showMaterialVideo=!1;this.is3MBrand=n.is3MBrand;this.isNsBrand=n.isNsBrand;this.isFreeGood=n.isFreeGood;this.category=n.category;this.voucherShopName=n.voucherShopName;this.voucherName=n.voucherName;this.updateCharacterSets(n.characterSets);this.voucherActiveMaterialsWithCharacterSets=n.voucherActiveMaterialsWithCharacterSets;n.minimumQuantities&&(t=this.getMaterialIndicatorFromSelectedCharacterSets(n.characterSets),t?(i=n.minimumQuantities.filter(function(n){return n.materialIndicator===t})[0],this.setMinimumQuantityValues(i)):this.setMinimumQuantityValues(n.minimumQuantities[0]),this.unitOfMeasureQuantities=this.createUnitOfMeasureData())},t.prototype.getMaterialIndicatorFromSelectedCharacterSets=function(n){var t="";try{n.forEach(function(n){t+=n.selectedValue.name+"_"})}catch(i){return null}return t?t.substr(0,t.length-1):null},t.prototype.getCharacterSetMessage=function(){switch(this.characterSets.length){case 1:return"View "+this.getNameForFirstCharacterSet()+" Options";case 2:return"View "+this.getNameForFirstCharacterSet()+" & "+this.getNameForSecondCharacterSet()+" Options";default:return"View All Options"}},t.prototype.getNameForFirstCharacterSet=function(){var n=_.first(this.characterSets);return n.name},t.prototype.getNameForSecondCharacterSet=function(){var n=_.last(this.characterSets);return n.name},t.prototype.updateCurrentMinimumQuantityAndRoundingProfile=function(n){var i=_.where(this.minimumQuantities,{materialIndicator:n}),t=i[0];t&&(this.setMinimumQuantityValues(i[0]),this.shouldResetQuantity(t.value)&&(this.unitOfMeasureQuantities=this.createUnitOfMeasureData(n)),this.quantity=t.value)},t.prototype.createUnitOfMeasureData=function(n){var t,r,i;if(n===void 0&&(n=null),t=this.getDefaultItemWithRoundingProfile(),n&&(t=this.getItemWithRoundingProfile(n)),t!=null){for(r=[],i=1;i<=10;i++)r.push(this.getItemForUomDropDown(t,i));return r}return null},t.prototype.hasRestrictionCode=function(){return!!this.restrictionCode},t.prototype.unitAndSaleUnitAreTheSame=function(){return this.unitOfMeasure===this.saleUnitName},t.prototype.hasSDSLinks=function(){return this.sdsLinks!=null&&this.sdsLinks.length>0},t.prototype.numberOfSDSLinksOnAColumn=function(){return this.sdsLinks==null?0:Math.floor(this.sdsLinks.length/3)+1},t.prototype.hasSpecSheet=function(){return this.specSheet.link!=null&&this.specSheet.link!=""},t.prototype.showMaterialVideoModal=function(n,t){var u="#material-video-modal-"+n+"-"+t,f="#material-video-modal-body-"+n+"-"+t,i=u+"_clone",r=f+"_clone",e=$(u).clone(!0,!0).attr("id",i.replace("#",""));e.find(f).attr("id",r.replace("#",""));$(document.body).append(e);this.showMaterialVideo=!0;$(i).on("shown.bs.modal",function(){$.getScript("//players.brightcove.net/5737985336001/Hkp2jK6yX_default/index.min.js");$(r).html('<video-js data-account="5737985336001"data-video-id="'+n+'"data-player="Hkp2jK6yX"data-embed="default"class= "vjs-fluid" controls> <\/video-js>')});$(i).on("hide.bs.modal",function(){$(r).empty();$(i).remove()});$(i).modal({backdrop:!1,show:!0})},t.prototype.setMinimumQuantityValues=function(n){this.minimumQuantity=n.value;this.roundingProfile=n.roundingProfile;this.saleUnitName=n.saleUnitName;this.salePluralUnitName=n.salePluralUnitName},t.prototype.isHigherThanOne=function(n){return n>1},t.prototype.shouldResetQuantity=function(){return!1},t.prototype.updateCharacterSets=function(t){var i=_.map(t,function(t){var i=new n.CharacterSet;return i.update(t),i});this.characterSets=i},t.prototype.getDefaultItemWithRoundingProfile=function(){var i=this,t=this.minimumQuantities.filter(function(n){return i.isHigherThanOne(n.roundingProfile)}),n;return t.length<1?null:(n=this.getMaterialIndicatorFromSelectedCharacterSets(this.characterSets),n?this.minimumQuantities.filter(function(t){return t.materialIndicator===n})[0]:t[0])},t.prototype.getItemWithRoundingProfile=function(n){var t=this.minimumQuantities.filter(function(t){return t.materialIndicator==n});return t.length?t[0]:null},t.prototype.getItemNameForUomDropDown=function(n,t){var i="";return n.saleUnitName!==this.unitOfMeasure&&(i+=t!==1?" ("+t+" "+n.salePluralUnitName+")":" ("+t+" "+n.saleUnitName+")"),n.roundingProfile*t+i},t.prototype.getItemForUomDropDown=function(n,t){var i=this.getItemNameForUomDropDown(n,t);return{value:n.roundingProfile*t,name:i}},t}(),i,r,u,f;n.ProductBase=t;i=function(t){function i(){var n=t.call(this)||this;return n.thumbnailImageId=null,n.lowestPrice=null,n.highestPrice=null,n.catalogLowestPrice=null,n.catalogHighestPrice=null,n.unitOfMeasure=null,n.availablePrices=[],n.materialPricings=[],n.materialImages=[],n.isPriceHidden=!1,n.isCartable=!0,n.showStockStatus=null,n.stockStatuses=[],n.customMaterialNumberOptions=[],n.customMaterialDescriptions=[],n.customMaterialDescription="",n.vendorPartNumbers=[],n.materialBaseGroup=null,n.isNsBrand=!1,n.rating=null,n.outOfStockMessages=[],n.isBackOrderAvailable=!1,n.errorMessage=null,n.warningMessage=null,n.materialWarning=null,n.materialWarningAccepted=!1,n.quantityAvailableInStock=null,n.orderedQuantity=0,n.availabilitiesForPickup=[],n.isProductUnavailable=!1,n.isSelectedProductUnavailable=!1,n.availableQuantity=0,n.isQuantityRestrictedError=!1,n.nonReturnable=!1,n.voucherGuid=null,n}return __extends(i,t),i.prototype.canSetStockStatus=function(n){if(this.isProductUnavailable)return!0;if(n!=null&&n.length===0)return!1;if(this.isCustomizable||this.isClearance)return!0;if(n!=null&&n.length>1){var t=n[0],i=_.every(n,function(n){return!n.isDropShip&&!n.isSpecialOrder&&n.quantityInStock<=0||n.isTemporaryUnavailable||n.availableForBackOrder!=null?!1:n.isDropShip===t.isDropShip&&n.isAvailable===t.isAvailable&&n.isSpecialOrder===t.isSpecialOrder&&n.isTemporaryUnavailable===t.isTemporaryUnavailable}),r=_.every(n,function(n){return n.quantityInStock<=0&&!n.isDropShip&&!n.isSpecialOrder&&!n.isTemporaryUnavailable});return i||r}return n!=null&&n.length===1},i.prototype.update=function(n){t.prototype.update.call(this,n);this.isProductUnavailable=n.isProductUnavailable;this.isSelectedProductUnavailable=n.isSelectedProductUnavailable;this.thumbnailImageId=this.getThumbnailImage(n);this.lowestPrice=n.lowestPrice;this.highestPrice=n.highestPrice;this.catalogLowestPrice=n.catalogLowestPrice;this.catalogHighestPrice=n.catalogHighestPrice;this.availableForBackorderOnly=n.availableForBackorderOnly;this.materialImages=this.getMaterialImages(n);this.isPriceHidden=n.isPriceHidden;this.isCartable=n.isCartable;this.updateAvailabilityForPickup(n);this.customMaterialNumberOptions=n.customMaterialNumberOptions;this.customMaterialDescriptions=n.customMaterialDescriptions;this.customMaterialDescription=this.getMaterialDescription(n);this.vendorPartNumbers=n.vendorPartNumbers;this.materialBaseGroup=n.materialBaseGroup;this.isNsBrand=n.isNsBrand;this.rating=n.rating;this.outOfStockMessages=n.outOfStockMessages;this.updateStockStatuses(n.stockStatuses);this.updatePricings(n.availablePrices);this.updateMaterialPricing(this.availablePrices);this.updateStockStatus(this.stockStatuses);this.orderedQuantity=0;this.isBackOrderAvailable=!1;this.errorMessage=null;this.warningMessage=null;this.materialWarning=n.materialWarning||n.materialBaseWarning;this.materialWarningVisible=!1;this.materialWarningAccepted=!1;this.quantityAvailableInStock=null;this.nonReturnable=n.nonReturnable;this.voucherGuid=n.voucherGuid},i.prototype.getThumbnailImage=function(n){if(!n.thumbnailImageId)if(!n.imageId){if(!!n.materialImages&&n.materialImages.length>0)return n.materialImages[0]}else return n.imageId;else return n.thumbnailImageId;return n.thumbnailImageId},i.prototype.getMaterialDescription=function(n){if(n.customMaterialDescriptions&&n.customMaterialDescriptions.length>0)return n.customMaterialDescriptions.find(function(t){return t.materialBaseNumber==n.materialBaseNumber}).description},i.prototype.getMaterialImages=function(n){if(!!n.materialImages&&n.materialImages.length>0)return n.materialImages;if(!n.imageId){if(!!n.thumbnailImageId)return[n.thumbnailImageId]}else return[n.imageId];return n.materialImages},i.prototype.updateErrorData=function(n){n?(this.availableStockQuantity=n.availableStockQuantity,this.isBackOrderAvailable=n.isBackOrderAvailable,this.errorMessage=n.errorMessage,this.warningMessage=n.warningMessage,this.quantityAvailableInStock=n.quantityInStock,this.orderedQuantity=this.quantity,this.isQuantityRestrictedError=n.isQuantityRestrictedError,this.availableQuantity=n.totalQuantityAvailableToOrder):(this.availableStockQuantity=null,this.isBackOrderAvailable=!1,this.errorMessage=null,this.warningMessage=null,this.quantityAvailableInStock=null,this.orderedQuantity=0,this.isQuantityRestrictedError=!1,this.availableQuantity=0);this.isClearanceError()&&(this.quantity=this.availableStockQuantity)},i.prototype.updateMaterialPricing=function(n){if(n.length>0){var t=_.sortBy(n,function(n){return _.reduce(n.pricings,function(n,t){return n.price<t.price?n.price:t.price},Number.MAX_VALUE)});this.materialPricings=t[0].pricings}},i.prototype.updatePricings=function(t){var i=_.map(t,function(t){var i=new n.AvailablePricing;return i.update(t),i});this.availablePrices=i},i.prototype.updatePricingBasedOnCharacterSetSelection=function(n){var t=_.where(this.availablePrices,{materialIndicator:n});t[0]!=null?this.updateMaterialPricing(t):this.updateMaterialPricing(this.availablePrices)},i.prototype.updateStockStatusBasedOnCharacterSetSelection=function(n){n==null&&(n="");var t=_.where(this.stockStatuses,{materialIndicator:n});this.updateStockStatus(t)},i.prototype.updateStockStatuses=function(t){var i=t?t.map(function(t){var i=new n.MaterialStockStatus;return i.update(t),i}):[];this.stockStatuses=i},i.prototype.updateStockStatus=function(n){if(this.canSetStockStatus(n)){var t=_.findWhere(this.stockStatuses,{materialIndicator:n[0].materialIndicator});this.isDropShip=t.isDropShip;this.isSpecialOrder=t.isSpecialOrder;this.quantityInStock=t.quantityInStock;this.selectedStyleNotAvailable=!t.isAvailable;this.showStockStatus=!0}else this.isDropShip=!1,this.isSpecialOrder=!1,this.quantityInStock=null,this.selectedStyleNotAvailable=!0,this.showStockStatus=_.every(this.characterSets,function(n){return!!n.selectedValue})},i.prototype.resetStockStatus=function(){this.isDropShip=!1;this.isSpecialOffer=!1;this.selectedStyleNotAvailable=!1;this.showStockStatus=this.hasCharacterSetsValues()===!1?this.characterSets.every(function(n){return!!n.selectedValue}):!1},i.prototype.updateAvailabilityForPickupForSelectedCharacterSet=function(n){var t=_.findWhere(this.availabilitiesForPickup,{materialIndicator:n});this.isAvailableForPickup=!!t&&t.isAvailableForPickup},i.prototype.updateAvailabilityForPickup=function(n){this.availabilitiesForPickup=n.availabilitiesForPickup;this.isAvailableForPickup=_.every(n.availabilitiesForPickup,function(n){return n.isAvailableForPickup===!0})},i.prototype.hasCharacterSets=function(){return this.characterSets&&this.characterSets[0]},i.prototype.hasCharacterSetsValues=function(){return this.characterSets&&this.characterSets.length>0?!0:!1},i.prototype.hasSelectedCharacterSets=function(){var n=this.getSelectedCharacterSetValueIds();return!n||n.length!==this.characterSets.length?!1:!0},i.prototype.characterSetsHaveEqualValues=function(){var n=this;return this.hasCharacterSetsValues()?this.characterSets.every(function(t){return t.characterSetValues.every(function(t){return t===n.characterSets[0].characterSetValues[0]})}):!1},i.prototype.resetSelectedCharacterSets=function(){this.characterSets.forEach(function(n){n.selectedValue=undefined})},i.prototype.getSelectedCharacterSetValueIds=function(){var n=[];return _.each(this.characterSets,function(t){t.selectedValue&&n.push(t.selectedValue.id)}),n},i.prototype.getPriceForQuantity=function(){var t=this,n;return this.lowestPrice===this.highestPrice?this.lowestPrice:this.materialPricings.length===1?_.first(this.materialPricings).price:(n=_.find(this.materialPricings,function(n){return n.quantity>t.quantity}),n)?n.price:_.last(this.materialPricings).price},i.prototype.getTotal=function(){var n=this.getPriceForQuantity();return this.quantity*n},i.prototype.isBackOrder=function(){return this.orderedQuantity>this.availableStockQuantity&&this.isBackOrderAvailable},i.prototype.hasError=function(){return!this.isBackOrder()&&!this.isClearanceError()&&!this.isNotAvailable()&&!!this.errorMessage},i.prototype.isClearanceError=function(){return this.isClearance&&this.warningMessage},i.prototype.isNotAvailable=function(){return this.isClearance&&this.quantityAvailableInStock===0&&this.availableStockQuantity===0},i.prototype.isProductDetails=function(){return!1},i.prototype.isAddedToCartWithSuccess=function(){return!this.errorMessage&&!this.isBackOrder()&&!this.isNotAvailable()&&this.orderedQuantity>0},i.prototype.getUnitPriceTimesQuantity=function(){return this.unitPrice*this.quantity},i.prototype.getQuantityPerRoundingProfile=function(){return this.quantity/this.roundingProfile},i.prototype.shouldResetQuantity=function(n){return e.displayMinimumQuantity(this)&&this.quantity%n!=0},i.prototype.hasOnlyOnePrice=function(){return this.lowestPrice===this.highestPrice||this.lowestPrice===0},i.prototype.hasOnlyOneCatalogPrice=function(){return this.catalogLowestPrice===this.catalogHighestPrice||this.catalogLowestPrice===0},i}(t);n.Product=i;r=function(t){function i(){return t!==null&&t.apply(this,arguments)||this}return __extends(i,t),i.prototype.update=function(i){t.prototype.update.call(this,i);this.relatedProducts=_.map(i.relatedProducts,function(t){var i=new n.RelatedProduct;return i.update(t),i});this.subheading=i.subheading;this.bulletHeading=i.bulletHeading;this.bulletPoints=i.bulletPoints;this.packaging=i.packaging;this.isCustomizable=i.isCustomizable;this.customizedMaterialBaseNumbers=i.customizedMaterialBaseNumbers;this.nonCustomizedMaterialBaseNumber=i.nonCustomizedMaterialBaseNumber;this.nonCustomMaterialName=i.nonCustomMaterialName;this.heading=i.heading;this.additionalInfoMessages=i.additionalInfoMessages;this.kitContents=i.kitContents;this.hasRelatedProducts=i.relatedProducts.length>0;this.isLevelThreeRestricted=i.userInfo.isLevelThreeRestricted;this.prop65WarningMessage=i.prop65WarningMessage},i.prototype.isProductDetails=function(){return!0},i.prototype.hasDescriptionInfo=function(){return this.bulletHeading||this.bulletPoints&&this.bulletPoints.length>0||this.subheading||this.packaging||this.relatedProducts&&this.relatedProducts.length>0||this.outOfStockMessages&&this.outOfStockMessages.length>0},i.prototype.displayRelatedProducts=function(){return this.hasRelatedProducts&&!this.isLevelThreeRestricted},i.prototype.hasProp65WarningMessage=function(){return this.prop65WarningMessage!=null},i}(i);n.ProductDetails=r;u=function(n){function t(){var t=n.call(this)||this;return t.lineId=null,t.deliveryDate=null,t.deliveryMessage=null,t.materialNumber=null,t.customMaterialNumber=null,t.linePrice=null,t.isHazmat=!1,t.isOrmd=!1,t.isLib=!1,t.isLmb=!1,t.isLtq=!1,t.isPromotion=!1,t.backorderAllowed=!1,t.isEligibleForBackorder=!1,t.isQuantityLimitRestricted=!1,t.quantityRestrictedNumberOfDays=null,t.quantityRestrictedLimit=null,t.isUserAuthenticated=!1,t.totalQuantityAvailableToOrder=null,t.numberOfDaysWithRestriction=null,t.uom=null,t.packingNote=null,t.baseCost=0,t.deliveryDateSet=!1,t.materialGroup=null,t.isQuantityModified=!1,t.vendorPartNumber=null,t.materialPackingListIndicator=!1,t.inventory=null,t.isDropShipOrmd=!1,t.isGroundShippingFree=!1,t.hasLengthQuantity=!1,t.hasQuantityRestrictions=!1,t.sectedMaterialMinimumQuantity=null,t.isParcelDropShip=!1,t.isProductUnavailable=!1,t.isTemporaryUnavailable=!1,t.nonReturnable=!1,t.isFromVoucherShop=!1,t.isOutsideOfVoucherCollection=!1,t}return __extends(t,n),t.prototype.setDeliveryDate=function(n,t){this.deliveryDate=n;this.deliveryMessage=t?t:null;this.deliveryDateSet=!0},t.prototype.isHazmatOrOrmd=function(){return this.isHazmat||this.isOrmd||this.isLib||this.isLmb||this.isLtq},t.prototype.update=function(t){n.prototype.update.call(this,t);this.lineId=t.lineId;this.materialNumber=t.materialNumber;this.customMaterialNumber=t.customMaterialNumber;this.linePrice=t.linePrice;this.isHazmat=t.isHazmat;this.isOrmd=t.isOrmd;this.isLtq=t.isLtq;this.isLmb=t.isLmb;this.isLib=t.isLib;this.isPromotion=t.isPromotion;this.backorderAllowed=t.backorderAllowed;this.isEligibleForBackorder=t.isEligibleForBackorder;this.isQuantityLimitRestricted=t.isQuantityLimitRestricted;this.quantityRestrictedNumberOfDays=t.quantityRestrictedNumberOfDays;this.quantityRestrictedLimit=t.quantityRestrictedLimit;this.isUserAuthenticated=t.isUserAuthenticated;this.totalQuantityAvailableToOrder=t.totalQuantityAvailableToOrder;this.numberOfDaysWithRestriction=t.numberOfDaysWithRestriction;this.uom=t.uom;this.packingNote=t.packingNote;this.minQtyMsg=t.minQtyMsg;this.materialGroup=t.materialGroup;this.isQuantityModified=t.isQuantityModified;this.vendorPartNumber=t.vendorPartNumber;this.materialPackingListIndicator=t.materialPackingListIndicator;this.inventory=t.inventory;this.isDropShipOrmd=t.isDropShipOrmd;this.isGroundShippingFree=t.isGroundShippingFree;this.hasLengthQuantity=t.hasLengthQuantity;this.hasQuantityRestrictions=t.hasQuantityRestrictions;this.restrictionCode=t.restrictionCode;this.sectedMaterialMinimumQuantity=t.sectedMaterialMinimumQuantity;this.quantity=t.quantity;this.isParcelDropShip=t.isParcelDropShip;this.baseCost=t.baseCost;this.availableForBackorderOnly=t.availableForBackorderOnly;this.isProductUnavailable=t.isProductUnavailable;this.voucherGuid=t.voucherGuid;this.nonReturnable=t.nonReturnable;this.isFromVoucherShop=t.isFromVoucherShop;this.isOutsideOfVoucherCollection=t.isOutsideOfVoucherCollection},t.prototype.deliveryDateDisplayText=function(){return this.deliveryDate?this.deliveryDate.displayText():"Unavailable"},t.prototype.hasDeliveryDate=function(){return this.deliveryDateSet},t.prototype.getUnitName=function(){return this.quantity/this.roundingProfile>1?this.salePluralUnitName:this.saleUnitName},t.prototype.showMinQuantity=function(){return n.prototype.isHigherThanOne.call(this,this.minimumQuantity)},t.prototype.shouldResetQuantity=function(n){return this.showMinQuantity()&&this.quantity%n!=0},t.prototype.displayIsNotInVoucherCollectionMessage=function(){return this.isOutsideOfVoucherCollection},t}(t);n.CartLine=u;f=function(){function n(){}return n}();n.ProductQuickViewMetadata=f}(ns||(ns={})),function(n){var t=function(){function n(){}return n.prototype.update=function(n){this.materialBaseId=n.materialBaseId;this.materialBaseNumber=n.materialBaseNumber;this.materialName=n.materialName;this.brand=n.brand;this.thumbnailImageId=n.thumbnailImageId;this.unitOfMeasure=n.unitOfMeasure;this.lowestPrice=n.lowestPrice;this.highestPrice=n.highestPrice;this.isPriceHidden=n.isPriceHidden;this.isSale=n.isSale;this.catalogLowestPrice=n.catalogLowestPrice;this.catalogHighestPrice=n.catalogHighestPrice},n.prototype.hasOnlyOnePrice=function(){return this.lowestPrice===this.highestPrice||this.lowestPrice===0},n.prototype.hasOnlyOneCatalogPrice=function(){return this.catalogLowestPrice===this.catalogHighestPrice||this.catalogLowestPrice===0},n}();n.RelatedProduct=t}(ns||(ns={})),function(){var t=function(){function t(){this.bindings={product:"<",showDiscounts:"<"};this.templateUrl="/js/ns/materials/prices/price.component.html";this.controllerAs="controller";this.controller=n}return t}(),n=function(){function n(n){this.featureData=n}return n}();n.$inject=["featureData"];angular.module("ns").component("priceComponent",new t)}(ns||(ns={})),function(){var n=function(){function n(){this.restrict="A";this.templateUrl="/js/ns/materials/pricing-guide/pricing-guide.html";this.scope={product:"=productPricingGuide"}}return n.instance=function(){return new n},n}();angular.module("ns").directive("productPricingGuide",n.instance)}(ns||(ns={})),function(n){"use strict";n.directive("customQuantityMessage",function(){return{restrict:"A",templateUrl:"/js/ns/materials/quantity/custom-quantity-message.html",replace:!0,scope:{unitOfMeasure:"="},controller:"customQuantityMessageController"}});n.controller("customQuantityMessageController",["$scope",function(n){n.showQuantityMessage=function(){return n.unitOfMeasure==="Per Foot"}}])}(angular.module("ns")),function(){var n=function(){function n(){this.bindings={product:"<"};this.templateUrl="/js/ns/materials/quantity/minimum-quantity-message.html"}return n}();angular.module("ns").component("minimumQuantityMessage",new n)}(ns||(ns={})),function(){var n=common.MinimumQuantityValidator,i=function(){function n(){this.bindings={item:"<"};this.controller=t;this.templateUrl="/js/ns/materials/quantity/product-minimum-quantity.html";this.controllerAs="controller"}return n}(),t=function(){function t(n,t){this.productService=n;this.productDetailsService=t;this.$onInit=function(){this.setProductDetailsFlag(this.item);this.product=this.isProductDetails?this.productDetailsService.product:this.productService.product}}return t.prototype.setProductDetailsFlag=function(n){n&&(this.isProductDetails=n)},t.prototype.isAboveMinimumQuantity=function(){return n.isAboveMinimumQuantity(this.product)},t.prototype.isValidQuantity=function(){return n.isValidQuantity(this.product)},t.prototype.displaySingleUom=function(){return this.product.getQuantityPerRoundingProfile()===1&&this.isValidQuantity()},t.prototype.displayPluralUom=function(){return this.product.getQuantityPerRoundingProfile()>1&&this.isValidQuantity()},t.prototype.unitAndSaleUnitAreTheSame=function(){return this.product.unitAndSaleUnitAreTheSame()},t}();t.$inject=["productService","productDetailsService"];angular.module("ns").component("productMinimumQuantity",new i)}(ns||(ns={})),function(n){"use strict";n.directive("quickView",function(){return{restrict:"A",templateUrl:"/js/ns/materials/quick-view/quick-view.html",scope:{analyticsText:"@",pageType:"@",listType:"@"},controller:"quickViewController"}});n.controller("quickViewController",["$rootScope","$scope","productService","userService","navigationService","eventsService","punchOutService","focusService","featureData","productRestrictionsService","analyticsService",function(n,t,i,r,u,f,e,o,s,h,c){t.product=i.product;t.showQuickViewDetails=!0;t.showAddToCartSuccess=!1;t.allowReturns=r.user.allowReturns;t.isLoaded=function(){var n=!!i.loadingMaterialNumber;return t.showQuickViewDetails&&!n};t.displayMinimumQuantity=function(){return common.MinimumQuantityValidator.displayMinimumQuantity(t.product)};t.updateProductInfoAfterCharacterSetSelection=i.updateProductInfoAfterCharacterSetSelection.bind(i);t.addProductToCart=function(i){if(t.form=i,i.$setSubmitted(),t.product.materialWarning&&!t.product.materialWarningAccepted){t.product.materialWarningVisible=!0;o.focusErrorField(i);i.$submitted=!1;i.$valid=!1;n.$broadcast("reset-addToCart-spinner");return}t.isAddToCartAllowed()?t.addToCart(i):n.$broadcast("reset-addToCart-spinner")};t.isAddToCartAllowed=function(){return!t.shouldDisplayProductRestrictions()||t.shouldDisplayProductRestrictions()&&t.product.isRestricted===!1};t.addToCart=function(r){r.$setSubmitted();r.$valid&&common.MinimumQuantityValidator.isAboveMinimumQuantity(t.product)&&common.MinimumQuantityValidator.isValidQuantity(t.product)?(e.isPunchOutSession()?i.addProductToCart(t.product,t.analyticsText,!1,!0):i.addProductToCart(t.product,t.analyticsText,!1,!1),o.focusElement("quick-view-product-details-modal")):n.$broadcast("reset-addToCart-spinner")};t.goToCart=function(){return u.goToCart()};t.goToCheckout=function(){return u.goToCheckOut()};t.goToPunchOut=function(){return u.goToPunchOut()};t.isPunchOutSession=function(){return e.isPunchOutSession()};t.isQuantityFieldValid=function(n,t){return!!n&&!!n.qty&&!!n.qty.$error&&(n.qty.$error.pattern||n.qty.$error.required)&&t.$submitted===!0};t.shouldDisplayProductRestrictions=function(){return t.product.hasRestrictionCode()};t.shouldDisplayVoucherQuickShop=function(){return t.product.voucherGuid};t.showStockStatus=function(){return h.canShowStockStatus(t.product)};t.getMessageForMissingInfo=function(){return h.getMessageForMissingInfo(t.product)};t.trackProductClick=function(n){c.trackProductClick(n,"Quick View",1,"Quick View")};t.isProductOverallNonReturnable=function(){return t.product.nonReturnable||t.product.isDropShip||t.product.isClearance||t.product.isCustomizable};var l=function(){t.product.errorMessage||t.product.isNotAvailable()||(t.showQuickViewDetails=!1,t.showAddToCartSuccess=!0)},a=function(){n.$broadcast("reset-addToCart-spinner");t.form&&(t.form.$submitted=!1);t.showQuickViewDetails=!0;t.showAddToCartSuccess=!1;t.product=i.product;f.trigger(events.ProductCharacterSetsComponentEvents.ResetCharacterSetsForVoucher)};f.on(events.ProductEvents.ProductUpdated,a.bind(this));f.on(events.ProductEvents.ProductAddedToCart,l.bind(this))}])}(angular.module("ns")),function(n){var t=function(){function n(n,t){this.productDetailsService=n;this.analyticsService=t}return n.prototype.trackProductReviewStartEvent=function(){this.analyticsService.trackProductReviewStartEvent(this.productDetailsService.product)},n.prototype.trackProductReviewSubmitEvent=function(){this.analyticsService.trackProductReviewSubmitEvent(this.productDetailsService.product)},n}();t.$inject=["productDetailsService","analyticsService"];n.ProductReviewsController=t;angular.module("ns").controller("productReviewsController",t)}(ns||(ns={})),function(){var n=angular.module("ns");n.directive("ymalProducts",["$timeout",function(){return{restrict:"A",templateUrl:"/js/ns/materials/suggestions/ymal-products.html",replace:!0,scope:{numberOfYmals:"@number",product:"=?product",ymalTitle:"@",analyticsText:"@",pageType:"@",showSaveForLater:"="},controller:"ymalProductsController"}}]);n.controller("ymalProductsController",["$rootScope","$scope","$timeout","youMayAlsoLikeService","analyticsService","modelsFactory",function(n,t,i,r,u,f){function e(){t.updatingYmal=!0;r.getYmal(t.numberOfYmals,t.product,function(n){var r=t.analyticsText,e=r!==undefined?r+": "+t.ymalTitle:t.ymalTitle,h=n.filter(function(n){return n.isProductUnavailable===!1}),c=_.map(h,function(n){return f.createProduct(n)});o&&o.classList.contains("hidden")||(u.trackProductImpression(h,e,s()),t.showSaveForLater||u.trackViewItemListEvent(c,e));t.ymalItems=c;t.updatingYmal=!1;i(function(){$(".suggested-material-name").matchHeight()},1e3)})}function s(){return t.$parent.searchController==null?null:t.$parent.searchController._searchData}window.GANEventConstants.category=t.pageType!==undefined?t.pageType:t.analyticsText;window.GANEventConstants.actionField=t.ymalTitle;t.updatingYmal=!1;var o=document.getElementById("algoliaNoResults");t.getProductPosition=function(n){return t.ymalItems.indexOf(n)+1};t.getPageType=function(){return t.analyticsText};t.getListType=function(){return t.ymalTitle};e();n.$on("cart-updated",function(){e()});n.$on("sfl-emptied",function(){e()});n.$on(events.SaveForLaterEvents.ItemRemoved,function(){e()})}])}(ns||(ns={})),function(n){var i=function(){function n(){this.restrict="A";this.templateUrl="/js/ns/materials/summary/product-summary.html";this.replace=!0;this.controller=t;this.scope={product:"=?product",position:"=?position",pageType:"=?pageType",listType:"=?listType"}}return n.instance=function(){return new n},n}(),t;angular.module("ns").directive("productSummary",i.instance);t=function(){function n(n,t){this.scope=n;this.featureData=t}return n}();t.$inject=["$scope","featureData"];n.ProductSummaryController=t}(ns||(ns={})),function(n){"use strict";n.controller("technicalNotesController",["apiService","productDetailsService","cookieService","featureData",function(n,t,i){var u=this,r=this,f=function(){if(!u.fullListOfPlants&&r.UI.notes&&r.UI.notes.materialTechnicalData){var n=_.max(r.UI.notes.materialTechnicalData,function(n){return n.plantInventories.length});u.fullListOfPlants=n.plantInventories}return u.fullListOfPlants},e=function(n){for(var t=0;t<r.UI.notes.materialsPlantStatus.length;t++)if(r.UI.notes.materialsPlantStatus[t].plantID===n)return"isStocked";return""};this.preloadTechnicalNotes=function(){r.UI.preloadWasCalled||(r.UI.preloadWasCalled=!0,r.UI.shouldDisplayNotes()&&r.UI.reloadTechnicalNotes())};var o=function(){r.UI.isLoading=!0;n.getTechnicalNotesForMaterial(t.product.materialBaseNumber).then(function(n){r.UI.notes=n.data;r.UI.isBusinessAccount=n.data.isBusinessAccount;r.UI.notes.anyQuantityRestriction=n.data.requiresPurchaseHistory||n.data.materialsSoftLimits&&n.data.materialsSoftLimits.length||n.data.materialsLimits&&n.data.materialsLimits.length||n.data.extremeLimits&&n.data.extremeLimits.length||n.data.inventoryThresholds&&n.data.inventoryThresholds.length;i.setDisplayTechnicalNotesCookie(!0);r.UI.isLoading=!1})},s=function(n){var i=f().length-n.length,t;if(i>0)for(t=0;t<i;t++)n.push({inventory:0});return n},h=function(){return i.getDisplayTechnicalNotesCookie()==="true"&&!r.UI.isLoading},c=function(){i.setDisplayTechnicalNotesCookie(!1)},l=function(){return u.internalNotes};r.UI={isLoading:!1,preloadWasCalled:!1,notes:null,reloadTechnicalNotes:o,displayNotes:r.displayNotes,setDisplayNotesCookieToFalse:c,shouldDisplayNotes:h,getFullListOfPlants:f,fillPlantList:s,shouldDisplayStockIndicator:e,internalNotes:l,isBusinessAccount:!1}}])}(angular.module("ns")),function(n){var t=function(){function t(t,i){var r,u,f,e,s,o;for(this.$attrs=t,this.analyticsService=i,this.materialsSearchResultSection={products:undefined,sectionTitle:undefined,pageTitle:undefined},this.pageType="MarketingLandingPage",this.listType="Materials Search Result",r=JSON.parse(this.$attrs.input),u=[],f=0,e=r.products;f<e.length;f++)s=e[f],o=new n.Product,o.update(s),u.push(o);this.analyticsService.trackViewItemListEvent(u,this.listType);this.materialsSearchResultSection.products=u;this.materialsSearchResultSection.pageTitle=r.pageTitle;this.materialsSearchResultSection.sectionTitle=r.sectionTitle;window.GANEventConstants.actionField=r.sectionTitle;window.GANEventConstants.category=r.pageTitle}return t.prototype.trackProductPosition=function(n){return this.materialsSearchResultSection.products.indexOf(n)+1},t}();t.$inject=["$attrs","analyticsService"];n.MaterialsSearchResultSectionController=t;angular.module("ns").controller("materialsSearchResultSectionController",t)}(ns||(ns={})),function(n){var t=function(){function n(n){this.analyticsService=n}return n.prototype.trackNavClick=function(n){this.analyticsService.trackNavClickGA4(n)},n.prototype.trackLogoutClick=function(n){this.trackNavClick(n);this.analyticsService.trackLogout()},n.prototype.trackOrderHistoryReview=function(n){this.trackNavClick(n);this.analyticsService.trackOrderHistoryReview()},n}();t.$inject=["analyticsService"];n.MyAccountNavMenuController=t;angular.module("ns").controller("myAccountNavMenuController",t)}(ns||(ns={})),function(){var n=function(){function n(n,t){var i=this;this.passwordValidationService=t;this.submitButtonEnabled=!1;this.password="";this.passwordRequirementsMet=!0;setTimeout(function(){i.submitButtonEnabled=!1;i.password=""},1);$("#password").focusin(function(){setTimeout(function(){t.generatePasswordValidationHtmlContent(i.password,"#password","#PasswordInputWrapper",i);setTimeout(function(){t.generatePasswordValidationHtmlContent(i.password,"#password","#PasswordInputWrapper",i)},100)},100)});n.$watch(function(){return i.password},function(){i.generatePasswordValidationPopover();i.submitButtonEnabled=!$("#PasswordInputWrapper").hasClass("has-error")})}return n.prototype.generatePasswordValidationPopover=function(){var n=this.passwordValidationService.popoverSettings(this.password,"#password","#PasswordInputWrapper",this);$("#password").popover(n)},n}();n.$inject=["$scope","passwordValidationService"];angular.module("ns").controller("myAccountNewPasswordController",n)}(ns||(ns={})),function(){$("#page-selectpicker").on("change",function(){this.options[this.selectedIndex].value&&(window.location.href=this.options[this.selectedIndex].value)});$(".clickable-row").click(function(){window.location.href=$(this).data("href")})}(ns||(ns={})),function(n){var t=function(){function n(n,t){var i=this;this.featureData=n;this.registrationService=t;this.weakPasswordsVariants=["P@ssword","P@55word","P@55w0rd","Passw0rd","Pa55word","Pa55w0rd","P@55w0rd","P@$$word","Pa$$w0rd"];t.getWeakPasswords().then(function(n){i.weakPasswords=n.data})}return n.prototype.generatePasswordValidationHtmlContent=function(n,t,i,r){var o=this,s=$(t).parent().find(".popover-content"),f=function(n,t){return'<div style="color:'+(t?"green":"red")+'">'+n+"<\/div>"},e={passwordProvided:function(){return n&&n.length},passwordLengthIsCorrect:function(){return n&&n.length>=10},passwordIsWeak:function(){return n?n.replace(/\d+/g,"").length>=14?!1:o.weakPasswordsVariants.filter(function(t){return n.indexOf(t)!==-1}).length||!o.weakPasswords||!o.weakPasswords.length||o.weakPasswords.filter(function(t){return t.toLowerCase()===n.replace(/[^a-zA-Z]+/g,"").toLowerCase()}).length:!0},isAlphaNumOnly:function(){return n?/^[a-zA-Z0-9 ]*$/.test(n):!0},hasAtLeastOneDigit:function(){if(!n)return!1;for(var t=0;t<n.length;t++)if(/^\d+$/.test(n[t]))return!0;return!1},has3ConsecutiveRepeatingCharacter:function(){var t;if(!n||n.length<3)return!0;for(t=0;t<n.length-2;t++){var i=n[t],r=n[t+1],u=n[t+2];if(i===r&&i===u)return!0}return!1},specialCharacterIsFirstOrLast:function(){if(!n||n.length===0)return!0;var t=n[0],i=n[n.length-1];return!/^[a-z0-9]+$/i.test(t)||!/^[a-z0-9]+$/i.test(i)},hasUpperCaseAndLowerCaseLetters:function(){return!n||n.length<2?!1:/[a-z]/.test(n)&&/[A-Z]/.test(n)}},u="";return u+=f("At Least 10 Characters In Length",e.passwordLengthIsCorrect()),u+=f("Is Not A Known Weak Password",!e.passwordIsWeak()),u+=f("Contains A Special Character Such As !@#$%^&*",!e.isAlphaNumOnly()),u+=f("Contains At Least One Number",e.hasAtLeastOneDigit()),u+=f("Contains Both Uppercase and Lowercase Characters",e.hasUpperCaseAndLowerCaseLetters()),u+=f("Does Not Have 3 Consecutive Repeating Characters",!e.has3ConsecutiveRepeatingCharacter()),u.indexOf("color:red")===-1?($(i).removeClass("has-error"),r.passwordRequirementsMet=!0):n&&n.length>0&&($(i).addClass("has-error"),r.passwordRequirementsMet=!1),$(s).html(u),u},n.prototype.popoverHtmlTemplate=function(){return'<div class="popover" style="min-width: 323px;" role="tooltip"><div class="arrow"><\/div><h3 class="popover-title"><\/h3><div class="popover-content" style="font-size: 12px"><\/div><\/div>'},n.prototype.popoverSettings=function(n,t,i,r){return{content:this.generatePasswordValidationHtmlContent(n,t,i,r),template:this.popoverHtmlTemplate(),html:!0,placement:"top",trigger:"focus"}},n}();t.$inject=["featureData","registrationService"];n.PasswordValidationService=t;angular.module("ns").service("passwordValidationService",t)}(ns||(ns={})),function(n){"use strict";n.controller("registrationEmailController",["$scope","$rootScope","registrationService","navigationService","initialData","analyticsService",function(n,t,i,r,u,f){var e=this;e.ui={startRegistration:function(n){return(e.TrackRegistration(),n.$invalid)?(n.$submitted=!0,t.$broadcast("email-registered"),$("#email-input").focus(),!1):(e.CheckCaptchaV3(),!1)},submit:function(n,t){n.preventDefault();e.ui.startRegistration(t)},email:"",emailPattern:/^([A-Za-z0-9/'_\-\.\+])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,18})$/,returnUrl:r.getReturnUrl()};e.continueRegistration=function(){var n={email:e.ui.email};i.registerEmail(n).then(function(){$("#email-confirmation").modal("hide");var n=document.getElementById("registrationForm");n.submit()})["catch"](function(n){n.data&&($("#email-confirmation").modal("hide"),t.$broadcast("email-registered"),n.data.modelState&&(n.data.modelState.errorCode[0]!=="1"?$("#email-error").modal("show"):$("#email-already-exists").modal("show")))})};e.CheckCaptchaV3=function(){grecaptcha.execute(u.reCaptchaVersionThreePublicKey,{action:"/MyAccount/Login"}).then(function(n){$.ajax({url:"/MyAccount/CheckCaptchaVersionThree",type:"POST",dataType:"json",data:{token:n},success:function(n){e.CaptchaSuccessProcess(n)},error:function(){return!1}})})};e.TrackRegistration=function(){f.trackRegistrationStart()};e.CaptchaSuccessProcess=function(n){n.isCaptchaValid?($("#recaptchaErrorMessage").text(""),e.continueRegistration()):(t.$broadcast("email-registered"),$("#recaptchaErrorMessage").text("Please check the box to continue"))}}])}(angular.module("ns")),function(n){var t=function(){function n(){}return n.prototype.setEmail=function(n){this.email=n},n.prototype.setStreetNotFound=function(){this.streetNotFound=!0;this.addressCleanseFail=!1},n.prototype.setAddressCleanseFail=function(){this.streetNotFound=!1;this.addressCleanseFail=!0},n.prototype.setPriorityCode=function(n){this.priorityCode=n},n}();n.RegistrationInfo=t}(ns||(ns={})),function(n){var t=function(){function t(n,t,i){this.initialData=n;this.apiService=t;this.cookieService=i;this.init()}return t.prototype.getRegistrationInfo=function(){return this.registrationInfo},t.prototype.getWeakPasswords=function(){return this.apiService.getWeakPasswords()},t.prototype.submitRegistration=function(n){return this.registrationInfo.isOmniaAccount=n==="omnia",this.registrationInfo.setPriorityCode(this.cookieService.getPriorityCodeCookie()),this.apiService.submitRegistration(this.registrationInfo)},t.prototype.registerEmail=function(n){return this.apiService.registerEmail(n)},t.prototype.isPersonalAccount=function(){return this.registrationInfo.accountType&&this.registrationInfo.accountType=="0"},t.prototype.isBusinessAccount=function(){return this.registrationInfo.accountType&&this.registrationInfo.accountType=="1"},t.prototype.isNewBuyer=function(){return this.registrationInfo.isNewBuyer===!0},t.prototype.init=function(){this.registrationInfo=new n.RegistrationInfo;this.initialData&&this.registrationInfo.setEmail(this.initialData.email)},t}();t.$inject=["initialData","apiService","cookieService"];angular.module("ns").service("registrationService",t)}(ns||(ns={})),function(n){"use strict";n.controller("registrationCtrl",["$scope","$rootScope","registrationService","addressService","navigationService","focusService","passwordValidationService","featureData","analyticsService",function(n,t,i,r,u,f,e,o,s){var l=this,c="omnia",h=this;h.registrationInfo=i.getRegistrationInfo();h.registrationCompleted=!1;h.provider="";h.ui={emailAddressIsNotUnique:!1,omniaAccountNumberIsNotUnique:!1,invalidEmail:!1,invalidAccountNumber:!1,showUserInfoForm:function(n){(n.$setSubmitted(),n.$invalid)||(h.ui.hideAccountTypeSection=!0)},cancel:function(){u.goToNewLogin()},isBusinessAccount:function(){return i.isBusinessAccount()},isPersonalAccount:function(){return i.isPersonalAccount()},isNewBuyer:function(){return i.isNewBuyer()},disableContinueButton:function(){return!(i.isPersonalAccount()||i.isBusinessAccount()&&typeof h.registrationInfo.isNewBuyer!="undefined")}};h.submitAlreadyCleansedAccount=function(n){h.registrationInfo.isAlreadyCleansed=!0;h.submitRegistration(n)};h.setOmniaProvider=function(){h.provider=c};h.submitRegistration=function(n){var e,o,a;if($("#PasswordInputWrapper").hasClass("has-error")&&(e=n.$$controls.filter(function(n){return n.$name==="password"}),h.registrationInfo.password||(h.passwordRequirementsMet=!1),e.$error={required:!0},e.$valid=!1,e.$invalid=!0,n.$invalid=!0),n.$setSubmitted(),n.$invalid){t.$broadcast("account-submitted");f.focusErrorField(n);return}o=function(n){h.registrationInfo.setStreetNotFound();h.registrationInfo.cleansedAddressInfo=n.data.resultObject.cleansedAddressInfo;$("#address-verification-account").modal("show")};a=function(){s.trackRegistrationCompleted(h.registrationInfo);h.registrationCompleted=!0;h.registrationInfo.isAlreadyCleansed===!0&&$("#address-verification-account").modal("hide");h.ui.formSubmittedSuccessfully=!0};i.submitRegistration(l.provider).then(function(n){n.data.success?r.addressCleanseIsSuccess(n.data.resultObject.addressCleanseStatus)?(a(),h.provider===c?u.goOmniaToRegistrationConfirmation():u.goToRegistrationConfirmation()):o(n):n.data.resultObject&&r.addressCleanseFailed(n.data.resultObject.addressCleanseStatus)?(h.registrationInfo.setAddressCleanseFail(),$("#address-verification-account").modal("show")):h.ui.showRegistrationError=!0;t.$broadcast("account-submitted")})["catch"](function(n){h.ui.emailAddressIsNotUnique=!1;h.ui.omniaAccountNumberIsNotUnique=!1;h.ui.invalidEmail=!1;h.ui.invalidAccountNumber=!1;n.data.modelState?n.data.modelState.errorCode.forEach(function(n){switch(n){case"1":h.ui.emailAddressIsNotUnique=!0;break;case"2":h.ui.omniaAccountNumberIsNotUnique=!0;break;case"3":h.ui.invalidEmail=!0;break;case"4":h.ui.invalidAccountNumber=!0}}):h.ui.showRegistrationError=!0;t.$broadcast("account-submitted");return})};$("#password-input").focusin(function(){setTimeout(function(){e.generatePasswordValidationHtmlContent(h.registrationInfo.password,"#password-input","#PasswordInputWrapper",h);setTimeout(function(){e.generatePasswordValidationHtmlContent(h.registrationInfo.password,"#password-input","#PasswordInputWrapper",h)},100)},100)});h.handleUnloadEvent=function(){h.registrationCompleted||s.trackRegistrationAbandon();window.removeEventListener("beforeunload",h.handleUnloadEvent)};window.addEventListener("beforeunload",h.handleUnloadEvent);n.$watch(function(){return h.registrationInfo.password},function(){h.generatePasswordValidationPopover()});h.passwordRequirementsMet=!0;h.generatePasswordValidationPopover=function(){var n=e.popoverSettings(h.registrationInfo.password,"#password-input","#PasswordInputWrapper",h);$("#password-input").popover(n)}}])}(angular.module("ns")),function(n){var t=function(){function t(n,t,i,r,u,f){this.initialData=n;this.eventsService=t;this.uiGridConstants=i;this.$filter=r;this.apiService=u;this.featureData=f;this.groups=[];this.createGroups(n.groups);this.createGroupsGridOptions();this.configureGroupsGrid()}return t.prototype.editGroup=function(n){window.location.href="/MyAccount/EditApprovers?groupId="+n.id},t.prototype.createGroups=function(t){var i=this;t.forEach(function(t){var r=new n.GroupSummaryGridModel;r.id=t.id;r.name=t.name;r.usersCount=t.usersCount;r.transactionLimit=i.getTransactionLimit(t.approvalCondition);r.approvers=i.getApprovers(t.approvers);i.groups.push(r)})},t.prototype.getApprovers=function(n){var i=this,t;return n==null?[]:(t=[],Object.keys(n).forEach(function(r){var u="Rank "+r+":";n[r].forEach(function(n){var t=n.approvalLimit!==null?i.$filter("currency")(n.approvalLimit):"No limit";u+=" "+n.name+": "+t+";"});t.push(u)}),t)},t.prototype.getTransactionLimit=function(t){return t?t.condition===n.ApproversManagementConstants.AboveSpecificAmountCondition?this.$filter("currency")(t.amount):t.condition:""},t.prototype.createGroupsGridOptions=function(){this.groupsGridOptions={appScopeProvider:this,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,onRegisterApi:function(n){this.groupsGridApi=n},enableSelectAll:!1,selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS}},t.prototype.configureGroupsGrid=function(){var n=[{name:"id",field:"id",visible:!1,enableHiding:!1},{name:"name",displayName:"Group Name",field:"name",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"transactionLimit",displayName:"Transaction Limit",field:"transactionLimit",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"approvers",displayName:"Approvers",field:"approvers",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTemplate:'<div style="padding-left: 5px; padding-top: 5px;" ng-repeat="item in row.entity[col.field]">{{item}}<\/div>',width:400},{name:"usersCount",displayName:"Users",field:"usersCount",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellClass:"text-right",width:100},{name:"actions",displayName:"Actions",cellTemplate:'<div class="ng-binding ng-scope">\n                         <button class="btn btn-link" ng-click="grid.appScope.editGroup(row.entity)">Edit<\/button>\n                       <\/div>',enableSorting:!1,enableFiltering:!1,width:100,enableHiding:!1}];this.groupsGridOptions.columnDefs=n;this.groupsGridOptions.data=this.groups},t}();t.$inject=["initialData","eventsService","uiGridConstants","$filter","apiService","featureData"];angular.module("ns").controller("approversManagementController",t)}(ns||(ns={})),function(n){"use strict";var i=function(){function n(){this.restrict="A";this.scope=!0;this.templateUrl="/js/ns/my-account/approvers-management/change-approver-modal.html";this.replace=!0}return n.instance=function(){return new n},n}(),t;angular.module("ns").directive("changeApproverModal",i.instance);t=function(){function t(t,i,r,u,f,e,o,s,h){this.apiService=t;this.$rootScope=i;this.eventsService=r;this.editGroupInfo=u;this.featureData=f;this.uiGridConstants=e;this.$templateCache=o;this.$interval=s;this.focusService=h;this.group=new n.GroupEditModel;this.isAmountDisplayed=!1;this.updatingGroupFailed=!1;this.transactionLimitPattern=/^\d{1,}(\.\d{1,2})?$/;this.selectedMembers=[];this.displayIncorrectApproverSelectionError=!1;this.isFirstRankApproverNoLimitSelected=!1;this.isSecondRankApproverNoLimitSelected=!1;this.noApprovals=!1;this.approversByRank={};this.isGroupsAdmin=!1;this.openChangeMembersModal=function(){$("#change-group-members-modal").modal("show");this.changeMembersGridApi&&this.changeMembersGridApi.grid.handleWindowResize()};this.isGroupsAdmin=u.isGroupsAdmin;u.group!=null&&(this.initializeForm(u.group),this.initializeApproversByRank(u.group))}return t.prototype.initializeForm=function(t){if(this.group=t,this.group.approvalCondition==null||this.group.approvalCondition.condition==null){this.noApprovals=!0;return}this.noApprovals=!1;this.isAmountDisplayed=this.group.approvalCondition.condition==n.ApproversManagementConstants.AboveSpecificAmountCondition;this.isFirstRankApproverNoLimitSelected=this.group.firstRankApprover.approvalLimit==null;this.isSecondRankApproverNoLimitSelected=this.group.secondRankApprover.approvalLimit==null;this.configureBuyers();this.createBuyersGridOptions();this.configureBuyersGrid();this.configureMembers();this.createMembersGridOptions();this.configureMembersGrid();this.isGroupsAdmin&&(this.createChangeMembersGridOptions(),this.configureChangeMembersGrid());this.$templateCache.put("ui-grid/selectionRowHeaderButtons",'<div class="ui-grid-selection-row-header-buttons " ng-class="{\'ui-grid-row-selected\': row.isSelected}" ><input style="margin: 0; vertical-align: middle" type="checkbox" ng-model="row.isSelected">&nbsp;<\/div>')},t.prototype.initializeApproversByRank=function(n){this.approversByRank[1]=n.firstRankApprover;this.approversByRank[2]=n.secondRankApprover},t.prototype.configureApprovals=function(){this.group.approvalCondition.condition=n.ApproversManagementConstants.NoneCondition;this.initializeForm(this.group)},t.prototype.openChangeApproverModal=function(n){this.selectedApproverRankForChange=n;this.filterAlreadySelectedApprover(n);$("#change-approver-modal").modal("show");this.buyersGridApi.grid.handleWindowResize(null);this.buyersGridApi.selection.clearSelectedRows()},t.prototype.filterAlreadySelectedApprover=function(n){var t=this;switch(n){case 1:this.buyersGridOptions.data=this.group.buyers.filter(function(n){return n.customerID!==t.approversByRank[2].id});break;case 2:this.buyersGridOptions.data=this.group.buyers.filter(function(n){return n.customerID!==t.approversByRank[1].id})}},t.prototype.noLimitChanged=function(n){switch(n){case 1:if(this.isFirstRankApproverNoLimitSelected){this.approversByRank[n].approvalLimit=null;return}break;case 2:if(this.isSecondRankApproverNoLimitSelected){this.approversByRank[n].approvalLimit=null;return}}},t.prototype.selectApprover=function(){var n=this.buyersGridApi.selection.getSelectedRows();if(n.length!==1){this.displayIncorrectApproverSelectionError=!0;return}this.displayIncorrectApproverSelectionError=!1;this.updateApprover(n[0],this.selectedApproverRankForChange);$("#change-approver-modal").modal("hide")},t.prototype.updateApprover=function(n,t){this.approversByRank[t].id=n.customerID;this.approversByRank[t].name=n.name},t.prototype.removeApprover=function(n){this.approversByRank[n].id=0;this.approversByRank[n].approvalLimit=null;this.approversByRank[n].name=null;switch(n){case 1:this.isFirstRankApproverNoLimitSelected=!0;break;case 2:this.isSecondRankApproverNoLimitSelected=!0}},t.prototype.configureBuyers=function(){this.group.buyers.forEach(function(n){n.name=n.firstName+" "+n.lastName})},t.prototype.configureMembers=function(){this.group.membersSummary.forEach(function(n){n.name=n.firstName+" "+n.lastName})},t.prototype.createBuyersGridOptions=function(){var n=this;this.buyersGridOptions={appScopeProvider:this,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,onRegisterApi:function(t){n.buyersGridApi=t},selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.WHEN_NEEDED,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS,multiSelect:!1,enableRowSelection:!0,noUnselect:!0}},t.prototype.createMembersGridOptions=function(){var n=this;this.membersGridOptions={appScopeProvider:this,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,onRegisterApi:function(t){n.membersGridApi=t},enableSelectAll:this.isGroupsAdmin,selectionRowHeaderWidth:this.isGroupsAdmin?35:0,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.WHEN_NEEDED,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS,enableRowSelection:this.isGroupsAdmin}},t.prototype.createChangeMembersGridOptions=function(){var n=this;this.changeMembersGridOptions={appScopeProvider:this,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,onRegisterApi:function(t){n.changeMembersGridApi=t;n.$interval(function(n){n.grid.handleWindowResize()},500,10,!1,n.changeMembersGridApi)},enableSelectAll:!0,selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS,enableRowSelection:!0}},t.prototype.setElligibleGroupMembers=function(){var n=this;this.changeMembersGridOptions.data=this.group.buyers.filter(function(t){return!n.group.membersSummary.some(function(n){return n.customerID==t.customerID})})},t.prototype.selectMembers=function(){var n=this.changeMembersGridApi.selection.getSelectedRows();this.updateMembers(n);$("#change-group-members-modal").modal("hide")},t.prototype.updateMembers=function(n){var t=this;_.each(n,function(n){t.group.membersSummary.unshift(n)});this.setElligibleGroupMembers()},t.prototype.removeMembers=function(){var n=this,t=this.membersGridApi.selection.getSelectedRows();_.each(t,function(t){var i=n.group.membersSummary.indexOf(t);n.group.membersSummary.splice(i,1)});this.setElligibleGroupMembers()},t.prototype.editGroup=function(n){var t=this;if(n&&(n.$setSubmitted(),n.$invalid||!this.checkTransactionLimits()||!this.checkSecondRankLimit())){this.focusService.focusErrorField(n);n.$submitted=!1;n.$valid=!1;return}this.group.memberCustomerIds=_.map(this.group.membersSummary,function(n){return n.customerID});this.apiService.updateApprovalGroup(this.group).then(function(i){t.handleResult(i,n)}).catch(function(){t.handleException();t.$rootScope.$broadcast("group-submitted")})},t.prototype.handleResult=function(n,t){n&&this.handledSuccessfullSubmit(t)},t.prototype.resetForm=function(n){n&&(n.$setPristine(),n.$submitted=!1,this.updatingGroupFailed=!1)},t.prototype.handledSuccessfullSubmit=function(){this.$rootScope.$broadcast("group-submitted");window.location.href="/MyAccount/ManageApprovers"},t.prototype.handleException=function(){this.updatingGroupFailed=!0;this.$rootScope.$broadcast("group-submitted")},t.prototype.approvalConditionChanged=function(){this.isAmountDisplayed=this.group.approvalCondition.condition==n.ApproversManagementConstants.AboveSpecificAmountCondition;this.group.approvalCondition.condition!==n.ApproversManagementConstants.AboveSpecificAmountCondition&&(this.group.approvalCondition.amount=null)},t.prototype.checkTransactionLimits=function(n){var t,i,r;return(n===void 0&&(n=null),n===null)?(t=!(!this.isFirstRankApproverNoLimitSelected&&parseFloat(this.group.firstRankApprover.approvalLimit)<parseFloat(this.group.approvalCondition.amount)),i=!(!this.isSecondRankApproverNoLimitSelected&&parseFloat(this.group.secondRankApprover.approvalLimit)<parseFloat(this.group.approvalCondition.amount)),t&&i):(r=n===1?this.isFirstRankApproverNoLimitSelected:this.isSecondRankApproverNoLimitSelected,!(!r&&parseFloat(this.approversByRank[n].approvalLimit)<parseFloat(this.group.approvalCondition.amount)))},t.prototype.checkSecondRankLimit=function(){return this.isFirstRankApproverNoLimitSelected&&!this.isSecondRankApproverNoLimitSelected?!1:this.isSecondRankApproverNoLimitSelected||parseFloat(this.approversByRank[2].approvalLimit)>=this.approversByRank[1].approvalLimit},t.prototype.configureBuyersGrid=function(){var n=[{name:"customerId",field:"customerId",visible:!1,enableHiding:!1},{name:"name",displayName:"Buyer Name",field:"name",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0},{name:"city",displayName:"City",field:"city",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0},{name:"state",displayName:"State",field:"stateCode",filter:{condition:this.uiGridConstants.filter.CONTAINS},maxWidth:65,cellTooltip:!0,headerTooltip:!0,width:60},{name:"email",displayName:"Email",field:"email",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0},{name:"phone",displayName:"Phone",field:"phone",cellFilter:"formatPhoneNumber",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0,width:120}];this.buyersGridOptions.columnDefs=n;this.buyersGridOptions.data=this.group.buyers},t.prototype.configureMembersGrid=function(){var n=[{name:"customerId",field:"customerId",visible:!1,enableHiding:!1},{name:"name",displayName:"Buyer Name",field:"name",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0},{name:"email",displayName:"Email",field:"email",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0},{name:"phone",displayName:"Phone",field:"phone",cellFilter:"formatPhoneNumber",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0}];this.membersGridOptions.columnDefs=n;this.membersGridOptions.data=this.group.membersSummary},t.prototype.configureChangeMembersGrid=function(){var n=[{name:"customerID",field:"customerID",visible:!1,enableHiding:!1},{name:"name",displayName:"Name",field:"name",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0},{name:"city",displayName:"City",field:"city",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0},{name:"state",displayName:"State",field:"stateCode",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0,width:60},{name:"email",displayName:"Email",field:"email",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0},{name:"phone",displayName:"Phone",field:"phone",cellFilter:"formatPhoneNumber",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0,width:120}];this.setElligibleGroupMembers();this.changeMembersGridOptions.columnDefs=n},t}();t.$inject=["apiService","$rootScope","eventsService","editGroupInfo","featureData","uiGridConstants","$templateCache","$interval","focusService"];n.EditGroupController=t;angular.module("ns").controller("editGroupController",t)}(ns||(ns={})),function(n){var t=function(){function n(){}return n}();n.GroupEditApproverModel=t}(ns||(ns={})),function(n){var t=function(){function n(){this.memberCustomerIds=[]}return n}();n.GroupEditModel=t}(ns||(ns={})),function(n){var u=function(){function n(){this.restrict="A";this.scope=!0;this.templateUrl="/js/ns/my-account/buyers-management/assign-shipTos-modal.html";this.replace=!0}return n.instance=function(){return new n},n}(),i,r,t;angular.module("ns").directive("assignShiptosModal",u.instance);i=function(){function n(){this.restrict="A";this.scope=!0;this.templateUrl="/js/ns/my-account/buyers-management/reset-password-confirmation-modal.html";this.replace=!0}return n.instance=function(){return new n},n}();angular.module("ns").directive("resetPasswordConfirmationModal",i.instance);r=function(){function n(){this.restrict="A";this.scope=!0;this.templateUrl="/js/ns/my-account/buyers-management/reset-password-success-modal.html";this.replace=!0}return n.instance=function(){return new n},n}();angular.module("ns").directive("resetPasswordSuccessModal",r.instance);t=function(){function t(n,t,i,r,u,f,e,o,s,h){this.initialData=n;this.eventsService=t;this.uiGridConstants=i;this.$templateCache=r;this.apiService=u;this.$scope=f;this.featureData=e;this.$interval=o;this.forgotPasswordService=s;this.$rootScope=h;this.isAssignShipTosToBuyerDisabled=!1;this.displayRequestError=!1;this.displayEditSuccess=!1;this.buyerAddress="";this.isAdminImpersonation=!1;this.pathfinder_MakeAddressBookReadOnlyFeature=!1;this.openAssignShipTosModal=function(n){var t=this;this.resetForm();this.selectedBuyer=n;this.pathfinder_MakeAddressBookReadOnlyFeature?this.apiService.getBuyerShipTos(this.selectedBuyer.customerID).then(function(n){_.each(n.data.shipTos,function(n){var i=t.shipToGridOptions.data.find(function(t){return t.customerID===n.shipToCustomerID});i&&(i.allowEdits=!n.isReadOnly,t.shipToGridApi.selection.selectRow(i))});t.getBuyerSummary();t.shipToGridApi.pagination.seek(1);$("#assign-shipTos-modal").modal("show");t.shipToGridApi.grid.handleWindowResize();t.displayRequestError=!1;t.displayEditSuccess=!1}):(this.selectedBuyer.canUpdateShippingAddresses=!0,this.getBuyerSummary(),$("#assign-shipTos-modal").modal("show"),this.shipToGridApi.pagination.seek(1),this.shipToGridApi.grid.handleWindowResize(),this.displayRequestError=!1,this.displayEditSuccess=!1)};this.loginAs=function(n){$("#ImpersonateBuyerCustomerId").val(n.customerID);$("#ImpersonateBuyerSubmitBtn").click()};this.buyers=n.buyers;this.shipTos=n.shipTos;this.userRoles=n.userRoles;this.initialData.adminImpersonatorCustomerId&&(this.isAdminImpersonation=!0);this.pathfinder_MakeAddressBookReadOnlyFeature=e.pathfinder_MakeAddressBookReadOnlyFeature;this.buyers.forEach(function(n){n.name=n.firstName+" "+n.lastName});this.shipTos.forEach(function(n){n.displayName=n.city+", "+n.stateCode;n.allowEdits=!1});this.configureBuyerGridOptions();this.configureGrid();this.configureShipTosGridOptions();this.configureShipTosGrid();this.$templateCache.put("ui-grid/selectionRowHeaderButtons",'<div class="ui-grid-selection-row-header-buttons " ng-class="{\'ui-grid-row-selected\': row.isSelected}" ><input style="margin: 0; vertical-align: middle" type="checkbox" ng-model="row.isSelected">&nbsp;<\/div>');this.$scope.forms={}}return t.prototype.configureBuyerGridOptions=function(){this.gridOptions={appScopeProvider:this,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,onRegisterApi:function(n){this.gridApi=n},enableSelectAll:!1,selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS}},t.prototype.configureShipTosGridOptions=function(){var n=this;this.shipToGridOptions={appScopeProvider:this,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,onRegisterApi:function(t){n.shipToGridApi=t},enableRowSelection:!0,enableFullRowSelection:!1,enableSelectAll:!0,selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS}},t.prototype.resetAssignBuyersModal=function(){this.isAssignShipTosToBuyerDisabled=!1},t.prototype.getBuyerSummary=function(){var n=this.selectedBuyer.companyName!=null?this.selectedBuyer.companyName+", ":"";this.buyerAddress=this.selectedBuyer.name+", "+n+this.selectedBuyer.street1+", "+this.selectedBuyer.postcode},t.prototype.submitShipTos=function(){var t=this,r=this.shipToGridApi.selection.getSelectedRows(),i;this.isAssignShipTosToBuyerDisabled=!0;i={customerId:this.selectedBuyer.customerID,shipTosBuyerAssignments:_.map(r,function(t){var i=new n.ShipTosBuyerAssignment;return i.shipToCustomerId=t.customerID,i.shipToDisplayName=t.displayName,i.isReadOnly=!t.allowEdits,i})};this.apiService.assignShipTosToBuyer(i).then(function(){t.isAssignShipTosToBuyerDisabled=!1;$("#assign-shipTos-modal").modal("hide");t.displayEditSuccess=!0;t.resetForm()}).catch(function(){t.isAssignShipTosToBuyerDisabled=!1;$("#assign-shipTos-modal").modal("hide");t.displayRequestError=!0;t.resetForm()})},t.prototype.resetForm=function(){this.shipToGridApi.selection.clearSelectedRows();this.shipToGridApi.pagination.seek(1);this.$scope.forms.selectShipTosForm&&(this.$scope.forms.selectShipTosForm.$setPristine(),this.$scope.forms.selectShipTosForm.$submitted=!1,this.shipTos.forEach(function(n){n.displayName=n.city+", "+n.stateCode;n.allowEdits=!1}))},t.prototype.isBuyersAdmin=function(){return this.userRoles.includes("ManageBuyers")},t.prototype.isShipToAdmin=function(){return this.userRoles.includes("ManageShipTos")},t.prototype.configureGrid=function(){var n='<div class="ng-binding ng-scope">\n                            {{Edit}} <button class="btn btn-link" ng-click="grid.appScope.openAssignShipTosModal(row.entity)">Assign Ship Tos<\/button> {{LoginAsPlaceholder}} {{ResetPassword}}\n                       <\/div>',t;this.isBuyersAdmin()&&(n=n.replace("{{Edit}}",'<button class="btn btn-link" ng-click="grid.appScope.editBuyer(row)">Edit<\/button>').replace("{{LoginAsPlaceholder}}",this.isAdminImpersonation?"":'<button class="btn btn-link" ng-click="grid.appScope.loginAs(row.entity)">Login As<\/button>').replace("{{ResetPassword}}",'<button class="btn btn-link" ng-click="grid.appScope.openResetPasswordModal(row.entity)">Reset Password<\/button>'));this.pathfinder_MakeAddressBookReadOnlyFeature&&this.isShipToAdmin()&&(n=n.replace("{{Edit}}",'<button class="btn btn-link" ng-click="grid.appScope.editBuyer(row)">Edit<\/button>'));t=[{name:"customerId",field:"customerId",visible:!1,enableHiding:!1},{name:"name",displayName:"Name",field:"name",filter:{condition:this.uiGridConstants.filter.CONTAINS},minWidth:115,cellTooltip:!0,headerTooltip:!0},{name:"street",displayName:"Street",field:"street1",filter:{condition:this.uiGridConstants.filter.CONTAINS},minWidth:115,cellTooltip:!0,headerTooltip:!0},{name:"city",displayName:"City",field:"city",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0},{name:"state",displayName:"State",field:"stateCode",filter:{condition:this.uiGridConstants.filter.CONTAINS},maxWidth:65,cellTooltip:!0,headerTooltip:!0},{name:"zipcode",displayName:"ZipCode",field:"postcode",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0,cellClass:"text-right"},{name:"email",displayName:"Email",field:"email",filter:{condition:this.uiGridConstants.filter.CONTAINS},minWidth:135,cellTooltip:!0,headerTooltip:!0},{name:"phone",displayName:"Phone",field:"phone",cellFilter:"formatPhoneNumber",filter:{condition:this.uiGridConstants.filter.CONTAINS},maxWidth:100,cellTooltip:!0,headerTooltip:!0},{name:"actions",displayName:"Actions",cellTemplate:n,enableFiltering:!1,minWidth:this.isBuyersAdmin()?350:60,enableHiding:!1}];this.gridOptions.columnDefs=t;this.gridOptions.data=this.buyers},t.prototype.configureShipTosGrid=function(){var n=[{name:"customerId",field:"customerId",visible:!1,enableHiding:!1},{name:"displayName",displayName:"Display Name",field:"displayName",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"street",displayName:"Street",field:"street1",filter:{condition:this.uiGridConstants.filter.CONTAINS},width:170},{name:"city",displayName:"City",field:"city",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"state",displayName:"State",field:"stateCode",filter:{condition:this.uiGridConstants.filter.CONTAINS},maxWidth:65},{name:"zipcode",displayName:"ZipCode",field:"postcode",cellClass:"text-right",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"phone",displayName:"Daytime Phone",field:"phone",cellFilter:"formatPhoneNumber",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"hasAllowEdits",displayName:"Allow Edits",field:"allowEdits",cellTemplate:'<div class="ui-grid-cell-contents" >\n                           <input style="margin: 0; vertical-align: middle" type="checkbox" ng-model="row.entity.allowEdits" ng-disabled="!grid.appScope.selectedBuyer.canUpdateShippingAddresses">\n                       <\/div>',cellTooltip:!0,headerTooltip:!0,enableSorting:!1,enableFiltering:!1,width:60,enableHiding:!1}];this.shipToGridOptions.columnDefs=n;this.shipToGridOptions.data=this.shipTos},t.prototype.editBuyer=function(n){window.location.href="/MyAccount/EditBuyer?buyerId="+n.entity.customerID},t.prototype.openResetPasswordModal=function(n){this.selectedBuyer=n;$("#reset-password-confirmation-modal").modal("show")},t.prototype.resetPassword=function(){var n=this;return this.forgotPasswordService.forgotPassword(this.selectedBuyer.email).then(function(){n.eventsService.trigger(events.ForgotPasswordEvents.PasswordForgot);$("#reset-password-confirmation-modal").modal("hide");$("#reset-password-success-modal").modal("show");n.$rootScope.$broadcast("password-reset")}).catch(function(){n.eventsService.trigger(events.ForgotPasswordEvents.PasswordForgot);n.$rootScope.$broadcast("password-reset")})},t}();t.$inject=["initialData","eventsService","uiGridConstants","$templateCache","apiService","$scope","featureData","$interval","forgotPasswordService","$rootScope"];angular.module("ns").controller("buyersManagementController",t)}(ns||(ns={})),function(n){"use strict";var t,i;(function(n){n[n.FullMatch=0]="FullMatch";n[n.MinorChanges=1]="MinorChanges";n[n.StreetNotFound=2]="StreetNotFound";n[n.GeneralFailure=3]="GeneralFailure";n[n.TaxJurisdictionFailure=4]="TaxJurisdictionFailure"})(t||(t={}));i=function(){function n(n,t,i,r,u,f){this.initialData=n;this.apiService=t;this.$rootScope=i;this.$timeout=r;this.editBuyerInfo=u;this.featureData=f;this.buyerInfo={customerID:"",email:"",firstName:"",lastName:"",canUpdateShippingAddresses:!0,street1:"",street2:"",city:"",stateCode:"",zipCode:"",phone:""};this.isLoading=!1;this.emailPattern=/^([A-Za-z0-9/'_\-\.\+])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,18})$/;this.emailAddressIsNotUnique=!1;this.addressCleanseFail=!1;this.streetNotFound=!1;this.pathfinder_MakeAddressBookReadOnlyFeature=!1;this.shipToAdminReadOnlyBuyer=!1;this.userRoles=this.initialData.userRoles;u!=null&&this.mapBuyerInfo(u);this.pathfinder_MakeAddressBookReadOnlyFeature=this.featureData.pathfinder_MakeAddressBookReadOnlyFeature;this.shipToAdminReadOnlyBuyer=this.pathfinder_MakeAddressBookReadOnlyFeature&&this.isShipToAdmin()&&!this.isBuyersAdmin()}return n.prototype.createBuyer=function(){var n=this;this.emailAddressIsNotUnique=!1;this.initialEmail!==this.buyerInfo.email?this.apiService.registerEmail(this.buyerInfo).then(function(){n.submitBuyer()})["catch"](function(t){if(t.data.modelState&&t.data.modelState.errorCode[0]=="1"){n.emailAddressIsNotUnique=!0;n.$rootScope.$broadcast("account-submitted");return}}):this.submitBuyer()},n.prototype.submitBuyer=function(){var n=this;this.emailAddressIsNotUnique||this.apiService.cleanseAddress(this.buyerInfo).then(function(i){if(i.data){n.cleansedAddressInfo=i.data.cleansedAddress;switch(i.data.addressCleanseStatus){case t.FullMatch||t.MinorChanges:n.addressCleanseFail=!1;n.streetNotFound=!1;case t.StreetNotFound:n.addressCleanseFail=!1;n.streetNotFound=!0;$("#address-verification-buyer").modal("show");break;default:n.addressCleanseFail=!0;n.streetNotFound=!1;$("#address-verification-buyer").modal("show")}if(n.addressCleanseFail||n.streetNotFound){$("#address-verification-buyer").modal("show");n.$rootScope.$broadcast("account-submitted");return}n.apiService.createBuyer(n.buyerInfo).then(function(t){t.data.success&&(n.$rootScope.$broadcast("account-submitted"),window.location.href="/MyAccount/ManageBuyers")})}})},n.prototype.submitAlreadyCleansedBuyer=function(){var n=this;this.apiService.createBuyer(this.buyerInfo).then(function(t){t.data.success&&(n.$rootScope.$broadcast("account-submitted"),window.location.href="/MyAccount/ManageBuyers")})},n.prototype.useSoldToAddress=function(){var n=this;this.isLoading=!0;this.apiService.getSoldToAddress().then(function(t){n.buyerInfo.street1=t.data.street1;n.buyerInfo.street2=t.data.street2;n.buyerInfo.city=t.data.city;n.buyerInfo.stateCode=t.data.stateCode;n.buyerInfo.zipCode=t.data.zipCode}).finally(function(){return n.isLoading=!1})},n.prototype.mapBuyerInfo=function(n){this.buyerInfo.customerID=n.buyer.customerID;this.buyerInfo.email=n.buyer.email;this.initialEmail=n.buyer.email;this.buyerInfo.firstName=n.buyer.firstName;this.buyerInfo.lastName=n.buyer.lastName;this.buyerInfo.canUpdateShippingAddresses=n.buyer.canUpdateShippingAddresses;this.buyerInfo.street1=n.buyer.street1;this.buyerInfo.street2=n.buyer.street2;this.buyerInfo.city=n.buyer.city;this.buyerInfo.stateCode=n.buyer.stateCode;this.buyerInfo.zipCode=n.buyer.postCode;this.buyerInfo.phone=n.buyer.phone?n.buyer.phone.substring(0,3)+"-"+n.buyer.phone.substring(3,6)+"-"+n.buyer.phone.substring(6,11):""},n.prototype.isShipToAdmin=function(){return this.userRoles.includes("ManageShipTos")},n.prototype.isBuyersAdmin=function(){return this.userRoles.includes("ManageBuyers")},n}();i.$inject=["initialData","apiService","$rootScope","$timeout","editBuyerInfo","featureData"];n.CreateEditBuyerController=i;angular.module("ns").controller("CreateEditBuyerController",i)}(ns||(ns={})),function(n){var t=function(){function n(){}return n}();n.ShipTosBuyerAssignment=t}(ns||(ns={})),function(n){var t=function(){function n(){this.showErrorMessage=!1;this.showChangedEmailSuccessfullyMessage=!1;this.showChangedPasswordSuccessfullyMessage=!1}return n.prototype.setShowChangedEmailSuccessfullyMessage=function(){this.showChangedEmailSuccessfullyMessage=!0;this.showErrorMessage=!1;this.showChangedPasswordSuccessfullyMessage=!1},n.prototype.setShowErrorMessage=function(){this.showErrorMessage=!0;this.showChangedEmailSuccessfullyMessage=!1;this.showChangedPasswordSuccessfullyMessage=!1},n.prototype.setShowChangedPasswordSuccessfullyMessage=function(){this.showChangedPasswordSuccessfullyMessage=!0;this.showErrorMessage=!1;this.showChangedEmailSuccessfullyMessage=!1},n}();n.ChangeEmailAndPassword=t}(ns||(ns={})),function(n){"use strict";n.factory("changeEmailAndPasswordService",["apiService","modelsFactory","pageErrorsService","focusService","featureData","userService",function(n,t,i,r,u,f){var e=t.createChangeEmailAndPassword();return{changeEmail:function(t){return n.changeEmail(t).then(function(n){return(r.focusElement("changelogin"),n.data.success)?(e.setShowChangedEmailSuccessfullyMessage(),$("#updateEmailConfirmation").modal(),n):(e.setShowErrorMessage(),i.clear(),n.data.errors[0].errorCode===1)?(i.add(i.errors.EmailIsNotUnique),n):n.data.errors[0].errorCode===2?(i.add(i.errors.PasswordIsNotCorrect),n):void 0})},changePassword:function(t){var u=f.user.isEmployeeUser?n.changeEmployeePassword(t):n.changePassword(t);return u.then(function(n){return(r.focusElement("changelogin"),n.data.success)?(e.setShowChangedPasswordSuccessfullyMessage(),n):(e.setShowErrorMessage(),i.clear(),i.add(i.errors.PasswordIsNotCorrect),n)})},changePasswordOnLogIn:function(t){return n.changePasswordFromLogIn(t).then(function(n){return n.data.result.Success?(window.location.href=n.data.returnUrl?n.data.returnUrl:"/",n):(e.setShowErrorMessage(),i.clear(),i.add(i.errors.PasswordIsNotCorrect),n)})},showChangedEmailSuccessfullyMessage:function(){return e.showChangedEmailSuccessfullyMessage},setErrorMessage:function(n){i.clear();i.add(n);e.setShowErrorMessage()},showErrorMessage:function(){return e.showErrorMessage},showChangedPasswordSuccessfullyMessage:function(){return e.showChangedPasswordSuccessfullyMessage}}}])}(angular.module("ns")),function(n){"use strict";n.controller("changeEmailAndPasswordCtrl",["$rootScope","$scope","changeEmailAndPasswordService","pageErrorsService","navigationService","passwordValidationService","dateService","focusService","userService",function(n,t,i,r,u,f,e,o,s){var c=this,h=this;h.ui={passwordChangeRequiredDeadLine:new Date(2020,9,1),changeEmailInfo:{},changePassInfo:{passwordRequirementsMet:!0,generatePasswordValidationPopover:function(){var n=f.popoverSettings(h.ui.changePassInfo.newPassword,"#new-password","#newPassword",h.ui.changePassInfo,!0);$("#new-password").popover(n)}},isEmployeeUser:s.user.isEmployeeUser,showErrorMessage:i.showErrorMessage,showChangedEmailSuccessfullyMessage:i.showChangedEmailSuccessfullyMessage,showChangedPasswordSuccessfullyMessage:i.showChangedPasswordSuccessfullyMessage,goToAccountOverview:function(){u.goToAccountOverview()},getError:function(){return r.pageErrors[0]},changeEmail:function(t){return(t.$setSubmitted(),t.$invalid)?(t.$submitted=!0,n.$broadcast("login-updated"),null):i.changeEmail(c.ui.changeEmailInfo).then(function(t){t.data.success&&(this.ui.newEmail=this.ui.changeEmailInfo.newEmail);n.$broadcast("login-updated")})["catch"](function(){n.$broadcast("login-updated")})},changePassword:function(t){if($("#PasswordInputWrapper").hasClass("has-error")){var r=t.$$controls.filter(function(n){return n.$name==="password"});h.ui.changePassInfo.password||(h.ui.changePassInfo.passwordRequirementsMet=!1);r.$error={required:!0};r.$valid=!1;r.$invalid=!0}return(t.$setSubmitted(),t.$invalid)?(t.$submitted=!0,n.$broadcast("password-updated"),null):i.changePassword(c.ui.changePassInfo).then(function(){n.$broadcast("password-updated")})["catch"](function(t){i.setErrorMessage(t.data.message);n.$broadcast("password-updated")})},changePasswordFromLogIn:function(t){if($("#newPassword").hasClass("has-error")){var r=t.$$controls.filter(function(n){return n.$name==="password"});h.ui.changePassInfo.password||(h.ui.changePassInfo.passwordRequirementsMet=!1);r.$error={required:!0};r.$valid=!1;r.$invalid=!0}return(t.$setSubmitted(),t.$invalid||!h.ui.changePassInfo.passwordRequirementsMet)?(t.$submitted=!0,n.$broadcast("password-updated"),null):i.changePasswordOnLogIn(c.ui.changePassInfo).then(function(){n.$broadcast("password-updated");$("#updatePassword").modal("hide")})["catch"](function(){n.$broadcast("password-updated")})},passwordChangeRequired:function(){var n=e.getCurrentDate();return n.getTime()>h.ui.passwordChangeRequiredDeadLine.getTime()}};t.$watch(function(){return h.ui.changePassInfo.newPassword},function(){h.ui.changePassInfo.generatePasswordValidationPopover()});$("#new-password").focusin(function(){setTimeout(function(){f.generatePasswordValidationHtmlContent(h.ui.changePassInfo.newPassword,"#new-password","#newPassword",h.ui.changePassInfo);setTimeout(function(){f.generatePasswordValidationHtmlContent(h.ui.changePassInfo.newPassword,"#new-password","#newPassword",h.ui.changePassInfo)},100)},100)})}])}(angular.module("ns")),function(){"use strict";var n=function(){function n(){this.restrict="A";this.scope={displayIncorrectSelectionError:"=",selectMembersFn:"&",gridOptions:"=",gridApi:"="};this.templateUrl="/js/ns/my-account/common/change-group-members-modal.html";this.replace=!0}return n.instance=function(){return new n},n}();angular.module("ns").directive("changeGroupMembersModal",n.instance)}(ns||(ns={})),function(n){var t=function(){function n(n){this.abandonedCartReminders=n.abandonedCartReminders;this.catalogMailers=n.catalogMailers;this.emailSpecials=n.emailSpecials;this.nameRenting=n.nameRenting;this.newsletters=n.newsletters;this.orderShipConfirmations=n.orderShipConfirmations;this.phone=n.phone;this.productReviews=n.productReviews;this.survey=n.survey;this.preferencesList=this.returnPreferencesList();this.showErrorMessage=!1;this.showChangedPreferencesSuccessfullyMessage=!1;this.emailAddress=n.emailAddress;this.privacyManagementRequests=n.privacyManagementRequests}return n.prototype.setShowChangedPreferencesSuccessfullyMessage=function(){this.showChangedPreferencesSuccessfullyMessage=!0;this.showErrorMessage=!1},n.prototype.setShowErrorMessage=function(){this.showErrorMessage=!0;this.showChangedPreferencesSuccessfullyMessage=!1},n.prototype.clearMessages=function(){this.showErrorMessage=!1;this.showChangedPreferencesSuccessfullyMessage=!1},n.prototype.returnPreferencesList=function(){return{abandonedCartReminders:["Receive All","Receive None"],emailSpecials:["Receive All","Once a Week","Twice a Week","Bi-Weekly","Quarterly","Monthly","Receive None"],orderShipConfirmations:["Receive All","Order Confirmation Only","Shipping Confirmation Only","Receive None"],newsletters:["Receive All","Receive None"],productReviews:["Receive All","Receive None"],survey:["Receive All","Receive None"],catalogMailers:["Receive All","Catalog Only","Monthly","Quarterly","Receive None"],phone:["Yes","No","Account Manager Only"]}},n}();n.ContactPreferences=t}(ns||(ns={})),function(n){var t=function(){function n(n,t,i,r){this.$q=n;this.apiService=t;this.modelsFactory=i;this.initialPreferences=r;this.contactPreferences=i.createContactPreferences(r)}return n.prototype.savePreferences=function(n){var i=this,t=this.$q.defer();return this.contactPreferences.clearMessages(),this.apiService.changeContactPreferences(n).then(function(n){return n.data.success?(i.contactPreferences.setShowChangedPreferencesSuccessfullyMessage(),t.resolve(!0)):(i.contactPreferences.setShowErrorMessage(),t.resolve(!1)),t.promise})},n.prototype.savePreferencesByEmail=function(n){var i=this,t=this.$q.defer();return this.contactPreferences.clearMessages(),this.apiService.changeContactPreferencesByEmail(n).then(function(n){return n.data.success?(i.contactPreferences.setShowChangedPreferencesSuccessfullyMessage(),t.resolve(!0)):(i.contactPreferences.setShowErrorMessage(),t.resolve(!1)),t.promise})},n.prototype.showChangedPreferencesSuccessfullyMessage=function(){return this.contactPreferences.showChangedPreferencesSuccessfullyMessage},n.prototype.showPrivacyManagementRequests=function(){return this.contactPreferences.privacyManagementRequests.optOutFromCommunications||this.contactPreferences.privacyManagementRequests.generalInformation||this.contactPreferences.privacyManagementRequests.specificInformation||this.contactPreferences.privacyManagementRequests.requestToDelete||this.contactPreferences.privacyManagementRequests.doNotSellInformation},n.prototype.showErrorMessage=function(){return this.contactPreferences.showErrorMessage},n}();t.$inject=["$q","apiService","modelsFactory","initialPreferences"];n.ContactPreferencesService=t;angular.module("ns").service("contactPreferencesService",t)}(ns||(ns={})),function(){var n=function(){function n(n,t,i,r,u,f,e){this.eventsService=n;this.contactPreferencesService=t;this.focusService=i;this.addressService=r;this.userService=u;this.privacyManagementService=f;this.analyticsService=e;this.preferences=this.contactPreferencesService.contactPreferences;this.mailingAddress=this.addressService.mailingAddress;this.eventsService.on(events.AddressesEvents.MailingAddressSaved,this.updateMailingAddress.bind(this));setInterval(this.isModalHidden.bind(this),3e3)}return n.prototype.savePreferences=function(){var n=this;return this.analyticsService.trackEmailSignUp(this.preferences),this.analyticsService.trackEvent({name:"trackEvent",pageType:"Email",action:"Opt Out"}),this.contactPreferencesService.savePreferences(this.preferences).then(function(){n.focusService.focusElement("contact-preferences-header")})},n.prototype.submitPrivacyHubRequest=function(){return this.privacyManagementService.submitRequests(this.preferences.privacyManagementRequests).then(function(){$("#privacyManagementRequests").modal("show")})},n.prototype.savePreferencesByEmail=function(n){var t=this;if(this.analyticsService.trackEmailSignUp(this.preferences),this.analyticsService.trackEvent({name:"trackEvent",pageType:"Email",action:"Opt Out"}),n.$setSubmitted(),n.$invalid){this.eventsService.trigger(events.MyAccountEvents.ContactUpdated);return}return this.contactPreferencesService.savePreferencesByEmail(this.preferences).then(function(){t.focusService.focusElement("contact-preferences-header");t.eventsService.trigger(events.MyAccountEvents.ContactUpdated)}).catch(function(){t.eventsService.trigger(events.MyAccountEvents.ContactUpdated)})},n.prototype.showErrorMessage=function(){return this.contactPreferencesService.showErrorMessage()},n.prototype.showChangedPreferencesSuccessfullyMessage=function(){return this.contactPreferencesService.showChangedPreferencesSuccessfullyMessage()},n.prototype.showPrivacyManagementRequests=function(){return this.contactPreferencesService.showPrivacyManagementRequests()},n.prototype.editMailingAddress=function(n){this.addressService.reloadMailingAddress();this.mailingAddressNeedsUpdate=!0;$(n).modal("show")},n.prototype.isPersonal=function(){return this.userService.user.isPersonal()},n.prototype.isModalHidden=function(){var n=$("body").data("open-modals")===0;return n&&this.mailingAddressNeedsUpdate&&(this.reloadMailingAddress(),this.mailingAddressNeedsUpdate=!1),n},n.prototype.updateMailingAddress=function(n,t){var i=t[0][0];i&&this.reloadMailingAddress()},n.prototype.reloadMailingAddress=function(){this.addressService.reloadMailingAddress();this.mailingAddress=this.addressService.mailingAddress},n}();n.$inject=["eventsService","contactPreferencesService","focusService","addressService","userService","privacyManagementService","analyticsService"];angular.module("ns").controller("contactPreferencesController",n)}(ns||(ns={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var u=function(){function n(){this.id=null;this.employeeGuid=null;this.firstName=null;this.lastName=null;this.email=null;this.employeeNumber=null;this.createdOn=null;this.internalNotes=null}return n}(),t,i,r;n.EmployeeGrid=u;t=function(){function n(){this.metaData={};this.employeeNumber=null;this.buyerAccountNumber=null;this.id=null;this.email=null;this.firstName=null;this.lastName=null;this.internalNotes=null;this.isActive=!0;this.employeeGuid=null;this.managerId=null}return n}();n.EmployeeModel=t;i=function(n){function t(){var t=n.call(this)||this;return t.isCreate=!0,t}return __extends(t,n),t}(t);n.EmployeeRequestModel=i;r=function(){function n(){}return n}();n.EmployeeHistory=r}(ns||(ns={}));__assign=this&&this.__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},function(n){var t=function(){function t(t,i,r,u,f,e,o){var s=this;this.initialData=t;this.uiGridConstants=i;this.$scope=r;this.apiService=u;this.$rootScope=f;this.employeeResetPasswordService=e;this.featureData=o;this.filters=[];this.employees=[];this.employee=new n.EmployeeModel;this.employeeHistory=[];this.employeeIsActiveStatus={active:{key:String(!0),value:"Active"},inactive:{key:String(!1),value:"Inactive"}};this.pagination={pageNumber:1,pageSize:10};this.voucher_DisplayEmployeesStatusColumn=!1;this.voucher_DisplayEmployeesStatusColumn=o.voucher_DisplayEmployeesStatusColumn;this.submitFailed=!1;this.errorMessage="";this.createEmployeesGridOptions();this.configureEmployeesGridColumns();this.$scope.$on("manager-selected",function(n,t){return s.selectManager(t)});this.$scope.$on("buyer-account-selected",function(n,t){return s.selectBuyerAccount(t)});t.employeeHistory&&(this.employeeHistory=t.employeeHistory,this.createEmployeeHistoryGridOptions(),this.configureEmployeeHistoryGridColumns())}return t.prototype.createEmployeesGridOptions=function(){var n=this;this.employeesGridOptions={appScopeProvider:this,enableFiltering:!0,enableGridMenu:!0,useExternalFiltering:!0,enableSorting:!1,paginationPageSizes:[10,20,30,100],paginationPageSize:10,useExternalPagination:!0,onRegisterApi:function(t){n.gridApi=t;n.gridApi.pagination.on.paginationChanged(n.$scope,function(t,i){n.pagination.pageSize=i;n.pagination.pageNumber=t;n.getEmployees()});n.gridApi.core.on.filterChanged(n.$scope,function(){n.filters=n.gridApi.grid.columns.map(function(n){return{field:n.field,operator:"contains",value:n.filters[0].term}}).filter(function(n){return n.value!=null&&n.value!=undefined&&n.value!==""});n.filters.length==0?n.getEmployees():(clearTimeout(n.filterTimeout),n.filterTimeout=setTimeout(function(){n.getEmployees()},1e3))})},selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.WHEN_NEEDED,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS,data:this.employees}},t.prototype.createEmployeeHistoryGridOptions=function(){var n=this;this.employeeHistoryGridOptions={appScopeProvider:this,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,onRegisterApi:function(t){n.gridApi=t},enableSelectAll:!0,selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.WHEN_NEEDED,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS,data:this.employeeHistory}},t.prototype.configureEmployeesGridColumns=function(){var n='<div class="ng-binding ng-scope"><button ng-click="grid.appScope.editEmployee(row)" class="btn btn-link">Edit<\/button>{{loginAsPlaceholder}}<button ng-click="grid.appScope.resetEmployeePassword(row)" class="btn btn-link">Reset Password<\/button><\/div>',t;this.voucher_DisplayEmployeesStatusColumn?(n=n.replace("{{loginAsPlaceholder}}",'<button ng-disabled="row.entity.isActive === false" ng-click="grid.appScope.impersonateEmployee(row)" class="btn btn-link">Login As<\/button>'),t=this.getEmployeeGridColumnsV2(n),this.employeesGridOptions.columnDefs=t,this.employeesGridOptions.data=this.employees):(n=n.replace("{{loginAsPlaceholder}}",'<button ng-click="grid.appScope.impersonateEmployee(row)" class="btn btn-link">Login As<\/button>'),t=this.getEmployeeGridColumns(n),this.employeesGridOptions.columnDefs=t,this.employeesGridOptions.data=this.employees)},t.prototype.configureEmployeeHistoryGridColumns=function(){var n=[{name:"date",displayName:"Change Date",field:"date",type:"date",cellFilter:"date:'MM/dd/yyyy hh:mm.ss a'",filter:{condition:function(n,t){var i=new Date(t).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"numeric"}),r=n.replace(/\\/g,"");return i.indexOf(r)!==-1}}},{name:"field",displayName:"Field",field:"field"},{name:"oldValue",displayName:"Old Value",field:"oldValue"},{name:"newValue",displayName:"New Value",field:"newValue"},{name:"changedBy",displayName:"Changed By",field:"changedBy"}];this.employeeHistoryGridOptions.columnDefs=n;this.employeeHistoryGridOptions.data=this.employeeHistory},t.prototype.editEmployee=function(n){window.location.href="/MyAccount/CreateEditEmployee?guid="+n.entity.employeeGuid},t.prototype.resetEmployeePassword=function(t){var i=new n.EmployeeModel;i.employeeGuid=t.entity.employeeGuid;i.firstName=t.entity.firstName;i.lastName=t.entity.lastName;this.employeeResetPasswordService.setEmployee(i);$("#employee-reset-password-modal").modal("show")},t.prototype.getEmployees=function(){var n=this;this.loadingEmployees=!0;this.apiService.getEmployeesPaginated({page:this.pagination.pageNumber,pageSize:this.pagination.pageSize,filter:{filters:this.filters}}).then(function(t){n.employees=t.data.employees;n.employeesGridOptions.data=t.data.employees;n.employeesGridOptions.totalItems=t.data.total;n.loadingEmployees=!1})},t.prototype.displayStatus=function(n){return n.entity.isActive?this.employeeIsActiveStatus.active.value:this.employeeIsActiveStatus.inactive.value},t.prototype.initializeData=function(n,t,i){var r=this;n.forEach(function(n){return r.employee.metaData[n.Id]=""});this.isCreate=t;i!=null&&this.mapEmployee(i)},t.prototype.mapEmployee=function(n){this.employee.buyerAccountNumber=n.BuyerAccountNumber;this.employee.employeeGuid=n.EmployeeGuid;this.employee.employeeNumber=n.EmployeeNumber;this.employee.email=n.Email;this.employee.firstName=n.FirstName;this.employee.lastName=n.LastName;this.employee.id=n.Id;this.employee.isActive=n.IsActive;this.employee.managerId=n.ManagerId;this.processMetadata(n.MetaData);this.employee.internalNotes=n.InternalNotes;this.managerName=n.ManagerName;var t=this.initialData.buyerAccounts.find(function(t){return t.accountNumber===n.BuyerAccountNumber});t&&(this.buyerAccountName=t.firstName+" "+t.lastName)},t.prototype.processMetadata=function(n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(this.employee.metaData[t]=n[t])},t.prototype.impersonateEmployee=function(n){this.apiService.loginAsEmployee(n.entity.employeeGuid).then(function(){window.location.href="/Employee/VoucherHub"})},t.prototype.openManagersModal=function(){$("#managers-modal").modal("show")},t.prototype.selectManager=function(n){this.employee.managerId=n.id;this.managerName=n.firstName+" "+n.lastName;$("#managers-modal").modal("hide")},t.prototype.removeManager=function(){this.managerName=null;this.employee.managerId=null},t.prototype.openBuyerAccountModal=function(){$("#employee-buyer-account-modal").modal("show")},t.prototype.selectBuyerAccount=function(n){this.employee.buyerAccountNumber=n.accountNumber;this.buyerAccountName=n.name;$("#employee-buyer-account-modal").modal("hide")},t.prototype.removeBuyerAccount=function(){this.buyerAccountName=null;this.employee.buyerAccountNumber=null},t.prototype.submitEmployee=function(n){var t=this;n&&n.$invalid||(this.errorMessage="",this.submitFailed=!1,this.apiService.addEditEmployee(__assign({},this.employee,{isCreate:this.isCreate})).then(function(){n.$setPristine();n.$submitted=!1;t.submitFailed=!1;t.errorMessage="";t.$rootScope.$broadcast("employee-submitted");window.location.href="/MyAccount/ManageEmployees"}).catch(function(n){t.errorMessage=n.status===400&&n.data?n.data.errors.map(function(n){return n.message}).join("; "):"We're sorry, there was an error processing your request";t.submitFailed=!0;t.$rootScope.$broadcast("employee-submitted")}))},t.prototype.showErrorMessage=function(){return this.employeeResetPasswordService.showErrorMessage()},t.prototype.showEmployeePasswordResetSuccessfully=function(){return this.employeeResetPasswordService.showResetPasswordSuccessfulMessage()},t.prototype.getEmployeeGridColumns=function(n){return[{name:"id",field:"id",visible:!1,enableHiding:!1},{name:"employeeGuid",field:"employeeGuid",visible:!1},{name:"firstName",displayName:"First Name",field:"firstName"},{name:"lastName",displayName:"Last Name",field:"lastName"},{name:"email",displayName:"Email",field:"email"},{name:"employeeNumber",displayName:"Employee Number",field:"employeeNumber",cellClass:"text-right"},{name:"createdOn",displayName:"Created Date",field:"createdOn",type:"date",cellFilter:"date:'MM/dd/yyyy'"},{name:"internalNotes",displayName:"Notes",field:"internalNotes"},{name:"actions",displayName:"Actions",cellTemplate:n,enableHiding:!1,enableFiltering:!1,width:220}]},t.prototype.getEmployeeGridColumnsV2=function(n){return[{name:"id",field:"id",visible:!1,enableHiding:!1},{name:"employeeGuid",field:"employeeGuid",visible:!1},{name:"firstName",displayName:"First Name",field:"firstName"},{name:"lastName",displayName:"Last Name",field:"lastName"},{name:"email",displayName:"Email",field:"email"},{name:"employeeNumber",displayName:"Employee Number",field:"employeeNumber",cellClass:"text-right"},{name:"createdOn",displayName:"Created Date",field:"createdOn",type:"date",cellFilter:"date:'MM/dd/yyyy'"},{name:"internalNotes",displayName:"Notes",field:"internalNotes"},{name:"isActive",displayName:"Status",field:"isActive",cellTemplate:'<div style="padding-left: 5px; padding-top: 5px;">{{grid.appScope.displayStatus(row)}}<\/div>',filter:{type:this.uiGridConstants.filter.SELECT,selectOptions:[{value:this.employeeIsActiveStatus.active.key,label:this.employeeIsActiveStatus.active.value},{value:this.employeeIsActiveStatus.inactive.key,label:this.employeeIsActiveStatus.inactive.value}]}},{name:"actions",displayName:"Actions",cellTemplate:n,enableHiding:!1,enableFiltering:!1,width:220}]},t}();t.$inject=["initialData","uiGridConstants","$scope","apiService","$rootScope","employeeResetPasswordService","featureData"];angular.module("ns").controller("employeesManagementController",t)}(ns||(ns={})),function(n){var i=function(){function n(){this.restrict="A";this.scope=!0;this.templateUrl="/js/ns/my-account/employees-management/employee-address/add-edit-employee-address-modal.html";this.replace=!0}return n.instance=function(){return new n},n}(),t;angular.module("ns").directive("addEditEmployeeAddressModal",i.instance);t=function(){function t(t,i,r,u,f,e,o){this.initialData=t;this.uiGridConstants=i;this.addressService=r;this.eventsService=u;this.apiService=f;this.$rootScope=e;this.focusService=o;this.addresses=[];this.address=new n.ShippingAddress;this.modalTitle="";this.submitFailed=!1;this.deleteFailed=!1;this.createGridOptions();this.configureGridColumns();this.addressService.setEmployeeGuid(t.employeeGuid);this.loadingAddresses=!1;this.eventsService.on(events.AddressesEvents.SubmitCleansedAddress,this.submitAlreadyCleansedShipToAddress.bind(this))}return t.prototype.submitAlreadyCleansedShipToAddress=function(t,i){(!i||i[0][0]&&i[0][0]instanceof n.ShippingAddress)&&(this.address.isAlreadyCleansed=!0,this.address.cleansedAddressInfo=this.addressService.addressCleansedResult.cleansedAddressInfo,this.submitAddress())},t.prototype.updateAddressStateCode=function(){this.address.stateCode=this.address.state?this.address.state.stateCode:null},t.prototype.createGridOptions=function(){var n=this;this.addressesGridOptions={appScopeProvider:this,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,onRegisterApi:function(t){n.gridApi=t},enableSelectAll:!0,selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.WHEN_NEEDED,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS,data:this.addresses}},t.prototype.configureGridColumns=function(){var n=[{name:"shipToId",field:"shipToId",visible:!1,enableHiding:!1},{name:"displayName",displayName:"Display Name",field:"displayName"},{name:"street1",displayName:"Street",field:"street1"},{name:"city",displayName:"City",field:"city"},{name:"stateCode",displayName:"State",field:"stateCode"},{name:"zipCode",displayName:"ZipCode",field:"zipCode",cellClass:"text-right"},{name:"isDefaultShipTo",displayName:"Default Address",field:"isDefaultShipTo",cellTemplate:'<div class="text-center"><input type="checkbox" class="boolean-column" ng-checked="row.entity.isDefaultShipTo === true" disabled="disabled" /><\/div>',filter:{type:this.uiGridConstants.filter.SELECT,selectOptions:[{value:"True",label:"True"},{value:"False",label:"False"}]},maxWidth:120},{name:"phone",displayName:"Phone Number",field:"phone"},{name:"actions",displayName:"Actions",cellTemplate:'<div class="ng-binding ng-scope"><button ng-click="grid.appScope.editAddress(row.entity)" class="btn btn-link">Edit<\/button><button ng-click="grid.appScope.openDeleteModal(row.entity)" class="btn btn-link">Delete<\/button><\/div>',enableHiding:!1,enableFiltering:!1,width:125}];this.addressesGridOptions.columnDefs=n;this.addressesGridOptions.data=this.addresses},t.prototype.editAddress=function(n){var t=this;this.submitFailed=!1;this.modalTitle="Edit Employee Address";this.apiService.getEmployeeAddressById(n.shipToId).then(function(n){t.mapAddress(n.data);$("#add-edit-employee-address-modal").modal("show")}).catch(function(){t.showAddressModal()})},t.prototype.openDeleteModal=function(n){this.addressToDelete=n;$("#delete-employee-address-modal").modal("show")},t.prototype.deleteAddress=function(){var n=this,t;this.deleteFailed=!1;t=function(){n.$rootScope.$broadcast("address-deleted");$("#delete-employee-address-modal").modal("hide");n.getAddresses()};this.apiService.removeEmployeeShippingLocationByGuid(this.addressToDelete.shipToId,this.initialData.employeeGuid).then(function(){t()}).catch(function(){t();n.deleteFailed=!0})},t.prototype.mapAddress=function(t){if(this.address=new n.ShippingAddress,this.address.shipToId=t.id,this.address.displayName=t.displayName,this.address.companyName=t.name,this.address.department=t.attentionTo,this.address.street1=t.street1,this.address.street2=t.street2,this.address.city=t.city,this.address.stateCode=t.stateCode,this.address.state=this.states.find(function(n){return n.stateCode===t.stateCode}),this.address.zipCode=t.zipCode,this.address.phoneExtension=t.phoneExtension,this.address.specialDeliveryInstructions=t.specialDeliveryInstructions,this.address.setAsDefaultShipTo=t.isDefault,t.phone){var i=t.phone.replaceAll("-","");this.address.phone=i.substring(0,3)+"-"+i.substring(3,6)+"-"+i.substring(6,11)}},t.prototype.submitAddress=function(n){var t=this;if(this.submitFailed=!1,n&&(this.addressForm=n,n.$setSubmitted(),n.$invalid)){this.focusService.focusScrollErrorField(n);return}this.address.isFromAdminHub=!0;this.addressService.addOrEditShippingLocation(this.address).then(function(n){t.handleResult(n)}).catch(function(){t.handleException()})},t.prototype.handleResult=function(n){if(n&&this.addressService.addressCleansedResult.isAddressCleanseSuccess()){this.$rootScope.$broadcast("address-submitted");this.handledSuccessfulSubmit();return}this.showAddressVerification();this.$rootScope.$broadcast("address-submitted")},t.prototype.showAddressVerification=function(){$(".vertex-address-verification").first().on("hidden.bs.modal",function(){$("#add-edit-employee-address-modal").modal("show")});$(".vertex-address-verification").first().modal("show")},t.prototype.handledSuccessfulSubmit=function(){$(".vertex-address-verification").modal("hide");this.addressForm&&(this.addressForm.$setPristine(),this.addressForm.$submitted=!1,this.submitFailed=!1);this.getAddresses()},t.prototype.getAddresses=function(){var n=this;this.loadingAddresses=!0;this.apiService.getEmployeeAddressesByGuid(this.initialData.employeeGuid).then(function(t){n.addresses=t.data;n.addressesGridOptions.data=t.data;n.loadingAddresses=!1})},t.prototype.handleException=function(){$(".vertex-address-verification").modal("hide");this.submitFailed=!0},t.prototype.initializeData=function(n){this.addresses=n;this.addressesGridOptions.data=n;this.states=this.initialData.states.map(function(n){return{stateCode:n.value,stateName:n.text}})},t.prototype.showAddressModal=function(){this.submitFailed=!1;this.address=new n.ShippingAddress;$("#add-edit-employee-address-modal").modal("show")},t}();t.$inject=["initialData","uiGridConstants","addressService","eventsService","apiService","$rootScope","focusService"];angular.module("ns").controller("employeeAddressesManagementController",t)}(ns||(ns={})),function(n){var i=function(){function n(){this.shipToId=null;this.displayName=null;this.companyName=null;this.street1=null;this.street2=null;this.city=null;this.stateCode=null;this.countryCode=null;this.zipCode=null;this.isDefaultShipTo=!0;this.phone=null;this.phoneExtension=null;this.addressType=null;this.specialDeliveryInstructions=null}return n}(),t;n.EmployeeAddressGrid=i;t=function(){function n(){this.employeeGuid=null;this.id=null;this.displayName=null;this.name=null;this.street1=null;this.street2=null;this.city=null;this.stateCode=null;this.countryCode=null;this.zipCode=null;this.isDefault=!1;this.phone=null;this.phoneExtension=null;this.specialDeliveryInstructions=null;this.taxJurisdiction=null;this.attentionTo=null;this.lastCleansed=null}return n}();n.EmployeeAddress=t}(ns||(ns={})),function(n){var i=function(){function n(){this.restrict="A";this.templateUrl="/js/ns/my-account/employees-management/employee-buyer-account/employee-buyer-modal.html";this.controller=t;this.controllerAs="employeeBuyerController"}return n.instance=function(){return new n},n}(),t;angular.module("ns").directive("employeeBuyerModal",i.instance);t=function(){function t(n,t,i){this.uiGridConstants=n;this.initialData=t;this.$scope=i;this.buyerAccounts=this.initializeData(t.buyerAccounts);this.createGridOptions();this.configureGridColumns()}return t.prototype.modalIsVisible=function(){return $("#employee-buyer-account-modal").is(":visible")},t.prototype.selectBuyer=function(n){this.$scope.$broadcast("buyer-account-selected",n.entity)},t.prototype.initializeData=function(t){return t?t.map(function(t){return new n.BuyerAccount(t)}):[]},t.prototype.createGridOptions=function(){var n=this;this.gridOptions={appScopeProvider:this,enableFiltering:!0,enableGridMenu:!0,enableSorting:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,onRegisterApi:function(t){n.gridApi=t},selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.WHEN_NEEDED,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS}},t.prototype.configureGridColumns=function(){var n=[{name:"accountNumber",field:"accountNumber",visible:!1},{name:"buyerName",displayName:"Buyer Name",field:"name"},{name:"city",displayName:"City",field:"city"},{name:"state",displayName:"State",field:"stateCode",maxWidth:60},{name:"email",displayName:"Email",field:"email"},{name:"phone",displayName:"Phone",field:"phone",maxWidth:150},{name:"actions",displayName:"Actions",cellTemplate:this.getActionsTemplate(),enableHiding:!1,enableFiltering:!1,maxWidth:80}];this.gridOptions.columnDefs=n;this.gridOptions.data=this.buyerAccounts},t.prototype.getActionsTemplate=function(){return'<div class="ng-binding ng-scope"><button ng-click="grid.appScope.selectBuyer(row)" class="btn btn-link">Select<\/button><\/div>'},t}();t.$inject=["uiGridConstants","initialData","$scope"];n.EmployeeBuyerModalController=t;angular.module("ns").controller("employeeBuyerModalController",t)}(ns||(ns={})),function(n){var t=function(){function n(n){this.accountNumber=n.accountNumber;this.email=n.email;this.name=n.firstName+" "+n.lastName;this.city=n.city;this.stateCode=n.stateCode;this.phone=n.phone}return n}();n.BuyerAccount=t}(ns||(ns={})),function(n){var i=function(){function n(){this.restrict="A";this.templateUrl="/js/ns/my-account/employees-management/employee-manager/managers-modal.html";this.controller=t;this.controllerAs="managersController"}return n.instance=function(){return new n},n}(),t;angular.module("ns").directive("managersModal",i.instance);t=function(){function n(n,t,i){this.uiGridConstants=n;this.initialData=t;this.$scope=i;this.managers=[];this.managers=t.managers;this.createGridOptions();this.configureGridColumns()}return n.prototype.createGridOptions=function(){var n=this;this.managersGridOptions={appScopeProvider:this,enableFiltering:!0,enableGridMenu:!0,enableSorting:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,onRegisterApi:function(t){n.gridApi=t},selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.WHEN_NEEDED,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS}},n.prototype.configureGridColumns=function(){var n=[{name:"employeeGuid",field:"employeeGuid",visible:!1},{name:"firstName",displayName:"First Name",field:"firstName"},{name:"lastName",displayName:"Last Name",field:"lastName"},{name:"employeeNumber",displayName:"Employee Number",field:"employeeNumber",cellClass:"text-right"},{name:"email",displayName:"Email",field:"email"},{name:"actions",displayName:"Actions",cellTemplate:this.getActionsTemplate(),enableHiding:!1,enableFiltering:!1}];this.managersGridOptions.columnDefs=n;this.managersGridOptions.data=this.managers},n.prototype.getActionsTemplate=function(){return'<div class="ng-binding ng-scope"><button ng-click="grid.appScope.selectManager(row)" class="btn btn-link">Select<\/button><\/div>'},n.prototype.modalIsVisible=function(){return $("#managers-modal").is(":visible")},n.prototype.selectManager=function(n){this.$scope.$broadcast("manager-selected",n.entity)},n}();t.$inject=["uiGridConstants","initialData","$scope"];n.ManagersModalController=t;angular.module("ns").controller("managersModalController",t)}(ns||(ns={})),function(n){var i=function(){function n(){this.restrict="A";this.templateUrl="/js/ns/my-account/employees-management/employee-reset-password/employee-reset-password-modal.html";this.controller=t;this.controllerAs="employeeResetPasswordModalController"}return n.instance=function(){return new n},n}(),t;angular.module("ns").directive("employeeResetPasswordModal",i.instance);t=function(){function n(n,t,i){this.apiService=n;this.employeeResetPasswordService=t;this.eventsService=i;this.controllerForm=null}return n.prototype.submit=function(n){var t=this;n&&(n.$setSubmitted(),this.controllerForm=n);this.employee||(this.employee=this.employeeResetPasswordService.getEmployee());this.employeeResetPasswordService.resetEmployeePassword(this.employee).then(function(){t.resetForm(n)}).catch(function(){t.resetForm(n)})},n.prototype.getEmployeeName=function(){return(this.employee=this.employeeResetPasswordService.getEmployee(),!this.employee)?"":this.employee.firstName+" "+this.employee.lastName},n.prototype.resetForm=function(n){$("#employee-reset-password-modal").modal("hide");this.eventsService.trigger(events.EmployeeEvents.PasswordReset);n&&(n.$setPristine(),n.$submitted=!1)},n}();t.$inject=["apiService","employeeResetPasswordService","eventsService"];n.EmployeeResetPasswordModalController=t;angular.module("ns").controller("employeeResetPasswordModalController",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t){this.$q=n;this.apiService=t}return n.prototype.resetEmployeePassword=function(n){var i=this,t=this.$q.defer();return this.clearMessages(),this.apiService.resetLastLoginDate(n.employeeGuid).then(function(n){return n.status===200?(i.setShowResetPasswordSuccessfulMessage(),t.resolve(!0)):(i.setShowErrorMessage(),t.resolve(!1)),t.promise})},n.prototype.setEmployee=function(n){this.employee=n},n.prototype.getEmployee=function(){return this.employee},n.prototype.setShowResetPasswordSuccessfulMessage=function(){this.shouldShowResetPasswordSuccessfulMessage=!0;this.shouldShowErrorMessage=!1},n.prototype.setShowErrorMessage=function(){this.shouldShowErrorMessage=!0;this.shouldShowResetPasswordSuccessfulMessage=!1},n.prototype.clearMessages=function(){this.shouldShowErrorMessage=!1;this.shouldShowResetPasswordSuccessfulMessage=!1},n.prototype.showResetPasswordSuccessfulMessage=function(){return this.shouldShowResetPasswordSuccessfulMessage},n.prototype.showErrorMessage=function(){return this.shouldShowErrorMessage},n}();t.$inject=["$q","apiService"];n.EmployeeResetPasswordService=t;angular.module("ns").service("employeeResetPasswordService",t)}(ns||(ns={})),function(){var t=function(){function t(){this.templateUrl="/js/ns/my-account/employees-management/employee-voucher/employee-voucher-adjustment.html";this.controllerAs="ctrl";this.controller=n;this.bindings={errorMessage:"<",title:"<",voucher:"<",hasDollarValue:"<",hasQuantity:"<",debit:"<",displayDebitAsOrder:"<",displayDebitAsOrderBasedOnMode:"<",credit:"<",reset:"<",onSubmitSucceeded:"&"}}return t}(),n=function(){function n(n,t){this.apiService=n;this.$rootScope=t;this.$onInit=function(){this.initializeDebitVoucherModel();this.maxDateOfPurchase=(new Date).toISOString().substring(0,10)};this.submitFailed=!1;this.atLeastOneFieldCompleted=!0}return n.prototype.hasError=function(){return!this.isEmpty(this.errorMessage)},n.prototype.submit=function(n){var t=this;if(n){if(n.$submitted=!0,n.$invalid)return;if(this.hasQuantity&&this.hasDollarValue&&this.isEmpty(this.model.dollarAmount)&&this.isEmpty(this.model.quantity)){n.$invalid=!0;n.$valid=!1;this.atLeastOneFieldCompleted=!1;return}}this.model.dateOfPurchase!=null&&(this.model.dateOfPurchase=new Date(this.model.dateOfPurchase.getTime()-this.model.dateOfPurchase.getTimezoneOffset()*6e4));this.atLeastOneFieldCompleted=!0;this.submitFailed=!1;this.debit&&this.apiService.debitEmployeeVoucher(this.model).then(function(){t.handleSuccessfulSubmit(n)}).catch(function(){t.handleError()});this.credit&&this.apiService.creditEmployeeVoucher(this.model).then(function(){t.handleSuccessfulSubmit(n)}).catch(function(){t.handleError()});this.reset&&this.apiService.resetEmployeeVoucher(this.model).then(function(){t.handleSuccessfulSubmit(n)}).catch(function(){t.handleError()})},n.prototype.handleSuccessfulSubmit=function(n){this.initializeDebitVoucherModel();n.$setPristine();n.$submitted=!1;this.$rootScope.$broadcast("voucher-adjustment-submitted");this.onSubmitSucceeded()},n.prototype.handleError=function(){this.$rootScope.$broadcast("voucher-adjustment-submitted");this.submitFailed=!0},n.prototype.isEmpty=function(n){return n===null||n===undefined||n===""},n.prototype.initializeDebitVoucherModel=function(){this.model=this.displayDebitAsOrderBasedOnMode&&(this.voucher.mode==="PurchaseDateOffset"||this.voucher.mode==="Formula"&&this.voucher.modeFormulaAppliedAtPurchase)?{dollarAmount:null,quantity:null,reason:"",voucherGuid:this.voucher.voucherGuid,debitAsPurchase:!0,dateOfPurchase:null}:{dollarAmount:null,quantity:null,reason:"",voucherGuid:this.voucher.voucherGuid,debitAsPurchase:!1,dateOfPurchase:null}},n}();n.$inject=["apiService","$rootScope"];angular.module("ns").component("employeeVoucherAdjustment",new t)}(ns||(ns={})),function(){var n=function(){function n(n,t,i,r){this.initialData=n;this.uiGridConstants=t;this.apiService=i;this.$rootScope=r;this.editedVoucher=null;this.voucherHistory=[];n.voucher&&(this.editedVoucher=this.mapVoucher(n.voucher));n.voucherHistory&&(this.voucherHistory=this.initialData.voucherHistory);this.createGridOptions();this.configureGridColumns();this.loadingVoucherData=!1;this.loadingHistory=!1}return n.prototype.createGridOptions=function(){var n=this;this.voucherHistoryGridOptions={appScopeProvider:this,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,onRegisterApi:function(t){n.gridApi=t},enableSelectAll:!0,selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.WHEN_NEEDED,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS,data:this.voucherHistory}},n.prototype.configureGridColumns=function(){var n=[{name:"createdOnDate",displayName:"Date",field:"createdOnDate",type:"date",sort:{direction:this.uiGridConstants.DESC,priority:0},cellFilter:"date:'MM/dd/yyyy'",filter:{condition:function(n,t){var i=new Date(t).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"numeric"}),r=n.replace(/\\/g,"");return i.indexOf(r)!==-1}}},{name:"activityType",displayName:"Type",field:"activityType"},{name:"changedBy",displayName:"User",field:"changedBy"},{name:"orderNumber",displayName:"OrderNumber",field:"orderNumber"},{name:"amount",displayName:"Amount",field:"amount",cellFilter:"currency",cellClass:"text-right",visible:this.hasDollarValue()},{name:"quantity",displayName:"Quantity",field:"quantity",cellClass:"text-right",visible:this.hasQuantity()},{name:"notes",displayName:"Notes",field:"notes"}];this.voucherHistoryGridOptions.columnDefs=n;this.voucherHistoryGridOptions.data=this.voucherHistory},n.prototype.hasDollarValue=function(){return!this.isEmpty(this.editedVoucher.remainingAmount)},n.prototype.hasQuantity=function(){return!this.isEmpty(this.editedVoucher.remainingQuantity)},n.prototype.hasResetDate=function(){return!this.isEmpty(this.editedVoucher.resetDate)},n.prototype.isEmpty=function(n){return n===null||n===undefined||n===""},n.prototype.reloadVoucherData=function(){var n=this;this.loadingVoucherData=!0;this.apiService.getEmployeeVoucherData(this.editedVoucher.voucherGuid).then(function(t){n.loadingVoucherData=!1;n.voucherHistory=t.data.resultObject.voucherActivity;n.voucherHistoryGridOptions.data=n.voucherHistory;n.editedVoucher=n.mapVoucher(t.data.resultObject.voucherSummary)}).catch(function(){n.loadingVoucherData=!1})},n.prototype.reloadVoucherHistory=function(){var n=this;this.loadingHistory=!0;this.apiService.getEmployeeVoucherActivity(this.editedVoucher.voucherGuid).then(function(t){n.voucherHistory=t.data;n.voucherHistoryGridOptions.data=t.data;n.loadingHistory=!1}).catch(function(){n.loadingHistory=!1})},n.prototype.mapVoucher=function(n){return{voucherProgramId:n.voucherProgramId,voucherGuid:n.voucherGuid,name:n.voucherName,status:n.voucherProgramStatus,isUsable:n.isUsable,isEligible:n.isEligible,remainingAmount:n.remainingDollarValue,remainingQuantity:n.remainingQuantityValue,resetDate:n.resetDate,shortResetDate:n.shortResetDate,mode:n.mode,modeFormulaAppliedAtPurchase:n.modeFormulaAppliedAtPurchase}},n}();n.$inject=["initialData","uiGridConstants","apiService","$rootScope"];angular.module("ns").controller("employeeVoucherAdjustmentController",n)}(ns||(ns={})),function(n){var r=function(){function n(){this.voucherProgramId=null;this.voucherGuid=null;this.name=null;this.status=null;this.isUsable=null;this.isEligible=null;this.remainingAmount=null;this.remainingQuantity=null;this.resetDate=null;this.shortResetDate=null;this.mode=null;this.modeFormulaAppliedAtPurchase=null}return n}(),t,i;n.EmployeeVoucher=r;t=function(){function n(){}return n}();n.VoucherActivity=t;i=function(){function n(){}return n}();n.ManualEnrollmentInfo=i}(ns||(ns={})),function(n){var i=function(){function n(){this.restrict="A";this.scope=!0;this.templateUrl="/js/ns/my-account/employees-management/employee-voucher/manual-enrollment/voucher-manual-enrollment-modal.html";this.replace=!0}return n.instance=function(){return new n},n}(),t;angular.module("ns").directive("voucherManualEnrollmentModal",i.instance);t=function(){function t(n,t,i,r){var u=this;this.initialData=n;this.uiGridConstants=t;this.apiService=i;this.$rootScope=r;this.vouchers=[];this.nonEligibleVouchers=[];n.vouchers&&(this.employeeId=n.employeeId,this.vouchers=n.vouchers.map(function(n){return u.mapVoucher(n)}),this.apiService.getAllNamesForManualEnrollment(this.employeeId).then(function(n){u.nonEligibleVouchers=n.data.resultObject}));this.employeeGuid=n.employeeGuid;this.createGridOptions();this.configureGridColumns()}return t.prototype.createGridOptions=function(){var n=this;this.vouchersGridOptions={appScopeProvider:this,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,onRegisterApi:function(t){n.gridApi=t},enableSelectAll:!0,selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.WHEN_NEEDED,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS,data:this.vouchers}},t.prototype.configureGridColumns=function(){var n=[{name:"voucherGuid",field:"voucherGuid",visible:!1,enableHiding:!1},{name:"name",displayName:"Name",field:"name"},{name:"status",displayName:"Status",field:"status"},{name:"isUsable",displayName:"Usable",field:"isUsable",cellTemplate:'<div class="ui-grid-cell-contents" >\n                           <input style="margin: 0; vertical-align: middle" type="checkbox" ng-model="row.entity.isUsable"  disabled="disabled">\n                       <\/div>'},{name:"isEligible ",displayName:"Is Eligible ",field:"isUsable",cellTemplate:'<div class="ui-grid-cell-contents" >\n                           <input style="margin: 0; vertical-align: middle" type="checkbox" ng-model="row.entity.isEligible "  disabled="disabled">\n                       <\/div>'},{name:"remainingAmount",displayName:"Remaining Amount",field:"remainingAmount",cellFilter:"currency",cellClass:"text-right"},{name:"remainingQuantity",displayName:"Remaining Quantity",field:"remainingQuantity",cellClass:"text-right"},{name:"resetDate",visible:!0,displayName:"Reset Date",field:"resetDate",type:"date",cellClass:"text-right",cellFilter:"date:'MM/dd/yyyy'",filter:{condition:function(n,t){var i=new Date(t).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"numeric"}),r=n.replace(/\\/g,"");return i.indexOf(r)!==-1}}},{name:"actions",displayName:"Actions",cellTemplate:'<div class="ng-binding ng-scope"><button ng-disabled="row.entity.status === \'InActive\'" ng-click="grid.appScope.editVoucher(row.entity)" class="btn btn-link" type="button">Edit<\/button><\/div>',enableHiding:!1,enableFiltering:!1}];this.vouchersGridOptions.columnDefs=n;this.vouchersGridOptions.data=this.vouchers},t.prototype.editVoucher=function(n){window.location.href="/MyAccount/EditEmployeeVoucher?voucherGuid="+n.voucherGuid+"&employeeGuid="+this.employeeGuid},t.prototype.mapVoucher=function(n){return{voucherProgramId:n.voucherProgramId,voucherGuid:n.voucherGuid,name:n.voucherName,status:n.voucherProgramStatus,isUsable:n.isUsable,isEligible:n.isEligible,remainingAmount:n.remainingDollarValue,remainingQuantity:n.remainingQuantityValue,resetDate:n.resetDate,shortResetDate:n.shortResetDate,mode:n.mode,modeFormulaAppliedAtPurchase:n.modeFormulaAppliedAtPurchase}},t.prototype.showManualEnrollmentModal=function(){this.submitFailed=!1;this.selectedVoucherProgram=new n.ManualEnrollmentInfo;$("#voucher-manual-enrollment-modal").modal("show")},t.prototype.enroll=function(n){var t=this;if(this.submitFailed=!1,n){if(!this.selectedVoucherProgram.id){this.$rootScope.$broadcast("stop-spinner");return}this.apiService.manualEnrollmentVoucher(this.employeeId,this.selectedVoucherProgram.id).then(function(n){if(!n.data.success){t.submitFailed=!0;t.errorText=n.data.errors[0].message;t.$rootScope.$broadcast("stop-spinner");return}location.reload()}).catch(function(){t.submitFailed=!0;t.errorText="Error"})}},t}();t.$inject=["initialData","uiGridConstants","apiService","$rootScope"];angular.module("ns").controller("employeeVouchersManagementController",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t){this.apiService=n;this.initialData=t}return n.prototype.forgotPassword=function(n){return this.apiService.forgotPassword(n)},n.prototype.resetPassword=function(n,t){return this.apiService.resetPassword(n,t)},n.prototype.activateAccount=function(n,t,i){return this.apiService.activateAccount(n,t,i)},n.prototype.createPassword=function(n){var t=this;return this.apiService.forgotPassword(n).then(function(){return t.apiService.setEmailSentForForgotPassword()})},n.prototype.isEmailSent=function(){return this.initialData&&this.initialData.forgotPassword&&this.initialData.forgotPassword.isEmailSent},n.prototype.getUserIdentifierToken=function(){return this.initialData&&this.initialData.forgotPassword&&this.initialData.forgotPassword.userIdentifierToken},n.prototype.getUserEmail=function(){return this.initialData&&this.initialData.forgotPassword&&this.initialData.forgotPassword.userEmail},n}();t.$inject=["apiService","initialData"];n.ForgotPasswordService=t;angular.module("ns").service("forgotPasswordService",t)}(ns||(ns={})),function(){"use strict";var n=function(){function n(n,t,i,r,u,f){var e=this;this.$scope=n;this.forgotPasswordService=t;this.eventsService=i;this.passwordValidationService=r;this.emailValidationService=u;this.apiService=f;this.emailPattern=/^([A-Za-z0-9/'_\-\.\+])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,18})$/;this.resetPasswordErrors={TokenExpired:1};this.passwordRequirementsMet=!0;this.displayTermsAndConditions=!1;this.userAgreementAccepted=!1;this.processState="Initial";this.processInputs={email:undefined,securityCode:undefined,password:undefined,passwordConfirm:undefined};this.processOutputs={isEmailMalformed:undefined,isSecurityCodeValid:undefined,isSecurityCodeResent:undefined,isPasswordEmpty:undefined,isPasswordConfirmEmpty:undefined,isPasswordConfirmNonMatching:undefined,passwordRequirementsMet:!0,passwordResetServerError:undefined,isPasswordResetComplete:undefined};this.isEmailWellFormed=function(n){return n===void 0&&(n=e.processInputs.email),e.emailValidationService.isEmail(n)};this.isSecurityCodeWellFormed=function(){return!!e.processInputs&&!!e.processInputs.securityCode&&e.processInputs.securityCode.length===6};this.emailSent=t.isEmailSent();this.userIdentifierToken=t.getUserIdentifierToken();$("#password-input").focusin(function(){setTimeout(function(){r.generatePasswordValidationHtmlContent(e.password,"#password-input","#PasswordInputWrapper",e);setTimeout(function(){r.generatePasswordValidationHtmlContent(e.password,"#password-input","#PasswordInputWrapper",e)},100)},100)});this.userIdentifierToken!=null&&(this.processInputs.email=t.getUserEmail(),this.getNextPasswordResetProcessState());n.$watch(function(){return e.password},function(){e.generatePasswordValidationPopover()})}return n.prototype.processForgotPasswordRequest=function(n){var i=this,t;return($("#PasswordInputWrapper").hasClass("has-error")&&(t=n.$$controls.filter(function(n){return n.$name==="password"}),this.password||(this.passwordRequirementsMet=!1),t.$error={required:!0},t.$valid=!1,t.$invalid=!0),n.$setSubmitted(),n.$invalid)?(this.eventsService.trigger(events.ForgotPasswordEvents.PasswordForgot),!1):this.forgotPasswordService.forgotPassword(this.email).then(function(n){n.status===200&&(i.emailSent=!0);i.eventsService.trigger(events.ForgotPasswordEvents.PasswordForgot)}).catch(function(n){n.data&&$("#email-error").modal("show");i.eventsService.trigger(events.ForgotPasswordEvents.PasswordForgot)})},n.prototype.resetPassword=function(n){var t=this,i;return($("#PasswordInputWrapper").hasClass("has-error")&&(i=n.$$controls.filter(function(n){return n.$name==="password"}),this.password||(this.passwordRequirementsMet=!1),i.$error={required:!0},i.$valid=!1,i.$invalid=!0,n.$invalid=!0),n.$setSubmitted(),n.$invalid)?(this.eventsService.trigger(events.ForgotPasswordEvents.PasswordReset),!1):this.forgotPasswordService.resetPassword(this.requestId,this.password).then(function(n){n.data.success?t.passwordChanged=!0:(n.data.errors[0].errorCode===t.resetPasswordErrors.TokenExpired&&(t.showTokenExpiredErrorMessage=!0),$("#resetPassword-error").modal("show"));t.eventsService.trigger(events.ForgotPasswordEvents.PasswordReset)}).catch(function(n){n.data&&$("#resetPassword-error").modal("show");t.eventsService.trigger(events.ForgotPasswordEvents.PasswordReset)})},n.prototype.submit=function(){var n=this;if(this.processState==="Initial"&&(this.isEmailWellFormed()?(this.isSubmitting=!0,this.resetProcessEmailOutputs(),this.apiService.sendBuyerSecurityCodeEmail(this.processInputs.email).then(function(){n.getNextPasswordResetProcessState()}).catch(function(n){n.data&&$("#email-error").modal("show")}).finally(function(){n.isSubmitting=!1})):(this.resetProcessEmailOutputs(),this.processOutputs.isEmailMalformed=!0,this.getNextPasswordResetProcessState())),this.processState==="SecurityCodeSent"&&(this.isSecurityCodeWellFormed()===!1?this.processOutputs.isSecurityCodeValid=!1:(this.isSubmitting=!0,this.apiService.validateEmailAndSecurityCode(this.processInputs.email,this.processInputs.securityCode,this.userIdentifierToken).then(function(t){n.processOutputs.isSecurityCodeValid=t.data.isValid;n.processOutputs.isSecurityCodeValid&&(n.apiService.hasUserAgreementAccepted(n.processInputs.email).then(function(t){n.displayTermsAndConditions=!t.data.userAgreementAccepted}),n.$scope.$watch(function(){return n.processInputs.password},function(){return n.generatePasswordValidationPopover2()}));n.getNextPasswordResetProcessState()}).finally(function(){n.isSubmitting=!1}))),this.processState==="SecurityCodeIsValidated"){if(this.resetProcessPasswordOutputs(),!this.processInputs.password||!this.processInputs.passwordConfirm||this.processInputs.password!==this.processInputs.passwordConfirm){this.processOutputs.isPasswordEmpty=!this.processInputs.password;this.processOutputs.isPasswordConfirmEmpty=!this.processInputs.passwordConfirm;this.processOutputs.isPasswordConfirmNonMatching=this.processInputs.password!==this.processInputs.passwordConfirm;return}this.isSubmitting=!0;this.apiService.changePasswordViaEmail({buyerIdentifier:this.processInputs.email,password:this.processInputs.password,identifierToken:this.userIdentifierToken}).then(function(t){if(t.data.errors[0]){n.processOutputs.passwordResetServerError=t.data.errors[0];return}n.processOutputs.isPasswordResetComplete=!0;n.getNextPasswordResetProcessState()}).finally(function(){n.isSubmitting=!1})}},n.prototype.activateAccount=function(n){var t=this;return(n.$setSubmitted(),n.$invalid)?(this.eventsService.trigger(events.ForgotPasswordEvents.AccountActivate),!1):this.forgotPasswordService.activateAccount(this.userId,this.email,this.password).then(function(n){n.data.success?t.passwordChanged=!0:$("#activateAccount-error").modal("show");t.eventsService.trigger(events.ForgotPasswordEvents.AccountActivate)}).catch(function(n){n.data&&$("#activateAccount-error").modal("show");t.eventsService.trigger(events.ForgotPasswordEvents.AccountActivate)})},n.prototype.resetProcessEmailOutputs=function(){this.processOutputs.isEmailMalformed=undefined},n.prototype.passwordsMatch=function(){return this.password===this.confirmedPassword},n.prototype.isPasswordResetComplete=function(){return this.processState==="PasswordResetComplete"},n.prototype.isEmailInvalid=function(n){return n===void 0&&(n=this.processOutputs),n.isEmailMalformed},n.prototype.isSecurityCodeSent=function(n){return n===void 0&&(n=this.processState),n==="SecurityCodeSent"||n==="SecurityCodeIsValidated"},n.prototype.isSecurityCodeInvalid=function(){return this.processOutputs.isSecurityCodeValid===!1},n.prototype.resendSecurityCode=function(){var n=this;this.processOutputs.isSecurityCodeResent=!1;this.apiService.sendBuyerSecurityCodeEmail(this.processInputs.email).then(function(){n.processOutputs.isSecurityCodeResent=!0})},n.prototype.getNextPasswordResetProcessState=function(){if(this.processState==="Initial")this.processState=this.processOutputs.isEmailMalformed?"Initial":"SecurityCodeSent";else if(this.processState==="SecurityCodeSent")this.processState=this.processOutputs.isSecurityCodeValid?"SecurityCodeIsValidated":"SecurityCodeSent";else if(this.processState==="SecurityCodeIsValidated")this.processState=this.processOutputs.isPasswordResetComplete?"PasswordResetComplete":"SecurityCodeIsValidated";else throw new Error("Unexpected state");},n.prototype.generatePasswordValidationPopover=function(){var n=this.passwordValidationService.popoverSettings(this.password,"#password-input","#PasswordInputWrapper",this);$("#password-input").popover(n)},n.prototype.generatePasswordValidationPopover2=function(){var n=this.passwordValidationService.popoverSettings(this.processInputs.password,"#secured-password-input","#SecuredPasswordInputWrapper",this);$("#secured-password-input").popover(n)},n.prototype.onPasswordInputFocus=function(){this.processOutputs.isPasswordEmpty=!1;this.passwordValidationService.generatePasswordValidationHtmlContent(this.processInputs.password,"#secured-password-input","#SecuredPasswordInputWrapper",this.processOutputs)},n.prototype.resetProcessPasswordOutputs=function(){this.processOutputs.isPasswordEmpty=undefined;this.processOutputs.isPasswordConfirmEmpty=undefined;this.processOutputs.isPasswordConfirmNonMatching=undefined;this.processOutputs.passwordResetServerError=undefined},n}();n.$inject=["$scope","forgotPasswordService","eventsService","passwordValidationService","emailValidationService","apiService"];angular.module("ns").controller("forgotPasswordCtrl",n)}(ns||(ns={})),function(n){var t=function(){function n(){}return n}();n.GroupSummaryApprovalConditionConfigModel=t}(ns||(ns={})),function(n){var t=function(){function n(){}return n}();n.GroupSummaryApproverModel=t}(ns||(ns={})),function(n){var t=function(){function n(){}return n}();n.GroupSummaryGridModel=t}(ns||(ns={})),function(n){var t=function(){function n(){}return n}();n.GroupSummaryModel=t}(ns||(ns={})),function(n){"use strict";var t=function(){function t(t,i,r,u,f,e,o,s,h){this.isFirst=t;this.$rootScope=i;this.apiService=r;this.editGroupInfo=u;this.availableCollections=f;this.uiGridConstants=e;this.$templateCache=o;this.$interval=s;this.featureData=h;this.GroupPaymentMethod=n.GroupPaymentMethod;this.shopAllCollectionCode="shop-all";this.openChangeMemberModal=function(){$("#change-group-members-modal").modal("show");this.memberGridApi.grid.handleWindowResize()};this.addOrEditFailed=!1;this.group=new n.Group;u!=null&&(this.group.name=u.group.name,this.group.isDefault=u.group.isDefault,this.group.id=u.group.id,this.group.members=u.group.membersSummary,this.group.members.forEach(function(n){n.name=n.firstName+" "+n.lastName}),this.group.buyers=u.group.buyers,this.group.buyers.forEach(function(n){n.name=n.firstName+" "+n.lastName}),this.featureData.pathfinder_MinimumOrderAmount&&(this.group.minimumAmount=u.group.minimumAmount));t!=null&&(this.group.isDefault=t);this.initializePaymentMethods();this.createGridOptions();this.configureGrid()}return t.prototype.toggleCollection=function(n){if(n===this.shopAllCollectionCode){this.group.groupCollections.collectionCodes=[];this.group.groupCollections.isShopAll=!this.group.groupCollections.isShopAll;this.group.groupCollections.isShopAll&&this.addAllAvailableCollections();return}var t=this.group.groupCollections.collectionCodes.indexOf(n);t>-1?(this.group.groupCollections.isShopAll&&(this.group.groupCollections.isShopAll=!1),this.group.groupCollections.collectionCodes.splice(t,1)):(this.group.groupCollections.collectionCodes.push(n),this.group.groupCollections.collectionCodes.length===this.availableCollections.length&&(this.group.groupCollections.isShopAll=!0))},t.prototype.isCollectionSelected=function(n){return n===this.shopAllCollectionCode?this.group.groupCollections.isShopAll:this.group.groupCollections.collectionCodes.indexOf(n)>-1},t.prototype.initializeCollections=function(){(this.group.groupCollections=new n.GroupCollections,this.addAllAvailableCollections(),this.editGroupInfo&&this.editGroupInfo.group.collections)&&this.editGroupInfo.group.collections.groupCollections&&(this.group.groupCollections=this.editGroupInfo.group.collections.groupCollections,this.group.groupCollections.isShopAll&&this.addAllAvailableCollections())},t.prototype.addAllAvailableCollections=function(){var n=this;this.availableCollections.forEach(function(t){n.group.groupCollections.collectionCodes.push(t.collectionCode)})},t.prototype.initializePaymentMethods=function(){if(this.group.paymentMethod=n.GroupPaymentMethod.BillMyAccountAndCreditCard,this.editGroupInfo&&this.editGroupInfo.group.paymentMethod){if(!this.editGroupInfo.group.paymentMethod.billMyAccountPaymentAllowed){this.group.paymentMethod=n.GroupPaymentMethod.CreditCardOnly;return}this.editGroupInfo.group.paymentMethod.paymentMethod&&(this.group.paymentMethod=this.editGroupInfo.group.paymentMethod.paymentMethod)}},t.prototype.createGridOptions=function(){var n=this;this.gridOptions={appScopeProvider:this,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,enableRowSelection:!0,enableFullRowSelection:!0,onRegisterApi:function(t){n.gridApi=t},enableSelectAll:!0,selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS};this.memberGridOptions={appScopeProvider:this,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,onRegisterApi:function(t){n.memberGridApi=t;n.$interval(function(n){n.grid.handleWindowResize()},500,10,!1,n.memberGridApi)},enableSelectAll:!0,selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS,enableRowSelection:!0}},t.prototype.selectMembers=function(){var n=this.memberGridApi.selection.getSelectedRows();this.updateMembers(n);$("#change-group-members-modal").modal("hide")},t.prototype.updateMembers=function(n){var t=this;_.each(n,function(n){t.group.members.push(n);t.removeBuyer(n.customerID)})},t.prototype.removeMembers=function(){var n=this,t=this.gridApi.selection.getSelectedRows();_.each(t,function(t){var i=n.group.members.indexOf(t);n.group.members.splice(i,1);n.group.buyers.push(t)})},t.prototype.removeBuyer=function(n){var t=this.group.buyers.filter(function(t){return t.customerID===n}),i=this.group.buyers.indexOf(t[0]);this.group.buyers.splice(i,1)},t.prototype.addEditGroup=function(n){var t=this;if(n){if(n.$setSubmitted(),n.$invalid)return;this.featureData.pathfinder_MinimumOrderAmount?this.group.minimumAmount||(this.group.minimumAmount=0):this.group.minimumAmount=0;this.group.memberCustomerIds=_.map(this.group.members,function(n){return n.customerID});this.apiService.addEditGroup(this.group).then(function(){n.$setPristine();n.$submitted=!1;window.location.href="/MyAccount/ManageGroups"}).catch(function(){t.addOrEditFailed=!0;t.$rootScope.$broadcast("group-submitted")})}},t.prototype.configureGrid=function(){var n=[{name:"customerID",field:"customerID",visible:!1,enableHiding:!1},{name:"name",displayName:"Name",field:"name",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0},{name:"city",displayName:"City",field:"city",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0},{name:"state",displayName:"State",field:"stateCode",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0,width:60},{name:"email",displayName:"Email",field:"email",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0},{name:"phone",displayName:"Phone",field:"phone",cellFilter:"formatPhoneNumber",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0,width:120}];this.gridOptions.data=this.group.members;this.gridOptions.columnDefs=n;this.memberGridOptions.data=this.group.buyers;this.memberGridOptions.columnDefs=n;this.$templateCache.put("ui-grid/selectionRowHeaderButtons",'<div class="ui-grid-selection-row-header-buttons " ng-class="{\'ui-grid-row-selected\': row.isSelected}" ><input style="margin: 0; vertical-align: middle" type="checkbox" ng-model="row.isSelected">&nbsp;<\/div>')},t}();t.$inject=["isFirst","$rootScope","apiService","editGroupInfo","availableCollections","uiGridConstants","$templateCache","$interval","featureData"];n.CreateEditGroupController=t;angular.module("ns").controller("createEditGroupController",t)}(ns||(ns={})),function(n){var i=function(){function n(){this.name=null;this.isDefault=null;this.id=null;this.members=null;this.buyers=null;this.memberCustomerIds=[];this.groupCollections=null;this.paymentMethod=null;this.minimumAmount=null}return n}(),t,r;n.Group=i;t=function(){function n(){this.collectionCodes=[];this.isShopAll=!0}return n}();n.GroupCollections=t,function(n){n[n.BillMyAccountAndCreditCard=0]="BillMyAccountAndCreditCard";n[n.CreditCardOnly=1]="CreditCardOnly";n[n.BillMyAccountOnly=2]="BillMyAccountOnly";n[n.BillMyAccountWithPO=3]="BillMyAccountWithPO"}(r=n.GroupPaymentMethod||(n.GroupPaymentMethod={}))}(ns||(ns={})),function(n){var t=function(){function t(n,t,i,r,u,f){this.initialData=n;this.eventsService=t;this.uiGridConstants=i;this.featureData=r;this.apiService=u;this.$rootScope=f;this.groups=[];this.createGroups(n.groups);this.createGroupsGridOptions();this.configureGroupsGrid();this.groupToDelete=null;this.deleteFailed=!1}return t.prototype.createGroups=function(t){var i=this;t.forEach(function(t){var r=new n.GroupSummaryGridModel;r.id=t.id;r.name=t.name;r.isDefault=i.capitalizeFirstLetter(String(t.isDefault));i.groups.push(r)})},t.prototype.capitalizeFirstLetter=function(n){return n.charAt(0).toUpperCase()+n.slice(1)},t.prototype.createGroupsGridOptions=function(){this.groupsGridOptions={appScopeProvider:this,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,enableSelectAll:!1,selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS}},t.prototype.configureGroupsGrid=function(){var n=[{name:"id",field:"id",visible:!1,enableHiding:!1},{name:"name",displayName:"Group Name",field:"name",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"isDefault",displayName:"Default",field:"isDefault",cellTemplate:'<div class="text-center"><input type="checkbox" class="boolean-column" ng-checked="row.entity.isDefault === \'True\'" disabled="disabled" /><\/div>',filter:{type:this.uiGridConstants.filter.SELECT,selectOptions:[{value:"True",label:"True"},{value:"False",label:"False"}]},width:80},{name:"actions",displayName:"Actions",cellTemplate:'<div class="ng-binding ng-scope">\n                        <button ng-click="grid.appScope.editGroup(row)" class="btn btn-link">Edit<\/button>\n                        <button ng-class="grid.appScope.disableDelete(row)" ng-click="grid.appScope.deleteGroupConfirmationModal(row)" class="btn btn-link">Delete<\/button>\n                        <\/div>',enableFiltering:!1,enableHiding:!1,width:150}];this.groupsGridOptions.columnDefs=n;this.groupsGridOptions.data=this.groups},t.prototype.editGroup=function(n){window.location.href="/MyAccount/EditGroup?groupId="+n.entity.id},t.prototype.deleteGroupConfirmationModal=function(n){this.groupToDelete=n.entity;$("#groupDelete").modal("show")},t.prototype.disableDelete=function(n){return n.entity.isDefault=="True"&&this.groups.length>1?"disabled":""},t.prototype.deleteGroup=function(){var n=this;this.apiService.deleteGroup(this.groupToDelete.id).then(function(){window.location.href="/MyAccount/ManageGroups"}).catch(function(){n.$rootScope.$broadcast("group-deleted");n.deleteFailed=!0})},t}();t.$inject=["initialData","eventsService","uiGridConstants","featureData","apiService","$rootScope"];angular.module("ns").controller("groupsManagementController",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t,i,r){this.$q=n;this.apiService=t;this.modelsFactory=i;this.initialData=r;this.customBillingFields=i.createCustomBillingInfo(r)}return n.prototype.submitRequest=function(){var t=this,n=this.$q.defer();return this.apiService.saveBillingData(this.customBillingFields.getInputModel()).then(function(i){return i.data.success?(t.customBillingFields.setCustomBillingInfoUpdatedSuccessfullyMessage(),n.resolve(!0)):(t.customBillingFields.setShowErrorMessage(),n.resolve(!1)),n.promise})},n.prototype.showUpdatedBillingInfoSuccessfully=function(){return this.customBillingFields.showCustomBillingInfoUpdatedSuccessfully},n.prototype.showErrorMessage=function(){return this.customBillingFields.showErrorMessage},n}();t.$inject=["$q","apiService","modelsFactory","initialData"];n.BillingsManagementService=t;angular.module("ns").service("billingsManagementService",t)}(ns||(ns={})),function(n){var t=function(){function t(n,t,i,r){this.billingsManagementService=n;this.focusService=t;this.$rootScope=i;this.featureData=r;this.pathfinder_ToggleBillingRequiredFields=!1;this.pathfinder_ToggleBillingRequiredFields=r.pathfinder_ToggleBillingRequiredFields;this.modelInputValueList=this.billingsManagementService.customBillingFields.modelInputValueList;this.poNumber=this.billingsManagementService.customBillingFields.poNumber;this.location=this.billingsManagementService.customBillingFields.location;this.department=this.billingsManagementService.customBillingFields.department;this.costCenter=this.billingsManagementService.customBillingFields.costCenter;this.additionalBillingField1=this.billingsManagementService.customBillingFields.additionalBillingField1;this.additionalBillingField2=this.billingsManagementService.customBillingFields.additionalBillingField2;this.additionalBillingField3=this.billingsManagementService.customBillingFields.additionalBillingField3;this.inputSelectList=this.billingsManagementService.customBillingFields.inputSelectList;this.billingFieldsRequired=this.poNumber.isEnabled||this.location.isEnabled||this.department.isEnabled||this.costCenter.isEnabled||this.costCenter.isEnabled||this.additionalBillingField1.isEnabled||this.additionalBillingField2.isEnabled||this.additionalBillingField3.isEnabled}return t.prototype.submit=function(n){var t=this;if(this.billingsManagementService.customBillingFields.clearMessages(),this.customBillingForm.$setSubmitted(),this.customBillingForm.$invalid||!this.inputValuesAreValid()){this.focusService.focusErrorField(this.customBillingForm);n.$submitted=!1;n.$valid=!1;return}this.billingsManagementService.submitRequest().then(function(n){n&&t.customBillingForm.$setPristine();t.focusService.focusElement("billings-management-header");t.$rootScope.$broadcast("custom-fields-submitted")})},t.prototype.inputValuesAreValid=function(){return this.poNumber.inputValuesAreValid()&&this.location.inputValuesAreValid()&&this.department.inputValuesAreValid()&&this.costCenter.inputValuesAreValid()&&this.additionalBillingField1.inputValuesAreValid()&&this.additionalBillingField2.inputValuesAreValid()&&this.additionalBillingField3.inputValuesAreValid()},t.prototype.cancel=function(){window.location.href="/MyAccount/AdminHub"},t.prototype.showErrorMessage=function(){return this.billingsManagementService.showErrorMessage()},t.prototype.showSuccessfullUpdate=function(){return this.billingsManagementService.showUpdatedBillingInfoSuccessfully()},t.prototype.fieldIsRequired=function(n){var t=this[n];return Object.keys(t).some(function(n){return t[n]!==null&&t[n]!==""&&t[n]!==undefined})},t.prototype.inputTypeSelect=function(t,i){this[t].inputType!==n.InputTypeEnum.listOfValues?(this[t].inputValues=null,this.modelInputValueList[i]=null):(this[t].inputValues=[],this.modelInputValueList[i]="")},t}();t.$inject=["billingsManagementService","focusService","$rootScope","featureData"];angular.module("ns").controller("billingsManagementController",t)}(ns||(ns={})),function(n){var i=function(){function n(n){this.poNumber=new t(n.poNumber);this.location=new t(n.location);this.department=new t(n.department);this.costCenter=new t(n.costCenter);this.additionalBillingField1=new t(n.additionalBillingField1);this.additionalBillingField2=new t(n.additionalBillingField2);this.additionalBillingField3=new t(n.additionalBillingField3);this.modelInputValueList={locationInputList:this.constructInputForDisplay(n.location.inputValues),departmentInputList:this.constructInputForDisplay(n.department.inputValues),costCenterInputList:this.constructInputForDisplay(n.costCenter.inputValues),poNumberInputList:this.constructInputForDisplay(n.poNumber.inputValues),inputList1:this.constructInputForDisplay(n.additionalBillingField1.inputValues),inputList2:this.constructInputForDisplay(n.additionalBillingField2.inputValues),inputList3:this.constructInputForDisplay(n.additionalBillingField3.inputValues)};this.inputSelectList=[{value:null,text:"Select One"},{value:1,text:"Numeric"},{value:2,text:"Alphanumeric"},{value:3,text:"Yes/No"},{value:4,text:"List of Values"}];this.showErrorMessage=!1;this.showCustomBillingInfoUpdatedSuccessfully=!1}return n.prototype.setCustomBillingInfoUpdatedSuccessfullyMessage=function(){this.showCustomBillingInfoUpdatedSuccessfully=!0;this.showErrorMessage=!1},n.prototype.setShowErrorMessage=function(){this.showErrorMessage=!0;this.showCustomBillingInfoUpdatedSuccessfully=!1},n.prototype.clearMessages=function(){this.showErrorMessage=!1;this.showCustomBillingInfoUpdatedSuccessfully=!1},n.prototype.getInputModel=function(){return{poNumber:this.poNumber,location:this.location,department:this.department,costCenter:this.costCenter,additionalBillingField1:this.additionalBillingField1,additionalBillingField2:this.additionalBillingField2,additionalBillingField3:this.additionalBillingField3}},n.prototype.constructInputForDisplay=function(n){return Array.isArray(n)&&n.length>0?n.join("\n"):null},n}(),t;n.CustomBilling=i;t=function(){function n(n){this.minLength=1;this.maxLength=1;this.checkoutRequired=!0;this.caption=n.caption;this.inputType=n.inputType;this.inputValues=this.configureInputValues(n.inputValues);this.helpText=n.helpText;this.allowOnlyDigits=n.allowOnlyDigits;this.minValue=n.minValue;this.maxValue=n.maxValue;this.minLength=n.minLength===0?1:n.minLength;this.maxLength=n.maxLength===0?1:n.maxLength;this.isEnabled=n.isEnabled;this.checkoutRequired=n.checkoutRequired===undefined||n.checkoutRequired===!0}return n.prototype.configureInputValues=function(n){return n.length>0?n:null},n.prototype.convertInputValuesToArray=function(n){n!=null&&(this.inputValues=n.split("\n"))},n.prototype.inputValuesAreValid=function(){return this.inputValues===null||this.inputValues.every(function(n){return n.length<=50})},n}();n.BillingField=t}(ns||(ns={})),function(){"use strict";var n=function(){function n(n,t){this.analyticsService=n;this.featureData=t}return n.prototype.trackLoginByStatus=function(n){n&&(n=="Login Fail"&&this.trackLoginFail(),this.trackLogin(n))},n.prototype.trackLogin=function(n){this.featureData.useGA4Implementation&&this.analyticsService.trackLogin();this.featureData.sendGANEvents&&n&&this.analyticsService.trackEvent({name:"trackEvent",pageType:"Login",action:n})},n.prototype.trackLogout=function(){this.featureData.useGA4Implementation&&this.analyticsService.trackLogout()},n.prototype.trackLoginFail=function(){this.featureData.useGA4Implementation&&this.analyticsService.trackLoginFail()},n}();n.$inject=["analyticsService","featureData"];angular.module("ns").controller("loginController",n)}(ns||(ns={})),function(n){var t=function(){function n(){}return n.prototype.update=function(n){this.materialAmount=n.materialAmount;this.discountAmount=n.discountAmount;this.shippingAmount=n.shippingAmount;this.taxAmount=n.taxAmount;this.bankFeeAmount=n.bankFeeAmount;this.subTotal=n.subTotal;this.netTotal=n.netTotal;this.total=n.total;this.voucherCoverage=n.voucherCoverage},n}();n.Amount=t}(ns||(ns={})),function(n){var t=function(){function n(){}return n}();n.Employee=t}(ns||(ns={})),function(){var t=function(){function t(){this.controller=n;this.controllerAs="orderDetailHeaderController";this.templateUrl="/js/ns/my-account/order-history/order-details-header.component.html"}return t}(),n=function(){function n(n,t){this.voucher_DisplayDeductedFromVoucherLine=!1;this.billingAddress=n.billingAddress;this.shippingAddress=n.shippingAddress;this.orderAmounts=n.orderAmounts;this.email=n.email;this.isEmployeeUser=t.user.isEmployeeUser;this.voucherProgramName=n.voucherProgramName;this.employee=n.employee;this.paymentMethods=n.paymentMethods;this.voucher_DisplayDeductedFromVoucherLine=n.Voucher_DisplayDeductedFromVoucherLine}return n.prototype.billingAddressIsSet=function(){return this.billingAddress.firstName||this.billingAddress.lastName||this.billingAddress.companyName||this.billingAddress.street1||this.billingAddress.street2||this.billingAddress.city||this.billingAddress.stateCode||this.billingAddress.zipCode},n.prototype.getVoucherCoverage=function(){return this.orderAmounts.voucherCoverage*-1},n.prototype.getRemaining=function(){return this.orderAmounts.total+this.getVoucherCoverage()},n.prototype.shouldDisplayVoucherInfo=function(){return this.getVoucherCoverage()!==0},n.prototype.hasVoucherProgramName=function(){return this.voucherProgramName&&this.voucherProgramName.length>0},n.prototype.shouldDisplayEmployeeInfo=function(){return this.employee?this.employee.firstName||this.employee.lastName||this.employee.number:!1},n}();n.$inject=["orderHistoryService","userService"];angular.module("ns").component("orderDetailsHeader",new t)}(ns||(ns={})),function(n){var t=function(){function n(n,t,i,r,u,f,e,o){var s=this;this.$attrs=t;this.orderHistoryService=i;this.$q=r;this.focusService=u;this.featureData=f;this.analyticsService=e;this.userService=o;this.allSelected=!1;this.fromOrderApproval=!1;this.numberOfTotalOrderLines=0;this.counterOfSelectedOrderLines=0;this._noTrackingShippingConditions=["LTL","Replacement","Delivery CUSTOM ORD","Delivery","Customer Pickup","Custom Order","Other","Freight Request","Sales Rep Delivery"];this.shipments=i.shipments;this.returns=i.returns;this.shippingCondition=i.shippingCondition;this.billingAddress=i.billingAddress;this.orderAmounts=i.orderAmounts;this.shippingAddress=i.shippingAddress;this.email=i.email;this.displayedGroupNumber=0;this.analyticsService=e;this.paymentMethods=i.paymentMethods;n.allowReturns=o.user.allowReturns;t.fromorderapproval!=null&&t.fromorderapproval&&(this.fromOrderApproval=!0);this.shipments.forEach(function(n){s.numberOfTotalOrderLines+=n.orderLines.length})}return n.prototype.displayTrackingNumbers=function(n){return n.trackingNumbers.length>0&&!_.contains(this._noTrackingShippingConditions,this.shippingCondition)},n.prototype.addSelectedToCart=function(){var n=this;return this.orderHistoryService.canAddToCart()?this.orderHistoryService.addToCart().then(function(){n.focusService.focusElement("main-nav");n.allSelected=!1}):this.$q.when(!0)},n.prototype.addedWithSuccess=function(){return this.orderHistoryService.linesWithSuccess.length>0},n.prototype.hasError=function(){return this.orderHistoryService.linesWithErrors.length>0},n.prototype.hasWarnings=function(){return this.orderHistoryService.linesWithWarnings.length>0},n.prototype.getItemsWithWarnings=function(){return this.orderHistoryService.linesWithWarnings.join(", ").trim()},n.prototype.getItemsWithErrors=function(){return this.orderHistoryService.linesWithErrors.join(", ").trim()},n.prototype.showAddToCartButton=function(){return this.areLinesAvailableForReOrder()&&this.areSelectedOrderLines()},n.prototype.getTotalNumberOfShipments=function(){var n=this.shipments.length,t=_.some(this.shipments,function(n){return n.hasCancelledItems()});return t&&(n-=1),n},n.prototype.areLinesAvailableForReOrder=function(){return _.some(this.shipments,function(n){return n.hasLinesAvailableForReOrder()})},n.prototype.areSelectedOrderLines=function(){return _.some(this.shipments,function(n){return n.hasSelectedLines()})},n.prototype.selectAll=function(){var n=this;this.counterOfSelectedOrderLines=this.allSelected?this.numberOfTotalOrderLines:0;_.each(this.shipments,function(t){t.allSelected=n.allSelected;t.allCancelledSelected=n.allSelected;t.selectAll()})},n.prototype.selectOrderLine=function(n,t){t?this.counterOfSelectedOrderLines++:this.counterOfSelectedOrderLines--;this.allSelected=this.counterOfSelectedOrderLines===this.numberOfTotalOrderLines;n.allLinesAreSelected()?(n.allSelected=!0,n.allCancelledSelected=!0):(n.allSelected=!1,n.allCancelledSelected=!1)},n.prototype.hasLinesAvailableForReOrder=function(){return _.some(this.shipments,function(n){return n.hasLinesAvailableForReOrder()})},n.prototype.hasCancelledItems=function(){return _.some(this.shipments,function(n){return n.hasCancelledItems()})},n.prototype.getProductPosition=function(n){var t={allOrderLines:Array()};return _.each(this.shipments,function(n){t.allOrderLines=t.allOrderLines.concat(n.orderLines)}),t.allOrderLines.indexOf(n)+1},n.prototype.trackProductClick=function(n){this.analyticsService.trackProductClick(n,"Order Details",this.getProductPosition(n),"Order Details")},n.prototype.isNonReturnable=function(n){return n.nonReturnable||n.isDropShip||n.isClearance||n.isCustom},n}();t.$inject=["$scope","$attrs","orderHistoryService","$q","focusService","featureData","analyticsService","userService"];n.OrderHistoryController=t;angular.module("ns").controller("orderHistoryController",t)}(ns||(ns={})),function(n){var t=function(){function t(t,i,r,u,f,e){this.orderHistoryData=t;this.cookieService=i;this.apiService=r;this.eventsService=u;this.analyticsService=f;this.featureData=e;this.voucher_DisplayDeductedFromVoucherLine=!1;this._linesWithWarnings=[];this._linesWithErrors=[];this._linesWithSuccess=[];this.voucher_DisplayDeductedFromVoucherLine=e.voucher_DisplayDeductedFromVoucherLine;this._shipments=_.map(t.shipments,function(t){var i=new n.Shipment;return i.update(t),i});this._returns=t.returns;this._shippingCondition=t.shippingCondition;this.getAdditionalData();this._cartCookie=i.getCartCookie();this._paymentMethods=t.paymentMethods}return Object.defineProperty(t.prototype,"shipments",{get:function(){return this._shipments},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"returns",{get:function(){return this._returns},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"billingAddress",{get:function(){return this._billingAddress},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shippingAddress",{get:function(){return this._shippingAddress},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"orderAmounts",{get:function(){return this._orderAmounts},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"shippingCondition",{get:function(){return this._shippingCondition},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"email",{get:function(){return this._email},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"voucherProgramName",{get:function(){return this._voucherProgramName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"employee",{get:function(){return this._employee},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"paymentMethods",{get:function(){return this._paymentMethods},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"linesWithWarnings",{get:function(){return this._linesWithWarnings},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"linesWithErrors",{get:function(){return this._linesWithErrors},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"linesWithSuccess",{get:function(){return this._linesWithSuccess},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"Voucher_DisplayDeductedFromVoucherLine",{get:function(){return this.voucher_DisplayDeductedFromVoucherLine},enumerable:!0,configurable:!0}),t.prototype.canAddToCart=function(){return _.some(this.shipments,function(n){return n.hasSelectedLines()})},t.prototype.addToCart=function(){var n=this,t=this.getItemsToBeAddedToCart();return this.apiService.addLinesToCart(t).then(function(t){n.cookieService.setCartCookie(t.data[0].cartCookieId);n.cookieService.slideExpirationDates();var i=t.data;n.resetValues();n.handleResponse(i);n.refreshSelections();n.eventsService.trigger(events.CartEvents.UpdateCart)})},t.prototype.getItemsToBeAddedToCart=function(){var n=this;return this._orderLines=[],_.each(this._shipments,function(t){return n._orderLines=_.union(n._orderLines,t.getSelectedLines())}),_.map(this._orderLines,function(t){return n.createAddToCartInput(t)})},t.prototype.refreshSelections=function(){_.each(this._shipments,function(n){n.allSelected=!1;n.allCancelledSelected=!1;n.selectAll();n.selectAllCancelled()})},t.prototype.handleResponse=function(n){var i=this,t;_.any(n,function(n){return n.isSuccess})&&(t=_.map(_.filter(n,function(n){return n.isSuccess}),function(n){return n.materialBaseId}),this._linesWithSuccess=this.getMaterialNumbers(t),this.analyticsService.trackReorderAndAddProductsToCart(_.filter(this._orderLines,function(n){return _.any(i._linesWithSuccess,function(t){return t===n.materialNumber})}),"Order Details","Add Selected To Cart"));_.any(n,function(n){return!!n.errorMessage})&&(t=_.map(_.filter(n,function(n){return!!n.errorMessage}),function(n){return n.materialBaseId}),this._linesWithErrors=this.getUniqueMaterialNumbers(t));_.any(n,function(n){return!!n.warningMessage})&&(t=_.map(_.filter(n,function(n){return!!n.warningMessage}),function(n){return n.materialBaseId}),this._linesWithWarnings=this.getUniqueMaterialNumbers(t))},t.prototype.createAddToCartInput=function(t){var i=new n.AddToCartInput;return i.quantity=t.quantity,i.force=!0,i.characterSetValueIds=t.reOrderData.characterSetValueIds,i.materialBaseId=t.reOrderData.materialBaseId,i.cartId=this._cartCookie,i},t.prototype.getUniqueMaterialNumbers=function(n){return this.getMaterialNumbers(n).filter(function(n,t,i){return n&&i.indexOf(n)===t})},t.prototype.getMaterialNumbers=function(n){return _.map(_.filter(this._orderLines,function(t){return n.indexOf(t.reOrderData.materialBaseId)>=0}),function(n){return n.materialNumber})},t.prototype.getAdditionalData=function(){this.orderHistoryData.billingAddress&&(this._billingAddress=new n.Address,this._billingAddress.update(this.orderHistoryData.billingAddress));this.orderHistoryData.orderAmounts&&(this._orderAmounts=new n.Amount,this._orderAmounts.update(this.orderHistoryData.orderAmounts));this._shippingAddress=_.first(this._shipments).address;this._email=this.orderHistoryData.email;this._voucherProgramName=this.orderHistoryData.voucherProgramName;this._employee=this.orderHistoryData.employee},t.prototype.resetValues=function(){this._linesWithSuccess=[];this._linesWithErrors=[];this._linesWithWarnings=[]},t}();t.$inject=["orderHistoryData","cookieService","apiService","eventsService","analyticsService","featureData"];n.OrderHistoryService=t;angular.module("ns").service("orderHistoryService",t)}(ns||(ns={})),function(n){var t=function(){function t(){this.selected=!1}return t.prototype.update=function(t){this.materialName=t.materialName;this.materialBrand=t.materialBrand;this.materialBaseNumber=t.materialBaseNumber;this.materialNumber=t.materialNumber;this.materialCustomNumber=t.materialCustomNumber;this.quantity=t.quantity;this.quantityDelivered=t.quantityDelivered;this.materialPrice=t.materialPrice;this.linePrice=t.linePrice;this.isCancelled=t.isCancelled;this.isDropShip=t.isDropShip;this.deliveryStatus=t.deliveryStatus;this.isCustom=t.isCustom;this.isFreeGood=t.isFreeGood;this.isCatalogKit=t.isCatalogKit;this.isServiceMaterial=t.isServiceMaterial;this.isMaterialActive=t.isMaterialActive;this.vendorPartNumber=t.vendorPartNumber;this.isAvailableForReOrder=t.isAvailableForReOrder;this.isClearance=t.isClearance;this.isSpecialOrder=t.isSpecialOrder;this.quantityInStock=t.quantityInStock;this.imageId=t.imageId;this.unitPrice=t.linePrice;this.isAvailableOnWebsite=t.isAvailableOnWebsite;this.category=t.category;this.availableForBackorderOnly=t.availableForBackorderOnly;this.nonReturnable=t.nonReturnable;t.reOrderData&&(this.reOrderData=new n.ReOrderData,this.reOrderData.update(t.reOrderData))},t}();n.OrderLine=t}(ns||(ns={})),function(n){var t=function(){function n(){}return n.prototype.update=function(n){this.materialBaseId=n.materialBaseId;this.isBackorderAllowed=n.isBackorderAllowed;this.characterSetValueIds=n.characterSetValueIds;this.characterSetValues=n.characterSetValues},n}();n.ReOrderData=t}(ns||(ns={})),function(n){var t=function(){function n(){}return n}();n.Return=t}(ns||(ns={})),function(n){var i=function(){function n(){this.restrict="A";this.templateUrl="/js/ns/my-account/order-history/returns-information.html";this.controller=t;this.controllerAs="returnsController";this.scope={returns:"=",zipcode:"="};this.replace=!0}return n.instance=function(){return new n},n}(),t;angular.module("ns").directive("returnsInformation",i.instance);t=function(){function n(n,t){this.$scope=n;this.featureData=t;this.returns=n.returns;this.zipcode=n.zipcode}return n}();t.$inject=["$scope","featureData"];n.ReturnsController=t}(ns||(ns={})),function(n){var i=function(){function n(){this.restrict="A";this.templateUrl="/js/ns/my-account/order-history/shipment-information.html";this.controller=t;this.controllerAs="shipmentController";this.scope={shipments:"="};this.replace=!0}return n.instance=function(){return new n},n}(),t;angular.module("ns").directive("shipmentInformation",i.instance);t=function(){function n(n,t){this.$scope=n;this.featureData=t;this.shipments=n.shipments}return n}();t.$inject=["$scope","featureData"];n.ShipmentController=t}(ns||(ns={})),function(n){var t,i;(function(n){n[n.Shipped=0]="Shipped";n[n.DropShipped=1]="DropShipped";n[n.NotShipped=2]="NotShipped";n[n.NotDropShipped=3]="NotDropShipped";n[n.Cancelled=4]="Cancelled";n[n.CompletedWithoutDeliveryOrderLines=5]="CompletedWithoutDeliveryOrderLines"})(t=n.ShipmentType||(n.ShipmentType={}));i=function(){function i(){this._deliveryShippingCondition="Delivery";this._shippingMessage=[];this.allSelected=!1;this.allCancelledSelected=!1;this._shippingMessage[t.DropShipped]=this.getDropShippedMessage.bind(this);this._shippingMessage[t.Shipped]=this.getShippedMessage.bind(this);this._shippingMessage[t.Cancelled]=this.getCancelledMessage.bind(this);this._shippingMessage[t.NotDropShipped]=this.getNotDropShippedMessage.bind(this);this._shippingMessage[t.NotShipped]=this.getNotShippedMessage.bind(this);this._shippingMessage[t.CompletedWithoutDeliveryOrderLines]=this.getNotShippedMessage.bind(this)}return i.prototype.update=function(t){this.trackingNumbers=t.trackingNumbers;this.shipDate=t.shipDate;this.type=t.shipmentType;this.orderLines=_.map(t.orderLines,function(t){var i=new n.OrderLine;return i.update(t),i});this.address=t.shippingAddress;this.shipmentNumber=t.shipmentNumber},i.prototype.shipmentIsCancelled=function(){return this.type===t.Cancelled},i.prototype.showTrackingNumbers=function(n){return _.any(this.trackingNumbers)&&this._deliveryShippingCondition!==n},i.prototype.getShippingMessage=function(n){return this._shippingMessage[this.type]?this._shippingMessage[this.type](n):""},i.prototype.hasSelectedLines=function(){return _.some(this.orderLines,function(n){return n.selected})},i.prototype.selectAllLines=function(n){_.each(this.orderLines,function(t){return t.selected=n})},i.prototype.allLinesAreSelected=function(){return _.some(this.orderLines)&&_.every(this.orderLines,function(n){return n.selected})},i.prototype.getSelectedLines=function(){return _.where(this.orderLines,{selected:!0})},i.prototype.getShippedMessage=function(n){var t=this.getShippedMessageForDelivery(n);return t?t:this.shipDate?"The item(s) shipped via "+n+" on "+this.shipDate+".":"The item(s) shipped via "+n+"."},i.prototype.getDropShippedMessage=function(n){return this.shipDate?"The item(s) drop shipped via "+n+" on "+this.shipDate+".":"The item(s) drop shipped via "+n+"."},i.prototype.getNotShippedMessage=function(n){return this._deliveryShippingCondition===n?"The item(s) will be shipped.":"The item(s) will ship via "+n+"."},i.prototype.getNotDropShippedMessage=function(){return"The item(s) will be drop shipped."},i.prototype.getCancelledMessage=function(){return"The item(s) have been cancelled from this order."},i.prototype.getShippedMessageForDelivery=function(n){return this._deliveryShippingCondition!==n?null:this.shipDate?"The item(s) shipped on "+this.shipDate+".":"The item(s) were shipped."},i.prototype.selectAll=function(){var n=this;_.each(this.orderLines,function(t){return t.selected=t.isAvailableForReOrder&&n.allSelected})},i.prototype.selectAllCancelled=function(){var n=this;_.each(this.orderLines,function(t){return t.selected=n.allCancelledSelected})},i.prototype.hasLinesAvailableForReOrder=function(){return _.some(this.orderLines,function(n){return n.isAvailableForReOrder})},i.prototype.hasCancelledItems=function(){return _.some(this.orderLines,function(n){return n.isCancelled})},i}();n.Shipment=i}(ns||(ns={})),function(n){var t=function(){function n(n){this.apiService=n}return n.prototype.submitRequests=function(n){return this.apiService.submitPrivacyOptionsRequestForLoggedUsers(n)},n}();t.$inject=["apiService"];n.PrivacyManagementService=t;angular.module("ns").service("privacyManagementService",t)}(ns||(ns={})),function(){var n=function(){function n(n,t,i){this.privacyManagementService=n;this.initialData=t;this.eventsService=i;this.email=t.email;this.resetRequest()}return n.prototype.submit=function(){var n=this;this.privacyManagementService.submitRequests(this.request).then(function(){return n.triggerRequestsSentEvent()})},n.prototype.submitButtonDisabled=function(){for(var n in this.request)if(this.request[n])return!1;return!0},n.prototype.triggerRequestsSentEvent=function(){$("#privacyManagementRequests").modal("show");this.eventsService.trigger("reset-update-spinner");this.resetRequest()},n.prototype.resetRequest=function(){this.request={generalInformation:!1,specificInformation:!1,requestToDelete:!1,doNotSellInformation:!1}},n}();n.$inject=["privacyManagementService","initialData","eventsService"];angular.module("ns").controller("privacyManagementController",n)}(ns||(ns={})),function(){var t=function(){function t(){this.templateUrl="/js/ns/my-account/reports/reports.html";this.controllerAs="controller";this.controller=n;this.bindings={hasQuotedPrice:"<"}}return t}(),n=function(){function n(n,t,i){var r=this;this.$http=n;this.userService=t;this.analyticsService=i;this.hasQuotedPrice=!1;this.spinnerId=Math.random().toString(36).replace("0.","REPORTLIST_");this.reports=[];this.downloadUrlBase="/MyAccount/GetReport";this.reportListEndpoint="/MyAccount/GetReportsList";this.hasOptions=!1;this.cusomerQuotedPriceReportName="Customer Quoted Pricing List";this.areValidateDates(null,null);this.$http.get(this.reportListEndpoint,{responseType:"json"}).then(function(n){if(n.data)for(var t in n.data)r.reports.push({name:n.data[t],id:t})}).catch(function(n){window.alert("An error occurred while loading the dynamic reports list.");console.error(n)}).finally(function(){var n=document.getElementById(r.spinnerId);n&&n.classList.add("hidden")})}return n.prototype.createReport=function(n,t,i){var r,u,f;(t=t==undefined?$("#daterangepicker-field-start-date").val():t,i=i==undefined?$("#daterangepicker-field-end-date").val():i,!this.hasOptions||this.areValidateDates(t,i))&&(r=document.createElement("a"),r.href=n.name!==this.cusomerQuotedPriceReportName?encodeURI(this.downloadUrlBase+"?reportId="+n.id+"&startDate="+t+"&endDate="+i):encodeURI(this.downloadUrlBase+"?reportId="+n.id),u="/"+n.id+".pdf",f=document.getElementById("createReportButton").textContent,this.trackFileDownload(r.href,u,f),r.target="_blank",document.body.appendChild(r),r.click(),document.body.removeChild(r))},n.prototype.showReportOptions=function(n){if(this.areValidateDates(this.startDate,this.endDate),n.name===this.cusomerQuotedPriceReportName){this.hasOptions=!1;$("#"+n.id+"_ReportOptions").show();return}this.hasOptions=!0;this.initializeDatePickers();$("#"+n.id+"_ReportOptions").show()},n.prototype.displayReportOption=function(n){var t=this.userService.user;return n.name===this.cusomerQuotedPriceReportName&&this.hasQuotedPrice?!0:n.name!==this.cusomerQuotedPriceReportName&&t.showCustomerReports?!0:!1},n.prototype.hasReportTypeSelected=function(n){var t=document.getElementById(n);return t.checked},n.prototype.areValidateDates=function(n,t){if(n&&t){var i=Date.parse(n),r=Date.parse(t);return i>=r?($("#alert-message").show(),!1):($("#alert-message").hide(),!0)}$("#alert-message").hide()},n.prototype.initializeDatePickers=function(){function i(t){n.startDate=t.format("L");$(this).val(n.startDate);!n.areValidateDates(n.startDate,n.endDate)}function r(t){n.endDate=t;n.endDate=moment(n.endDate).isSame(new Date,"day")?moment().format("L"):moment(n.endDate).endOf("day").format("L");$(this).val(n.endDate);!n.areValidateDates(n.startDate,n.endDate)}function u(n){setTimeout(function(){var t=$(n).val(),i=moment(t,"MM/DD/YYYY",!0).isValid();i?$(n).parent().removeClass("has-error"):$(n).parent().addClass("has-error")},300)}var n=this,t="#daterangepicker-field-start-date";[t,"#daterangepicker-field-end-date"].forEach(function(n){$(n).on("keyup",function(){u(n)});$(n).daterangepicker({forceUpdate:!0,autoUpdateInput:!0,showDropdowns:!1,minDate:moment().subtract(2,"years"),periods:["month"],startDate:n===t?moment().subtract(1,"months").date(1):moment(),maxDate:moment(),autoClose:!0,singleDatePicker:!0,showShortcuts:!1,singleMonth:!0},function(u){n===t?i(u):r(u)})})},n.prototype.trackFileDownload=function(n,t,i){this.analyticsService.trackFileDownload("pdf",t,i,n)},n}();n.$inject=["$http","userService","analyticsService"];angular.module("ns").component("reports",new t)}(ns||(ns={})),function(n){var i=function(){function n(){this.restrict="A";this.scope=!0;this.controller=t;this.controllerAs="controller";this.replace=!0}return n.instance=function(){return new n},n}(),t=function(){function t(t,i){if(this.returnableData=t,this.featureData=i,this.voucherOrderProgramCategory="VoucherShop",this.emailPattern=/^([A-Za-z0-9/'_\-\.\+])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,18})$/,this.orderReturn=new n.OrderReturn,this.canInitiateReturn=!1,this.orderPartOfOrrMigration=!1,this.shippedOrder=!1,this.orderedLessThen90Days=!1,this.availableForReturnQuantity=!1,this.orderContainsReturnableItems=!1,this.returnSubmitted=!1,this.allowReturn=!1,this.isVoucherOrder=!1,this.pathfinder_Returns_PreventOpenOrderAndBadAmounts=!1,this.orderReturn.orderNumber=t.orderNumber,this.returnableOrderLines=t.returnableOrderLines,this.shippedOrder=t.shippedOrder,this.orderedLessThen90Days=t.orderedLessThen90Days,this.availableForReturnQuantity=t.availableForReturnQuantity,this.orderContainsReturnableItems=t.orderContainsReturnableItems,this.pathfinder_Returns_PreventOpenOrderAndBadAmounts=i.pathfinder_Returns_PreventOpenOrderAndBadAmounts,this.orderPartOfOrrMigration=i.pathfinder_Returns_PreventOpenOrderAndBadAmounts&&t.orderPartOfOrrMigration,this.canInitiateReturn=this.orderContainsReturnableItems&&this.shippedOrder&&this.orderedLessThen90Days&&this.availableForReturnQuantity&&!this.orderPartOfOrrMigration,this.isVoucherOrder=t.programCategory===this.voucherOrderProgramCategory,this.orderReturn.contactName=t.contactName,this.orderReturn.emailAddress=t.email,t.contactPhone){var r=t.contactPhone.replaceAll("-","");this.orderReturn.contactPhoneNumber=r.substring(0,3)+"-"+r.substring(3,6)+"-"+r.substring(6,11)}}return t.prototype.getOptionsArray=function(n){return _.range(0,n+1)},t.prototype.enableReturn=function(){this.allowReturn=this.returnableOrderLines.some(function(n){return n.returnedQuantity>0})},t.prototype.returnItems=function(n,t){this.returnSubmitted=!0;t.$invalid||this.orderReturn.selectedReason===""?(t.$setSubmitted(),n.preventDefault()):$("#processReturnsModal").modal("show");this.orderReturn.returnedItems=this.returnableOrderLines.filter(function(n){return n.returnedQuantity>0})},t}();t.$inject=["returnableData","featureData"];angular.module("ns").controller("returnsManagementController",t)}(ns||(ns={})),function(n){var i=function(){function n(){this.restrict="A";this.scope=!0;this.controller=t;this.controllerAs="controller";this.replace=!0}return n.instance=function(){return new n},n}(),t=function(){function t(t,i,r){(this.returnedDataSummary=t,this.featureData=i,this.initialData=r,this.returnSummary=new n.OrderReturnSummary,this.hasError=!1,this.hasLabel=!1,this.returnSummary=t,this.returnSummary.returnIsBeingProcessed)||(this.setReturnReferenceNumber(t),this.hasError=this.returnSummary.returnedOrderLines==null||this.returnSummary.returnedOrderLines.length===0||t.hasError,this.phoneNumberSupport=this.initialData.contactMessagePhoneNumber,this.setLabel(t))}return t.prototype.printReceipt=function(){$("#returnedItemsTable").removeClass("table-bordered");$("#printHeaderId").addClass("hidden-print");$("#top-action-bar").addClass("hidden-print");$("#globalbanner").hasClass("global-banner")&&$("#covidbanner").hasClass("covid-banner")&&$("body").removeClass("customer-header-pad");$("#contentDiv").addClass("col-md-11");$("#contentDiv").removeClass("col-md-9");$("#contentDiv").css("margin-left","50px");$("#FoldHereWrapper").show();$("#FoldHereLine").show();window.print();$("#returnedItemsTable").addClass("table-bordered");$("#printHeaderId").removeClass("hidden-print");$("#globalbanner").hasClass("global-banner")&&$("#covidbanner").hasClass("covid-banner")&&$("body").addClass("customer-header-pad");$("#contentDiv").addClass("col-md-9");$("#contentDiv").removeClass("col-md-11");$("#contentDiv").css("margin-left","0");this.hasLabel&&$("#UpsShippingLabelWrapper").show();$("#FoldHereWrapper").hide();$("#FoldHereLine").hide()},t.prototype.setReturnReferenceNumber=function(n){if(n.returnReferenceNumber==null){var t=new Date;this.returnSummary.returnReferenceNumber=Math.floor(t.getTime()/10).toString()}},t.prototype.setLabel=function(n){n.upsShippingLabel!=null&&(this.hasLabel=!0,this.returnSummary.upsShippingLabel.indexOf("base")<0&&(this.returnSummary.upsShippingLabel="data:image/png;base64,"+n.upsShippingLabel))},t}();t.$inject=["returnedDataSummary","featureData","initialData"];angular.module("ns").controller("returnsSummaryController",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t,i){this.buyers=n.buyers;this.selectedBuyers=[];this.selectedRoles=[];this.manage_Administrators_Role=i;this.roles=t?this.configureAdminRoles():this.configureAdminRolesTheOldWay();this.showErrorMessage=!1;this.showUpdatedBuyerRolesSuccessfullyMessage=!1}return n.prototype.configureAdminRoles=function(){return[{role:"No Administrator Rights",value:"none",selected:!1},{role:this.manage_Administrators_Role?"Manage Administrators":"Full Administrator",value:"FullAdministrator",selected:!1},{role:"Approvers Administrator",value:"ApproversAdministrator",selected:!1},{role:"Buyers Administrator",value:"BuyersAdministrator",selected:!1},{role:"Employees Administrator",value:"EmployeesAdministrator",selected:!1},{role:"Groups Administrator",value:"GroupsAdministrator",selected:!1},{role:"Invoices Administrator",value:"InvoicesAdministrator",selected:!1},{role:"Orders Administrator",value:"OrdersAdministrator",selected:!1},{role:"Reports Administrator",value:"ReportsAdministrator",selected:!1},{role:"Shipping Addresses Administrator",value:"ShipTosAdministrator",selected:!1},{role:"Vouchers Administrator",value:"VouchersAdministrator",selected:!1}]},n.prototype.configureAdminRolesTheOldWay=function(){return[{role:"No Administrator Rights",value:"none",selected:!1},{role:this.manage_Administrators_Role?"Manage Administrators":"Full Administrator",value:"FullAdministrator",selected:!1},{role:"Buyers Administrator",value:"BuyersAdministrator",selected:!1},{role:"Orders Administrator",value:"OrdersAdministrator",selected:!1},{role:"Invoices Administrator",value:"InvoicesAdministrator",selected:!1},{role:"Shipping Addresses Administrator",value:"ShipTosAdministrator",selected:!1},{role:"Vouchers Administrator",value:"VouchersAdministrator",selected:!1},{role:"Approvers Administrator",value:"ApproversAdministrator",selected:!1},{role:"Employees Administrator",value:"EmployeesAdministrator",selected:!1},{role:"Groups Administrator",value:"GroupsAdministrator",selected:!1}]},n.prototype.setShowUpdatedBuyerRolesSuccessfullyMessage=function(){this.showUpdatedBuyerRolesSuccessfullyMessage=!0;this.showErrorMessage=!1},n.prototype.setAssignedRoles=function(n){var t=this;this.roles.forEach(function(i){n.indexOf(i.value)>-1&&(i.selected=!0,t.selectedRoles.push(i.value))})},n.prototype.setShowErrorMessage=function(){this.showErrorMessage=!0;this.showUpdatedBuyerRolesSuccessfullyMessage=!1},n.prototype.clearMessages=function(){this.showErrorMessage=!1;this.showUpdatedBuyerRolesSuccessfullyMessage=!1},n}();n.RoleManagement=t}(ns||(ns={})),function(n){var t=function(){function n(n,t,i,r,u){this.$q=n;this.apiService=t;this.modelsFactory=i;this.initialData=r;this.featureData=u;var f=this.featureData.pathfinder_BuyerReportsImprovements,e=this.featureData.manage_Administrators_Role;this.adminRoles=i.createAdminRoleManager(r,f,e)}return n.prototype.submitRequests=function(n){var i=this,t=this.$q.defer();return this.adminRoles.clearMessages(),this.apiService.assignBuyerRoles(n).then(function(n){return n.data.success?(i.adminRoles.setShowUpdatedBuyerRolesSuccessfullyMessage(),t.resolve(!0)):(i.adminRoles.setShowErrorMessage(),t.resolve(!1)),t.promise})},n.prototype.getBuyerRoles=function(n){var i=this,t=this.$q.defer();return this.apiService.getBuyerRoles(n).then(function(n){return n.data.success&&(i.adminRoles.setAssignedRoles(n.data.resultObject.roles),t.resolve(!0)),t.promise})},n.prototype.showUpdatedBuyersSuccessfully=function(){return this.adminRoles.showUpdatedBuyerRolesSuccessfullyMessage},n.prototype.showErrorMessage=function(){return this.adminRoles.showErrorMessage},n}();t.$inject=["$q","apiService","modelsFactory","initialData","featureData"];n.RoleManagementService=t;angular.module("ns").service("roleManagementService",t)}(ns||(ns={})),function(){var t=function(){function n(){this.restrict="A";this.scope=!0;this.templateUrl="/js/ns/my-account/roles-management/roles-modal.html";this.replace=!0}return n.instance=function(){return new n},n}(),n;angular.module("ns").directive("rolesEditModal",t.instance);n=function(){function n(n,t,i,r,u){this.eventsService=n;this.uiGridConstants=t;this.$templateCache=i;this.roleManagementService=r;this.featureData=u;this.submitDisabled=!1;this.adminRoles=this.roleManagementService.adminRoles;this.gridOptions={appScopeProvider:this,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,enableColumnMenus:!1,paginationPageSizes:[10,20,30,100],paginationPageSize:10,enableSelectAll:!0,selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS,onRegisterApi:function(n){n.grid.appScope.gridApi=n}};this.configureBuyerRoles();this.configureGrid();this.$templateCache.put("ui-grid/selectionRowHeaderButtons",'<div class="ui-grid-selection-row-header-buttons " ng-class="{\'ui-grid-row-selected\': row.isSelected}" ><input style="margin: 0; vertical-align: middle" type="checkbox" ng-model="row.isSelected">&nbsp;<\/div>');this.singleBuyer=null}return n.prototype.submit=function(){var n=this,t;return this.submitDisabled=!0,t={customerIds:this.singleBuyer?[this.singleBuyer]:this.adminRoles.selectedBuyers,roles:this.adminRoles.selectedRoles},this.roleManagementService.submitRequests(t).then(function(){$("#roles-management-modal").modal("hide");n.submitDisabled=!1;n.updateBuyersRoles();n.gridApi.selection.clearSelectedRows();n.resetRequest()})},n.prototype.updateBuyersRoles=function(){var n=this;_.each(this.adminRoles.selectedBuyers,function(t){n.resetBuyerRoles(t)});this.singleBuyer&&this.resetBuyerRoles(this.singleBuyer)},n.prototype.resetBuyerRoles=function(n){var t=this,i=this.adminRoles.buyers.find(function(t){return t.customerID===n});_.each(this.adminRoles.roles,function(n){i[n.value]=_.contains(t.adminRoles.selectedRoles,n.value)?"true":"false"})},n.prototype.assignRolesButtonDisabled=function(){return this.gridApi.selection.getSelectedRows().length===0},n.prototype.toggleRoleSelection=function(n){if(n==="none"){this.resetSelectedRoles();return}var t=this.adminRoles.selectedRoles.indexOf(n);t>-1?this.adminRoles.selectedRoles.splice(t,1):this.adminRoles.selectedRoles.push(n)},n.prototype.openRolesSelectionModal=function(n){n===void 0&&(n=null);this.resetSelectedRoles();n?(this.singleBuyer=n.entity.customerID,this.roleManagementService.getBuyerRoles(this.singleBuyer).then(function(){$("#roles-management-modal").modal("show")})):(this.adminRoles.selectedBuyers=this.gridApi.selection.getSelectedRows().map(function(n){return n.customerID}),this.adminRoles.selectedBuyers.length===1?(this.singleBuyer=null,this.roleManagementService.getBuyerRoles(this.adminRoles.selectedBuyers[0]).then(function(){$("#roles-management-modal").modal("show")})):$("#roles-management-modal").modal("show"))},n.prototype.resetRequest=function(){this.adminRoles.selectedBuyers=[];this.resetSelectedRoles();this.gridApi.selection.clearSelectedRows();this.singleBuyer=null},n.prototype.cancel=function(){this.gridApi.grid.refresh();this.resetSelectedRoles()},n.prototype.resetSelectedRoles=function(){this.adminRoles.selectedRoles=[];this.adminRoles.roles=this.featureData.pathfinder_BuyerReportsImprovements?this.roleManagementService.adminRoles.configureAdminRoles():this.roleManagementService.adminRoles.configureAdminRolesTheOldWay()},n.prototype.showErrorMessage=function(){return this.roleManagementService.showErrorMessage()},n.prototype.showChangedBuyersSuccessfully=function(){return this.roleManagementService.showUpdatedBuyersSuccessfully()},n.prototype.configureRoleColumns=function(){var t=this,n=[];return _.each(this.adminRoles.roles,function(i){var r={name:i.value,displayName:t.getColumnHeader(i.role),field:i.value,cellTemplate:'<div class="text-center"><input type="checkbox" class="boolean-column" ng-checked="row.entity.'+i.value+' === \'true\'" disabled="disabled" /><\/div>',filter:{type:t.uiGridConstants.filter.SELECT,selectOptions:[{value:"true",label:"True"},{value:"false",label:"False"}]}};n.push(r)}),n.splice(0,1),n},n.prototype.getColumnHeader=function(n){var t=n.indexOf(" ");return n.substring(0,t)},n.prototype.configureBuyerRoles=function(){var n=this;_.each(this.adminRoles.buyers,function(t){_.each(n.adminRoles.roles,function(n){t[n.value]=_.contains(t.userRoles,n.value)?"true":"false"})})},n.prototype.configureGrid=function(){var n=[{name:"customerId",field:"customerId",visible:!1,enableHiding:!1},{name:"name",displayName:"Name",field:"name",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0,width:125},{name:"email",displayName:"Email",field:"email",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0,width:175}],i=this.configureRoleColumns(),t;n=[].concat(n,i);t={name:"actions",displayName:"Actions",cellTemplate:'<div class="ng-binding ng-scope"><button ng-click="grid.appScope.openRolesSelectionModal(row)" class="btn btn-link">Edit<\/button><\/div>',enableFiltering:!1};n.push(t);this.gridOptions.columnDefs=n;this.gridOptions.data=this.adminRoles.buyers},n}();n.$inject=["eventsService","uiGridConstants","$templateCache","roleManagementService","featureData"];angular.module("ns").controller("rolesManagementController",n)}(ns||(ns={})),function(n){var t=function(){function n(){}return n}();n.BuyerShipToAssignment=t}(ns||(ns={})),function(n){"use strict";var t=function(){function t(t,i,r,u,f){this.addressService=t;this.$rootScope=i;this.eventsService=r;this.editShipToInfo=u;this.createShipToInfo=f;this.address=new n.ShippingAddress;this.addingOrUpdatingShipToFailed=!1;this.eventsService.on(events.AddressesEvents.SubmitCleansedAddress,this.submitAlreadyCleansedShipToAddress.bind(this));u!=null&&u.shipTo!==null&&this.mapShipToInfo(u);f&&(this.address.companyName=f.soldToCompanyName)}return t.prototype.addOrEditShipTo=function(n){var t=this;n&&(n.$setSubmitted(),this.controllerForm=n,n.$invalid)||(this.address.isFromAdminHub=!0,this.addressService.addOrEditShippingLocation(this.address).then(function(i){t.handleResult(i,n)}).catch(function(){t.handleException()}))},t.prototype.submitAlreadyCleansedShipToAddress=function(t,i){(!i||i[0][0]&&i[0][0]instanceof n.ShippingAddress)&&(this.address.isAlreadyCleansed=!0,this.address.cleansedAddressInfo=this.addressService.addressCleansedResult.cleansedAddressInfo,this.addOrEditShipTo())},t.prototype.handleResult=function(n,t){if(n&&this.addressService.addressCleansedResult.isAddressCleanseSuccess()){this.handledSuccessfullSubmit(t);return}this.showAddressVerification();this.$rootScope.$broadcast("shipTo-submitted")},t.prototype.resetForm=function(n){n&&(n.$setPristine(),n.$submitted=!1,this.addingOrUpdatingShipToFailed=!1)},t.prototype.showAddressVerification=function(){$(".vertex-address-verification").first().modal("show")},t.prototype.handledSuccessfullSubmit=function(n){$(".vertex-address-verification").modal("hide");this.addressService.closeAddressBook();this.resetForm(n);window.location.href="/MyAccount/ManageShipTos"},t.prototype.handleException=function(){$(".vertex-address-verification").modal("hide");this.addingOrUpdatingShipToFailed=!0},t.prototype.mapShipToInfo=function(n){if(this.address.shipToId=n.shipTo.shipToId,this.address.firstName=n.shipTo.firstName,this.address.lastName=n.shipTo.lastName,this.address.companyName=n.shipTo.companyName,this.address.department=n.shipTo.department,this.address.street1=n.shipTo.street1,this.address.street2=n.shipTo.street2,this.address.city=n.shipTo.city,this.address.state={},this.address.state.stateCode=n.shipTo.stateCode,this.address.zipCode=n.shipTo.zipCode,this.address.phoneExtension=n.shipTo.phoneExtension,this.address.specialDeliveryInstructions=n.shipTo.specialDeliveryInstructions,this.address.displayName="Not applicable",n.shipTo.phone){var t=n.shipTo.phone.replaceAll("-","");this.address.phone=n.shipTo.phone?t.substring(0,3)+"-"+t.substring(3,6)+"-"+t.substring(6,11):""}},t}();t.$inject=["addressService","$rootScope","eventsService","editShipToInfo","createShipToInfo"];n.CreateEditShipToController=t;angular.module("ns").controller("createEditShipToController",t)}(ns||(ns={})),function(n){var i=function(){function n(){this.restrict="A";this.scope=!0;this.templateUrl="/js/ns/my-account/shipTos-management/assign-buyers-modal.html";this.replace=!0}return n.instance=function(){return new n},n}(),t;angular.module("ns").directive("assignBuyersModal",i.instance);t=function(){function t(n,t,i,r,u,f,e){this.initialData=n;this.eventsService=t;this.uiGridConstants=i;this.$templateCache=r;this.apiService=u;this.featureData=f;this.$scope=e;this.isAssignBuyersToShipToDisabled=!1;this.displayNoBuyersSelectedError=!1;this.displayRequestError=!1;this.selectedAddressForBuyerAssignment="";this.assignedShipToDisplayName="";this.openAssignBuyersModal=function(n){var t=this;this.loadingAssignedBuyers=!0;this.apiService.getBuyersAssignedToShipTo(n.customerID).then(function(n){t.configureBuyers(n.data);t.loadingAssignedBuyers=!1});this.resetAssignBuyersModal();this.resetForm();this.selectedAddressForBuyerAssignment=n.street1+", "+n.city+", "+n.stateCode+".";this.selectedShipTo=n;$("#assign-buyers-modal").modal("show");this.buyersGridApi.grid.handleWindowResize();this.buyersGridApi.selection.clearSelectedRows()};this.assignBuyersToShipTo=function(n){var t=this,i,r;if(this.displayRequestError=!1,i=this.buyersGridApi.selection.getSelectedRows(),i.length<1){this.displayNoBuyersSelectedError=!0;return}(this.displayNoBuyersSelectedError=!1,n&&(n.$setSubmitted(),n.$invalid))||(this.isAssignBuyersToShipToDisabled=!0,r=i.map(function(n){return t.createBuyerShipToAssignment(n)}),this.apiService.assignBuyersToShipTo(this.selectedShipTo.customerID,this.assignedShipToDisplayName,r).then(function(){t.isAssignBuyersToShipToDisabled=!1;$("#assign-buyers-modal").modal("hide")}).catch(function(){t.isAssignBuyersToShipToDisabled=!1;t.displayRequestError=!0}))};this.openRemoveShipToModal=function(n){this.selectedShipTo=n;$("#remove-shipToAddress-modal").modal("show")};this.shipTos=n.shipTos;this.createShipTosGridOptions();this.configureShipTosGrid();this.buyers=n.buyers;this.createBuyersGridOptions();this.configureBuyersGrid();this.$templateCache.put("ui-grid/selectionRowHeaderButtons",'<div class="ui-grid-selection-row-header-buttons " ng-class="{\'ui-grid-row-selected\': row.isSelected}" ><input style="margin: 0; vertical-align: middle" type="checkbox" ng-model="row.isSelected">&nbsp;<\/div>');this.$scope.forms={}}return t.prototype.editShipTo=function(n){window.location.href="/MyAccount/EditShipTo?shipToCustomerId="+n.customerID},t.prototype.removeShipTo=function(){var n=this;this.apiService.removeShippingLocationFromAdmin(this.selectedShipTo.customerID).then(function(){window.location.href="/MyAccount/ManageShipTos"}).catch(function(){n.$scope.$broadcast("shipTo-deleted")})},t.prototype.resetForm=function(){this.$scope.forms.assignBuyersForm&&(this.$scope.forms.assignBuyersForm.$setPristine(),this.$scope.forms.assignBuyersForm.$submitted=!1)},t.prototype.resetAssignBuyersModal=function(){this.displayNoBuyersSelectedError=!1;this.isAssignBuyersToShipToDisabled=!1;this.displayRequestError=!1;this.assignedShipToDisplayName=""},t.prototype.createBuyerShipToAssignment=function(t){var i=new n.BuyerShipToAssignment;return i.buyerCustomerId=t.customerID,i.shipToIsReadOnly=!t.allowEdits,i},t.prototype.configureBuyers=function(n){var t=this;this.buyers.forEach(function(i){i.name=i.firstName+" "+i.lastName;i.allowEdits=!1;t.isAssignBuyersToShipToDisabled&&(i.hasShipToReadOnly=!1);i.assignedToShipTo=n.includes(i.customerID)?!0:!1})},t.prototype.createBuyersGridOptions=function(){var n=this;this.buyersGridOptions={appScopeProvider:this,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,onRegisterApi:function(t){n.buyersGridApi=t},enableSelectAll:!0,selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.WHEN_NEEDED,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS}},t.prototype.createShipTosGridOptions=function(){this.shipTosGridOptions={appScopeProvider:this,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,onRegisterApi:function(n){this.shipTosGridApi=n},enableSelectAll:!1,selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS}},t.prototype.configureShipTosGrid=function(){var n=[{name:"customerId",field:"customerId",visible:!1,enableHiding:!1},{name:"companyName",displayName:"Company",field:"companyName",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"street",displayName:"Street",field:"street1",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"city",displayName:"City",field:"city",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"state",displayName:"State",field:"stateCode",filter:{condition:this.uiGridConstants.filter.CONTAINS},maxWidth:65},{name:"zipcode",displayName:"ZipCode",field:"postcode",cellClass:"text-right",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"phone",displayName:"Phone",field:"phone",cellFilter:"formatPhoneNumber",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"actions",displayName:"Actions",cellTemplate:'<div class="ng-binding ng-scope">\n                         <button class="btn btn-link" ng-click="grid.appScope.editShipTo(row.entity)">Edit<\/button>\n                         <button class="btn btn-link" ng-click="grid.appScope.openAssignBuyersModal(row.entity)">Assign Buyers<\/button>\n                         <button class="btn btn-link" ng-click="grid.appScope.openRemoveShipToModal(row.entity)">Delete<\/button>\n                       <\/div>',enableSorting:!1,enableFiltering:!1,width:250,enableHiding:!1}];this.shipTosGridOptions.columnDefs=n;this.shipTosGridOptions.data=this.shipTos},t.prototype.configureBuyersGrid=function(){var n=[{name:"customerId",field:"customerId",visible:!1,enableHiding:!1},{name:"assignedToShipTo",displayName:"Assigned",field:"assignedToShipTo",cellTemplate:'<div class="ui-grid-cell-contents" >\n                           <input style="margin: 0; vertical-align: middle" type="checkbox" disabled="disabled" ng-model="row.entity.assignedToShipTo">\n                       <\/div>',cellTooltip:!0,headerTooltip:!0,enableSorting:!1,enableFiltering:!1,enableHiding:!1,width:60},{name:"name",displayName:"Buyer Name",field:"name",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0},{name:"street",displayName:"Street",field:"street1",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0},{name:"city",displayName:"City",field:"city",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0,width:80},{name:"state",displayName:"State",field:"stateCode",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0,width:60},{name:"zipcode",displayName:"ZipCode",field:"postcode",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0,cellClass:"text-right",width:100},{name:"email",displayName:"Email",field:"email",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0,width:250},{name:"phone",displayName:"Phone",field:"phone",cellFilter:"formatPhoneNumber",filter:{condition:this.uiGridConstants.filter.CONTAINS},cellTooltip:!0,headerTooltip:!0,width:100},{name:"allowEdits",displayName:"Allow Edits",field:"allowEdits",cellTemplate:'<div class="ui-grid-cell-contents" >\n                           <input style="margin: 0; vertical-align: middle" type="checkbox" ng-model="row.entity.allowEdits">\n                       <\/div>',cellTooltip:!0,headerTooltip:!0,enableSorting:!1,enableFiltering:!1,width:60,enableHiding:!1}];this.buyersGridOptions.columnDefs=n;this.buyersGridOptions.data=this.buyers},t}();t.$inject=["initialData","eventsService","uiGridConstants","$templateCache","apiService","featureData","$scope"];angular.module("ns").controller("shipTosManagementController",t)}(ns||(ns={})),function(){var n=function(){function n(n,t,i){this.initialData=n;this.uiGridConstants=t;this.featureData=i;this.soldTos=this.initialData.soldTos;this.createSoldTosGridOptions();this.configureSoldTosGrid()}return n.prototype.createSoldTosGridOptions=function(){this.soldTosGridOptions={appScopeProvider:this,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,onRegisterApi:function(n){this.soldTosGridApi=n},enableSelectAll:!1,selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS}},n.prototype.manageSoldTo=function(n){window.location.href="/MyAccount/ManageSoldTo?accountNumber="+n.accountNumber},n.prototype.configureSoldTosGrid=function(){var n=[{name:"accountNumber",field:"accountNumber",displayName:"Account Number",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"companyName",displayName:"Company Name",field:"companyName",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"companyName2",displayName:"Company Name 2",field:"companyName2",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"street",displayName:"Street",field:"street",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"city",displayName:"City",field:"city",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"state",displayName:"State",field:"state",filter:{condition:this.uiGridConstants.filter.CONTAINS},maxWidth:65},{name:"zip",displayName:"Zip Code",field:"zip",cellClass:"text-right",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"phone",displayName:"Daytime Phone",field:"phone",cellFilter:"formatPhoneNumber",filter:{condition:this.uiGridConstants.filter.CONTAINS}},{name:"actions",displayName:"Actions",cellTemplate:'<div class="ng-binding ng-scope">\n                         <button class="btn btn-link" ng-click="grid.appScope.manageSoldTo(row.entity)">Manage<\/button>\n                       <\/div>',enableHiding:!1,enableFiltering:!1,maxWidth:80,visible:this.featureData.pathfinder_SalesRepManageSoldTos}];this.soldTosGridOptions.columnDefs=n;this.soldTosGridOptions.data=this.soldTos},n}();n.$inject=["initialData","uiGridConstants","featureData"];angular.module("ns").controller("soldTosManagementController",n)}(ns||(ns={})),function(n){"use strict";var t=function(){function t(t,i,r,u,f){this.apiService=t;this.$rootScope=i;this.$timeout=r;this.editVoucherProgramInfo=u;this.focusService=f;this.numberFieldPattern=/^\d*$/;this.dollarValuePattern=/^\d{1,}(\.\d{1,})?$/;this.voucherProgramInfo=new n.VoucherProgram;u!=null&&this.mapVoucherProgramInfo(u.voucherProgramInfo)}return t.prototype.editVoucherProgram=function(n){var t=this;if(n){if(n.$setSubmitted(),n.$invalid){this.focusService.focusScrollErrorField(n);n.$submitted=!1;n.$valid=!1;return}this.apiService.editVoucherProgram(this.voucherProgramInfo).then(function(){n.$setPristine();n.$submitted=!1;window.location.href="/MyAccount/ManageVoucherPrograms"}).catch(function(){t.$rootScope.$broadcast("voucherProgram-submitted")})}},t.prototype.mapVoucherProgramInfo=function(n){this.voucherProgramInfo.id=n.id;this.voucherProgramInfo.name=n.name;this.voucherProgramInfo.displayName=n.displayName;this.voucherProgramInfo.status=n.status;this.voucherProgramInfo.displayToNonEnrolled=n.displayToNonEnrolled;this.voucherProgramInfo.dollarValue=n.dollarValue;this.voucherProgramInfo.materialQuantity=n.materialQuantity;this.voucherProgramInfo.poNumber=n.poNumber;this.voucherProgramInfo.displayOrder=n.displayOrder;this.voucherProgramInfo.description=n.description;this.voucherProgramInfo.programType=n.programType},t}();t.$inject=["apiService","$rootScope","$timeout","editVoucherProgramInfo","focusService"];n.EditVoucherProgramController=t;angular.module("ns").controller("editVoucherProgramCtrl",t)}(ns||(ns={})),function(n){var t=function(){function n(){this.id=null;this.name=null;this.displayName=null;this.status=null;this.displayToNonEnrolled=null;this.dollarValue=null;this.materialQuantity=null;this.poNumber=null;this.displayOrder=null;this.description=null;this.programType=null}return n}();n.VoucherProgram=t}(ns||(ns={})),function(n){var t=function(){function n(){this.id=null;this.displayOrder=null;this.name=null;this.displayName=null;this.status=null;this.programType=null}return n}();n.VoucherProgramSummaryModel=t}(ns||(ns={})),function(){var n=function(){function n(n,t,i){this.initialData=n;this.analyticsService=t;this.uiGridConstants=i;this.voucherPrograms=[];this.voucherPrograms=n.voucherPrograms;this.createGridOptions();this.configureGridColumns();this.initializeDatePickers()}return n.prototype.createGridOptions=function(){this.voucherProgramsGridOptions={appScopeProvider:this,enableFiltering:!0,enableSorting:!0,enableGridMenu:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,enableSelectAll:!1,selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.NEVER,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS}},n.prototype.configureGridColumns=function(){this.voucherProgramsGridOptions.columnDefs=[{name:"id",field:"id",visible:!1,enableHiding:!1},{name:"displayOrder",displayName:"Display Order",field:"displayOrder",cellClass:"text-right",width:100},{name:"name",displayName:"Program Name",field:"name"},{name:"displayName",displayName:"Display Name",field:"displayName"},{name:"status",displayName:"Status",field:"status"},{name:"programType",displayName:"Program Type",field:"programType"},{name:"actions",displayName:"Actions",cellTemplate:'<div class="ng-binding ng-scope">\n                        <button ng-click="grid.appScope.editVoucherProgram(row)" class="btn btn-link">Edit<\/button>\n                        <\/div>',enableFiltering:!1}];this.voucherProgramsGridOptions.data=this.voucherPrograms},n.prototype.editVoucherProgram=function(n){window.location.href="/MyAccount/EditVoucherProgram?voucherProgramId="+n.entity.id},n.prototype.initializeDatePickers=function(){function i(t){n.startDate=t.format("L");$(this).val(n.startDate);!n.areValidateDates(n.startDate,n.endDate)}function r(t){n.endDate=t;n.endDate=moment(n.endDate).isSame(new Date,"day")?moment().format("L"):moment(n.endDate).endOf("day").format("L");$(this).val(n.endDate);!n.areValidateDates(n.startDate,n.endDate)}function u(n){setTimeout(function(){var t=$(n).val(),i=moment(t,"MM/DD/YYYY",!0).isValid();i?$(n).parent().removeClass("has-error"):$(n).parent().addClass("has-error")},300)}var n=this,t="#daterangepicker-field-start-date";[t,"#daterangepicker-field-end-date"].forEach(function(n){$(n).on("keyup",function(){u(n)});$(n).daterangepicker({forceUpdate:!0,autoUpdateInput:!0,showDropdowns:!1,minDate:moment().subtract(2,"years"),periods:["day"],startDate:n===t?moment().subtract(1,"months"):moment(),maxDate:moment(),autoClose:!0,singleDatePicker:!0,showShortcuts:!1,singleMonth:!0},function(u){n===t?i(u):r(u)})})},n.prototype.areValidateDates=function(n,t){var i=Date.parse(n),r=Date.parse(t);return i>=r?($("#alert-message").show(),!1):($("#alert-message").hide(),!0)},n.prototype.createReport=function(n,t){var i,r,u;(n=n==undefined?$("#daterangepicker-field-start-date").val():n,t=t==undefined?$("#daterangepicker-field-end-date").val():t,this.areValidateDates(n,t))&&(i=document.createElement("a"),i.href="GetCustomerReport?startDate="+n+"&endDate="+t,r=document.getElementById("voucherProgrmGenerateReportButton").textContent,u="/Customer Reports.xlsx",this.trackFileDownload(i.href,u,r),i.target="_blank",document.body.appendChild(i),i.click(),document.body.removeChild(i))},n.prototype.trackFileDownload=function(n,t,i){this.analyticsService.trackFileDownload("xlsx",t,i,n)},n}();n.$inject=["initialData","analyticsService","uiGridConstants"];angular.module("ns").controller("voucherProgramsManagementController",n)}(ns||(ns={})),function(n){var t=function(){function t(n,t,i,r,u,f,e){this.uiGridConstants=n;this.$scope=t;this.initialData=i;this.apiService=r;this.$rootScope=u;this.employeeResetPasswordService=f;this.featureData=e;this.employees=[];this.employees=i.employees;this.isImpersonated=i.isImpersonated;this.createGridOptions();this.configureGridColumns()}return t.prototype.createGridOptions=function(){var n=this;this.employeesGridOptions={appScopeProvider:this,enableFiltering:!0,enableGridMenu:!0,enableSorting:!0,paginationPageSizes:[10,20,30,100],paginationPageSize:10,onRegisterApi:function(t){n.gridApi=t},selectionRowHeaderWidth:35,enableHorizontalScrollbar:this.uiGridConstants.scrollbars.WHEN_NEEDED,enableVerticalScrollbar:this.uiGridConstants.scrollbars.ALWAYS,data:this.employees}},t.prototype.configureGridColumns=function(){var n=[{name:"employeeGuid",field:"employeeGuid",visible:!1},{name:"firstName",displayName:"First Name",field:"firstName"},{name:"lastName",displayName:"Last Name",field:"lastName"},{name:"employeeNumber",displayName:"Employee Number",field:"employeeNumber",cellClass:"text-right"},{name:"email",displayName:"Email",field:"email"},{name:"actions",displayName:"Actions",cellTemplate:this.getActionsTemplate(),enableHiding:!1,enableFiltering:!1,visible:!this.isImpersonated}];this.employeesGridOptions.columnDefs=n;this.employeesGridOptions.data=this.employees},t.prototype.getActionsTemplate=function(){return'<div class="ng-binding ng-scope"><button ng-click="grid.appScope.impersonateEmployee(row)" class="btn btn-link">Login As<\/button><button ng-click="grid.appScope.resetEmployeePassword(row)" class="btn btn-link">Reset Password<\/button><\/div>'},t.prototype.impersonateEmployee=function(n){this.apiService.loginAsEmployee(n.entity.employeeGuid).then(function(){window.location.href="/Employee/VoucherHub"})},t.prototype.resetEmployeePassword=function(t){var i=new n.EmployeeModel;i.employeeGuid=t.entity.employeeGuid;i.firstName=t.entity.firstName;i.lastName=t.entity.lastName;this.employeeResetPasswordService.setEmployee(i);$("#employee-reset-password-modal").modal("show")},t.prototype.showErrorMessage=function(){return this.employeeResetPasswordService.showErrorMessage()},t.prototype.showEmployeePasswordResetSuccessfully=function(){return this.employeeResetPasswordService.showResetPasswordSuccessfulMessage()},t}();t.$inject=["uiGridConstants","$scope","initialData","apiService","$rootScope","employeeResetPasswordService","featureData"];angular.module("ns").controller("myEmployeesController",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t){this.initialData=n;this.navigationService=t;this.myList=this.initialData.myList;this.setPriceStatus();this.goToPrevNonMyListPage=function(){this.navigationService.goToPrevNonMyListPage()}}return n.prototype.goToPrevNonMyListPage=function(){},n.prototype.setPriceStatus=function(){this.myList.forEach(function(n){return n.isPriceUnavailable=n.quantityInStock<=0&&!(n.isDropShip||n.isClearance||n.isCustomizable||n.isSpecialOrder)})},n}();t.$inject=["initialData","navigationService"];n.MyListController=t;angular.module("ns").controller("myListController",t)}(ns||(ns={})),function(n){var t=function(){function n(){this.materialName=null;this.materialNumber=null;this.characterSets=[];this.materialBaseNumber=null;this.unitOfMeasure=null;this.lowestPrice=null;this.highestPrice=null;this.isClearance=null;this.isDropShip=null;this.quantityInStock=null;this.isCustomizable=null;this.isSpecialOrder=null;this.customMaterialNumber=null;this.isNew=null;this.isSale=null;this.isPriceUnavailable=null}return n}();n.MyListItem=t}(ns||(ns={})),function(){var n=function(){function n(){this.bindings={imageNextGenFormatSrc:"=",imageNextGenFormatType:"=",width:"=",height:"=",imageSrc:"=",altText:"=",imageClass:"=",imageTitle:"=",imageTabindex:"="};this.templateUrl="/js/ns/next-gen-images/next-generation-image.html"}return n}();angular.module("ns").component("nextGenerationImage",new n)}(ns||(ns={})),function(n){var t=function(){function t(n,t,i,r){this.initialData=n;this.cookieService=t;this.analyticsService=i;this.gtmEventService=r;this.init(n);this.trackPlaceOrder();this.trackOrderConfirmation()}return Object.defineProperty(t.prototype,"checkoutData",{get:function(){return this._checkoutData},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"priorityCode",{get:function(){var n=this.cookieService.getPriorityCodeCookie();return n||(n=this._checkoutData.orderConfirmation.priorityCode),n!==null?n:(new Date).getFullYear().toString().substr(-2)+"UNWEB"},enumerable:!0,configurable:!0}),t.prototype.trackOrderConfirmation=function(){var n=this,t=[],i;this.checkoutData.orderConfirmation.orderInfo.orderItems.forEach(function(i){return t.push({id:i.materialBaseNumber,name:i.materialName,brand:i.brand,category:n.gtmEventService.getCategoryPathWithChangedDelimiter(i.category,i.isCustomizable),variant:n.gtmEventService.getSelectedCharacterSetsValues(i),price:i.unitPrice,quantity:i.quantity,materialSaleFlag:n.gtmEventService.getMaterialSaleFlag(i.isSale),freeProductFlag:n.gtmEventService.getFreeProductFlag(i.isFreeGood),brandFlag:n.gtmEventService.getBrandFlag(i.isNsBrand),newMaterialFlag:n.gtmEventService.getNewMaterialFlag(i.isNew),characterSets:i.characterSets})});i={id:this.checkoutData.orderConfirmation.orderNumber,revenue:this.checkoutData.orderConfirmation.orderInfo.subtotal,tax:this.checkoutData.orderConfirmation.orderInfo.tax,shipping:this.checkoutData.orderConfirmation.orderInfo.shippingAndHandling,orderDiscount:this.checkoutData.orderConfirmation.orderInfo.discount,coupon:this.priorityCode,affiliation:"",option:this.checkoutData.shippingMethodText,custom:(this.getTotalCostOfGoods()+1e3)*3.1457+31457};this.analyticsService.trackOrderConfirmation(t,i)},t.prototype.trackPlaceOrder=function(){if(!this.hasError){var n=this.checkoutData.orderConfirmation;this.analyticsService.trackPlaceOrder({priorityCode:this.cookieService.getPriorityCodeCookie(),orderNumber:n.orderNumber,soldToState:n.billingAddress.stateCode,soldToZipCode:n.billingAddress.zipCode,cartLinesInfo:this.buildCartLinesInfo(n.orderInfo.orderItems,n)});this.cookieService.removePriorityCodeCookie()}},t.prototype.getTotalCostOfGoods=function(){var n=0;return this.checkoutData.orderConfirmation.orderInfo.orderItems.forEach(function(t){return n=n+t.baseCost}),n},t.prototype.getMaterialUomCost=function(n,t){var i=_.find(n.orderInfo.orderItems,function(n){return n.lineId===t});return i.baseCost},t.prototype.buildCartLinesInfo=function(n,t){var i=this;return n?_.map(n,function(n){return{materialBaseId:n.materialBaseId,quantity:n.quantity,price:n.linePrice,materialCost:i.getMaterialUomCost(t,n.lineId),isPromotion:n.isPromotion,isSale:n.isSale,discountedLinePrice:n.discountedLinePrice}}):[]},t.prototype.init=function(t){if(!t.checkout.orderConfirmation){this.hasError=!0;return}this._checkoutData=t.checkout;var i=this._checkoutData.orderConfirmation;i.billingAddress=new n.Address;i.billToAddress?i.billingAddress.update(i.billToAddress):i.billingAddress.update(i.soldToAddress)},t}();t.$inject=["initialData","cookieService","analyticsService","gtmEventService"];n.OrderConfirmationService=t;angular.module("ns").service("orderConfirmationService",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t,i,r,u,f){this.orderConfirmationService=t;this.userService=i;this.loggerFactory=r;this.browserDetectionService=u;this.analyticsService=f;this.logger=r.getBackendLogger("OrderConfirmationController");this.init();n.allowReturns=i.user.allowReturns}return n.prototype.getVoucherCoverage=function(){return this.orderConfirmation.orderInfo.voucherCoverage*-1},n.prototype.getRemaining=function(){return this.orderConfirmation.orderInfo.total+this.getVoucherCoverage()},n.prototype.getOrderConfirmationCartLines=function(){return this.orderConfirmation.orderInfo.orderItems},n.prototype.are3MBrandMaterials=function(){return this.orderConfirmation.orderInfo.orderItems.some(function(n){return n.is3MBrand})},n.prototype.getTrackingPixelsImageSrc=function(){var t="https://www.commerce-connector.com/tracking/tracking.gif?shop=4Yu1bDawE320krD600IuEeEqWDWeMhKo",n=this.orderConfirmation.orderInfo.orderItems.filter(function(n){return n.is3MBrand});return n.forEach(function(i){return t=t+"&merchant["+n.indexOf(i)+"]="+i.materialNumber+"&sale["+n.indexOf(i)+"]="+i.quantity+"&price["+n.indexOf(i)+"]="+i.unitPrice}),t},n.prototype.getOrderDeliveryEstimateMax=function(){return this.checkoutData.orderDeliveryEstimateMax==="Unavailable"||!this.checkoutData.orderDeliveryEstimateMax?new Date:new Date(this.checkoutData.orderDeliveryEstimateMax)},n.prototype.getOrderShipDate=function(){return this.checkoutData.orderShipDate},n.prototype.showCustomerRestrictedWarning=function(n){return!n.isQuoted&&(this.isLevelTwoRestricted()||this.isLevelOneRestricted())},n.prototype.isPersonalCustomer=function(){return this.userService.user.isPersonal()},n.prototype.showShippingCharge=function(){return this.orderConfirmation.orderInfo.isShippingCalculationSuccessful===!0&&this.orderConfirmation.orderInfo.isFreeShipping===!1&&this.orderConfirmation.orderInfo.shippingAndHandlingAs0===!1},n.prototype.showFreeShipping=function(){return this.orderConfirmation.orderInfo.isShippingCalculationSuccessful===!0&&this.orderConfirmation.orderInfo.isFreeShipping===!0&&this.orderConfirmation.orderInfo.shippingAndHandlingAs0===!1},n.prototype.showZeroShipping=function(){return this.orderConfirmation.orderInfo.isShippingCalculationSuccessful===!0&&this.orderConfirmation.orderInfo.shippingAndHandlingAs0===!0},n.prototype.showUnavailableShipping=function(){return this.orderConfirmation.orderInfo.isShippingCalculationSuccessful===!1},n.prototype.getProductPosition=function(n){var t=this.getOrderConfirmationCartLines();return t.indexOf(n)+1},n.prototype.trackProductClick=function(n){this.analyticsService.trackProductClick(n,"Order confirmation",this.getProductPosition(n),"Order confirmation items")},n.prototype.showNeedsApprovalModal=function(){setTimeout(function(){$("#needs-approval-modal").modal("show")},800)},n.prototype.closeNeedsApprovalModal=function(){$("#needs-approval-modal").modal("hide")},n.prototype.showTotalVoucherDeductedAmount=function(){var n=this.orderConfirmation.orderInfo.totalVoucherDeductedAmount;return n&&n>0},n.prototype.getTotalVoucherDeductedAmount=function(){return this.orderConfirmation.orderInfo.totalVoucherDeductedAmount*-1},n.prototype.isNonReturnable=function(n){return n.nonReturnable||n.isDropShip||n.isClearance||n.isCustom},n.prototype.init=function(){(this.hasError=this.orderConfirmationService.hasError,this.hasError)||(this.checkoutData=this.orderConfirmationService.checkoutData,this.orderConfirmation=this.checkoutData.orderConfirmation,this.orderConfirmation.temporaryOrderNumber&&(this.orderConfirmation.orderNumber=this.orderConfirmation.temporaryOrderNumber),this.checkoutData.needsApproval&&this.showNeedsApprovalModal(),this.logger.debug("We have to display the date "+this.checkoutData.orderDeliveryEstimateMax+" and using browser: "+this.browserDetectionService.showBrowser()))},n.prototype.isLevelOneRestricted=function(){return this.userService.user.isLevelOneRestricted},n.prototype.isLevelTwoRestricted=function(){return this.userService.user.isLevelTwoRestricted},n}();t.$inject=["$scope","orderConfirmationService","userService","loggerFactory","browserDetectionService","analyticsService"];n.OrderConfirmationController=t;angular.module("ns").controller("orderConfirmationCtrl",t)}(ns||(ns={})),function(n){var t=function(){function n(n){this.apiService=n}return n.prototype.getApprovalPendingOrders=function(n){return this.apiService.getOrdersPendingApproval(n)},n.prototype.approveOrder=function(n,t){return this.apiService.approvePendingOrder(n,t)},n.prototype.rejectOrder=function(n,t){return this.apiService.rejectPendingOrder(n,t)},n}();t.$inject=["apiService"];n.OrderPendingApprovalsService=t;angular.module("ns").service("orderPendingApprovalsService",t)}(ns||(ns={})),function(n){var i=function(){function n(){this.restrict="A";this.templateUrl="/js/ns/order-pending-approvals/order-pending-approvals.html";this.controllerAs="orderPendingApprovals";this.controller=t}return n.instance=function(){return new n},n}(),t;angular.module("ns").directive("orderPendingApprovals",i.instance);t=function(){function n(n,t,i){this.orderPendingApprovalsService=n;this.$window=t;this.$location=i;this.pendingOrders=[];this.loadingPendingOrders=!0;this.sortColumn="";this.sortDirection="";this.recordsPerPage=10;this.recordsPerPageOptions=[10,25,50];this.pageNumber=1;this.totalPages=0;this.noOrdersToApprove=!1;this.jumpToPageOptions=[1];this.searchString="";this.startDate="";this.endDate="";this.loadSearchParamsFromUrl();this.initializeDatePickers();this.reload()}return n.prototype.setApprovalPendingOrders=function(n){this.pendingOrders=n.data.Orders;this.noOrdersToApprove=!n.data.Total;this.loadingPendingOrders=!1;this.totalPages=Math.ceil(n.data.Total/this.recordsPerPage);this.jumpToPageOptions=[];for(var t=1;t<=this.totalPages;t++)this.jumpToPageOptions.push(t)},n.prototype.reload=function(){this.updateUrl();this.loadingPendingOrders=!0;var n={SortBy:this.sortColumn,SortDirection:this.sortDirection,RecordsPerPage:this.recordsPerPage,PageNumber:this.pageNumber,SearchString:this.searchString,StartDate:this.startDate,EndDate:this.endDate};this.orderPendingApprovalsService.getApprovalPendingOrders(n).then(this.setApprovalPendingOrders.bind(this))},n.prototype.loadSearchParamsFromUrl=function(){var n=this.$location.$$search;this.searchString=n.searchString?n.searchString:"";this.startDate=n.startDate?n.startDate:"";this.endDate=n.endDate?n.endDate:""},n.prototype.updateUrl=function(){if(this.searchString!==""||this.startDate!==""||this.endDate!==""){this.$location.url("?searchString="+this.searchString+"&startDate="+this.startDate+"&endDate="+this.endDate);this.$location.replace();return}this.$location.url("")},n.prototype.resetFiltersAndReload=function(){this.resetFilters();this.reload()},n.prototype.resetFilters=function(){this.sortDirection=null;this.sortColumn=null;this.recordsPerPage=10;this.pageNumber=1},n.prototype.tableHeaderColumn=function(n,t){if(n!==this.sortColumn)return t?t:n;var i=this.sortDirection==="ascending"?' <i class="fa fa-angle-up"><\/i>':' <i class="fa fa-angle-down"><\/i>';return t?t+i:n+i},n.prototype.viewOrderDetails=function(n){this.loadingPendingOrders=!0;this.$window.location.href="/MyAccount/OrderPendingApproval?orderNumber="+n.OrderNumber},n.prototype.sortBy=function(n){this.sortColumn!==n&&(this.sortDirection=null);this.sortDirection=this.sortDirection?this.sortDirection==="ascending"?"descending":"ascending":"ascending";this.sortColumn=n;this.reload()},n.prototype.numberOfRecordsPerPageChanged=function(){this.pageNumber=1;this.reload()},n.prototype.previousPage=function(){this.pageNumber>1&&(this.pageNumber--,this.reload())},n.prototype.nextPage=function(){this.pageNumber<this.totalPages&&(this.pageNumber++,this.reload())},n.prototype.firstPage=function(){this.pageNumber=1;this.reload()},n.prototype.lastPage=function(){this.pageNumber=this.totalPages;this.reload()},n.prototype.preceedingPage=function(){this.pageNumber=this.pageNumber-2;this.reload()},n.prototype.subsequentPage=function(){this.pageNumber=this.pageNumber+2;this.reload()},n.prototype.jumpToPageChanged=function(){this.reload()},n.prototype.isFirstPage=function(){return this.pageNumber===1},n.prototype.isLastPage=function(){return this.pageNumber===this.totalPages},n.prototype.showPreceedingPage=function(){return!this.isFirstPage()&&this.isLastPage()&&this.isValidPageNumber(this.pageNumber-2)},n.prototype.showSubsequentPage=function(){return this.isFirstPage()&&!this.isLastPage()&&this.isValidPageNumber(this.pageNumber+2)},n.prototype.isValidPageNumber=function(n){return n>=1&&n<=this.totalPages},n.prototype.searchPendingOrders=function(){this.reload()},n.prototype.clearSearchFilters=function(){this.searchString!==""&&(this.searchString="",this.reload())},n.prototype.clearDateRangeFilters=function(){(this.startDate!==""||this.endDate!=="")&&(this.startDate="",this.endDate="",this.reload())},n.prototype.initializeDatePickers=function(){function r(n){setTimeout(function(){var t=$(n).val(),i=moment(t,"MM/DD/YYYY",!0).isValid();i?$(n).parent().removeClass("has-error"):$(n).parent().addClass("has-error")},i)}function f(r){setTimeout(function(){var u=moment($(n).val(),"MM/DD/YYYY",!0),f=moment($(t).val(),"MM/DD/YYYY"),i=u.diff(f,"days")>0;i&&r===n&&$(t).val($(n).val());i&&r===t&&$(n).val($(t).val())},i)}var u=new Date,n="input[name='startDate']",t="input[name='endDate']",i=300;[n,t].forEach(function(n){$(n).on("keyup",function(){r(n)});$(n).daterangepicker({opens:"left",autoUpdateInput:!0,showDropdowns:!1,maxDate:u,autoClose:!0,autoclose:!0,singleDatePicker:!0,showShortcuts:!1,singleMonth:!0},function(){r(n);f(n)})})},n}();t.$inject=["orderPendingApprovalsService","$window","$location"];n.OrderPendingApprovalsController=t;angular.module("ns").controller("orderPendingApprovalsController",t)}(ns||(ns={})),function(n){var i=function(){function n(){this.restrict="A";this.templateUrl="/js/ns/order-pending-approvals/pending-order.html";this.controllerAs="pendingOrderController";this.controller=t}return n.instance=function(){return new n},n}(),t;angular.module("ns").directive("pendingOrder",i.instance);t=function(){function n(n,t,i){this.orderPendingApprovalsService=n;this.$window=t;this.initialData=i;this.orderNumber=null;this.poNumber=null;this.orderApproved=!1;this.orderRejected=!1;this.rejectionReason="";this.rejectionReasonMaximumLength=1e3;this.rejectionReasonError=!1;this.loading=!1;this.serverErrorMessage=null;this.serverErrorCustomerServiceMessage="Please try again later. For additional help call one of our friendly Customer Support Representatives toll free, at 1-800-571-4646, 7:30 am - 7:00 pm ET, Monday - Friday. You may also contact us through our Live Chat 8:00 am - 5:00 pm ET, Monday - Friday.";this.orderAlreadyRejected="Order has already been rejected, rejection will not be performed";this.orderNumber=i.OrderNumber;this.poNumber=i.PONumber}return n.prototype.ShowApproveModal=function(){this.serverErrorMessage=null;this.loading=!1;$("#pending-order-approval-modal").modal("show")},n.prototype.HideApproveModal=function(){this.poNumber=this.initialData.PONumber;$("#pending-order-approval-modal").modal("hide")},n.prototype.ShowRejectModal=function(){this.rejectionReason="";this.loading=!1;this.serverErrorMessage=null;$("#pending-order-rejection-modal").modal("show")},n.prototype.HideRejectModal=function(){$("#pending-order-rejection-modal").modal("hide")},n.prototype.ApproveOrder=function(){var n=this;this.loading=!0;this.orderPendingApprovalsService.approveOrder(this.orderNumber,this.poNumber).then(function(){n.orderApproved=!0;n.loading=!1;setTimeout(function(){n.$window.location.href="/MyAccount/OrderPendingApprovals"},1e3)}).catch(function(){n.loading=!1;n.serverErrorMessage="We could not approve the order. "+n.serverErrorCustomerServiceMessage})},n.prototype.RejectOrder=function(){var n=this;if(this.rejectionReasonError=!1,this.rejectionReason.length>this.rejectionReasonMaximumLength){this.rejectionReasonError=!0;return}this.loading=!0;this.orderPendingApprovalsService.rejectOrder(this.orderNumber,this.rejectionReason).then(function(){n.orderRejected=!0;n.loading=!1;setTimeout(function(){n.$window.location.href="/MyAccount/OrderPendingApprovals"},1e3)}).catch(function(t){n.loading=!1;n.serverErrorMessage=t.data.message!=null&&t.data.message===n.orderAlreadyRejected?t.data.message:"We could not reject the order. "+n.serverErrorCustomerServiceMessage})},n}();t.$inject=["orderPendingApprovalsService","$window","initialData"];n.PendingOrderController=t;angular.module("ns").controller("pendingOrderController",t)}(ns||(ns={})),function(n){var i=function(){function n(){this.restrict="A";this.templateUrl="/js/ns/packing-note/packing-list-note.html";this.controllerAs="packingNoteCtrl";this.controller=t}return n.instance=function(){return new n},n}(),t;angular.module("ns").directive("packingListNote",i.instance);t=function(){function n(n){this.cartService=n}return n.prototype.updateCartPackingNote=function(n){this.cartService.updateCartPackingNote(n)},n}();t.$inject=["cartService"];n.PackingNoteController=t;angular.module("ns").controller("packingNoteCtrl",t)}(ns||(ns={})),function(n){"use strict";n.factory("pageErrorsService",function(){function t(t){return _(n).contains(t)}function i(){return n.length}function r(i){t(i)||n.push(i)}function u(){while(n.length)n.pop()}var n=[];return{errors:{AddressBookIsOpen:"Please verify your shipping address change by hitting Select in your Address Book.",WalletIsOpen:"Please confirm you would like to pay by credit card.",BillMyAccountNotConfirmed:"Please confirm you would like to bill your account or select to pay by credit card.",MissingOtherShippingMethodDetails:"Please specify other shipping method details.",InvalidCollectAccountNumber:"Please enter a valid collect account #.",ProductNotForSaleInCalifornia:"A product you have selected is not for sale in California.",OtherShippingMethodIsRequired:"Other shipping method is required.",NotShippingToPOBox:"We are unable to ship to a PO Box. Please enter a shipping address.",NoCreditCardInformation:"Please enter your credit card information.",ExpiredCreditCard:"This credit card has expired.",InvalidSecurityCode:"Please enter a valid security code.",SAPOrderFailed:"We are unable to process your request. Please call one of our friendly Customer Service Representatives toll free, at 1-800-571-4646, 7:30 am - 8:00 pm ET, Monday – Friday, or email us.",SAPOrderTimeout:"We are unable to process your request. Please verify the entries and try again, or call one of our friendly Customer Service Representatives toll free, at 1-800-571-4646, 7:30 am - 8:00 pm ET, Monday – Friday, or email us.",InvalidCreditCard:"Payroll deduct is not available for this customer or we are unable to authorize the credit card entered. Please verify the entries and try again, or call one of our friendly Customer Service Representatives toll free, at 1-800-571-4646, 7:30 am - 8:00 pm ET, Monday – Friday, or email us.",CartInvalid:"There is something wrong with your cart, please <a href='/cart'> proceed to cart <\/a> for more details",UnknownFormPostError:"Please verify the entries and try again, or call one of our friendly Customer Service Representatives toll free, at 1-800-571-4646, 7:30 am - 8:00 pm ET, Monday – Friday, or email us.",UserNotAuthorized:"You are not authorized to view this page. Please <a href='/MyAccount/Login?ReturnUrl=%2fCheckout'> login <\/a> and try again.",PasswordIsNotCorrect:"Password is not valid",EmailIsNotUnique:"New Email Address is currently in use on another account",AdditionalForwardOrderEmails:"Forward order confirmation emails are not correct",AdditionalForwardOrderEmailsLength:"Forward order confirmation emails maximum length is 1000 characters",InvalidPikupShippingMethodPhoneNumber:"Please specify a valid phone number",AmountOverApproverLimit:"The order total exceeds your approver’s transaction limits.",AdditionalBillingInformationRequired:"All Additional Information fields are Required",GetVouchersFailed:"We are unable to verify the voucher used in cart. Please try again.",MultipleVouchersInCart:"There is something wrong with your cart, multiple vouchers were used in cart. Please review your <a href='/cart'>cart<\/a>.",VoucherNotAvailable:"The voucher used in cart is no longer available.",PlaceOrderNotAllowed:"Your program administrator has not allowed additional payment methods to cover the balance of the order.  Please adjust your cart so there is no remaining balance or contact your program administrator.",ShippingAndTaxNotAvailable:"Shipping and Tax not available.",StaleVoucher:"Voucher Coverage has changed, please refresh the page.",PayrollDeductDisclaimerNotAccepted:"Payroll Deduction Terms and Conditions must be accepted before placing the order.",NonContributingVoucherCoverage:"Voucher Coverage is not correct, please refresh the page.",ItemsNotCoveredByVoucherForRestrictedUser:"The items in your cart are not covered by the voucher. Please review your <a href='/cart'>cart<\/a>."},hasErrors:i,pageErrors:n,add:r,clear:u}})}(angular.module("ns")),function(n){"use strict";n.directive("paginator",function(){return{restrict:"A",templateUrl:"/js/ns/paginator/paginator.html",controller:"paginatorCtrl",link:function(n,t,i){n.pageTotalItems=function(){return i.totalItems}}}});n.controller("paginatorCtrl",["$scope",function(n){n.pageItemsPerPage=3;n.pageCurrentPage=0;n.pageRange=function(){var r=3,u=[],t,i;for(t=n.pageCurrentPage,t>n.pagePageCount()-r&&(t=n.pagePageCount()-r+1),i=t;i<t+r;i++)i>=0&&u.push(i);return u};n.pagePrevPage=function(){n.pageCurrentPage>0&&n.pageCurrentPage--};n.pageDisablePrevPage=function(){return n.pageCurrentPage===0?"disabled":""};n.pagePageCount=function(){return Math.ceil(n.pageTotalItems()/n.pageItemsPerPage)-1};n.pageNextPage=function(){n.pageCurrentPage<n.pagePageCount()&&n.pageCurrentPage++};n.pageSetPage=function(t){n.pageCurrentPage=t};n.pageDisableNextPage=function(){return n.pageCurrentPage===n.pagePageCount()?"disabled":""};n.pageViewAll=function(){n.pageItemsPerPage=n.pageTotalItems();n.pageSetPage(0)};n.$watch("pagePageCount()",function(t){t<=n.pageCurrentPage&&n.pageSetPage(0)});n.$watch("pageTotalItems()",function(){n.pageItemsPerPage!==3&&(n.pageItemsPerPage=n.pageTotalItems())})}]);n.filter("pagination",function(){return function(n,t,i){var u=t*i,r;return u>n.length?[]:(r=u+t,r>n.length&&(r=n.length),n.slice(u,r))}})}(angular.module("ns")),function(n){var t=function(){function t(n,t,i,r){this.analyticsService=r;this.initialData=n;this.paymentService=t;this.eventsService=i}return t.prototype.isBillMyAccountDefault=function(){return this.paymentService.isDefaultBillMyAccount()},t.prototype.isBillMyAccount=function(){return this.paymentService.isSelectedPaymentMethod(n.PaymentMethods.billMyAccount)},t.prototype.isPayrollDeduct=function(){return this.paymentService.isSelectedPaymentMethod(n.PaymentMethods.payrollDeduct)},t.prototype.isNotAllowed=function(){return this.paymentService.isSelectedPaymentMethod(n.PaymentMethods.notAllowed)},t.prototype.allowBillMyAccountPayment=function(){return this.initialData.checkout.paymentInformation.allowBillMyAccountPayment},t.prototype.allowCreditCardPayment=function(){return this.initialData.checkout.paymentInformation.allowCreditCardPayment},t.prototype.showBillMyAccountTab=function(){this.paymentService.showBillMyAccountTab()},t.prototype.setBillMyAccountAsPaymentMethod=function(){this.paymentService.setPaymentMethod(n.PaymentMethods.billMyAccount);this.analyticsService.trackEditCartOrCheckout("Payment Information: Select bill my account")},t.prototype.setBillMyAccountAsDefaultPaymentMethod=function(){this.paymentService.setBillMyAccountAsDefaultPayment()},t.prototype.showPayrollDeduct=function(){return this.paymentService.showPaymentMethodForEmployee(n.PaymentMethods.payrollDeduct)},t.prototype.showCreditCard=function(){return this.paymentService.showPaymentMethodForEmployee(n.PaymentMethods.creditCard)},t.prototype.setPayrollDeductAsPaymentMethod=function(){this.paymentService.setPaymentMethod(n.PaymentMethods.payrollDeduct)},t.prototype.getEmployeePayrollDeductDisclaimer=function(){return this.paymentService.getEmployeePayrollDeductDisclaimer()},t.prototype.setEmployeePayrollDeductDisclaimer=function(){this.paymentService.setEmployeePayrollDeductDisclaimer(this.acceptPayrollDeductDisclaimer)},t}();t.$inject=["initialData","paymentService","eventsService","analyticsService"];angular.module("ns").controller("paymentInfoCtrl",t)}(ns||(ns={})),function(n){var t,i,r;(function(n){n[n.billMyAccount=1]="billMyAccount";n[n.creditCard=2]="creditCard";n[n.payrollDeduct=3]="payrollDeduct";n[n.notAllowed=4]="notAllowed";n[n.voucher=5]="voucher"})(t=n.PaymentMethods||(n.PaymentMethods={})),function(n){n[n.none=0]="none";n[n.billMyAccount=1]="billMyAccount";n[n.creditCard=2]="creditCard"}(i||(i={}));r=function(){function r(t,i){var r=t.paymentInformation;r&&(this._featureData=i,this.setEmployeePaymentDetails(t.userInfo),this._defaultPaymentInfo=r.defaultPaymentInfo,this._paymentMethod=this.getSelectedPaymentMethod(),this._creditCardId=r.defaultPaymentInfo.creditCardId,this._allowBillMyAccountPayment=r.allowBillMyAccountPayment,this._showBillMyAccountTab=r.showBillMyAccountTab,this._userCreditCards=r.userCreditCards,this._appliedCreditCard=null,this._selectedCreditCard=null,this.dateService=new n.DateService,this.setCreditCardsExpirationDate())}return Object.defineProperty(r.prototype,"paymentMethod",{get:function(){return this._paymentMethod},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"appliedCreditCard",{get:function(){return this.updateExpirationDate(this._appliedCreditCard),this._appliedCreditCard},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"selectedCreditCard",{get:function(){return this.updateExpirationDate(this._selectedCreditCard),this._selectedCreditCard},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"allowBillMyAccountPayment",{get:function(){return this._allowBillMyAccountPayment},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"showBillMyAccountTab",{get:function(){return this._showBillMyAccountTab},enumerable:!0,configurable:!0}),r.prototype.isSelectedPaymentMethod=function(n){return this.paymentMethod===n},r.prototype.isDefaultBillMyAccount=function(){return this._defaultPaymentInfo&&this._defaultPaymentInfo.paymentMethod===i.billMyAccount},r.prototype.isDefaultCreditCard=function(n){return n?this._defaultPaymentInfo.paymentMethod===i.creditCard&&this._defaultPaymentInfo.creditCardId===n:this._defaultPaymentInfo.paymentMethod===i.creditCard&&!!this._defaultPaymentInfo.creditCardId},r.prototype.isAppliedCreditCardDefaultPaymentMethod=function(){return!!this._appliedCreditCard&&this.isDefaultCreditCard(this._appliedCreditCard.id)},r.prototype.setDefaultPaymentMethod=function(n,t){this._defaultPaymentInfo.creditCardId=n;this._defaultPaymentInfo.paymentMethod=t?t:i.creditCard},r.prototype.setPaymentMethod=function(n){this._paymentMethod=n?n:t.creditCard},r.prototype.setDefaultCreditCardId=function(n){this._defaultPaymentInfo.creditCardId=n},r.prototype.selectCreditCard=function(n){this._selectedCreditCard=n},r.prototype.applyCreditCard=function(n){this.selectCreditCard(n);this._appliedCreditCard=n},r.prototype.setBillMyAccountAsDefault=function(){this._defaultPaymentInfo.creditCardId=null;this._defaultPaymentInfo.paymentMethod=i.billMyAccount},r.prototype.hasCvv=function(){return this._appliedCreditCard!=null&&this._appliedCreditCard.cvv&&String(this._appliedCreditCard.cvv).length>=3},r.prototype.getUserCreditCardByToken=function(n){return _.findWhere(this._userCreditCards,{token:n})},r.prototype.userHasSavedCreditCards=function(){return!!this._userCreditCards&&this._userCreditCards.length>0},r.prototype.markSelectedCreditCardAsNotDefault=function(){this._selectedCreditCard&&(this._selectedCreditCard.isDefault=!1)},r.prototype.getDefaultUserCreditCard=function(){return _.findWhere(this._userCreditCards,{id:this._defaultPaymentInfo.creditCardId})},r.prototype.removeUserCreditCard=function(n){this._userCreditCards=_(this._userCreditCards).reject(function(t){return n.id?t.id===n.id:t===n})},r.prototype.getSelectedPaymentMethod=function(){return this._employeePaymentOptions?this._employeePaymentOptions.indexOf(t.creditCard)>=0?t.creditCard:this._employeePaymentOptions.indexOf(t.payrollDeduct)>=0?t.payrollDeduct:t.notAllowed:this._defaultPaymentInfo.paymentMethod===i.none?t.creditCard:this._defaultPaymentInfo.paymentMethod},r.prototype.showPaymentMethodForEmployee=function(n){return this._employeePaymentOptions&&this._employeePaymentOptions.indexOf(n)>=0},r.prototype.getEmployeePayrollDeductDisclaimer=function(){return this._employeePayrollDeductDisclaimer?this._employeePayrollDeductDisclaimer:""},r.prototype.setEmployeePaymentDetails=function(n){n&&(n.employeePaymentDetails&&n.employeePaymentDetails.paymentOptions&&n.employeePaymentDetails.paymentOptions.length>0?(this._employeePaymentOptions=n.employeePaymentDetails.paymentOptions,this._employeePayrollDeductDisclaimer=n.employeePaymentDetails.payrollDisclaimer):this._featureData.VoucherProgramPaymentOptions||n.employeePaymentOptions&&n.employeePaymentOptions.length>0&&(this._employeePaymentOptions=n.employeePaymentOptions))},r.prototype.setCreditCardsExpirationDate=function(){var n=this;_.each(this._userCreditCards,function(t){n.setExpirationDate(t)})},r.prototype.updateExpirationDate=function(n){n&&this.setExpirationDate(n)},r.prototype.setExpirationDate=function(n){n.expirationDate=this.dateService.createDateWith1IndexedMonth(n.expirationYear,n.expirationMonth)},r}();n.Payment=r}(ns||(ns={})),function(n){var t=function(){function t(n,t,i){this.initialData=n;this.apiService=t;this.creditCardService=i;this._payment=this.creditCardService.payment}return Object.defineProperty(t.prototype,"payment",{get:function(){return this._payment},enumerable:!0,configurable:!0}),t.prototype.isSelectedPaymentMethod=function(n){return this.payment.isSelectedPaymentMethod(n)},t.prototype.isDefaultBillMyAccount=function(){return this.payment.isDefaultBillMyAccount()},t.prototype.getPaymentMethod=function(){return this.payment.paymentMethod},t.prototype.showBillMyAccountTab=function(){return this.payment.showBillMyAccountTab},t.prototype.setBillMyAccountAsDefaultPayment=function(){var t=this;return this.apiService.setBillMyAccountAsDefaultPayment().then(function(i){i.data.success&&(t.payment.setPaymentMethod(n.PaymentMethods.billMyAccount),t.payment.setBillMyAccountAsDefault(),t.payment.markSelectedCreditCardAsNotDefault(),t.creditCardService.setFirstAsSelectedCreditCard())})},t.prototype.setPaymentMethod=function(n){this.payment.setPaymentMethod(n)},t.prototype.billMyAccountNotConfirmed=function(){return $("#bill-my-account").hasClass("active")&&!this.payment.isSelectedPaymentMethod(n.PaymentMethods.billMyAccount)},t.prototype.walletIsOpen=function(){return $("#credit-card").hasClass("active")&&!this.payment.isSelectedPaymentMethod(n.PaymentMethods.creditCard)},t.prototype.billMyAccountInfoTabIsOpen=function(){return $("#bill-my-account-info").hasClass("active")},t.prototype.showPaymentMethodForEmployee=function(n){return this.payment.showPaymentMethodForEmployee(n)},t.prototype.isNotAllowedPaymentMethod=function(){return this.isSelectedPaymentMethod(n.PaymentMethods.notAllowed)},t.prototype.getEmployeePayrollDeductDisclaimer=function(){return this.payment.getEmployeePayrollDeductDisclaimer()},t.prototype.setEmployeePayrollDeductDisclaimer=function(n){this._acceptPayrollDeductDisclaimer=n},t.prototype.isPayrollDeductSelectedAndDisclaimerNotAccepted=function(){return this.isSelectedPaymentMethod(n.PaymentMethods.payrollDeduct)&&!this._acceptPayrollDeductDisclaimer},t.prototype.getSelectedPaymentMethod=function(){return this.payment.getSelectedPaymentMethod()},t}();t.$inject=["initialData","apiService","creditCardService"];n.PaymentService=t;angular.module("ns").service("paymentService",t)}(ns||(ns={})),function(n){"use strict";n.directive("priorityCodeDescription",function(){return{restrict:"A",templateUrl:"/js/ns/priority-code/priority-code-description.html",scope:{priorityCodeSummary:"=priorityCodeDescription"}}})}(angular.module("ns")),function(n){var t=function(){function n(){this.priorityCode=null;this.freeGoodBrand=null;this.freeGoodName=null;this.endDate=null;this.discountAmount=null;this.discountAmountType=null;this.discountType=null;this.qualifier=null;this.isManuallyAdded=null;this.isReseller=null;this.hasReward=null}return n.prototype.update=function(n){this.priorityCode=n.priorityCode;this.freeGoodBrand=n.freeGoodBrand;this.freeGoodName=n.freeGoodName;var t=n.endDate?new Date(n.endDate):new Date,i=t.getTimezoneOffset()*6e4;this.endDate=new Date(t.getTime()+i);this.discountAmount=n.discountAmount;this.discountAmountType=n.discountAmountType;this.discountType=n.discountType;this.qualifier=n.qualifier;this.isManuallyAdded=n.isManuallyAdded;this.isReseller=n.isReseller;this.hasReward=n.hasReward},n.prototype.reset=function(){this.priorityCode=null;this.freeGoodBrand=null;this.freeGoodName=null;this.endDate=null;this.discountAmount=null;this.discountAmountType=null;this.discountType=null;this.qualifier=null;this.isManuallyAdded=null;this.isReseller=null;this.hasReward=null},n.prototype.hasRewardOrIsManuallyAdded=function(){return this.priorityCode&&(this.hasReward||this.isManuallyAdded)},n.prototype.determinePCodePlaceholderText=function(){return this.hasRewardOrIsManuallyAdded()?this.priorityCode:"Enter Promo Code"},n}();n.PriorityCode=t}(ns||(ns={})),function(n){var t=function(){function t(n,t,i,r,u,f,e){this.cookieService=n;this.dateService=t;this.apiService=i;this.cartService=r;this.eventsService=u;this.loggerFactory=f;this.browserDetectionService=e;this.initialize()}return t.prototype.updatePriorityCode=function(){var n=this.cartService.getPriorityCodeSummary();n?this.priorityCodeModel.update(n):this.getAndUpdatePriorityCode();this.logger.debug("Priority code "+this.priorityCodeModel.priorityCode+" with end date "+this.priorityCodeModel.endDate+" and using browser: "+this.browserDetectionService.showBrowser())},t.prototype.changePriorityCode=function(n,t){var i=this,r=this.dateService.getFormatedUTCCurrentDate(),u=this.cookieService.getCartCookie(),f={cartCookieId:u,priorityCode:n,dateAdded:r,isManuallyAdded:!0};return this.apiService.changePriorityCode(f).then(function(u){return i.cookieService.setPriorityCodeCookie(n),i.cookieService.setDateAddedPriorityCodeCookie(r),i.cookieService.setPriorityCodeIsManuallyAdded(!0),i.cartService.updateCart(t),u})},t.prototype.removePriorityCode=function(n){var t=this,i=this.cookieService.getCartCookie();return this.apiService.removePriorityCode({cartCookieId:i}).then(function(){t.cookieService.removePriorityCodeCookie();t.cartService.updateCart(n)})},t.prototype.getAndUpdatePriorityCode=function(){var n=this,t=this.cookieService.getPriorityCodeCookie(),i;if(!t){this.priorityCodeModel.reset();return}i=this.cookieService.getPriorityCodeIsManullyAdded();this.apiService.getPriorityCode({priorityCode:t,isManuallyAdded:i}).then(function(t){t.data?n.priorityCodeModel.update(t.data):n.cookieService.removePriorityCodeCookie()})},t.prototype.initialize=function(){this.logger=this.loggerFactory.getBackendLogger("PriorityCodeService");this.priorityCodeModel=new n.PriorityCode;this.updatePriorityCode();this.eventsService.on(events.CartEvents.PriorityCodeUpdated,this.updatePriorityCode.bind(this))},t}();t.$inject=["cookieService","dateService","apiService","cartService","eventsService","loggerFactory","browserDetectionService"];n.PriorityCodeService=t;angular.module("ns").service("priorityCodeService",t)}(ns||(ns={})),function(){var t=function(){function t(){this.templateUrl="/js/ns/priority-code/p-code.html";this.controllerAs="priorityCodeCtrl";this.controller=n}return t}(),n=function(){function n(n,t,i,r,u){this.$q=n;this.priorityCodeService=t;this.userService=i;this.analyticsService=r;this.featureData=u;this.isImpersonatedUser=i.user.isUserImpersonated}return n.prototype.clearPriorityCodeErrors=function(){this.selectedPriorityCode||(this.priorityCodeErrors=null)},n.prototype.applyPriorityCode=function(n){var t=this,i="Cart";return n.$invalid?this.$q.resolve():(this.analyticsService.trackPromoCodeAttempt(this.selectedPriorityCode),this.priorityCodeService.changePriorityCode(this.selectedPriorityCode).then(function(r){r.data.success?(t.priorityCodeErrors=null,n.$submitted=!1,t.analyticsService.trackPromoCodeEnteredSuccess(t.selectedPriorityCode,i),t.selectedPriorityCode=null):(t.priorityCodeErrors=r.data.errors,t.analyticsService.trackPromoCodeEnteredFailed(t.selectedPriorityCode,i))}).catch(function(n){t.priorityCodeErrors=n.data;t.analyticsService.trackPromoCodeEnteredFailed(t.selectedPriorityCode,i)}))},n.prototype.getPriorityCodeSummary=function(){return this.clearPriorityCodeErrors(),this.priorityCodeService.priorityCodeModel},n.prototype.removePriorityCode=function(){var n=this;return this.priorityCodeService.removePriorityCode().then(function(){n.selectedPriorityCode=null})},n}();n.$inject=["$q","priorityCodeService","userService","analyticsService","featureData"];angular.module("ns").component("pCode",new t);angular.module("ns").controller("priorityCodeCtrl",n)}(ns||(ns={})),function(n){"use strict";n.filter("rewardInfo",["currencyFilter",function(n){var t=function(t,i,r){return t.discountAmountType==="Percent"?t.discountAmount===100?i:t.discountAmount+"% "+r:n(t.discountAmount)+" "+r};return function(n){return n.discountType==="Product"?t(n,"FREE order","off your order"):n.discountType==="Zof2"?t(n,"FREE order","off on some items"):n.discountType==="Freight"?t(n,"FREE shipping","off your shipping"):""}}])}(angular.module("ns")),function(n){"use strict";n.controller("privacyOptionsCtrl",["$scope","$rootScope","navigationService","focusService","apiService",function(n,t,i,r,u){var e=this,f=this;f.privacyRequest={};f.ui={emailPattern:new RegExp(/^([A-Za-z0-9/'_\-\.\+])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,18})$/),displayRecentNumber:function(){return f.privacyRequest.userType==="1"},displayApplicationDate:function(){return f.privacyRequest.userType==="2"}};f.submitPrivacyRequest=function(n){if(n.$setSubmitted(),n.$invalid){r.focusErrorField(n);return}u.submitPrivacyOptionsRequest(e.privacyRequest).then(function(){i.goPrivacyOptionsSubmitRequestConfirmation(f.privacyRequest.email)})};f.requestTypeChanged=function(){var n=f.privacyRequest.requestType,t=n&&n.length?"darkgrey":"white";$("#requestType").find("button").css("backgroundColor",t)}}])}(angular.module("ns")),function(n){var t=function(){function n(n,t,i){this.cookieService=n;this.apiService=t;this.featureData=i}return n.prototype.isPunchOutSession=function(){var n=this.cookieService.getPunchOutCookie();return!!n&&n.trim()!==""},n.prototype.isPunchOutLevel2Session=function(){return this.isPunchOutSession()&&this.cookieService.isPunchOutLevel2Cookie()},n.prototype.deletePunchOutSession=function(){var n=this.cookieService.getCartCookie();n&&this.apiService.deletePunchOutSession(n)},n.prototype.punchOutBuildCart=function(){var n=this.cookieService.getCartCookie();return this.apiService.getPunchOutBuildCart(n).then(function(n){return n.data})},n}();t.$inject=["cookieService","apiService","featureData"];n.PunchOutService=t;angular.module("ns").service("punchOutService",t)}(ns||(ns={})),function(){"use strict";var n=function(){function n(n,t,i,r,u,f){var e=this;this.quickShopService=n;this.navigationService=t;this.eventsService=i;this.$q=r;this.focusService=u;this.punchOutService=f;this.quickShop=n.quickShop;this.topQuickShop=n.topQuickShop;this.isQuickShopClicked=!1;this.eventsService.on(this.quickShopService.events.QUICK_SHOP_UPDATED,function(){e.quickShop=e.quickShopService.quickShop})}return n.prototype.isPunchOutSession=function(){return this.punchOutService.isPunchOutSession()},n.prototype.addToCart=function(n){this.canAddToCart(n,this.quickShop)&&this.addFromQuickShop(this.quickShop)},n.prototype.addToCartFromTopActionBar=function(n){this.canAddToCart(n,this.topQuickShop)&&this.addFromQuickShop(this.topQuickShop)},n.prototype.canAddToCart=function(n,t){return(n.$setSubmitted(),n.$invalid)?(this.stopAddToCartSpinner(),this.focusService.focusErrorField(n),!1):t.hasItemsToAdd()?!0:(this.stopAddToCartSpinner(),!1)},n.prototype.quickShopClicked=function(){this.isQuickShopClicked=!0;$("#qs-toggle").dropdown("toggle")},n.prototype.goToCart=function(){return this.$q.when(this.navigationService.goToCart())},n.prototype.goToCheckout=function(){return this.$q.when(this.navigationService.goToCheckOut())},n.prototype.goToPunchOut=function(){return this.$q.when(this.navigationService.goToPunchOut())},n.prototype.reset=function(){return this.$q.when(this.resetQuickShop())},n.prototype.shouldShowGeneralErrorMessage=function(n){return n.$submitted&&!this.quickShop.hasItemsToAdd()},n.prototype.addFromQuickShop=function(n){this.quickShopService.addFromQuickShop(n)},n.prototype.stopAddToCartSpinner=function(){this.eventsService.trigger(events.SpinnerEvents.ResetQuickShopAddSpinner)},n.prototype.resetQuickShop=function(){this.quickShopService.resetQuickShop();this.quickShop=this.quickShopService.quickShop},n}();n.$inject=["quickShopService","navigationService","eventsService","$q","focusService","punchOutService"];angular.module("ns").controller("quickShopController",n)}(ns||(ns={})),function(){var n=function(){function n(){this.templateUrl="/js/ns/quick-shop/quick-shop-line.html";this.controllerAs="controller";this.controller=angular.noop;this.bindings={line:"<",index:"<"}}return n}();angular.module("ns").component("quickShopLine",new n)}(ns||(ns={})),function(n){"use strict";var t=function(){function t(t,i,r,u,f,e,o){this.initialData=t;this.apiService=i;this.cookieService=r;this.navigationService=u;this.eventsService=f;this.userService=e;this.analyticsService=o;this.quickShop=new n.QuickShop;this.topQuickShop=new n.QuickShop;this.events={QUICK_SHOP_UPDATED:"quickShopService:quick_shop_updated"};this.quickShopItemFactory=new n.QuickShopItemsFactory(e,r,o);this.needsToLoadDataFromInitialData(t)?this.createQuickShopResponse(t.quickShopData):this.quickShop.populateQuickShop();this.topQuickShop.populateQuickShop()}return t.prototype.addFromQuickShop=function(n){var t=this,i=this.getQuickShopWithValidItems(n);return this.apiService.addFromQuickShop(i).then(function(n){t.navigationService.goToQuickShopPage(n.data)})["catch"](function(){t.handleException()})},t.prototype.resetQuickShop=function(){this.quickShop=new n.QuickShop;this.quickShop.populateQuickShop()},t.prototype.replaceQuickShopItemFromResponse=function(n){var t=this.quickShopItemFactory.createQuickShopItem(_.first(n.data.quickShopItems));this.replaceQuickShop(t)},t.prototype.addMaterialToCart=function(n){var t=this;return this.apiService.addQuickShopItem(this.createQuickShopForItem(n)).then(function(n){t.replaceQuickShopItemFromResponse(n)})},t.prototype.addBackorderToCart=function(n){var t=this;return this.apiService.addQuickShopItem(this.createQuickShopForBackorderItem(n)).then(function(n){t.replaceQuickShopItemFromResponse(n)})},t.prototype.addMaterialBaseToCart=function(n){var t=this;return this.apiService.addQuickShopItem(this.createQuickShopForMaterialBaseItem(n)).then(function(n){t.replaceQuickShopItemFromResponse(n)})},t.prototype.cancelAddingToCart=function(n){var t=n;t.cancelAddingToCart=!0;t.addToCartResult.isSuccess=!0;this.replaceQuickShop(t)},t.prototype.createNewQuickShop=function(){var t=new n.QuickShop;return t.cartId=this.cookieService.getCartCookie(),t},t.prototype.createQuickShopForItem=function(n){var t=this.createNewQuickShop();return n&&(t.quickShopItems=[n]),t},t.prototype.createQuickShopForBackorderItem=function(t){var i=new n.QuickShop;return i.cartId=this.cookieService.getCartCookie(),t&&(t.allowBackorder=!0,i.quickShopItems=[t]),i},t.prototype.createQuickShopForMaterialBaseItem=function(n){var i=this.createNewQuickShop(),t=n;return t&&(t.materialNumber=t.selectedMaterial.materialNumber,i.quickShopItems=[t]),i},t.prototype.createQuickShopResponse=function(t){var i=this;this.quickShop=new n.QuickShop;this.quickShop.quickShopItems=_.map(t.quickShopItems,function(n){return i.quickShopItemFactory.createQuickShopItem(n)});this.quickShop.isResponse=!0;this.setCartCookieId(t.cartId);this.eventsService.trigger(events.CartEvents.UpdateCart)},t.prototype.getQuickShopWithValidItems=function(t){var r=this,i=new n.QuickShop;return i.quickShopItems=t.getItemsToAdd(),_.each(i.quickShopItems,function(n){n.zipCode=r.cookieService.getZipCodeValue()}),i.cartId=this.cookieService.getCartCookie(),i},t.prototype.setCartCookieId=function(n){n&&(this.cookieService.setCartCookie(n),this.cookieService.slideExpirationDates())},t.prototype.handleException=function(){},t.prototype.needsToLoadDataFromInitialData=function(n){return n&&n.quickShopData&&n.quickShopData.isResponse},t.prototype.replaceQuickShop=function(t){var i=new n.QuickShop,r,u;for(i.quickShopItems=[],i.isResponse=!0,r=0;r<this.quickShop.quickShopItems.length;r++){if(this.quickShop.quickShopItems[r].materialNumber===t.materialNumber){i.quickShopItems.push(t);continue}if(u=t,u.itemType===ItemType.NotFound&&this.quickShop.quickShopItems[r].materialNumber===u.notFoundMaterialNumber){i.quickShopItems.push(t);continue}i.quickShopItems.push(this.quickShop.quickShopItems[r])}this.quickShop=i;this.eventsService.trigger(this.events.QUICK_SHOP_UPDATED)},t}();t.$inject=["initialData","apiService","cookieService","navigationService","eventsService","userService","analyticsService"];n.QuickShopService=t;angular.module("ns").service("quickShopService",t)}(ns||(ns={})),function(){"use strict";var t=function(){function t(){this.restrict="A";this.replace=!0;this.template="<div><ng-include src='controller.getTemplateUrl()'/><\/div>";this.controller=n;this.controllerAs="controller";this.scope={index:"="}}return t.instance=function(){return new t},t}(),n=function(){function n(n,t,i,r,u,f,e){this.$scope=n;this.quickShopService=t;this.userService=i;this.eventsService=r;this.restrictionsService=u;this.apiService=f;this.featureData=e;this.index=n.index+1;this.item=this.quickShopService.quickShop.quickShopItems[n.index];this.zipCode=i.user.zipCode;this.searchUrl=e.useGenericSearchURLsFeature?"/Search?keywords=":"/Search?q="}return n.prototype.getTemplateUrl=function(){if(this.item.requiresPurchaseHistory||this.item.materialUnavailable)return"/js/ns/quick-shop/items/error-message.html";if(this.item.itemType===ItemType.ExactlyMatch){var n=this.item;if(n.cancelAddingToCart)return"/js/ns/quick-shop/items/cancel-item.html";if(n.addToCartResult.isSuccess)return"/js/ns/quick-shop/items/found-added-item.html";if(n.addToCartResult.quantityNotValid)return"/js/ns/quick-shop/items/quantity-error.html";if(n.addToCartResult.isBackOrderAvailable)return"/js/ns/quick-shop/items/backorder-available.html";if(n.addToCartResult.errorMessage)return"/js/ns/quick-shop/items/error-message.html"}return this.item.itemType===ItemType.MaterialBaseMatch?"/js/ns/quick-shop/items/material-base-match-item.html":this.item.itemType===ItemType.NotFound?"/js/ns/quick-shop/items/no-match-found.html":this.item.itemType===ItemType.Replacement?"/js/ns/quick-shop/items/replacement-item.html":this.item.itemType===ItemType.UnknownGeoRestriction?"/js/ns/quick-shop/items/unknown-zipcode.html":this.item.itemType===ItemType.GeoRestricted?"/js/ns/quick-shop/items/geographical-restricted-item.html":void 0},n.prototype.addMaterialBaseToCart=function(n){var t=this;if(n.$setSubmitted(),n.$invalid){this.stopSpinner();return}this.quickShopService.addMaterialBaseToCart(this.item).then(function(){var n=t.item.availableForBackorderOnly;t.item=t.quickShopService.quickShop.quickShopItems[t.index-1];t.item.availableForBackorderOnly=n;t.eventsService.trigger(events.CartEvents.UpdateCart);t.stopSpinner()})},n.prototype.addBackorderToCart=function(n){var t=this;if(n==="0"){this.quickShopService.addBackorderToCart(this.item).then(function(){t.item=t.quickShopService.quickShop.quickShopItems[t.index-1];t.eventsService.trigger(events.CartEvents.UpdateCart);t.stopSpinner()});return}if(n==="1"){this.quickShopService.cancelAddingToCart(this.item);this.item=this.quickShopService.quickShop.quickShopItems[this.index-1];this.stopSpinner();return}this.stopSpinner()},n.prototype.addLimitedMaterialToCart=function(){var n=this;this.item.quantity=this.item.addToCartResult.totalQuantityAvailableToOrder;this.quickShopService.addBackorderToCart(this.item).then(function(){n.item=n.quickShopService.quickShop.quickShopItems[n.index-1];n.eventsService.trigger(events.CartEvents.UpdateCart);n.stopSpinner()});return},n.prototype.displayLargeOrderEmailYourRequest=function(){return this.item.quantity>10},n.prototype.addMaterialToCart=function(n){var t=this;if(n.$setSubmitted(),n.$invalid){this.stopSpinner();return}this.quickShopService.addMaterialToCart(this.item).then(function(){t.item=t.quickShopService.quickShop.quickShopItems[t.index-1];t.eventsService.trigger(events.CartEvents.UpdateCart);t.stopSpinner()})},n.prototype.addRestrictedMaterialToCart=function(n){var t=this;if(n.$setSubmitted(),n.$invalid){this.restrictionsService.setZipCodeInvalid(this.zipCode);this.stopSpinner();return}this.item.zipCode=this.zipCode;this.restrictionsService.updateZipCode(this.zipCode).then(function(n){return n?t.quickShopService.addMaterialToCart(t.item):n}).then(function(){t.item=t.quickShopService.quickShop.quickShopItems[t.index-1];t.eventsService.trigger(events.CartEvents.UpdateCart);t.stopSpinner()})},n.prototype.hasError=function(n){return n.$submitted&&(n.zipCode.$invalid||this.restrictionsService.isZipCodeInvalid())},n.prototype.onStyleChange=function(){var n=this,t=this.item.selectedMaterial;this.apiService.materialCanBeAddedToCart(this.item.materialNumber,t.characterSetValueIds).then(function(t){n.item.isProductUnavailable=!t.data.canBeOrderedBasedOnInventory;n.item.availableForBackorderOnly=t.data.availableForBackorderOnly})},n.prototype.stopSpinner=function(){this.eventsService.trigger(events.SpinnerEvents.ResetAddSpinner)},n}();n.$inject=["$scope","quickShopService","userService","eventsService","productRestrictionsService","apiService","featureData"];angular.module("ns").directive("quickShopResponseItem",t.instance);angular.module("ns").controller("quickShopResponseItemController",n)}(ns||(ns={})),function(n){var t=function(){function n(){}return n}();n.AddToCartInput=t}(ns||(ns={})),function(n){var t=function(){function n(){}return n}();n.AddToCartResult=t}(ns||(ns={})),function(n){n[n.UnknownGeoRestriction=0]="UnknownGeoRestriction";n[n.GeoRestricted=1]="GeoRestricted";n[n.ExactlyMatch=2]="ExactlyMatch";n[n.MaterialBaseMatch=3]="MaterialBaseMatch";n[n.Replacement=4]="Replacement";n[n.NotFound=5]="NotFound"}(ItemType||(ItemType={})),function(n){var t=function(){function t(n,t,i){this.userService=n;this.cookieService=t;this.analyticsService=i;this.userService=n;this.cookieService=t;this.analyticsService=i}return t.prototype.createQuickShopItem=function(t){switch(t.itemType){case ItemType.ExactlyMatch:return this.createFoundItem(t);case ItemType.MaterialBaseMatch:return this.createMaterialBaseItem(t);case ItemType.NotFound:return this.createNoMatchFoundItem(t);case ItemType.Replacement:return this.createReplacementItem(t);case ItemType.UnknownGeoRestriction:return this.createItem(t);case ItemType.GeoRestricted:return this.createItem(t);default:return new n.QuickShopItem}},t.prototype.createItem=function(t){var i=new n.QuickShopItem;return i.materialNumber=t.materialNumber,i.itemType=t.itemType,i.zipCode=this.cookieService.getZipCodeValue(),i.quantity=t.quantity,i.materialWarning=t.materialWarning,i.addToCartResult=t.addToCartResult,i.requiresPurchaseHistory=t.requiresPurchaseHistory,i.materialUnavailable=t.materialUnavailable,i},t.prototype.createFoundItem=function(t){var i=new n.QuickShopFoundItem;return i.quantity=t.quantity,i.materialNumber=t.materialNumber,i.brandName=t.brandName,i.materialName=t.materialName,i.characterSetNames=t.characterSetNames,i.isNotApprovedForPurchase=(this.userService.user.isLevelOneRestricted||this.userService.user.isLevelTwoRestricted)&&!t.isQuoted,i.addToCartResult=t.addToCartResult,i.roundingProfile=t.roundingProfile,i.saleUnitName=t.saleUnitName,i.unitOfMeasureQuantities=this.createUnitOfMeasureOptions(t.roundingProfile,t.saleUnitName,t.unitOfMeasure),i.showMinimumQuantity=t.minOrderQty>1,i.zipCode=this.cookieService.getZipCodeValue(),i.category=t.category,i.isNew=t.isNew,i.isFreeGood=t.isFreeGood,i.isSale=t.isSale,i.isNsBrand=t.isNsBrand,i.price=t.price,i.materialBaseNumber=t.materialBaseNumber,i.materialWarning=t.materialWarning,i.materialUnavailable=t.materialUnavailable,i.availableForBackorderOnly=t.availableForBackorderOnly,this.trackAddToCartForFoundItem(i),i},t.prototype.trackAddToCartForFoundItem=function(n){this.analyticsService.trackQuickShopAddToCart(n)},t.prototype.createMaterialBaseItem=function(t){var i=new n.QuickShopMaterialBaseItem;return i.quantity=t.quantity,i.materialNumber=t.materialNumber,i.itemNumber=t.materialNumber,i.materialBaseId=t.materialBaseId,i.setMaterials(t.quickShopMaterials),i.roundingProfile=t.roundingProfile,i.saleUnitName=t.saleUnitName,i.unitOfMeasureQuantities=this.createUnitOfMeasureOptions(t.roundingProfile,t.saleUnitName,t.unitOfMeasure),i.showMinimumQuantity=t.minOrderQty>1,i.zipCode=this.cookieService.getZipCodeValue(),i.materialWarning=t.materialWarning,i.materialUnavailable=t.materialUnavailable,i.addToCartResult=t.addToCartResult,i},t.prototype.createNoMatchFoundItem=function(t){var i=new n.QuickShopNoMatchFoundItem;return i.notFoundMaterialNumber=t.materialNumber,i.zipCode=this.cookieService.getZipCodeValue(),i.materialWarning=t.materialWarning,i},t.prototype.createReplacementItem=function(t){var i=new n.QuickShopReplacementItem;return i.materialNumber=t.materialNumber,i.replacementMaterialNumber=t.replacementMaterialNumber,i.zipCode=this.cookieService.getZipCodeValue(),i.materialWarning=t.materialWarning,i},t.prototype.createUnitOfMeasureOptions=function(n,t,i){for(var u=[{value:n*1,name:!t||t===i?n*1:n*1+" (1 "+t+")"}],r=2;r<=10;r++)u.push({value:n*r,name:!t||t===i?n*r:n*r+" ("+r+" "+t+"s)"});return u},t}();n.QuickShopItemsFactory=t}(ns||(ns={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t=function(){function n(){}return n.prototype.isValid=function(){return!this.isMaterialNumberDefined()&&!this.isQuantityDefined()?!0:this.isOnlyOneDefined()?!1:this.materialNumber.length===0&&!this.quantity?!0:this.materialNumber.length>0&&this.quantity>=1?!0:!1},n.prototype.hasValues=function(){return this.isValid()&&this.isMaterialNumberDefined()&&this.isQuantityDefined()},n.prototype.isMaterialNumberDefined=function(){return!!this.materialNumber&&this.materialNumber.length>0},n.prototype.isQuantityDefined=function(){return!!this.quantity&&this.quantity>0},n.prototype.isOnlyOneDefined=function(){return this.isMaterialNumberDefined()&&!this.isQuantityDefined()||!this.isMaterialNumberDefined()&&this.isQuantityDefined()},n}(),i,r,u,f;n.QuickShopItem=t;i=function(n){function t(){var t=n.call(this)||this;return t.itemType=ItemType.ExactlyMatch,t}return __extends(t,n),t.prototype.getCharacterSetValues=function(){return _.reduce(this.characterSetNames,function(n,t){return n+" - "+t},"")},t.prototype.getAddedToCartMessage=function(){return this.quantity===1?"has been added to your cart":"have been added to your cart"},t.prototype.isQuantityAdjusted=function(){return this.addToCartResult.isClearance&&this.quantity>this.addToCartResult.availableStockQuantity},t.prototype.getQuantityAdjustedMessage=function(){return"The quantity requested has been modified to the quantity remaining in stock."},t.prototype.getAdjustedQuantity=function(){return this.isQuantityAdjusted()?this.addToCartResult.availableStockQuantity:this.quantity},t}(t);n.QuickShopFoundItem=i;r=function(t){function i(){var n=t.call(this)||this;return n.itemType=ItemType.MaterialBaseMatch,n}return __extends(i,t),i.prototype.setMaterials=function(t){var i=this;this.quickShopMaterials=[];_.each(t,function(t){i.quickShopMaterials.push(new n.QuickShopMaterial(t.characterSetValueIds,t.characterSetValues,t.materialNumber))})},i}(t);n.QuickShopMaterialBaseItem=r;u=function(n){function t(){var t=n.call(this)||this;return t.itemType=ItemType.NotFound,t}return __extends(t,n),t}(t);n.QuickShopNoMatchFoundItem=u;f=function(n){function t(){var t=n.call(this)||this;return t.itemType=ItemType.Replacement,t}return __extends(t,n),t}(t);n.QuickShopReplacementItem=f}(ns||(ns={})),function(n){var i=function(){function n(n,i,r){var u=this;this.characterSetValueIds=n;this.materialNumber=r;this.characterSetValueIds=n;this.characterSetValues=[];_.each(i,function(n){u.characterSetValues.push(new t(n.name,n.value))})}return n.prototype.getStyles=function(){var n="";return _.each(this.characterSetValues,function(t){n+=t.name+": "+t.value+" "}),n.slice(0,-1)},n}(),t;n.QuickShopMaterial=i;t=function(){function n(n,t){this.name=n;this.value=t}return n}();n.CharacterSetValue=t}(ns||(ns={})),function(n){var t=function(){function t(){this.isResponse=!1}return t.prototype.populateQuickShop=function(){this.quickShopItems=[];for(var t=0;t<6;t++)this.quickShopItems.push(new n.QuickShopItem)},t.prototype.getItemsToAdd=function(){return this.quickShopItems?this.quickShopItems.filter(function(n){return n.hasValues()}):[]},t.prototype.hasItemsToAdd=function(){return this.getItemsToAdd().length>0},t.prototype.allItemsAddedWithSuccess=function(){return _.every(this.quickShopItems,function(n){var t=n;return!!t&&!!t.addToCartResult&&t.addToCartResult.isSuccess})},t}();n.QuickShop=t}(ns||(ns={})),function(n){var t=function(){function n(){}return n}();n.RedwingVoucher=t}(ns||(ns={})),function(n){"use strict";var t=function(){function t(t,i,r,u,f){this.initialData=t;this.userService=i;this.navigationService=r;this.apiService=u;this.$rootScope=f;this.smsCommunicationChannel="SMS";this.emailCommunicationChannel="Email";this.communicationChannels=[this.smsCommunicationChannel,this.emailCommunicationChannel];this.emailPattern=/^([A-Za-z0-9/'_\-\.\+])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,18})$/;this.redwingVoucher=new n.RedwingVoucher;this.redwingVoucher.redwingApiKey=this.initialData.redwingApiKey}return t.prototype.submitRedwingVoucher=function(n){var t=this;(n.$setSubmitted(),n.$invalid)||(this.hasError=!1,this.redwingVoucher.sendText=this.selectedCommunicationChannel===this.communicationChannels.indexOf(this.smsCommunicationChannel),this.redwingVoucher.sendEmail=this.selectedCommunicationChannel===this.communicationChannels.indexOf(this.emailCommunicationChannel),this.apiService.recordRedwingVoucher(this.redwingVoucher).then(function(){t.navigationService.goToVoucherHub()}).catch(function(){t.hasError=!0;t.$rootScope.$broadcast(events.SpinnerEvents.StopSpinner)}))},t}();t.$inject=["initialData","userService","navigationService","apiService","$rootScope"];angular.module("ns").controller("redwingVoucherController",t)}(ns||(ns={})),function(n){var t=function(){function n(){this.selectedReason="";this.specificReason=null;this.emailAddress=null;this.contactName=null;this.returnedItems=[];this.orderNumber=null;this.contactPhoneNumber=null}return n}();n.OrderReturn=t}(ns||(ns={})),function(n){var t=function(){function n(){this.reasonForReturn=null;this.specificReason=null;this.emailAddress=null;this.contactName=null;this.returnedOrderLines=[];this.orderNumber=null;this.returnReferenceNumber=null;this.returnDate=null;this.contactPhone=null;this.upsShippingLabel=null;this.returnIsBeingProcessed=!1}return n}();n.OrderReturnSummary=t}(ns||(ns={})),function(n){"use strict";n.directive("saveForLaterItem",function(){return{restrict:"A",templateUrl:"/js/ns/save-for-later/save-for-later-item.html",scope:{item:"=saveForLaterItem"},controller:"saveForLaterItemCtrl"}});n.controller("saveForLaterItemCtrl",["$scope","saveForLaterService","featureData","analyticsService","userService",function(n,t,i,r,u){n.addToCartFromSavedForLater=function(n){return t.addOneItemToCartFromSavedForLater(n)};n.removeItem=function(n){return t.removeItem(n)};n.getProductPosition=function(n){var i=t.getAllSaveForLaterItems();return i.indexOf(n)+1};n.trackProductClick=function(n){r.trackProductClick(n,"Cart",this.getProductPosition(n),"Save for Later")};n.allowReturns=u.user.allowReturns}])}(angular.module("ns")),function(n){"use strict";n.factory("saveForLaterService",["$http","$q","$rootScope","cookieService","analyticsService",function(n,t,i,r,u){var f=[];return{getSavedForLaterList:function(t){var i=r.getSavedForLaterCookie();i&&n.get("/api/v1/saved-for-later-lists/"+i).then(function(n){f=n.data.items;t(n);r.slideExpirationDates()},function(n){n.status===404&&r.removeCartCookie()})},getMoreItems:function(n,t){return f.slice(n,n+t)},getTotalItemsOnSavedForLaterList:function(){return f.length},removeItem:function(u){var f=t.defer();return u&&n["delete"]("api/v1/saved-for-later-lists/"+r.getSavedForLaterCookie()+"/items/"+u.itemId).then(function(){i.$broadcast(events.SaveForLaterEvents.ItemRemoved);r.slideExpirationDates();f.resolve(!0)}),f.promise},emptySavedForLaterList:function(){var u=t.defer(),f=r.getSavedForLaterCookie();return f?n["delete"]("/api/v1/saved-for-later-lists/"+f+"/items").then(function(){r.slideExpirationDates();i.$broadcast(events.SaveForLaterEvents.EmptySaveForLater);u.resolve(!0)}):i.$broadcast(events.CartEvents.UpdateCart),u.promise},addOneItemToCartFromSavedForLater:function(f){var e=t.defer();return n.post("/api/v1/carts/"+r.getCartCookie()+"/items/"+f.itemId).then(function(n){u.trackAddToCart(f,"Cart");r.setCartCookie(n.data);r.slideExpirationDates();i.$broadcast(events.SaveForLaterEvents.ItemRemoved);i.$broadcast(events.CartEvents.UpdateCart);e.resolve(!0)}),e.promise},addSavedForLaterItemsToCart:function(){var e=t.defer();return n.post("/api/v1/carts/"+r.getCartCookie()+"/items/all-items-from-sfl").then(function(){u.trackAddAllProductsToCart(f,"Saved For Later");r.slideExpirationDates();i.$broadcast(events.CartEvents.UpdateCart);i.$broadcast(events.SaveForLaterEvents.EmptySaveForLater);e.resolve(!0)}),e.promise},getAllSaveForLaterItems:function(){return f}}}])}(angular.module("ns")),function(n){"use strict";n.directive("saveForLater",function(){return{restrict:"A",templateUrl:"/js/ns/save-for-later/save-for-later.html",controller:"saveForLaterCtrl"}});n.controller("saveForLaterCtrl",["$rootScope","$scope","saveForLaterService","analyticsService",function(n,t,i,r){function s(){return t.savedForLaterItems&&t.savedForLaterItems.items&&t.savedForLaterItems.items.length>0}function h(){t.removeAndAddAll=t.savedForLaterItems&&t.savedForLaterItems.items.length>0?!0:!1}function e(){t.endOfList=!t.savedForLaterItems||t.savedForLaterItems.items.length==i.getTotalItemsOnSavedForLaterList()}function c(){f=4;u()}var f=4,u,o;t.endOfList=!1;u=function(){i.getSavedForLaterList(function(n){t.savedForLaterItemsCount=n.data.items.length;n.items=n.data.items.slice(0,f);t.savedForLaterItems=n;t.showSaveForLater=s();h();e();t.isSavedForLaterExecuted=!0;n.items.length>0&&r.trackViewItemListEvent(n.items,"Saved Items For Later")})};o=function(){t.savedForLaterItems=null;t.showSaveForLater=s();h();n.$broadcast("sfl-emptied")};t.emptySavedForLaterList=function(){return i.emptySavedForLaterList()};t.addSavedForLaterItemsToCart=function(){return i.addSavedForLaterItemsToCart()};t.showMoreItems=function(){var n=i.getMoreItems(t.savedForLaterItems.items.length,10);t.savedForLaterItems.items=t.savedForLaterItems.items.concat(n);f=t.savedForLaterItems.items.length;e()};n.$on(events.SaveForLaterEvents.ItemAdded,u);n.$on(events.SaveForLaterEvents.EmptySaveForLater,o);n.$on(events.SaveForLaterEvents.ItemRemoved,u);n.$on(events.SaveForLaterEvents.CartAdded,c);u();e()}])}(angular.module("ns")),function(n){"use strict";var i=function(){function n(){this.restrict="A";this.templateUrl="/js/ns/save-for-later/sfl-line-stock.html";this.scope={material:"=sflLineStock"};this.controller=t;this.controllerAs="controller"}return n.instance=function(){return new n},n}(),t;angular.module("ns").directive("sflLineStock",i.instance);t=function(){function n(n,t){this.$scope=n;this.analyticsService=t;this.material=n.material;this.trackOutOfStock()}return n.prototype.isMaterialStockStatusDropShip=function(){return this.material.isDropShip},n.prototype.isMaterialStockStatusLimited=function(){return this.material.isClearance},n.prototype.isMaterialStockStatusCustom=function(){return this.material.isCustomizable},n.prototype.isMaterialStockStatusSpecialOrder=function(){return this.material.isSpecialOrder},n.prototype.isMaterialStockStatusOutOfStock=function(){return!this.material.isProductUnavailable&&this.material.quantityInStock<=0&&!(this.isMaterialStockStatusDropShip()||this.isMaterialStockStatusLimited()||this.isMaterialStockStatusCustom()||this.isMaterialStockStatusSpecialOrder())},n.prototype.isMaterialStockStatusInStock=function(){return this.material.quantityInStock>0&&!(this.isMaterialStockStatusDropShip()||this.isMaterialStockStatusLimited()||this.isMaterialStockStatusCustom()||this.isMaterialStockStatusSpecialOrder()||this.material.isProductUnavailable)&&this.material.availableForBackorderOnly!==!0},n.prototype.hasExtendedLeadTime=function(){return this.material.availableForBackorderOnly===!0},n.prototype.materialHasPrice=function(){return this.material.unitPrice>0},n.prototype.trackOutOfStock=function(){this.isMaterialStockStatusOutOfStock()&&this.analyticsService.trackIsMaterialOutOfStock(this.material)},n}();t.$inject=["$scope","analyticsService"];n.SflLineStockController=t}(ns||(ns={})),function(n){var t=function(){function n(n,t,i,r){this.searchData=n;this.userService=t;this.analyticsService=i;this.modelsFactory=r;this.init()}return n.prototype.init=function(){var t=this,n;this.products=_.map(this.searchData.materials,function(n){return t.modelsFactory.createProduct(n)});this.customerInfo=this.userService.user;n="Search Results";this.analyticsService.trackProductImpression(this.searchData.materials,n,this.getSearchData())},n.prototype.showCustomerLogo=function(n){return n.isQuoted&&this.userService.user.customerSiteName},n.prototype.getSearchData=function(){return!this.searchData.searchString&&!this.searchData.totalNumberOfResults?null:{searchString:this.searchData.searchString,totalNumberOfResults:this.searchData.totalNumberOfResults}},n.prototype.isNotAllowedForPurchase=function(n){return!this.userService.isNotAllowedForPurchase(n)},n}();t.$inject=["searchData","userService","analyticsService","modelsFactory"];n.SearchServiceFactory=t;angular.module("ns").service("searchService",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t){this._searchService=n;this.analyticsService=t;this.materials=this.fixProductImages(n.products);this.customerInfo=n.customerInfo;this.analyticsService=t;this.materials.length>0&&this.analyticsService.trackViewItemListEvent(this.materials)}return n.prototype.showCustomerLogo=function(n){return this._searchService.showCustomerLogo(n)},n.prototype.isMaterialBaseAvailableForPickup=function(n){return _.every(n.availabilitiesForPickup,function(n){return n.isAvailableForPickup===!0})},n.prototype.getThumbnailImage=function(n){if(!n.thumbnailImageId)if(!n.imageId){if(!!n.materialImages&&n.materialImages.length>0)return n.materialImages[0]}else return n.imageId;else return n.thumbnailImageId;return n.thumbnailImageId},n.prototype.getMaterialImages=function(n){if(!!n.materialImages&&n.materialImages.length>0)return n.materialImages;if(!n.imageId){if(!!n.thumbnailImageId)return[n.thumbnailImageId]}else return[n.imageId];return n.materialImages},n.prototype.fixProductImages=function(n){var t=this;return _.each(n,function(n){n.thumbnailImageId=t.getThumbnailImage(n);n.materialImages=t.getMaterialImages(n)}),n},n.prototype.trackVideo=function(n,t,i){this.analyticsService.trackVideo(n,t,i)},n.prototype.trackProductClick=function(n,t){var i=this._searchService.products.indexOf(n)+1;this.analyticsService.trackProductClick(n,t,i,null)},n.prototype.trackProductQuickView=function(n){this.analyticsService.trackProductQuickView(n)},n}();t.$inject=["searchService","analyticsService"];n.SearchController=t;angular.module("ns").controller("searchController",t)}(ns||(ns={})),function(){var n=function(){function n(n,t,i){var u=this,r;this.productService=n;this.apiService=t;this.analyticsService=i;this.results=[];r=this;window.addEventListener("open-quick-view",function(n){r.getQuickViewData(n.detail.image,n.detail.materialBaseNumber,r);var t=u.results.filter(function(t){return t.MaterialBaseNumber===n.detail.materialBaseNumber})[0];r.analyticsService.trackProductQuickView({materialBaseNumber:n.detail.materialBaseNumber,materialName:t.Name},null,null)});window.addEventListener("searchCompleted",function(n){return r.searchCompleted(n)});window.addEventListener("hitsViewed",function(n){return r.analyticsService.trackViewItemListEvent(n.detail.hits,null,!0)});window.addEventListener("trackProductClick",function(n){return r.trackProductClick(n.detail.materialBaseNumber)});$("#video-tracking").on("video-started",function(n,t){r.analyticsService.trackVideo("Search Page",t.videoTitle,t.videoId)})}return n.prototype.searchCompleted=function(n){n.detail.term.trim().length>0&&this.analyticsService.trackViewSearchResults(n.detail.term,n.detail.hits);this.results=n.detail.results},n.prototype.trackProductClick=function(n){var t=this.results.filter(function(t){return t.MaterialBaseNumber===n})[0];this.analyticsService.trackProductClick({materialBaseNumber:n,materialName:t.Name,brand:t.Brand,unitPrice:t.Price},null,this.getIndexOfProduct(n),null,!1)},n.prototype.getIndexOfProduct=function(n){for(var i=-1,t=0;t<this.results.length;t++)if(this.results[t].MaterialBaseNumber==n){i=t+1;break}return i},n.prototype.getQuickViewData=function(n,t,i){var r=i.getThumbnailImageId(n);i.setThumbnailImage(r,i);$("#page-blocker").removeClass("hidden");i.apiService.getQuickViewDataForMaterial(t).then(function(n){i.productService.updateProductInformation(n.data);i.openQuickViewModal()}).finally(function(){$("#page-blocker").addClass("hidden")})},n.prototype.openQuickViewModal=function(){$("#quick-view-product-details-modal").modal("show")},n.prototype.getThumbnailImageId=function(n){return n?parseInt(n.split("material/")[1].split(".")[0]):0},n.prototype.setThumbnailImage=function(n,t){t.productService.product.imageId=n},n}();n.$inject=["productService","apiService","analyticsService"];angular.module("ns").controller("algoliaProductController",n)}(ns||(ns={})),function(n){var r=function(){function n(){this._minDate=null;this._maxDate=null;this._message=null}return n.prototype.setRange=function(n,t){this._minDate=n?new Date(n):null;this._maxDate=t?new Date(t):null},n.prototype.setMessage=function(n){this._message=n},Object.defineProperty(n.prototype,"message",{get:function(){return this._message},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"minDate",{get:function(){return this._minDate},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"maxDate",{get:function(){return this._maxDate},enumerable:!0,configurable:!0}),n.prototype.update=function(n){this.setRange(n.minDate,n.maxDate);this.setMessage(n.message)},n.prototype.hasError=function(){return!!this._message},n.prototype.hasDates=function(){return!!this._minDate},n.prototype.displayText=function(){var n="";return this._minDate&&this._maxDate&&(n=this._minDate.getTime()==this._maxDate.getTime()?this._minDate.getCustomFormattedDate():this._minDate.getCustomFormattedDate()+" - "+this._maxDate.getCustomFormattedDate()),n},n}(),t,i;n.EstimatedDeliveryDateRange=r;t=function(){function n(n){n.deliveryDate&&(this._date=new Date(n.deliveryDate));this._lineId=n.lineId;this._message=n.message}return Object.defineProperty(n.prototype,"lineId",{get:function(){return this._lineId},enumerable:!0,configurable:!0}),n.prototype.displayText=function(){return this._date?this._date.getCustomFormattedDate():"Unavailable"},n}();n.ItemEstimatedDeliveryDate=t;i=function(){function n(){this._range=null;this._itemsDeliveryDates=[]}return n.prototype.update=function(n){this._range.setMessage(n.message)},n.prototype.setRange=function(n){this._range=n},n.prototype.hasError=function(){return this._range.hasError()},n.prototype.hasDates=function(){return this._range.hasDates()},n.prototype.displayRange=function(){return this._range.displayText()},n.prototype.setItemsDelivery=function(n){this._itemsDeliveryDates=n},n.prototype.getMessage=function(){var n=this._range.message;return n==="Partial"&&(n="\r\n"+this._range.message),n},n.prototype.getMaxDate=function(){return this._range.maxDate},n.prototype.getDeliveryDateForLine=function(n){return _.findWhere(this._itemsDeliveryDates,{lineId:n})},n}();n.EstimatedDeliveryDate=i}(ns||(ns={})),function(n){var t=function(){function n(n,t,i,r,u,f,e){this.apiService=n;this.cartService=t;this.addressService=i;this.shippingMethodsService=r;this.modelsFactory=u;this.eventsService=f;this.functionUtils=e;this.computingShippingCharges=!1;this.isCleansedAddress=!1;this.shippingConditionCodesBuffer={}}return n.prototype.initialize=function(){var n=this.functionUtils.waitForMore(this.calculate.bind(this));this.eventsService.on(events.CartEvents.CartUpdated,n);this.eventsService.on(events.ShippingEvents.ShippingMethodChanged,n);this.eventsService.on(events.ShippingEvents.ShippingConditionChanged,this.updateCartService.bind(this));n()},n.prototype.clearBuffer=function(){this.shippingConditionCodesBuffer={}},n.prototype.getDataForSelectedShippingCondition=function(){var n=this.shippingMethodsService.getSelectedShippingConditionCode();return this.shippingConditionCodesBuffer[n]},n.prototype.updateCartService=function(){var n=this.getDataForSelectedShippingCondition();n&&this.cartService.updateShippingAndHandlingEstimateDatesAndTaxes(n)},n.prototype.notifyShippingMethodsService=function(){var n=_.object(_.map(this.shippingConditionCodesBuffer,function(n,t){return[t,{shippingAndHandling:n.shippingAndHandling,deliveryDate:n.deliveryDate}]}));this.shippingMethodsService.updateShippingAndHandlingAndEdd(n)},n.prototype.notifyServices=function(){this.updateCartService();this.notifyShippingMethodsService()},n.prototype.addDataToBuffer=function(n,t){this.shippingConditionCodesBuffer[n]=t},n.prototype.createTotalsAndAddToBuffer=function(n,t){var i=this.modelsFactory.createShippingAndHandling(n.shippingAndHandling),r=this.modelsFactory.createEstimatedDeliveryDate(n.deliveryDate),u=this.modelsFactory.createTaxes(n.taxes),f=this.modelsFactory.createVoucherCoverage(n.voucherCoverage);this.addDataToBuffer(t,{shippingAndHandling:i,deliveryDate:r,taxes:u,voucherCoverage:f})},n.prototype.getResultsAndNotify=function(n){this.selectedShippingMethodChanged(n.deliveryCosts)||(this.clearBuffer(),_.each(n.deliveryCosts,this.createTotalsAndAddToBuffer.bind(this)),this.notifyServices())},n.prototype.selectedShippingMethodChanged=function(n){var t=this.shippingMethodsService.getCodesForSelectedShippingMethod();return!_.isEmpty(_.difference(Object.keys(n),t))},n.prototype.calculate=function(){var n=this,e;this.computingShippingCharges=!0;var t=this.cartService.getCart().cartId,i=this.addressService.selectedShipToAddress.shipToId,r=this.shippingMethodsService.getCodesForSelectedShippingMethod(),u=this.cartService.getPriorityCodeSummary(),f=null;(u&&(f=u.priorityCode),t&&i&&!_.isEmpty(r))&&(this.eventsService.trigger(events.ShippingEvents.CalculatingTotals),e={cartCookieId:t,addressId:i,shippingMethods:r,priorityCode:f},this.apiService.getDeliveryCosts(e).then(function(t){n.getResultsAndNotify(t.data);n.computingShippingCharges=!1;n.setIsCleansedAddress(t.data);n.eventsService.trigger(events.ShippingEvents.CalculatedTotals)}).catch(function(){n.eventsService.trigger(events.ShippingEvents.CalculatedTotalsFailed);n.computingShippingCharges=!1;n.isCleansedAddress=!1}))},n.prototype.setIsCleansedAddress=function(n){this.isCleansedAddress=n.isCleansedAddress},n}();t.$inject=["apiService","cartService","addressService","shippingMethodsService","modelsFactory","eventsService","functionUtils"];n.ShippingAndHandlingEstimatedDeliveryDatesAndTaxService=t;angular.module("ns").service("shEddTaxService",t)}(ns||(ns={})),function(n){var t,i;(function(n){n[n.infoOnly=0]="infoOnly";n[n.noEstimationAvailable=1]="noEstimationAvailable";n[n.stopCheckout=2]="stopCheckout";n[n.partial=3]="partial";n[n.orderBlock=4]="orderBlock";n[n.ok=5]="ok";n[n.californiaRestriction=6]="californiaRestriction";n[n.hazmatAirRestriction=7]="hazmatAirRestriction";n[n.voucherRestriction=8]="voucherRestriction"})(t||(t={}));i=function(){function n(){this.cost=0;this.discount=0;this.isFreeShipping=!1;this.hazmatCharges=0;this.liftGateCharges=0;this.hazmatChargesAreUnavailable=!1;this.errorCode=null;this.errorMessages=null;this.success=!1}return n.prototype.update=function(n){this.cost=n.cost;this.discount=n.discount;this.isFreeShipping=n.isFreeShipping;this.hazmatCharges=n.hazmatCharges;this.liftGateCharges=n.liftGateCharges;this.hazmatChargesAreUnavailable=n.hazmatChargesAreUnavailable;this.errorCode=n.errorCode;this.errorMessages=n.errorMessages;this.success=n.success},n.prototype.hasError=function(){return this.errorCode===t.partial||this.errorCode===t.noEstimationAvailable},n.prototype.getHazmatCharges=function(){return this.hazmatCharges},n.prototype.getLiftGateCharges=function(){return this.liftGateCharges?this.liftGateCharges:0},n.prototype.isPartial=function(){return this.errorCode===t.partial},n.prototype.isFree=function(){return this.isFreeShipping},n.prototype.hasCaliforniaError=function(){return this.errorCode===t.californiaRestriction},n.prototype.hasVoucherRestrictionError=function(){return this.errorCode===t.voucherRestriction},n.prototype.hasHazmatAirRestriction=function(){return this.errorCode===t.hazmatAirRestriction},n.prototype.shipsHazmatOrmdToNonContinentalUs=function(){return this.errorCode===t.stopCheckout},n.prototype.shippingAndHandlingIsFree=function(){return this.success&&this.isFreeShipping},n.prototype.hasAmount=function(){return this.success&&!this.isFreeShipping},n.prototype.isUnavailable=function(){return!this.success},n.prototype.getAmount=function(){return this.hasAmount()?this.cost-this.discount:0},n.prototype.isEstimatedTotal=function(){return!this.success||this.isPartial()},n}();n.ShippingAndHandling=i}(ns||(ns={})),function(n){var t=function(){function n(){this.tax=0;this.taxCalculatedSuccessfully=!1;this.isPartialCalculation=!1;this.message=null;this.errorMessages=null}return n.prototype.update=function(n){this.tax=n.tax;this.taxCalculatedSuccessfully=n.taxCalculatedSuccessfully;this.isPartialCalculation=n.isPartialCalculation&&this.getTaxes()>0;this.message=n.message;this.errorMessages=n.errorMessages},n.prototype.getTaxes=function(){return this.taxCalculatedSuccessfully?this.tax:0},n}();n.Taxes=t}(ns||(ns={})),function(n){var t=function(){function n(){this.coverage=0;this.totalDeductedAmount=null}return n.prototype.update=function(n){this.coverage=n.coverage;this.totalDeductedAmount=n.totalDeductedAmount},n.prototype.getVoucherCoverage=function(){return this.coverage},n.prototype.getTotalVoucherDeductedAmount=function(){return this.totalDeductedAmount},n}();n.VoucherCoverage=t}(ns||(ns={})),function(n){var t=function(){function n(n){this.analyticsService=n}return n.prototype.trackNavClick=function(n){this.analyticsService.trackNavClickGA4(n)},n.prototype.trackContactUsClick=function(n){this.trackNavClick(n);this.analyticsService.trackContactUsView()},n.prototype.trackLiveChatClick=function(n,t){this.trackNavClick(n);this.analyticsService.trackLiveChatClick(t)},n}();t.$inject=["analyticsService"];n.CustomerServiceNavMenuController=t;angular.module("ns").controller("customerServiceNavMenuController",t)}(ns||(ns={}));angular.module("ns").directive("shopProductsMenu",["$http","$compile",function(n,t){var i="/Home/TopNav";return{link:function(r,u){n.get(i,{responseType:"text"}).then(function(n){n.data&&u.replaceWith(t(n.data)(r))})}}}]);angular.module("ns").directive("topActionBar",["$window",function(n){function t(){var t=function(){var r=$("#customer-site-header").hasClass("customer-site-header"),n=$("#covidbanner").hasClass("covid-banner"),t=$("#globalbanner").hasClass("global-banner"),i=$("#voucherbanner").hasClass("voucher-banner");r&&(t&&n?$("body").addClass("customer-header-pad"):$("body").addClass("no-banner-pad"),$("body").addClass("has-customer-site"));n&&$("body").addClass("covid-banner-pad");t&&$("body").addClass("global-banner-pad");i&&$("body").addClass("voucher-banner-pad");t&&n&&i?$("body").addClass("triple-banner-pad"):(t&&n||i&&n||i&&t)&&$("body").addClass("double-banner-pad")};angular.element(document).ready(function(){window.setTimeout(function(){t()},500)});angular.element(n).bind("resize",function(){t()})}return{link:t}}]);__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){"use strict";var i=function(){function n(n,t){this.id=n;this.name=t}return n.prototype.isValid=function(){return!0},n.prototype.hasInformation=function(){return!0},n}(),t,r,u,f,e,o,s,h;n.DeliveryMethod=i;t=function(n){function t(t,i,r){var u=n.call(this,t,i)||this;return u.information=r,u.showInformation=!1,u}return __extends(t,n),t.prototype.toUpper=function(){this.information=this.information.toUpperCase().replace(/([^0-9A-Z])/g,"")},t.prototype.hasInformation=function(){return!!this.information},t.prototype.isValid=function(){return this.hasInformation()},t.prototype.setInformation=function(n){this.information=n},t.prototype.getInformation=function(){return this.information},t}(i);n.DeliveryMethodWithInfo=t;r=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),t.prototype.isValid=function(){if(!this.information)return!0;var n=new RegExp("^[A-Z0-9]{6}$");return n.test(this.information)},t}(t);n.UpsCollectDeliveryMethod=r;u=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),t.prototype.isValid=function(){if(!this.information)return!0;var n=new RegExp("^[0-9]{9}$");return n.test(this.information)},t}(t);n.FedExCollectDeliveryMethod=u;f=function(n){function t(){return n!==null&&n.apply(this,arguments)||this}return __extends(t,n),t.prototype.isValid=function(){var n=this.information.replace(/\s+/g,"");return n.length===12},t}(t);n.BranchPickupDeliveryMethod=f;e=function(){function n(n,t){this.id=n;this.name=t;this.shippingAndHandling=null;this.estimatedDeliveryDates=null}return n.prototype.setShippingAndHandling=function(n){this.shippingAndHandling=n},n.prototype.setEstimatedDeliveryDates=function(n){this.estimatedDeliveryDates=n},n.prototype.shippingHasCaliforniaError=function(){return this.shippingAndHandling?this.shippingAndHandling.hasCaliforniaError():!1},n.prototype.shippingHasVoucherRestriction=function(){return this.shippingAndHandling?this.shippingAndHandling.hasVoucherRestrictionError():!1},n.prototype.shippingHasHazmatAirRestriction=function(){return this.shippingAndHandling?this.shippingAndHandling.hasHazmatAirRestriction():!1},n.prototype.shipsHazmatOrmdToNonContinentalUs=function(){return this.shippingAndHandling?this.shippingAndHandling.shipsHazmatOrmdToNonContinentalUs():!1},n.prototype.shippingAndHandlingIsFree=function(){return this.shippingAndHandling?this.shippingAndHandling.shippingAndHandlingIsFree():!1},n.prototype.shippingAndHandlingHasAmount=function(){return this.shippingAndHandling?this.shippingAndHandling.hasAmount():!1},n.prototype.shippingAndHandlingIsUnavailable=function(){return this.shippingAndHandling?this.shippingAndHandling.isUnavailable():!1},n.prototype.shippingAndHandlingAmount=function(){return this.shippingAndHandling?this.shippingAndHandling.getAmount():0},n.prototype.hasEstimatedDeliveryDate=function(){return this.estimatedDeliveryDates?this.estimatedDeliveryDates.hasDates():!1},n.prototype.getEstimatedDeliveryDateToDisplay=function(){return this.estimatedDeliveryDates?this.estimatedDeliveryDates.displayRange():"Unavailable"},n.prototype.getMaxEstimatedDeliveryDateToDisplay=function(){return this.estimatedDeliveryDates&&this.estimatedDeliveryDates.getMaxDate()?this.estimatedDeliveryDates.getMaxDate().toString():"Unavailable"},n.prototype.getEstimateDeliveryDateMessage=function(){return this.estimatedDeliveryDates?this.estimatedDeliveryDates.getMessage():""},n}();n.DeliveryType=e;o=function(){function n(n,t,i,r,u){this.id=n;this.name=t;this.deliveryType=i;this.deliveryMethods=r;this.isSelected=u}return n.prototype.getSelectedDeliveryMethod=function(){var n=_.find(this.deliveryMethods,function(n){return n.hasInformation()});return n||this.deliveryMethods[0]},n}();n.ShippingMethod=o;s=function(){function n(n,t,i,r){this.code=n;this.shippingMethod=t;this.deliveryType=i;this.deliveryMethod=r}return n}();n.ShippingCondition=s;h=function(){function n(n,t){this.condition=n;this.shippingMethod=t}return n.prototype.conditionIsSatisfied=function(){return this.condition()},n.prototype.getShippingMethod=function(){return this.shippingMethod},n}();n.SelectDefaultShippingMethodRule=h}(ns||(ns={})),function(n){var i=events.ShippingEvents,t=function(){function n(n,t,i,r,u,f){(this.eventsService=n,this.modelsFactory=t,this.userService=i,this.addressService=r,this.cartService=u,this.initialData=f,this.shippingMethodDisplay={"01":"Standard","40":"Standard","50":"Standard","53":"Standard","56":"Standard","66":"Standard","03":"Two Day","04":"Two Day","58":"Two Day","61":"Two Day","07":"One Day","12":"One Day","13":"One Day","20":"One Day","24":"One Day","69":"One Day","72":"One Day","02":"Standard UPS Collect","51":"Standard FedEx Collect","55":"Standard FedEx Collect","31":"Two Day UPS Collect","35":"Two Day Collect","60":"Two Day FedEx Collect","63":"Two Day Collect","08":"One Day UPS Collect","14":"One Day Collect","15":"One Day Collect","22":"One Day Collect","44":"One Day Collect","64":"One Day Collect","65":"One Day Collect","71":"One Day Collect","74":"One Day FedEx Collect","99":"Other","95":"Pick-up"},this.selectedShippingCondition=null,this.initialized=!1,f&&f.checkout)&&(this.initialCollectNumber=f.checkout.collectAccountNumber,this.providedShippingConditions=f.checkout.shippingConditions,this.standardDeliveryMethod=f.checkout.standardDeliveryMethod,this.cart=u.getCart(),this.deliveryMethods=this.createDeliveryMethods(),this.deliveryTypes=this.createDeliveryTypes(),this.shippingMethods=this.createShippingMethods(),this.shippingConditions=this.createShippingConditions(),this.shippingMethodRules=this.createShippingMethodRules(),this.init())}return n.prototype.getSelectedShippingMethod=function(){return _.find(_.values(this.shippingMethods),function(n){return n.isSelected})},n.prototype.getShippingCondition=function(n){return _.findWhere(this.shippingConditions,{code:n})},n.prototype.setShippingMethod=function(n){var t=this.getSelectedShippingMethod();n!==t&&(_.each(_.values(this.shippingMethods),function(n){n.isSelected=!1}),n.isSelected=!0,this.updateSelectedShippingCondition(),this.initialized&&this.eventsService.trigger(i.ShippingMethodChanged))},n.prototype.isHazmatShipToAlaskaOrHawaii=function(){return this.addressService.selectedShipToAddress?this.addressService.selectedShipToAddress.stateCode?this.cart.hasHazmatOrOrmdItem()?this.addressService.stateCodeIsHawayOrAlaska(this.addressService.selectedShipToAddress.stateCode):!1:!1:!1},n.prototype.selectedAddressIsNotShippable=function(){return this.addressService.selectedShipToIsNonShippable()},n.prototype.hasValidInitialCollectAccountNumber=function(){return this.initialCollectNumber&&this.initialCollectNumber.length>=6},n.prototype.showCollect=function(){return!this.userService.user.isAssociate()&&(!this.userService.user.isEmployeeUser||this.hasValidInitialCollectAccountNumber())},n.prototype.setCollectAccountNumber=function(){var n=this.initialCollectNumber.length>6?this.deliveryMethods.fedexCollect:this.deliveryMethods.upsCollect;n.setInformation(this.initialCollectNumber)},n.prototype.selectDefaultShippingMethod=function(){var n=_.find(_.values(this.shippingMethodRules),function(n){return n.conditionIsSatisfied()}).getShippingMethod();this.setShippingMethod(n);n===this.shippingMethods.collect&&this.setCollectAccountNumber()},n.prototype.showBranchPickup=function(){return this.shippingMethods.pickup.isSelected&&this.cart.hasPickupItems()},n.prototype.showAssociatePickup=function(){return this.shippingMethods.pickup.isSelected&&this.userService.user.isAssociate()},n.prototype.allItemsAreAvailableForPickup=function(){return this.cart.allItemsAreAvailableForPickup()},n.prototype.getDisplayText=function(n,t){var i=this.shippingMethodDisplay[n];return n==="99"&&t&&(i+=": "+t),i||(i=n),i},n.prototype.setDeliveryType=function(n){var t=this.getSelectedShippingMethod();t.deliveryType=n;this.updateSelectedShippingCondition()},n.prototype.getShippingConditionCodeForDeliveryType=function(n){if(n){var t=this.getSelectedShippingMethod(),i=this.findShippingCondition(t,n,t.getSelectedDeliveryMethod());if(i)return i.code}return this.selectedShippingCondition.code},n.prototype.getCodesForSelectedShippingMethod=function(){var n=this.getSelectedShippingMethod(),t=_.where(this.shippingConditions,{shippingMethod:n});return _.map(t,function(n){return n.code})},n.prototype.getSelectedShippingConditionCode=function(){return this.updateSelectedShippingCondition(),this.getShippingConditionCodeForDeliveryType()},n.prototype.setAccountNumber=function(){(this.deliveryMethods.upsCollect.hasInformation()||this.deliveryMethods.fedexCollect.hasInformation())&&(this.setShippingMethod(this.shippingMethods.collect),this.updateSelectedShippingCondition())},n.prototype.getSelectedShippingMethodId=function(){var n=this.getSelectedShippingMethod();return n.id},n.prototype.getShippingMethods=function(){return this.shippingMethods},n.prototype.getDeliveryMethods=function(){return this.deliveryMethods},n.prototype.getDeliveryTypes=function(){return this.deliveryTypes},n.prototype.showOtherShippingModelInformation=function(){var n=this.getSelectedShippingMethod();n&&n.getSelectedDeliveryMethod()===this.deliveryMethods.other&&(this.shippingMethods.other.getSelectedDeliveryMethod().showInformation=!0)},n.prototype.removeOtherShippingModelInformation=function(){var n=this.getSelectedShippingMethod();n&&n.getSelectedDeliveryMethod()===this.deliveryMethods.other&&(this.shippingMethods.other.getSelectedDeliveryMethod().showInformation=!1,this.shippingMethods.other.getSelectedDeliveryMethod().setInformation(""))},n.prototype.updateShippingAndHandlingAndEdd=function(n){var t=this;_.each(n,function(n,i){var u=t.getShippingCondition(i),r=u.deliveryType;r.setShippingAndHandling(n.shippingAndHandling);r.setEstimatedDeliveryDates(n.deliveryDate)})},n.prototype.getDeliveryDateForOrderConfirmation=function(){var n=this.getSelectedShippingMethod(),t=n.deliveryType;return t.getEstimatedDeliveryDateToDisplay()},n.prototype.getMaxDeliveryDateForOrderConfirmation=function(){var n=this.getSelectedShippingMethod(),t=n.deliveryType;return t.getMaxEstimatedDeliveryDateToDisplay()},n.prototype.getEstimateDeliveryDateMessageForOrderConfirmation=function(){var n=this.getSelectedShippingMethod(),t=n.deliveryType;return t.getEstimateDeliveryDateMessage()},n.prototype.getCollectAccountNumber=function(){var n=this.shippingMethods.collect.getSelectedDeliveryMethod();return n?n.getInformation():""},n.prototype.getOtherNotes=function(){return this.deliveryMethods.other.getInformation()},n.prototype.getPickupPhoneNumber=function(){return this.deliveryMethods.pickup.getInformation()},n.prototype.shippingHasGeneralError=function(){return this.cart.hasShippingError()&&(this.shippingMethods.ship.isSelected||this.shippingMethods.collect.isSelected)},n.prototype.shipsHazmatOrmdToNonContinentalUs=function(n){return this.shippingMethods.ship.isSelected||this.shippingMethods.collect.isSelected?n?n.shipsHazmatOrmdToNonContinentalUs():!1:!1},n.prototype.shippingHasCaliforniaError=function(n){if(n)return n.shippingHasCaliforniaError();var t=this.getSelectedShippingMethod();return t.deliveryType.shippingHasCaliforniaError()},n.prototype.areShippingErrors=function(n){if(!n){var t=this.getSelectedShippingMethod();n=t.deliveryType}return n.shippingHasHazmatAirRestriction()||n.shippingHasCaliforniaError()||n.shipsHazmatOrmdToNonContinentalUs()||n.shippingHasVoucherRestriction()||this.addressService.selectedShipToIsNonShippable()},n.prototype.areDeliveryEstimationErrorsAndNoOtherRestrictions=function(){return this.cart.deliveryEstimationHasError()&&!this.areShippingErrors()},n.prototype.isOtherShipMethodWithoutNotes=function(){var n=this.getSelectedShippingMethod();return n===this.shippingMethods.other&&!n.getSelectedDeliveryMethod().hasInformation()},n.prototype.isCollectShipMethodWithInvalidAccountNumber=function(){var n=this.getSelectedShippingMethod();return n===this.shippingMethods.collect&&n.getSelectedDeliveryMethod().hasInformation()&&!n.getSelectedDeliveryMethod().isValid()},n.prototype.isShippingHazmatOrmdToNonContinentalUsAndOtherShippingMethodIsNotSelected=function(){var n=this.getSelectedShippingMethod();return this.cart.shipsHazmatOrmdToNonContinentalUs()&&n!==this.shippingMethods.other},n.prototype.isShippingToNonShippableStateAndOtherShippingMethodIsNotSelected=function(){var n=this.getSelectedShippingMethod();return this.selectedAddressIsNotShippable()&&n!==this.shippingMethods.other},n.prototype.isPickupMethodWitInvalidPhoneNumber=function(){if(this.userService.user.isAssociate())return!1;var n=this.getSelectedShippingMethod();return n===this.shippingMethods.pickup&&!n.getSelectedDeliveryMethod().isValid()},n.prototype.isBranchCustomerPickupMethod=function(){if(this.userService.user.isAssociate())return!1;var n=this.getSelectedShippingMethod();return n===this.shippingMethods.pickup},n.prototype.hasDropShipItems=function(){return this.cart.hasDropship()},n.prototype.isDeliveryMethodOfTypeOther=function(){var n=this.getSelectedShippingMethod();return n&&n.getSelectedDeliveryMethod()===this.deliveryMethods.other},n.prototype.init=function(){this.selectDefaultShippingMethod();this.initialized=!0;this.eventsService.on(events.AddressesEvents.SelectedAddressChanged,this.selectDefaultShippingMethod.bind(this))},n.prototype.createDeliveryMethods=function(){return{fedex:this.modelsFactory.createDeliveryMethod(0,"FedEx"),ups:this.modelsFactory.createDeliveryMethod(1,"UPS"),fedexCollect:this.modelsFactory.createDeliveryMethod(2,"FedExCollect",""),upsCollect:this.modelsFactory.createDeliveryMethod(3,"UPSCollect",""),other:this.modelsFactory.createDeliveryMethod(4,"Other"),pickup:this.modelsFactory.createDeliveryMethod(5,"Pick-up","")}},n.prototype.createDeliveryTypes=function(){return{standard:this.modelsFactory.createDeliveryType(0,"Standard"),oneDay:this.modelsFactory.createDeliveryType(1,"One Day"),twoDay:this.modelsFactory.createDeliveryType(2,"Two Day"),other:this.modelsFactory.createDeliveryType(3,"Other"),pickup:this.modelsFactory.createDeliveryType(4,"Pick-up")}},n.prototype.createShippingMethods=function(){var n=_.findWhere(_.values(this.deliveryMethods),{id:this.standardDeliveryMethod});return{ship:this.modelsFactory.createShippingMethod(0,"Ship",this.deliveryTypes.standard,[n]),collect:this.modelsFactory.createShippingMethod(1,"Collect",this.deliveryTypes.standard,[this.deliveryMethods.fedexCollect,this.deliveryMethods.upsCollect]),other:this.modelsFactory.createShippingMethod(2,"Other",this.deliveryTypes.other,[this.deliveryMethods.other]),pickup:this.modelsFactory.createShippingMethod(3,"Pick-Up",this.deliveryTypes.pickup,[this.deliveryMethods.pickup])}},n.prototype.createShippingConditions=function(){var n=this;return _.map(this.providedShippingConditions,function(t){var i=_.findWhere(_.values(n.shippingMethods),{id:t.shippingMethod}),r=_.findWhere(_.values(n.deliveryTypes),{id:t.deliveryType}),u=_.findWhere(_.values(n.deliveryMethods),{id:t.deliveryMethod});return n.modelsFactory.createShippingCondition(t.code,i,r,u)})},n.prototype.createShippingMethodRules=function(){var n=this;return{isAssociateUserRule:this.modelsFactory.createShippingMethodRule(function(){return n.userService.user.isAssociate()},this.shippingMethods.pickup),isAvailableForPickupRule:this.modelsFactory.createShippingMethodRule(function(){return n.cart.hasPickupItems()},this.shippingMethods.pickup),isHarmatOrOrmdShipRule:this.modelsFactory.createShippingMethodRule(function(){return n.isHazmatShipToAlaskaOrHawaii()},this.shippingMethods.other),isNonShippableAddressRule:this.modelsFactory.createShippingMethodRule(function(){return n.selectedAddressIsNotShippable()},this.shippingMethods.other),isCollectAccountUsedRule:this.modelsFactory.createShippingMethodRule(function(){return n.hasValidInitialCollectAccountNumber()},this.shippingMethods.collect),isDefaultRule:this.modelsFactory.createShippingMethodRule(function(){return!0},this.shippingMethods.ship)}},n.prototype.findShippingCondition=function(n,t,i){return _.findWhere(this.shippingConditions,{shippingMethod:n,deliveryType:t,deliveryMethod:i})},n.prototype.updateSelectedShippingCondition=function(){var n=this.getSelectedShippingMethod(),r=n.getSelectedDeliveryMethod(),t=this.findShippingCondition(n,n.deliveryType,r);t&&t!==this.selectedShippingCondition&&(this.selectedShippingCondition=t,this.initialized&&this.eventsService.trigger(i.ShippingConditionChanged))},n}();t.$inject=["eventsService","modelsFactory","userService","addressService","cartService","initialData"];n.ShippingMethodsService=t;angular.module("ns").service("shippingMethodsService",t)}(ns||(ns={})),function(n){"use strict";var t=function(){function n(n,t,i,r,u,f){var e=this;this.$scope=n;this.shippingMethodsService=t;this.functionUtils=i;this.eventsService=r;this.shEddTaxService=u;this.analyticsService=f;this.updatingTotals=!1;u.initialize();r.on([events.ShippingEvents.CalculatedTotals,events.ShippingEvents.CalculatedTotalsFailed],function(){this.updatingTotals=!1;this.setStandardIfFree()}.bind(this));r.on(events.ShippingEvents.CalculatingTotals,function(){this.updatingTotals=!0}.bind(this));this.shippingMethods=this.shippingMethodsService.getShippingMethods();this.deliveryMethods=this.shippingMethodsService.getDeliveryMethods();this.deliveryTypes=this.shippingMethodsService.getDeliveryTypes();n.$watch(function(){return e.deliveryMethods.upsCollect.information+e.deliveryMethods.fedexCollect.information},i.waitForMore(function(){this.shippingMethodsService.setAccountNumber()}.bind(this)))}return n.prototype.applyOtherInformation=function(){this.shippingMethodsService.showOtherShippingModelInformation()},n.prototype.removeOtherInformation=function(){this.shippingMethodsService.removeOtherShippingModelInformation()},n.prototype.setDeliveryType=function(n,t){t||(this.shippingMethodsService.setDeliveryType(n),this.analyticsService.trackEditCartOrCheckout("Shipping Method: "+n.name))},n.prototype.setShippingMethod=function(n){n!==this.shippingMethodsService.getSelectedShippingMethod()&&(this.updatingTotals=!0,this.analyticsService.trackShippingMethod(n),this.analyticsService.trackEditCartOrCheckout("Shipping method: "+n.name),this.shippingMethodsService.setShippingMethod(n))},n.prototype.getSelectedShippingConditionCode=function(){return this.shippingMethodsService.getSelectedShippingConditionCode()},n.prototype.getSelectedShippingMethodId=function(){return this.shippingMethodsService.getSelectedShippingMethodId()},n.prototype.showShippingAndHandlingAmount=function(n){return n?this.totalShippingAndHandling(n)>0&&n.shippingAndHandlingHasAmount():!1},n.prototype.showFreeShipping=function(n){return n?n.shippingAndHandlingIsFree():!1},n.prototype.showShippingAndHandlingUnavailable=function(n){return n?n.shippingAndHandlingIsUnavailable():!1},n.prototype.totalShippingAndHandling=function(n){return n?n.shippingAndHandlingAmount():0},n.prototype.shipsHazmatOrmdToNonContinentalUs=function(n){return this.shippingMethodsService.shipsHazmatOrmdToNonContinentalUs(n)},n.prototype.shippingHasCaliforniaError=function(n){return this.shippingMethodsService.shippingHasCaliforniaError(n)},n.prototype.shippingHasHazmatAirRestriction=function(n){var i=this.shippingMethodsService.isDeliveryMethodOfTypeOther(),t=n?n.shippingHasHazmatAirRestriction():!1;return t&&!i&&this.setDeliveryType(this.deliveryTypes.standard,this.standardIsDisabled()),t},n.prototype.shipsToNonShippableState=function(){return this.shippingMethodsService.selectedAddressIsNotShippable()},n.prototype.areDeliveryEstimationErrorsAndNoOtherRestrictions=function(){return this.shippingMethodsService.areDeliveryEstimationErrorsAndNoOtherRestrictions()&&!this.updatingTotals},n.prototype.standardShipIsActive=function(){return this.shippingMethods.ship.deliveryType===this.deliveryTypes.standard&&!this.shippingMethodsService.areShippingErrors(this.deliveryTypes.standard)},n.prototype.twoDayShipIsActive=function(){return this.shippingMethods.ship.deliveryType===this.deliveryTypes.twoDay&&!this.shippingMethodsService.areShippingErrors(this.deliveryTypes.twoDay)},n.prototype.oneDayShipIsActive=function(){return this.shippingMethods.ship.deliveryType===this.deliveryTypes.oneDay&&!this.shippingMethodsService.areShippingErrors(this.deliveryTypes.oneDay)},n.prototype.standardCollectIsActive=function(){return this.shippingMethods.collect.deliveryType===this.deliveryTypes.standard&&!this.shippingMethodsService.areShippingErrors(this.deliveryTypes.standard)},n.prototype.standardIsDisabled=function(){return this.shippingMethodsService.areShippingErrors(this.deliveryTypes.standard)},n.prototype.twoDayIsDisabled=function(){return this.shippingMethodsService.areShippingErrors(this.deliveryTypes.twoDay)},n.prototype.oneDayIsDisabled=function(){return this.shippingMethodsService.areShippingErrors(this.deliveryTypes.oneDay)},n.prototype.isUpdatingTotals=function(){return this.updatingTotals},n.prototype.showBranchPickup=function(){return this.shippingMethodsService.showBranchPickup()},n.prototype.showAssociatePickup=function(){return this.shippingMethodsService.showAssociatePickup()},n.prototype.showCollect=function(){return this.shippingMethodsService.showCollect()},n.prototype.notAllItemsAreAvailableForPickup=function(){return!this.shippingMethodsService.allItemsAreAvailableForPickup()},n.prototype.hasDropShipItems=function(){return this.shippingMethodsService.hasDropShipItems()},n.prototype.setStandardIfFree=function(){this.showFreeShipping(this.deliveryTypes.standard)&&this.setDeliveryType(this.deliveryTypes.standard,this.standardIsDisabled())},n.prototype.expeditedShippingHasVoucherRestriction=function(){return this.deliveryTypes.twoDay.shippingHasVoucherRestriction()||this.deliveryTypes.oneDay.shippingHasVoucherRestriction()},n.prototype.recomputeShippingCharges=function(){this.shEddTaxService.calculate()},n}();t.$inject=["$scope","shippingMethodsService","functionUtils","eventsService","shEddTaxService","analyticsService"];n.ShippingMethodsController=t;angular.module("ns").controller("shippingMethodsCtrl",t)}(ns||(ns={})),function(){var n=common.MinimumQuantityValidator,i=function(){function n(){this.restrict="A";this.templateUrl="/js/ns/shopping-cart/cart-line-edit-details.html";this.controller=t;this.controllerAs="controller"}return n.instance=function(){return new n},n}(),t=function(){function t(n,t,i,r,u,f,e){this.$q=t;this.cartService=i;this.featureData=r;this.eventsService=u;this.userService=f;this.analyticsService=e;this.materialForEdit=i.materialForEdit;this.updateProductInfoAfterCharacterSetSelection=this.cartService.updateProductInfoAfterCharacterSetSelection;n.allowReturns=f.user.allowReturns}return t.prototype.shouldDisplayCartLineRestrictions=function(){return this.materialForEdit.hasRestrictionCode()},t.prototype.showStockStatus=function(){return this.cartService.showStockStatus(this.materialForEdit)},t.prototype.updateMaterialDetails=function(n){var r=this,t=this.$q.defer(),i;if(this.isNotValidQuantity(n)||this.isUnderMinimumQuantity(n))t.reject(),this.eventsService.trigger("reset-update-spinner");else return i=this.cartService.changeMaterialDetails(n),i.then(function(){r.analyticsService.trackEditCartOrCheckout("Update cart item");t.resolve(!0)});return t.promise},t.prototype.isNotValidQuantity=function(t){return(t||(t=this.materialForEdit),n.isValidQuantity(t))?!1:n.isAboveMinimumQuantity(t)?!0:!1},t.prototype.isUnderMinimumQuantity=function(t){return(t||(t=this.materialForEdit),n.isAboveMinimumQuantity(t))?!1:!0},t}();t.$inject=["$scope","$q","cartService","featureData","eventsService","userService","analyticsService"];angular.module("ns").directive("cartlineEditDetails",i.instance)}(ns||(ns={})),function(n){var i=common.MinimumQuantityValidator,r=function(){function n(){this.restrict="A";this.scope={material:"=cartLine",isLevelThreeRestricted:"=isLevelThreeRestricted",isLevelTwoRestricted:"=isLevelTwoRestricted",isLevelOneRestricted:"=isLevelOneRestricted"};this.controller=t;this.controllerAs="controller";this.templateUrl="/js/ns/shopping-cart/cart-line.html"}return n.instance=function(){return new n},n}(),t;angular.module("ns").directive("cartLine",r.instance);t=function(){function t(t,i,r,u,f,e,o,s,h){this.$rootScope=t;this.$scope=i;this.$timeout=r;this.$q=u;this.cartService=f;this.featureData=e;this.punchOutService=o;this.analyticsService=s;this.userService=h;this.material=i.material;this.isLevelOneRestricted=i.isLevelOneRestricted;this.isLevelTwoRestricted=i.isLevelTwoRestricted;this.isLevelThreeRestricted=i.isLevelThreeRestricted;this.analyticsService=s;this.isPunchOutSession=o.isPunchOutSession();this.promise=null;i.allowReturns=h.user?h.user.allowReturns:!1;this.material&&(this.material.characterSets=_.map(this.material.characterSets,function(t){var i=new n.CharacterSet;return i.update(t),i}))}return t.prototype.copyMaterialForEdit=function(){this.material&&(this.cartService.updateMaterialToEdit(this.material),this.cartService.checkCartLineRestriction())},t.prototype.saveItemForLater=function(n){return this.cartService.saveItemForLater(n)},t.prototype.removeItem=function(n){return this.cartService.removeItem(n)},t.prototype.updateItemQuantity=function(n,t){var r=this,i;return t===void 0&&(t=!1),i=this.$q.defer(),this.isNotValidQuantity()||this.isUnderMinimumQuantity()?(i.reject(),this.$rootScope.$broadcast("reset-update-spinner")):(this.promise&&this.$timeout.cancel(this.promise),this.promise=this.$timeout(function(){},2e3),this.promise.then(function(){t&&(n.quantity=n.totalQuantityAvailableToOrder);r.cartService.updateItemQuantity(n);r.analyticsService.trackEditCartOrCheckout("Update cart item quantity");i.resolve(!0)})),i.promise},t.prototype.isNotValidQuantity=function(n){return(n||(n=this.material),i.isValidQuantity(n))?!1:i.isAboveMinimumQuantity(n)?!0:!1},t.prototype.isUnderMinimumQuantity=function(n){return(n||(n=this.material),i.isAboveMinimumQuantity(n))?!1:!0},t.prototype.getQuantityPerRoundingProfile=function(){return this.material.quantity/this.material.roundingProfile},t.prototype.getUnitPriceTimesQuantity=function(){return this.material.unitPrice*this.material.quantity},t.prototype.allowBackorder=function(n){var t=this;return this.cartService.setAllowBackorder(n.lineId).then(function(n){t.material.backorderAllowed=n})},t.prototype.isEligibleForBackorder=function(){return!this.material.isProductUnavailable&&!this.material.backorderAllowed&&this.material.isEligibleForBackorder},t.prototype.displayMaterialLimitRestrictedWithAvailableQuantityMessage=function(){return this.material.isQuantityLimitRestricted&&this.material.totalQuantityAvailableToOrder>0&&this.material.isUserAuthenticated},t.prototype.displayLargeOrderEmailYourRequest=function(){return this.material.quantity>10},t.prototype.displayLoggingInMessage=function(){return!this.material.isUserAuthenticated&&this.material.isQuantityLimitRestricted},t.prototype.isClearanceOverStock=function(){return this.material.isClearance&&this.material.availableStockQuantity<0},t.prototype.containsMessagesOrAlerts=function(){return this.material.isHazmat||this.material.minQtyMsg||this.material.isDropShipOrmd||(this.material.isOrmd||this.material.isLtq||this.material.isLib||this.material.isLmb)&&!this.material.isDropShip||this.material.hasLengthQuantity||this.material.isGroundShippingFree},t.prototype.isNotApprovedForPurchase=function(){return!this.material.isQuoted&&(this.isLevelOneRestricted||this.isLevelTwoRestricted)},t.prototype.showStockStatus=function(){return this.cartService.showStockStatus(this.material)},t.prototype.getProductPosition=function(n){var t=this.cartService.getCart().cartLines;return t.indexOf(n)+1},t.prototype.trackProductClick=function(n){this.analyticsService.trackProductClick(n,"Cart",this.getProductPosition(n),"Shopping Cart")},t.prototype.isProductUnavailable=function(){return this.material.isProductUnavailable=this.material.isProductUnavailable||this.cartService.materialIsTemporaryUnavailable(this.material),this.material.isProductUnavailable},t.prototype.shouldDisableManageCart=function(){return this.material.unitPrice<=0||this.material.isFromVoucherShop},t.prototype.canRemoveMaterialFromCart=function(){return this.material.unitPrice<=0},t}();t.$inject=["$rootScope","$scope","$timeout","$q","cartService","featureData","punchOutService","analyticsService","userService"];n.CartLineController=t;angular.module("ns").controller("cartLineCtrl",t)}(ns||(ns={})),function(n){var t=function(){function t(){this.cartId=0;this.productsDiscount=0;this.totalSavings=0;this.linesTotalPrice=0;this.packingNote=null;this.allItemsAreDropShips=!1;this.hasDangerousGood=!1;this.checkoutStatus={canCheckout:!0,errors:[]};this.cartLines=[];this.deliveryDate=null;this.shippingAndHandling=null;this.taxes=null;this.voucherCoverage=null;this.defaultShippingConditionCode=null;this.lastModified=null}return t.prototype.setId=function(n){this.cartId=n},t.prototype.updateLines=function(t){var i=_(t).map(function(t){var i=new n.CartLine;return i.update(t),i});this.cartLines=i},t.prototype.setCheckoutStatus=function(n){this.checkoutStatus=n},t.prototype.setCartDetails=function(n){this.linesTotalPrice=n.linesTotalPrice?n.linesTotalPrice:0;this.productsDiscount=n.productsDiscount?n.productsDiscount:0;this.totalSavings=n.totalSavings?n.totalSavings:0;this.defaultShippingConditionCode=n.defaultShippingConditionCode;this.lastModified=n.lastModified;this.allItemsAreDropShips=n.allItemsAreDropShips},t.prototype.update=function(n){this.setId(n.cartId);this.updateLines(n.cartLines);this.setCartDetails(n);n.checkoutStatus&&this.setCheckoutStatus(n.checkoutStatus)},t.prototype.hasHazmatOrOrmdItem=function(){return _.some(this.cartLines,function(n){return n.isHazmatOrOrmd()})},t.prototype.setDeliveryDates=function(n){var t=this;_&&(this.deliveryDate=n,_.each(this.cartLines,function(n){var i=t.deliveryDate.getDeliveryDateForLine(n.lineId);n.setDeliveryDate(i)}))},t.prototype.setShippingAndHandling=function(n){this.shippingAndHandling=n},t.prototype.setTaxes=function(n){this.taxes=n},t.prototype.setVoucherCoverage=function(n){this.voucherCoverage=n},t.prototype.hasShippingError=function(){return this.shippingAndHandling?this.shippingAndHandling.hasError():!1},t.prototype.getSubtotal=function(){return this.linesTotalPrice},t.prototype.getDiscount=function(){return this.productsDiscount},t.prototype.getNetTotal=function(){return this.linesTotalPrice-this.productsDiscount},t.prototype.getSavings=function(){return this.totalSavings},t.prototype.getDiscountForShippingAndHandling=function(){return this.shippingAndHandling?this.shippingAndHandling.discount:0},t.prototype.getTaxes=function(){return this.taxes?this.taxes.getTaxes():0},t.prototype.getVoucherCoverage=function(){return this.voucherCoverage?this.voucherCoverage.getVoucherCoverage():0},t.prototype.getTotalVoucherDeductedAmount=function(){return this.voucherCoverage?this.voucherCoverage.getTotalVoucherDeductedAmount():null},t.prototype.getHazmatCharges=function(){return this.shippingAndHandling?this.shippingAndHandling.getHazmatCharges():0},t.prototype.getLiftGateCharges=function(){return this.shippingAndHandling?this.shippingAndHandling.getLiftGateCharges():0},t.prototype.hazmatChargesAreUnavailable=function(){return this.shippingAndHandling?this.shippingAndHandling.hazmatChargesAreUnavailable:!1},t.prototype.hasShippingAndHandling=function(){return this.shippingAndHandling?this.shippingAndHandling.hasAmount():!1},t.prototype.getShippingAndHandlingCost=function(){return this.shippingAndHandling?this.shippingAndHandling.getAmount():0},t.prototype.getTotal=function(){return this.getSubtotal()+this.getShippingAndHandlingCost()+this.getHazmatCharges()+this.getLiftGateCharges()+this.getTaxes()-this.getDiscount()},t.prototype.shippingAndHandlingIsPartial=function(){return this.shippingAndHandling&&this.shippingAndHandling.isPartial()},t.prototype.shippingAndHandlingIsUnavailable=function(){return this.shippingAndHandling&&this.shippingAndHandling.isUnavailable()},t.prototype.shippingAndHandlingIsFree=function(){return this.shippingAndHandling&&this.shippingAndHandling.isFree()},t.prototype.deliveryEstimationHasError=function(){return this.deliveryDate&&this.deliveryDate.hasError()},t.prototype.shippingHasCaliforniaError=function(){return this.shippingAndHandling&&this.shippingAndHandling.hasCaliforniaError()},t.prototype.shipsHazmatOrmdToNonContinentalUs=function(){return this.shippingAndHandling&&this.shippingAndHandling.shipsHazmatOrmdToNonContinentalUs()},t.prototype.hasPickupItems=function(){return _.some(this.cartLines,function(n){return n.isAvailableForPickup})},t.prototype.allItemsAreAvailableForPickup=function(){return _.all(this.cartLines,function(n){return n.isAvailableForPickup})},Object.defineProperty(t.prototype,"calculatedSavings",{get:function(){return this.getSavings()+this.getDiscountForShippingAndHandling()},enumerable:!0,configurable:!0}),t.prototype.hasGeographicalRestrictedMaterials=function(){return _.some(this.cartLines,function(n){return n.hasRestrictionCode()})},t.prototype.hasDropship=function(){return _.some(this.cartLines,function(n){return n.isDropShip&&!n.isParcelDropShip})},t}();n.Cart=t}(ns||(ns={})),function(n){var t=events.CartEvents,i=function(){function n(n,t,i,r,u,f,e,o,s,h,c){this.$q=n;this.cookieService=t;this.analyticsService=i;this.initialData=r;this.apiService=u;this.modelsFactory=f;this.eventsService=e;this.navigationService=o;this.cartRestrictionsService=s;this.gtmEventService=h;this.featureData=c;this.init()}return Object.defineProperty(n.prototype,"cart",{get:function(){return this._cart},enumerable:!0,configurable:!0}),n.prototype.isCartLoaded=function(){return this._cartIsLoaded},n.prototype.updateCartData=function(n){n&&this._cart.update(n);this._cartIsLoaded?this.eventsService.trigger(t.CartUpdated):this.eventsService.trigger(t.CartLoaded);this._cartIsLoaded=!0},n.prototype.processPriorityCodeInfo=function(n){this._priorityCode=n.priorityCodeSummary;this.eventsService.trigger(t.PriorityCodeUpdated);n.isPriorityCodeExpired&&this.cookieService.removePriorityCodeCookie()},n.prototype.processRetrievedCart=function(n){n&&(this.processPriorityCodeInfo(n),this.updateCartData(n),this.cartRestrictionsService.updateCart(this._cart),this.cookieService.slideExpirationDates(),this.eventsService.trigger(t.CartUpdated))},n.prototype.loadInitialCart=function(){this.hasInitialCart()&&this.processRetrievedCart(this.initialData.cart)},n.prototype.hasInitialCart=function(){return this.initialData&&this.initialData.cart&&this.initialData.cart.cartId!=="00000000-0000-0000-0000-000000000000"},n.prototype.createQueryToGetCart=function(n,t){var r,o,u,f,e,i;return n?(r=this.cookieService.getPriorityCodeCookie(),o=this.cookieService.getPriorityCodeIsManullyAdded(),t&&t.shipToId&&(u=t.shipToId),t&&t.zipCode&&(f=t.zipCode),e=this.navigationService.getCurrentLocationPathName()==="/Cart",i="",(r||u||f||e)&&(i+="?"),r&&(i+="priorityCode="+r+"&isManuallyAdded="+o),u&&(i+="&shipToId="+u),f&&(i+="&zipCode="+f),e&&(i+="&requestFromCart=true"),i):undefined},n.prototype.loadCart=function(n){var i=this,r=this.cookieService.getCartCookie(),u;return r?(u=this.createQueryToGetCart(r,n),this.apiService.getCart(r+u).then(function(n){i.processRetrievedCart(n.data);i._zipCode&&i.getTaxes()}).catch(function(n){n.status===404&&i.cookieService.removeCartCookie()})):(this.eventsService.trigger(events.SpinnerEvents.StopSpinner),this.$q.when(this.eventsService.trigger(t.CartUpdated)))},n.prototype.reloadCart=function(n,t){var i=t[0];this.loadCart({shipToId:i[0]})},n.prototype.init=function(){this._cart=this.modelsFactory.createCart();this._priorityCode=null;this._cartIsLoaded=!1;this._materialForEdit=this.modelsFactory.createCartLine();this._addressBookLoaded=!1;this._zipCode=null;this.subscribeToEvents();this.loadInitialCart()},n.prototype.subscribeToEvents=function(){this.eventsService.on(t.UpdateCart,this.loadCart.bind(this));this.eventsService.on(events.AddressesEvents.SelectedAddressChanged,this.reloadCart.bind(this))},Object.defineProperty(n.prototype,"materialForEdit",{get:function(){return this._materialForEdit},enumerable:!0,configurable:!0}),n.prototype.validateZipCode=function(n){return this.apiService.validateZipCode(n)},n.prototype.getShippingAndHandling=function(n){this._zipCode=n;var t={zipCode:n};return this.loadCart(t)},n.prototype.getTaxes=function(){var n=this,i=this.cookieService.getCartCookie(),r=this.cookieService.getPriorityCodeCookie();return this.apiService.getShippingTaxes(i,{params:{zipCode:this._zipCode,shippingMethod:this._cart.defaultShippingConditionCode,priorityCode:r}}).then(function(i){n.updateShippingAndHandlingEstimateDatesAndTaxes(n.createShippingAndHandling(i.data));n.eventsService.trigger(t.UpdateDeliveryCost)})},n.prototype.createShippingAndHandling=function(n){var t=this.modelsFactory.createShippingAndHandling(n.shippingAndHandling),i=this.modelsFactory.createTaxes(n.taxes),r=this.modelsFactory.createEstimatedDeliveryDate(n.deliveryDate);return{deliveryDate:r,shippingAndHandling:t,taxes:i}},n.prototype.updateShippingAndHandlingEstimateDatesAndTaxes=function(n){this._cart.setDeliveryDates(n.deliveryDate);this._cart.setShippingAndHandling(n.shippingAndHandling);this._cart.setTaxes(n.taxes);this._cart.setVoucherCoverage(n.voucherCoverage)},n.prototype.trackViewCart=function(){var n=this,t=[];this._cart.cartLines.forEach(function(i){return t.push({id:i.materialBaseNumber,name:i.materialName,brand:i.brand,category:n.gtmEventService.getCategoryPathWithChangedDelimiter(i.category,i.isCustomizable),variant:n.gtmEventService.getSelectedCharacterSetsValues(i),price:i.unitPrice,quantity:i.quantity,materialSaleFlag:n.gtmEventService.getMaterialSaleFlag(i.isSale),freeProductFlag:n.gtmEventService.getFreeProductFlag(i.isFreeGood),brandFlag:n.gtmEventService.getBrandFlag(i.isNsBrand),newMaterialFlag:n.gtmEventService.getNewMaterialFlag(i.isNew)})});this.analyticsService.trackViewCart(t,this._cart.getSubtotal(),this.getPriorityCodeSummary()?this.getPriorityCodeSummary().priorityCode:null)},n.prototype.materialIsTemporaryUnavailable=function(n){var i,t;return n.availableForBackorderOnly===!1?!0:(i=n.materialBaseNumber,!this.initialData.cart||!this.initialData.cart.checkoutStatus)?!1:(t=this.initialData.cart.checkoutStatus.temporaryUnavailableMaterialNumbers,!t)?!1:t.filter(function(n){return n===i}).length},n.prototype.emptyCart=function(){var n=this,t=this.cookieService.getCartCookie();return t?this.apiService.emptyCart(t).then(function(t){return n.analyticsService.trackEmptyCart(n.cart.cartLines),t.data.cartDeleted&&(n.cookieService.removeCartCookie(),n.navigationService.reloadPage()),n.loadCart()}):this.$q.when(this.navigationService.reloadPage())},n.prototype.removeVoucherItems=function(n){for(var u,f=this,e=this.cookieService.getCartCookie(),i=[],t=0,r=this.getCart().cartLines.filter(function(t){return t.voucherGuid===n});t<r.length;t++)u=r[t],i.push(this.getRemoveCartLinePromise(u.lineId,e));return this.$q.all(i).then(function(){return f.loadCart()})},n.prototype.removeLines=function(n){for(var u,f=this,e=this.cookieService.getCartCookie(),i=[],t=0,r=n;t<r.length;t++)u=r[t],i.push(this.getRemoveCartLinePromise(u.lineId,e));return this.$q.all(i).then(function(){return f.loadCart()})},n.prototype.getRemoveCartLinePromise=function(n,t){return this.apiService.removeCartLine(t,n)},n.prototype.removeItem=function(n){var t=this;return this.apiService.removeCartLine(this.cookieService.getCartCookie(),n.lineId).then(function(i){return t.analyticsService.trackRemoveFromCart(n,"Cartline List"),i.data.cartDeleted&&(t.cookieService.removeCartCookie(),t.navigationService.reloadPage()),t.loadCart()}).catch(function(n){n.status===500&&t.navigationService.reloadPage()})},n.prototype.saveItemForLater=function(n){var t=this,i={cartId:this.cookieService.getCartCookie(),lineId:n.lineId,lastModified:this._cart.lastModified};return this.apiService.saveItemForLater(i).then(function(i){return i.data.success?(t.analyticsService.trackRemoveFromCart(n,"Saved For Later List"),t.analyticsService.trackSaveCartForLater(n),t.eventsService.trigger(events.SaveForLaterEvents.ItemAdded),t.loadCart()):i.data.errors[0]?t.$q.when(t.navigationService.reloadPage()):t.$q.when()})},n.prototype.updateItemQuantity=function(n){var t=this;this.apiService.updateItemQuantity(this.cookieService.getCartCookie(),n.lineId,n.quantity).then(function(){return n.quantity===0?t.analyticsService.trackRemoveFromCart(n,"Cartline List"):t.analyticsService.trackUpdateItemInCart("Change Quantity"),t.loadCart()}).catch(function(){t.$q.when(t.navigationService.reloadPage())})},n.prototype.collectCharacterSetIds=function(n){var i,t;if(n.length===0)return[];for(i=[],t=0;t<n.length;t++)i[t]=n[t].selectedValue.id;return i},n.prototype.changeMaterialDetails=function(n){var t=this,i=this.collectCharacterSetIds(n.characterSets),r={characterSetValueIds:i,packingNote:n.packingNote,quantity:n.quantity};return this.apiService.updateCartLine(this.cookieService.getCartCookie(),n.lineId,r).then(function(){return t.analyticsService.trackUpdateItemInCart("Edit Details"),t.loadCart()}).catch(function(n){if(n.data.status===500)return t.navigationService.reloadPage()})},n.prototype.setAllowBackorder=function(n){var t=this;return this.apiService.allowBackorder(this.cookieService.getCartCookie(),n).then(function(){return t.loadCart()}).then(function(){return!0})},n.prototype.updateStockInfoOnChSetsOrQtyChange=function(n){var t=this.collectCharacterSetIds(n.characterSets),i=this.cookieService.getCartCookie();return this.apiService.validateCartLineQuantity(i,n.lineId,{params:{quantity:n.quantity,allowBackorder:!0,characterSetValueIds:t}})},n.prototype.saveCartForLater=function(){var n=this;return this.apiService.saveCartForLater(this.cookieService.getCartCookie()).then(function(){n._cart.cartLines.forEach(function(t){n.analyticsService.trackSaveCartForLater(t)});n.eventsService.trigger(events.SaveForLaterEvents.CartAdded);n.loadCart()})},n.prototype.updateCartPackingNote=function(n){var t=this;this.apiService.updateCartPackingNote(this.cookieService.getCartCookie(),{packingNote:n}).then(function(){t.cookieService.slideExpirationDates();t.eventsService.trigger(events.SpinnerEvents.StopSpinner)})},n.prototype.getCart=function(){var n=this;return this._cartIsLoaded?this.eventsService.trigger(t.CartLoaded):this.loadCart().then(function(){n.eventsService.trigger(t.CartLoaded)}),this._cart},n.prototype.updateCartBasedOnNewVoucherContext=function(n){var i=this.cookieService.getCartCookie(),r;if(!i)return this.eventsService.trigger(events.SpinnerEvents.StopSpinner),this.$q.when(this.eventsService.trigger(t.CartUpdated));r=this.createQueryToGetCart(i,n);this.apiService.updateCartItemsWithVoucherContext(i,r);this.loadCart(n)},n.prototype.updateCart=function(n){this.loadCart(n)},n.prototype.getNetTotal=function(){return this._cart.linesTotalPrice-this._cart.productsDiscount},n.prototype.getPriorityCodeSummary=function(){return this._priorityCode},n.prototype.cartHasPickupItems=function(){return this._cart.hasPickupItems()},n.prototype.showStockStatus=function(n){return this.cartRestrictionsService.showStockStatusForCartLine(n)},n.prototype.checkCartLineRestriction=function(){this.cartRestrictionsService.checkCartLineRestriction()},n.prototype.updateMaterialToEdit=function(n){this._materialForEdit.update(n)},n.prototype.updateProductInfoAfterCharacterSetSelection=function(n,t){n.updateCurrentMinimumQuantityAndRoundingProfile(t)},n}();i.$inject=["$q","cookieService","analyticsService","initialData","apiService","modelsFactory","eventsService","navigationService","cartRestrictionsService","gtmEventService","featureData"];n.CartService=i;angular.module("ns").service("cartService",i)}(ns||(ns={})),function(){"use strict";var n=function(){function n(n,t,i,r,u){this.eventsService=n;this.cartService=t;this.navigationService=i;this.punchOutService=r;this.$interval=u;this.cart=null;this.isResultFetched=!1;this.checkIfCartLoaded();this.updateCart()}return n.prototype.updateCart=function(){this.cart=this.cartService.getCart()},n.prototype.checkIfCartLoaded=function(){var n=this;this.eventsService.on(events.CartEvents.CartLoaded,function(){n.isResultFetched=!0})},n.prototype.checkOut=function(){return this.navigationService.goToCheckOut()},n.prototype.punchOut=function(){return this.navigationService.goToPunchOut()},n.prototype.isPunchOutSession=function(){return this.punchOutService.isPunchOutSession()},n}();n.$inject=["eventsService","cartService","navigationService","punchOutService","$interval"];angular.module("ns").controller("cartSummaryController",n)}(ns||(ns={})),function(n){"use strict";n.directive("cartSummary",function(){return{restrict:"A",templateUrl:"/js/ns/shopping-cart/cart-summary.html",scope:{cart:"=cartSummary"},link:function(n){n.$on("place-order-success",function(){n.cart={}})}}})}(angular.module("ns")),function(n){"use strict";n.directive("cartTotals",function(){return{restrict:"A",templateUrl:"/js/ns/shopping-cart/cart-totals.html",scope:{cart:"=cartTotals"},link:function(n){n.$on("place-order-success",function(){n.cart={}})}}})}(angular.module("ns")),function(n){"use strict";n.directive("cart",function(){return{restrict:"A",templateUrl:"/js/ns/shopping-cart/cart.html",scope:!0,controller:"shoppingCartCtrl"}});n.controller("shoppingCartCtrl",["$rootScope","$scope","$q","cartService","configs","navigationService","analyticsService","userService","punchOutService","featureData","productListTypeConst",function(n,t,i,r,u,f,e,o,s,h,c){t.youMayLikeTitle=c.YouMayAlsoLike;t.cart={};t.shipingAndHandling={};t.includePackingNotesCheckboxValue=!0;t.currentLocation={zipCode:null};t.lastValidZipCode=null;t.isPunchOutSession=s.isPunchOutSession();t.isResellerCustomer=o.user.isReseller();t.isAssociateCustomer=o.user.isAssociate();t.isUserAuthenticated=o.user.isUserAuthenticated;t.isUserKnown=o.user.isKnown;t.isLevelOneRestricted=o.user.isLevelOneRestricted;t.isLevelTwoRestricted=o.user.isLevelTwoRestricted;t.isLevelThreeRestricted=o.user.isLevelThreeRestricted;t.isImpersonatedUser=o.user.isUserImpersonated;t.isEmployeeUser=o.user.isEmployeeUser;r.trackViewCart();var l=function(){t.zipCodeErrors=t.cart.taxes.errorMessages;t.clearZipCode();t.displayShippingAndHandling=!0;n.$broadcast(events.SpinnerEvents.StopSpinner)},v=function(){return t.cart.cartLines.length===0?(t.displayShippingAndHandling=!1,n.$broadcast(events.SpinnerEvents.StopSpinner),!1):!0},y=function(i){t.displayShippingAndHandling=!1;v()||l();var u=t.currentLocation.zipCode,f=i&&i.isOutsideContinentalUS;r.getShippingAndHandling(u,f).then(function(){l()}).catch(function(){n.$broadcast(events.SpinnerEvents.StopSpinner)})},p=function(n){return n.isFromVoucherShop},a=function(){return t.cart.cartLines.some(p)};t.updateCart=function(){var i=r.getCart();i&&(t.cart=i,t.currentLocation.zipCode?y():n.$broadcast(events.SpinnerEvents.StopSpinner),n.$broadcast(events.CartEvents.CartUpdated))};t.saveCartForLater=function(){return r.saveCartForLater()};t.emptyCart=function(){return r.emptyCart()};t.navigateToNotificationCenter=function(){return f.goToNotificationCenter()};t.clearZipCode=function(){t.zipInput=null};t.redirectToPrevNonCartPage=function(){var n=!1,t=r.getCart();return t.cartLines.length==0&&(n=!0),f.goToPrevNonCartPage(n)};t.checkOut=function(){t.cart.checkoutStatus&&t.cart.checkoutStatus.canCheckout?f.goToCheckOut():n.$broadcast("reset-checkout-spinner")};t.punchOut=function(){return f.goToPunchOut()};t.showCanNOTCheckoutMessage=function(){return t.cart.checkoutStatus&&!t.cart.checkoutStatus.canCheckout&&t.cartLinesLength()};t.showErrorMessageForItems=function(){return _.any(t.cart.checkoutStatus.errors,function(n){return n.toString().indexOf("order must be at least")===-1&&n.toString().indexOf("covered by a voucher")===-1})};t.cartIsEmpty=function(){return!t.cart.cartLines||t.cart.cartLines.length==0};t.cartLinesLength=function(){return r.isCartLoaded()?t.cart?t.cart.cartLines?t.cart.cartLines.length:0:0:0};t.canEmptyCart=function(){return t.cartLinesLength()&&!a()};t.canSaveCartForLater=function(){return t.cartLinesLength()&&!t.isPunchOutSession&&!t.isLevelThreeRestricted&&!a()};t.canShowSavedForLater=function(){return!t.showSaveForLater||t.isPunchOutSession||t.isLevelThreeRestricted};t.shouldDisplayVoucherShopRedirectMessage=function(){return t.cartLinesLength()&&a()};t.navigateToVoucherShop=function(){return f.goToVoucherShop()};t.updateCart();n.$on("processed-backorder",t.updateCart);n.$on(events.CartEvents.UpdateDeliveryCost,function(){t.currentLocation.zipCode&&l()});t.hasUnQuotedMaterials=function(){var n=_.find(t.cart.cartLines,function(n){return!n.isQuoted});return n!=null}}])}(angular.module("ns")),function(n){"use strict";n.directive("punchoutCartLine",function(){return{restrict:"A",templateUrl:"/js/ns/shopping-cart/punchout-cart-line.html",scope:{material:"=punchoutCartLine",isLevelThreeRestricted:"=isLevelThreeRestricted",isLevelTwoRestricted:"=isLevelTwoRestricted",isLevelOneRestricted:"=isLevelOneRestricted"},controller:"cartLineCtrl"}})}(angular.module("ns")),function(n){"use strict";n.controller("punchoutCartCtrl",["initialData","$scope","modelsFactory","punchOutService","apiService","cookieService","analyticsService",function(n,t,i,r,u,f,e){function o(){t.displayShippingAndHandling=!1;var r=i.createCart();r.update(n.cart);t.cart=r;t.isLevelOneRestricted=n.isLevelOneRestricted;t.isLevelTwoRestricted=n.isLevelTwoRestricted;t.isLevelThreeRestricted=n.isLevelThreeRestricted;t.punchOutType=n.punchOutType}o();e.trackViewPunchOutCheckout(t.cart.cartLines);t.cartLinesLength=function(){return t.cart?t.cart.cartLines?t.cart.cartLines.length:0:0};t.isPunchOutSession=r.isPunchOutSession();t.cartIsEmpty=function(){return!t.cart.cartLines||t.cart.cartLines.length===0};t.punchOut=function(){r.deletePunchOutSession();t.punchOutType=="CXML"?document.forms.punchOutFormCXML.submit():t.punchOutType=="OCI"&&document.forms.punchOutFormOCI.submit()}}])}(angular.module("ns")),function(){"use strict";var n=function(){function n(n,t,i,r,u,f){this.cartService=n;this.navigationService=t;this.eventsService=i;this.punchOutService=r;this.featureData=u;this.$q=f;this.cartLoading=!1;this.cartHasBeenProcessed=!1;this.eventsService.on(events.CartEvents.CartLoaded,function(){this.cartLoading=!1}.bind(this));this.eventsService.on("place-order-success",function(){this.cartHasBeenProcessed=!0;this.cart={cartLines:[],getSubtotal:function(){return 0}}}.bind(this))}return n.prototype.goToCart=function(){return this.$q.when(this.navigationService.goToCart())},n.prototype.goToCheckout=function(){return this.$q.when(this.navigationService.goToCheckOut())},n.prototype.goToPunchOut=function(){return this.$q.when(this.navigationService.goToPunchOut())},n.prototype.isPunchOutSession=function(){return this.punchOutService.isPunchOutSession()},n.prototype.loadCart=function(){this.cartHasBeenProcessed||(this.cartLoading=!0,this.cart=this.cartService.getCart())},n.prototype.isCartLoading=function(){return this.cartLoading},n.prototype.isCheckoutPage=function(){return this.navigationService.isCheckoutPage()},n.prototype.cartIsEmpty=function(){return this.cart&&this.cart.cartLines.length===0},n}();n.$inject=["cartService","navigationService","eventsService","punchOutService","featureData","$q"];angular.module("ns").controller("quickCartController",n)}(ns||(ns={})),function(){var t=function(){function t(){this.templateUrl="/js/ns/shopping-cart/ship-estimate.html";this.controllerAs="shipEstimateController";this.controller=n;this.bindings={displayShippingAndHandling:"=",location:"="}}return t}(),n=function(){function n(n,t,i,r){this.userService=n;this.cartService=t;this.analyticsService=i;this.eventsService=r;this.cart=t.getCart()}return n.prototype.isAssociateCustomer=function(){return this.userService.user.isAssociate()},n.prototype.zipCodeHasErrors=function(){return!!this.zipCodeErrors&&this.zipCodeErrors.length>0},n.prototype.applyZipCode=function(n){var t=this;this.zipCodeErrors=null;n.$setSubmitted();this.analyticsService.trackShippingEstimator(this.zipInput);n.$valid?(this.location.zipCode=this.zipInput,this.cart&&this.cart.cartLines&&this.cartService.validateZipCode(this.zipInput).then(function(i){t.callbackContainsErrors(i)?t.processBadZipCode(i):(t.lastValidZipCode=t.zipInput,t.updateCartBasedOnZipCode(i.data.resultObject),t.resetForm(n))}).catch(function(n){t.processBadZipCode(n)}),this.analyticsService.trackEnterZipCode()):this.eventsService.trigger(events.SpinnerEvents.StopSpinner);this.displayShippingAndHandling=!1},n.prototype.updateCartBasedOnZipCode=function(n){var t=this,i,r;this.displayShippingAndHandling=!1;this.shouldGetShippingAndHandling()||this.finishUpdateCart();i=this.location.zipCode;r=n&&n.isOutsideContinentalUS;this.cartService.getShippingAndHandling(i,r).then(function(){t.finishUpdateCart()}).catch(function(){t.eventsService.trigger(events.SpinnerEvents.StopSpinner)})},n.prototype.getPlaceholder=function(){return this.location.zipCode?this.location.zipCode:"Enter Zip Code"},n.prototype.displayShippingEstimate=function(){return this.cart.deliveryDate.hasDates()||this.cart.deliveryEstimationHasError()},n.prototype.noEstimates=function(){return!this.cart.deliveryDate.hasDates()&&!this.cart.deliveryEstimationHasError()},n.prototype.zipCodeInvalid=function(n){return n.$submitted&&n.$invalid&&!this.zipCodeHasErrors()},n.prototype.hasError=function(n){return n.$submitted&&(n.$invalid||this.zipCodeHasErrors())},n.prototype.callbackContainsErrors=function(n){return!!n.status&&n.status!==200||!n.data.success},n.prototype.processBadZipCode=function(n){this.eventsService.trigger(events.SpinnerEvents.StopSpinner);this.displayShippingAndHandling=!1;this.zipCodeErrors=this.processZipCodeErrors(n.data.errors)},n.prototype.processZipCodeErrors=function(n){return _.map(n,function(n){return n.message!==undefined?n.message:n})},n.prototype.finishUpdateCart=function(){this.zipCodeErrors=this.cart.taxes.errorMessages;this.zipInput=null;this.displayShippingAndHandling=!0;this.eventsService.trigger(events.SpinnerEvents.StopSpinner)},n.prototype.shouldGetShippingAndHandling=function(){return this.cart.cartLines.length===0?(this.displayShippingAndHandling=!1,this.eventsService.trigger(events.SpinnerEvents.StopSpinner),!1):!0},n.prototype.resetForm=function(n){n&&(n.$setPristine(),n.$submitted=!1)},n}();n.$inject=["userService","cartService","analyticsService","eventsService"];angular.module("ns").component("shipEstimate",new t)}(ns||(ns={})),function(n){"use strict";n.directive("stockAlert",function(){return{restrict:"A",templateUrl:"/js/ns/shopping-cart/stock-alert.html",scope:{material:"=stockAlert",isLevelOneRestricted:"=isLevelOneRestricted",isLevelTwoRestricted:"=isLevelTwoRestricted"}}})}(angular.module("ns")),function(){"use strict";var t=function(){function n(){this.restrict="A";this.templateUrl="/js/ns/shopping-cart/geographical-restrictions/restriction-zipcode-form.html"}return n.instance=function(){return new n},n}(),i=function(){function t(){this.restrict="A";this.template="<div><ng-include src='cartLineRestrictionsController.getTemplateUrl()'/><\/div>";this.controller=n;this.controllerAs="cartLineRestrictionsController";this.replace=!0;this.scope={product:"="}}return t.instance=function(){return new t},t}(),n=function(){function n(n,t,i,r){var u=this;this.$scope=n;this.eventsService=t;this.restrictionsService=i;this.apiService=r;this.zipCode={zipCodeValue:""};this.zipCode.zipCodeValue=i.getZipCodeValue();this.isLoading=!1;this.cartLine=n.product;t.on(events.GeoRestrictionsEvents.ZipCodeUpdated,function(){u.zipCode.zipCodeValue=i.user.zipCode});t.on(events.GeoRestrictionsEvents.CheckRestriction,function(){return u.checkRestriction()});t.on(events.GeoRestrictionsEvents.ResetZipCodeForm,function(){return u.resetZipCodeForm()});this.checkRestriction()}return n.prototype.getTemplateUrl=function(){return this.isLoading?"/js/ns/shopping-cart/geographical-restrictions/loading-restriction.html":this.cartLine.isRestricted===undefined?"/js/ns/shopping-cart/geographical-restrictions/request-zipcode.html":this.cartLine.isRestricted?"/js/ns/shopping-cart/geographical-restrictions/restricted-zipcode.html":this.cartLine.isRestricted?"/js/ns/shopping-cart/geographical-restrictions/request-zipcode.html":"/js/ns/shopping-cart/geographical-restrictions/available-zipcode.html"},n.prototype.updateZipCode=function(n){var t=this;if(n.$setSubmitted(),this.zipCodeForm=n,!n.$valid){this.eventsService.trigger(events.SpinnerEvents.ResetAddSpinner);return}this.restrictionsService.updateZipCode(this.zipCode.zipCodeValue).then(function(n){return n?t.apiService.checkGeographicalRestriction(t.zipCode.zipCodeValue,t.cartLine.restrictionCode):(t.setFormInvalidity(),n)}).then(function(n){n&&(t.cartLine.isRestricted=n.data,t.eventsService.trigger(events.GeoRestrictionsEvents.ZipCodeUpdated));t.eventsService.trigger(events.SpinnerEvents.ResetAddSpinner)})},n.prototype.hasError=function(n){return this.zipCodeForm=n,this.zipCodeForm.$submitted&&(this.zipCodeForm.zipCode.$invalid||this.restrictionsService.isZipCodeInvalid())},n.prototype.isLoadingRestrictions=function(){return this.isLoading},n.prototype.checkRestriction=function(){var n=this,t=this.restrictionsService.getZipCodeValue();!!t&&this.cartLine.hasRestrictionCode()&&(this.isLoading=!0,this.restrictionsService.checkRestriction(t,this.cartLine).then(function(){n.eventsService.trigger(events.CartEvents.UpdateCartLineRestriction,n.cartLine.lineId,n.cartLine.isRestricted);n.isLoading=!1}));t||(this.cartLine.isRestricted=undefined,this.eventsService.trigger(events.CartEvents.UpdateCartLineRestriction,this.cartLine.lineId,this.cartLine.isRestricted))},n.prototype.resetZipCodeForm=function(){this.zipCodeForm&&(this.zipCodeForm.$setPristine(),this.zipCode={zipCodeValue:this.restrictionsService.getZipCodeValue()})},n.prototype.setFormInvalidity=function(){this.zipCodeForm&&this.zipCodeForm.zipCode.$setValidity("pattern",!1)},n}();n.$inject=["$scope","eventsService","productRestrictionsService","apiService"];angular.module("ns").directive("cartlineRestrictions",i.instance);angular.module("ns").directive("cartlineRestrictedZipcodeForm",t.instance);angular.module("ns").controller("cartlineRestrictionsController",n)}(ns||(ns={})),function(n){var t=function(){function t(n,t,i,r,u){this.cookieService=n;this.navigationService=t;this.eventsService=i;this.productRestrictionsService=r;this.featureData=u;this.init()}return t.prototype.updateCart=function(n){this._cart=n;this.updateRestrictions()},t.prototype.showStockStatusForCartLine=function(n){return!n.hasRestrictionCode()||n.hasRestrictionCode()&&!!this.productRestrictionsService.getZipCodeValue()},t.prototype.checkCartLineRestriction=function(){this.eventsService.trigger(events.GeoRestrictionsEvents.CheckRestriction);this.eventsService.trigger(events.GeoRestrictionsEvents.ResetZipCodeForm)},t.prototype.init=function(){this._cart=new n.Cart;this._addressBookLoaded=!1;this.eventsService.on(events.CartEvents.UpdateCartLineRestriction,this.updateCartLine.bind(this));this.eventsService.on(events.GeoRestrictionsEvents.ZipCodeUpdated,this.updateRestrictions.bind(this));this.eventsService.on(events.AddressesEvents.AddressbookLoaded,this.setAddressBookLoaded.bind(this));this.eventsService.on(events.AddressesEvents.SelectedAddressChanged,this.updateSelectedAddressZipCode.bind(this))},t.prototype.updateSelectedAddressZipCode=function(n,t){var i=t[0];this._selectedShipToAddressZipCode=i[1]},t.prototype.updateRestrictions=function(){var t=this,n=this.cookieService.getZipCodeValue();(this.navigationService.isCheckoutPage()&&this._addressBookLoaded&&this._selectedShipToAddressZipCode&&(n=this._selectedShipToAddressZipCode.slice(0,5)),n)&&_.each(this._cart.cartLines,function(i){i.hasRestrictionCode()&&t.productRestrictionsService.checkRestriction(n,i)})},t.prototype.updateCartLine=function(n,t){var i=t[0],r=_.findWhere(this._cart.cartLines,{lineId:i[0]});r&&(r.isRestricted=i[1])},t.prototype.setAddressBookLoaded=function(){this._addressBookLoaded=!0;this.updateRestrictions()},t}();t.$inject=["cookieService","navigationService","eventsService","productRestrictionsService","featureData"];n.CartGeographicalRestrictionsService=t;angular.module("ns").service("cartRestrictionsService",t)}(ns||(ns={})),function(n){var t=function(){function n(n,t){this.cartService=n;this.shippingMethodsService=t;this.cart=n.getCart();this.shippingMethods=t.getShippingMethods()}return n.prototype.subtotal=function(){return this.cart.getSubtotal()},n.prototype.discount=function(){return this.cart.getDiscount()},n.prototype.netTotal=function(){return this.cart.getNetTotal()},n.prototype.savings=function(){var n=this.cart.getSavings();return this.shippingMethods.ship.isSelected?n+this.cart.getDiscountForShippingAndHandling():n},n.prototype.taxes=function(){return this.cart.getTaxes()},n.prototype.showTaxesAsUnavailable=function(){return!this.cart.taxes.taxCalculatedSuccessfully},n.prototype.hazmatCharges=function(){return this.shippingMethods.ship.isSelected?this.cart.getHazmatCharges():0},n.prototype.hazmatChargesAreUnavailable=function(){return this.cart.hazmatChargesAreUnavailable()},n.prototype.liftGateCharges=function(){return this.shippingMethods.ship.isSelected?this.cart.getLiftGateCharges():0},n.prototype.total=function(){return this.cart.getTotal()},n.prototype.voucherCoverage=function(){return this.cart.getVoucherCoverage()*-1},n.prototype.remaining=function(){return this.cart.getTotal()+this.voucherCoverage()},n.prototype.showShippingAndHandlingAmount=function(){return this.cart.hasShippingAndHandling()&&!this.shippingMethods.collect.isSelected&&!this.shippingMethods.pickup.isSelected},n.prototype.showShippingAndHandlingAsFree=function(){return this.cart.shippingAndHandlingIsFree()&&!this.shippingMethods.collect.isSelected&&!this.shippingMethods.pickup.isSelected},n.prototype.showShippingAndHandlingAs0$=function(){return this.shippingMethods.collect.isSelected||this.shippingMethods.pickup.isSelected},n.prototype.showShippingAndHandlingAsUnavailable=function(){return this.cart.shippingAndHandlingIsUnavailable()&&!this.shippingMethods.collect.isSelected&&!this.shippingMethods.pickup.isSelected},n.prototype.showShippingWarningMessage=function(){return this.shippingMethodsService.shippingHasGeneralError()&&!this.shippingMethodsService.shipsHazmatOrmdToNonContinentalUs()||this.shippingMethods.other.isSelected},n.prototype.showVoucherCoverageAmounts=function(n){return n?!0:this.cart.getVoucherCoverage()>0},n.prototype.isVoucherCoveringRemainingAmount=function(){return this.showVoucherCoverageAmounts()&&(this.remaining()*100|0)==0},n.prototype.shippingAndHandlingIsPartial=function(){return this.cart.shippingAndHandlingIsPartial()},n.prototype.getShippingAndHandlingCost=function(){return this.cart.getShippingAndHandlingCost()},n.prototype.showTotalVoucherDeductedAmount=function(){var n=this.cart.getTotalVoucherDeductedAmount();return n&&n>0},n.prototype.getTotalVoucherDeductedAmount=function(){return this.cart.getTotalVoucherDeductedAmount()*-1},n}();t.$inject=["cartService","shippingMethodsService"];n.TotalsService=t;angular.module("ns").service("totalsService",t)}(ns||(ns={})),function(n){"use strict";var t=function(){function t(n,t){this.totalsService=n;this.paymentService=t}return t.prototype.subtotal=function(){return this.totalsService.subtotal()},t.prototype.discount=function(){return this.totalsService.discount()},t.prototype.netTotal=function(){return this.totalsService.netTotal()},t.prototype.savings=function(){return this.totalsService.savings()},t.prototype.taxes=function(){return this.totalsService.taxes()},t.prototype.showTaxesAsUnavailable=function(){return this.totalsService.showTaxesAsUnavailable()},t.prototype.hazmatCharges=function(){return this.totalsService.hazmatCharges()},t.prototype.hazmatChargesAreUnavailable=function(){return this.totalsService.hazmatChargesAreUnavailable()},t.prototype.liftGateCharges=function(){return this.totalsService.liftGateCharges()},t.prototype.total=function(){return this.totalsService.total()},t.prototype.voucherCoverage=function(){return this.totalsService.voucherCoverage()},t.prototype.remaining=function(){return this.totalsService.remaining()},t.prototype.totalVoucherDeductedAmount=function(){return this.totalsService.getTotalVoucherDeductedAmount()},t.prototype.showShippingAndHandlingAmount=function(){return this.totalsService.showShippingAndHandlingAmount()},t.prototype.showShippingAndHandlingAsFree=function(){return this.totalsService.showShippingAndHandlingAsFree()},t.prototype.showShippingAndHandlingAs0$=function(){return this.totalsService.showShippingAndHandlingAs0$()},t.prototype.showShippingAndHandlingAsUnavailable=function(){return this.totalsService.showShippingAndHandlingAsUnavailable()},t.prototype.showShippingWarningMessage=function(){return this.totalsService.showShippingWarningMessage()},t.prototype.showVoucherCoverageAmounts=function(n){return this.totalsService.showVoucherCoverageAmounts(n)},t.prototype.showTotalVoucherDeductedAmount=function(){return this.totalsService.showTotalVoucherDeductedAmount()},t.prototype.isVoucherCoveringRemainingAmount=function(){var t=this.totalsService.isVoucherCoveringRemainingAmount(),i;return t?this.paymentService.setPaymentMethod(n.PaymentMethods.voucher):this.paymentService.payment.paymentMethod===n.PaymentMethods.voucher&&(i=this.paymentService.getSelectedPaymentMethod(),this.paymentService.setPaymentMethod(i)),t},t.prototype.shippingAndHandlingIsPartial=function(){return this.totalsService.shippingAndHandlingIsPartial()},t.prototype.getShippingAndHandlingCost=function(){return this.totalsService.getShippingAndHandlingCost()},t}();t.$inject=["totalsService","paymentService"];n.TotalsController=t;angular.module("ns").controller("totalsController",t)}(ns||(ns={})),function(n){var t=function(){function n(){}return n}();t.Personal="Personal";t.Reseller="Reseller";t.Associate="Associate";t.Wina="WINA";n.AccountType=t}(ns||(ns={})),function(n){var t=function(){function t(n){this._customerType=n.customerType;this._isLevelOneRestricted=n.isLevelOneRestricted!=null?n.isLevelOneRestricted:!1;this._isLevelTwoRestricted=n.isLevelTwoRestricted!=null?n.isLevelTwoRestricted:!1;this._isLevelThreeRestricted=n.isLevelThreeRestricted!=null?n.isLevelThreeRestricted:!1;this._customerSiteName=n.customerSiteName;this._customerSiteURI=n.customerSiteURI;this._isEmployeeUser=n.isEmployeeUser;this._isActiveCustomer=n.isActiveCustomer;this._isUserImpersonated=n.isImpersonatedUser;this._isUserAuthenticated=n.isUserAuthenticated;this._zipCode=n.zipCode;this._isKnown=n.isKnown;this._email=n.email;this._showCustomerReports=n.showCustomerReports;this._allowReturns=n.allowReturns;this._adminImpersonatorCustomerId=n.adminImpersonatorCustomerId;this._managerImpersonatorGuid=n.managerImpersonatorGuid;this._impersonatorUsername=n.impersonatorUsername;this._adminImpersonatorEmail=n.impersonatorEmail;this._canUpdateShippingAddresses=n.canUpdateShippingAddresses;this._isManaged=n.isManaged}return t.prototype.adminImpersonatorCustomerId=function(){return this._adminImpersonatorCustomerId?this._adminImpersonatorCustomerId:null},t.prototype.managerImpersonatorGuid=function(){return this._managerImpersonatorGuid?this._managerImpersonatorGuid:null},t.prototype.impersonatorUsername=function(){return this._impersonatorUsername?this._impersonatorUsername:null},t.prototype.adminImpersonatorEmail=function(){return this._adminImpersonatorEmail},t.prototype.isPersonal=function(){return this.customerType===n.AccountType.Personal||this.isEmployeeUser},t.prototype.isReseller=function(){return this.customerType===n.AccountType.Reseller||this.customerType===n.AccountType.Wina},t.prototype.isAssociate=function(){return this.customerType===n.AccountType.Associate},Object.defineProperty(t.prototype,"isLevelOneRestricted",{get:function(){return this._isLevelOneRestricted},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isLevelTwoRestricted",{get:function(){return this._isLevelTwoRestricted},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isLevelThreeRestricted",{get:function(){return this._isLevelThreeRestricted},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isEmployeeUser",{get:function(){return this._isEmployeeUser},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isActiveCustomer",{get:function(){return this._isActiveCustomer},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isUserImpersonated",{get:function(){return this._isUserImpersonated},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isUserAuthenticated",{get:function(){return this._isUserAuthenticated},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"customerType",{get:function(){return this._customerType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"customerSiteName",{get:function(){return this._customerSiteName},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"customerSiteURI",{get:function(){return this._customerSiteURI},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"zipCode",{get:function(){return this._zipCode},enumerable:!0,configurable:!0}),t.prototype.updateZipCode=function(n){this._zipCode=n},Object.defineProperty(t.prototype,"isKnown",{get:function(){return this._isKnown},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"email",{get:function(){return this._email},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showCustomerReports",{get:function(){return this._showCustomerReports},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"allowReturns",{get:function(){return this._allowReturns},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"canBuyerUpdateShippingAddresses",{get:function(){return this._canUpdateShippingAddresses},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isManaged",{get:function(){return this._isManaged},enumerable:!0,configurable:!0}),t}();n.User=t}(ns||(ns={})),function(n){"use strict";var t=function(){function n(n,t,i){this.navigationService=n;this.userService=t;this.massUserService=i}return n.prototype.getUserService=function(){return this.navigationService.isAddressCleansingPage()?this.massUserService:this.userService},n}();t.$inject=["navigationService","userService","massUserService"];n.UserServiceFactory=t;angular.module("ns").service("userServiceFactory",t)}(ns||(ns={})),function(n){"use strict";var t=function(){function n(n,t,i,r,u){this.modelsFactory=n;this.initialData=t;this.apiService=i;this.cookieService=r;this.featureData=u;this.init()}return n.prototype.getForwardOrderEmails=function(){return this.user.isEmployeeUser?this.user.adminImpersonatorEmail()?this.user.adminImpersonatorEmail()+","+this.user.email:this.user.email:this.user.adminImpersonatorEmail()},n.prototype.updateZipCode=function(n){var t=this;return this.apiService.updateUserZipCode({zipCode:n}).then(function(i){return t.user.updateZipCode(n),t.cookieService.setZipCodeCookie(n),i.data.success})},n.prototype.userZipCodeIsKnown=function(){return!!this.user.zipCode},n.prototype.isNotAllowedForPurchase=function(n){return this.user==null?!1:(this.user.isLevelOneRestricted||this.user.isLevelTwoRestricted)&&!n.isQuoted},n.prototype.isForAddressCleansing=function(){return!1},n.prototype.allowReturns=function(){return this.user.allowReturns},n.prototype.isEmployeeUser=function(){return this.user.isEmployeeUser},n.prototype.init=function(){if(this.initialData&&this.initialData.userInfo){this.user=this.modelsFactory.createUser(this.initialData.userInfo);var n=this.cookieService.getZipCodeValue();this.user.updateZipCode(n)}},n}();t.$inject=["modelsFactory","initialData","apiService","cookieService","featureData"];n.UserService=t;angular.module("ns").service("userService",t)}(ns||(ns={}));VoucherHubController=function(){function n(n,t,i,r,u){var f=this;this.apiService=n;this.navigationService=t;this.cartService=i;this.eventsService=r;this.featureData=u;this.accordionState={availableOpen:!1,unusableOpen:!1,unavailableOpen:!1,suspendedOpen:!1};this.fetchVouchersComplete=!1;this.availableVouchers=[];this.shouldApplyVoucherToApplicableLineItems=function(){return f.featureData.applyVoucherToApplicableLineItems};this.voucher_DisplayResetDateForUnusableVouchers=u.voucher_DisplayResetDateForUnusableVouchers;this.apiService.getEmployeeVouchers().then(function(n){var t=n.data.voucherShop,i,r;t&&t.isUsable?(i=n.data.availableVouchers,f.unusableVouchers=n.data.unusableVouchers,f.availableVouchers=f.appendVoucherShopToVouchersList(t,i)):(f.availableVouchers=n.data.availableVouchers,r=n.data.unusableVouchers,f.unusableVouchers=f.appendVoucherShopToVouchersList(t,r));f.unavailableVouchers=n.data.unavailableVouchers;f.suspendedVouchers=n.data.suspendedVouchers;f.accordionState.availableOpen=f.availableVouchers&&f.availableVouchers.length>0;f.fetchVouchersComplete=!0});this.apiService.getVoucherContext().then(function(n){f.voucherContext=n.data})}return n.prototype.appendVoucherShopToVouchersList=function(n,t){var i=[];return n&&i.push(n),t&&t.length>0&&i.push.apply(i,t),i.length>0?i.sort(function(n,t){return n.displayOrder>t.displayOrder?1:-1}):i},n.prototype.reprintEyewearVoucher=function(n){window.location.href=n.shopNowUrl},n.prototype.selectVoucher=function(n,t){var i=this,r,f;t===void 0&&(t=events.VoucherHubEvents.VoucherSelected);try{f=!n.voucherGuid&&!n.shopNowUrl&&n.vouchersGuid&&n.vouchersGuid.some(function(){return!0});r=function(){if(f===!1)n.programType==="Eyewear"?(i.shouldApplyVoucherToApplicableLineItems()&&i.cartService.updateCartBasedOnNewVoucherContext(),window.location.href=n.shopNowUrl):i.apiService.setEmployeeVoucher(n.voucherGuid).then(function(){i.shouldApplyVoucherToApplicableLineItems()&&i.cartService.updateCartBasedOnNewVoucherContext();window.location.href=n.shopNowUrl});else{var t=function(){return n.vouchersGuid[0]};i.apiService.setEmployeeVoucher(t()).then(function(){i.shouldApplyVoucherToApplicableLineItems()&&i.cartService.updateCartBasedOnNewVoucherContext();i.navigationService.goToVoucherShop()})}};var o=!!n.voucherGuid,e=!!this.voucherContext,h=e&&o&&n.voucherGuid!==this.voucherContext.guid,c=e&&f&&n.vouchersGuid&&n.vouchersGuid.every(function(n){return i.voucherContext.guid!==n}),u=this.cartService.cart.cartLines,s=u.filter(function(n){return!!n.voucherGuid}),l=u.length>0&&s.some(function(){return!0})&&s.every(function(t){return t.voucherGuid!==n.voucherGuid&&(!n.vouchersGuid||n.vouchersGuid.indexOf(t.voucherGuid)===-1)}),a=o?u.some(function(t){return t.voucherGuid&&t.voucherGuid!==n.voucherGuid}):u.some(function(t){return t.voucherGuid&&n.vouchersGuid.every(function(n){return t.voucherGuid!==n})}),v=e?a:l;if(h||c||v){this.eventsService.trigger(t,r.bind(this));return}r()}catch(y){this.eventsService.trigger(t,r.bind(this))}},n.prototype.selectRedwingVoucher=function(n){var t=this;this.apiService.selectRedwingVoucher(n).then(function(){t.navigationService.goToRedwingVoucherPage()})},n.prototype.isCartLoaded=function(){return this.cartService.isCartLoaded()},n.prototype.goToVoucherHub=function(){this.navigationService.goToVoucherHub()},n}();VoucherHubController.$inject=["apiService","navigationService","cartService","eventsService","featureData"];typeof window!="object"||!window.document||typeof process!="undefined"?module.exports={VoucherHubController:VoucherHubController}:angular.module("ns").controller("voucherHubController",VoucherHubController),function(n){var t=function(){function n(){this.name=null;this.description=null;this.balance=null;this.itemQuantity=null;this.shopNowUrl=null;this.voucherGuid=null}return n}();n.VoucherItem=t}(voucher||(voucher={})),function(n){"use strict";var t=function(){function t(n,t,i,r,u,f,e,o,s,h){var c=this;this.initialData=n;this.modelsFactory=t;this.apiService=i;this.eventsService=r;this.$timeout=u;this.productService=f;this.$q=e;this.voucherShopService=o;this.analyticsService=s;this.featureData=h;this.eventMessageDisplayDurationMs=5e3;this.voucherShopItems=[];this.selectedVoucherMaterials=[];this.loadingVoucherMaterials=!1;this.voucherShopCompleted=!1;this.wasMaterialUncarted=!1;this.voucherShopItems=this.initialData.voucherShopItems.map(function(n){return c.modelsFactory.createVoucherShopItem(c.featureData.voucher_VoucherShopHideVoucherQuantityCount,n)});this.eventsService.on(events.VoucherShopEvents.VoucherExhausted,this.onVoucherExhausted.bind(this));this.eventsService.on(events.VoucherShopEvents.MaterialUncarted,this.onUncartedMaterial.bind(this));this.eventsService.on(events.VoucherShopEvents.GroupVoucherSelectedChanged,this.onVoucherSelectedInGroup.bind(this));this.selectNextUnExhaustedVoucher()}return t.prototype.voucherSelectedInGroup=function(n,t){if(n.selectedVoucher&&n.selectedVoucher!==t.id()&&n.getSelectedVoucher().consumedQuantity!==0){this.eventsService.trigger(events.VoucherShopEvents.ChangeVoucherConfirmationModalOpened,n,t);return}n.selectedVoucher=t.id();this.itemSelected(t)},t.prototype.itemSelected=function(n){this.loadingVoucherMaterials=!1;this.voucherShopCompleted=!1;this.selectedVoucherMaterials=[];this.selectedItem=n;this.voucherSelected(n)},t.prototype.voucherSelected=function(t){var i=this;t.isGroup()||(this.loadingVoucherMaterials=!0,this.apiService.setEmployeeVoucher(t.voucherGuid).then(function(){i.apiService.getVoucherMaterials(t.collectionCode).then(function(r){t.id()===i.selectedItem.id()&&(i.selectedVoucherMaterials=r.data.map(function(t){var i=new n.Product;return i.update(t),i}),i.analyticsService.trackViewItemListEvent(i.selectedVoucherMaterials))}).finally(function(){i.loadingVoucherMaterials=!1})}))},t.prototype.onVoucherExhausted=function(){this.selectNextUnExhaustedVoucher()},t.prototype.onUncartedMaterial=function(n,t){var i=this;this.uncartedMaterialMessage=t[0][0];this.wasMaterialUncarted=!0;this.$timeout(function(){i.wasMaterialUncarted=!1},this.eventMessageDisplayDurationMs)},t.prototype.onVoucherSelectedInGroup=function(n,t){this.voucherSelectedInGroup(t[0][0],t[0][1])},t.prototype.selectNextUnExhaustedVoucher=function(){var t,i,n,r;if(!this.selectedItem||this.selectedItem.isExhausted()){for(t=0,i=this.voucherShopItems;t<i.length;t++)if(n=i[t],!n.isExhausted()){if(r=n,n.isGroup()&&r.selectedVoucher){this.itemSelected(r.getSelectedVoucher());return}this.itemSelected(n);return}this.selectedItem=undefined;this.voucherShopCompleted=!0}},t.prototype.isCollectionEmpty=function(){return!this.loadingVoucherMaterials&&(!this.selectedVoucherMaterials||this.selectedVoucherMaterials.length===0)},t}();t.$inject=["initialData","modelsFactory","apiService","eventsService","$timeout","productService","$q","voucherShopService","analyticsService","featureData"];angular.module("ns").controller("voucherShopController",t)}(ns||(ns={}));__extends=this&&this.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),function(n){var t=function(){function n(n,t){this.name=n;this.displayOrder=t}return n.prototype.isGroup=function(){return!1},n.prototype.id=function(){return"Voucher_"+this.displayOrder},n.prototype.displayName=function(){return""+this.name},n}(),i,r;n.VoucherShopItem=t;i=function(n){function t(t,i,r,u,f,e,o,s){var h=n.call(this,t,i)||this;return h.voucherGuid=r,h.collectionCode=u,h.consumedQuantity=f,h.maxQuantity=e,h.shouldDisplayDollarPrice=o,h.hideVoucherQuantityCount=s,h}return __extends(t,n),t.prototype.displayName=function(){return this.hideVoucherQuantityCount?""+this.name:this.name+" ("+this.consumedQuantity+" /"+this.maxQuantity+")"},t.prototype.getRemainingQuantity=function(){var n=this.maxQuantity?this.maxQuantity:0,t=this.consumedQuantity?this.consumedQuantity:0;return n-t},t.prototype.isExhausted=function(){return this.getRemainingQuantity()===0},t}(t);n.VoucherShopVoucher=i;r=function(n){function t(t,i,r,u){var f=n.call(this,t,i)||this;return f.selectedVoucher=undefined,f.getSelectedVoucher=function(){return _.find(f.vouchers,function(n){return n.id()===f.selectedVoucher})},f.vouchers=r,f.selectedVoucher=u,f}return __extends(t,n),t.prototype.isGroup=function(){return!0},t.prototype.id=function(){return"Group_"+this.displayOrder},t.prototype.isExhausted=function(){var n,t,i;if(!this.vouchers)return!1;for(n=0,t=this.vouchers;n<t.length;n++)if(i=t[n],i.isExhausted())return!0;return!1},t}(t);n.VoucherShopGroup=r}(ns||(ns={})),function(n){var t=function(){function n(n){this.eventsService=n;this.eventsService.on(events.ProductCharacterSetsComponentEvents.CharacterSetsSelected,this.onCharacterSetsSelected.bind(this))}return n.prototype.onCharacterSetsSelected=function(n,t){var i=t[0][0],r=t[0][1],f=function(){return r&&i&&i.stockStatuses.some(function(){return!0})},u;f()&&(u=i.stockStatuses.filter(function(n){return n.materialIndicator===r.values})[0],i.updateStockStatusBasedOnCharacterSetSelection(u.materialIndicator))},n.prototype.resetProductAttributes=function(n){n.selectedStyleNotAvailable=!1;n.resetSelectedCharacterSets();n.resetStockStatus();this.setSelectedProductQuantity(n,0);this.eventsService.trigger(events.ProductCharacterSetsComponentEvents.ResetOptions);this.eventsService.trigger(events.MaterialQuantityComponentEvents.ResetSelectedQuantity)},n.prototype.setVoucherConsumedQuantity=function(n,t){n.consumedQuantity=n.consumedQuantity+this.getSelectedProductQuantity(t);n.isExhausted()&&this.eventsService.trigger(events.VoucherShopEvents.VoucherExhausted)},n.prototype.getSelectedProductQuantity=function(n){return n?n.quantity:0},n.prototype.setSelectedProductQuantity=function(n,t){n.quantity=t},n}();t.$inject=["eventsService"];n.VoucherShopService=t;angular.module("ns").service("voucherShopService",t)}(ns||(ns={}));var MinimumQuantityValidator=common.MinimumQuantityValidator,CartMaterialComponent=function(){function n(){this.templateUrl="/js/ns/voucher-shop/add-to-cart-modal/cart-material-component.html";this.controllerAs="ctrl";this.controller=CartMaterialController;this.bindings={}}return n}(),CartMaterialController=function(){function n(n,t,i,r,u,f,e,o){var s=this;this.navigationService=n;this.eventsService=t;this.productService=i;this.$timeout=r;this.$window=u;this.productRestrictionsService=f;this.voucherShopService=e;this.featureData=o;this.cartMaterialModalSelector="#voucher-shop-cart-material-modal";this.isCarting=!1;this.isExposingControls=!1;this.wasVoucherExhausted=!1;this.voucherExhaustedMessage=undefined;this.isLoadingStyleInfo=!1;this.canShowStockStatus=!0;this.initialLoadComplete=!1;this.addToCartClicked=!1;this.eventsService.on(events.VoucherShopEvents.OpenCartMaterialModal,this.onOpenCartMaterialModal.bind(this));this.eventsService.on(events.ProductEvents.ProductAddedToCart,this.onCartedMaterial.bind(this));this.eventsService.on(events.VoucherShopEvents.VoucherExhausted,this.onVoucherExhausted.bind(this));this.eventsService.on(events.ProductCharacterSetsComponentEvents.CharacterSetsSelected,this.onCharacterSetsChanged.bind(this));this.eventsService.on(events.ProductEvents.ProductStylesReviewed,function(){s.isLoadingStyleInfo=!1;s.initialLoadComplete?s.canShowStockStatus=!0:s.initialLoadComplete=!0;s.product.updateErrorData(null)})}return n.prototype.isMaterialUnavailable=function(){return this.product.isProductUnavailable||this.product.isSelectedProductUnavailable||!this.product.selectedStyleNotAvailable&&this.product.availableForBackorderOnly===!1},n.prototype.onCharacterSetsChanged=function(n,t){this.canShowStockStatus=!1;var i=t[0][1].values,r=t[0][1].ids;this.productService.updateProductInfoAfterCharacterSetSelection(this.product,i,r,this.displayUnitOfMeasureQuantityOptions)},n.prototype.disableAddToCart=function(){return this.addToCartClicked&&this.product.isBackOrder()},n.prototype.shouldDisplayVoucherQuickShop=function(){return this.product.voucherGuid},n.prototype.onOpenCartMaterialModal=function(n,t){this.initialLoadComplete=!1;this.product=t[0][0];this.voucher=t[0][1];this.wasVoucherExhausted=!1;this.displayUnitOfMeasureQuantityOptions=MinimumQuantityValidator.displayMinimumQuantity(this.product);this.voucherShopService.resetProductAttributes(this.product);this.setRemainingVoucherQuantity();this.productService.updateProductInformation(this.product);this.product=this.productService.product;this.product.characterSets.length>0?(this.canShowStockStatus=!1,this.isLoadingStyleInfo=!0,this.productService.updateProductInfoAfterCharacterSetSelection(this.product,null,[])):this.canShowStockStatus=!0;this.showControls();this.showCartMaterialModal();this.forceSync()},n.prototype.showCartMaterialModal=function(){$(this.cartMaterialModalSelector).modal({show:!0,backdrop:"static"});$(this.cartMaterialModalSelector).appendTo("body")},n.prototype.closeCartMaterialModal=function(){$(this.cartMaterialModalSelector).modal("hide");this.product=null;this.eventsService.trigger(events.ProductMessagesComponentEvents.ResetMessages)},n.prototype.isMaterialQuantitySelected=function(){return this.product&&this.product.quantity>0},n.prototype.getVoucherGuid=function(){return this.voucher?this.voucher.voucherGuid:undefined},n.prototype.hideControls=function(){this.isExposingControls=!1},n.prototype.showControls=function(){this.isExposingControls=!0},n.prototype.tryCartMaterial=function(){var n=this,t=function(){return n.product.hasCharacterSetsValues()&&!n.product.hasSelectedCharacterSets()};t()||this.isMaterialQuantitySelected()&&(this.isCarting=!0,this.addToCartClicked=!0,this.productService.addProductToCart(this.product,"Voucher Shop",!1,!1,this.voucher.voucherGuid).finally(function(){n.isCarting=!1}))},n.prototype.onCartedMaterial=function(){this.voucherShopService.setVoucherConsumedQuantity(this.voucher,this.product);this.setRemainingVoucherQuantity()},n.prototype.onVoucherExhausted=function(){this.hideControls();this.wasVoucherExhausted=!0;this.voucherExhaustedMessage=this.voucher.isExhausted()?"\n"+this.voucher.name+" completed.":""},n.prototype.forceSync=function(n){var t=this;n===void 0&&(n="quantitySelect");this.$timeout(function(){var i=t.$window.document.getElementById(n);i&&i.dispatchEvent(new Event("change"))}.bind(this),0,!1)},n.prototype.shouldDisplayDollarPricing=function(){return this.featureData.displayDollarPricing&&this.voucher.shouldDisplayDollarPrice},n.prototype.setRemainingVoucherQuantity=function(){this.remainingVoucherQuantity=this.voucher.getRemainingQuantity()},n}();CartMaterialController.$inject=["navigationService","eventsService","productService","$timeout","$window","productRestrictionsService","voucherShopService","featureData"];angular.module("ns").component("cartMaterialModal",new CartMaterialComponent),function(){var t=function(){function t(){this.templateUrl="/js/ns/voucher-shop/change-voucher-confirmation-modal/change-voucher-confirmation-component.html";this.controllerAs="ctrl";this.controller=n;this.bindings={}}return t}(),n=function(){function n(n,t){this.cartService=n;this.eventsService=t;this.cartMaterialModalSelector="#changeVoucherModal";this.eventsService.on(events.VoucherShopEvents.ChangeVoucherConfirmationModalOpened,this.openChangeVoucherConfirmationModal.bind(this))}return n.prototype.openChangeVoucherConfirmationModal=function(n,t){this.group=t[0][0];this.oldVoucher=this.group.getSelectedVoucher();this.newVoucher=t[0][1];$(this.cartMaterialModalSelector).modal({show:!0,backdrop:!1})},n.prototype.closeChangeVoucherConfirmationModal=function(){$(this.cartMaterialModalSelector).modal("hide")},n.prototype.changeVoucher=function(){this.cartService.removeVoucherItems(this.oldVoucher.voucherGuid);this.oldVoucher.consumedQuantity=0;this.closeChangeVoucherConfirmationModal();this.eventsService.trigger(events.VoucherShopEvents.GroupVoucherSelectedChanged,this.group,this.newVoucher)},n}();n.$inject=["cartService","eventsService"];angular.module("ns").component("changeVoucherConfirmationModal",new t)}(ns||(ns={})),function(){var t=function(){function t(){this.templateUrl="/js/ns/voucher-shop/order-summary/voucher-shop-order-summary.html";this.controllerAs="ctrl";this.controller=n;this.bindings={voucherShopItems:"<"}}return t}(),n=function(){function n(n,t,i,r,u){this.$scope=n;this.$rootScope=t;this.navigationService=i;this.eventsService=r;this.cartService=u}return n.prototype.$onInit=function(){var n=this;this.$scope.checkOut=function(){n.$scope.cart.checkoutStatus&&n.$scope.cart.checkoutStatus.canCheckout?n.navigationService.goToCheckOut():n.$rootScope.$broadcast("reset-checkout-spinner")};this.eventsService.on(events.CartEvents.CartLoaded,this.filterVoucherCartLines.bind(this));this.eventsService.on(events.CartEvents.CartUpdated,this.filterVoucherCartLines.bind(this));this.$scope.cart=this.cartService.getCart()},n.prototype.filterVoucherCartLines=function(){var n=this;this.cartService.isCartLoaded()&&(this.$scope.voucherCartLines=this.cartService.cart.cartLines.filter(function(t){return _.any(n.voucherShopItems,function(n){return n.isGroup()?n.getSelectedVoucher().voucherGuid===t.voucherGuid:n.voucherGuid===t.voucherGuid})}))},n}();n.$inject=["$scope","$rootScope","navigationService","eventsService","cartService"];angular.module("ns").component("voucherShopOrderSummary",new t)}(ns||(ns={})),function(){var t=function(){function t(){this.templateUrl="/js/ns/voucher-shop/voucher-material/voucher-product-summary.html";this.controllerAs="ctrl";this.controller=n;this.bindings={product:"=",selectedVoucher:"="}}return t}(),n=function(){function n(n,t,i){this.eventsService=n;this.cartService=t;this.featureData=i;this.isRemovingItems=!1}return n.prototype.openCartMaterialModal=function(){this.getIsAddToCartDisabled()!==!0&&this.eventsService.trigger(events.VoucherShopEvents.OpenCartMaterialModal,this.product,this.selectedVoucher)},n.prototype.getIsAddToCartDisabled=function(){return this.selectedVoucher?this.selectedVoucher.isExhausted():!1},n.prototype.getCartedQuantityOfThisMaterial=function(){var r=this,n=this.cartService.cart,t,i;return!this.product||!n||!n.cartLines||n.cartLines.length===0?0:(t=function(n,t){return n+t.quantity},i=0,n.cartLines.filter(function(n){return r.isCartLineMatched(n)}).reduce(t,i))},n.prototype.shouldDisplayDollarPricing=function(){return this.featureData.displayDollarPricing&&this.selectedVoucher.shouldDisplayDollarPrice},n.prototype.removeMaterialFromCart=function(){var n=this,i,t;this.isRemovingItems!==!0&&(i=this.cartService.cart.cartLines.filter(function(t){return n.isCartLineMatched(t)}),t=this.getCartedQuantityOfThisMaterial(),this.isRemovingItems=!0,this.cartService.removeLines(i).then(function(){n.selectedVoucher.consumedQuantity=n.selectedVoucher.consumedQuantity-t;n.eventsService.trigger(events.VoucherShopEvents.MaterialUncarted,t+" "+n.product.brand+" "+n.product.materialName+" removed from your cart.")}).finally(function(){n.isRemovingItems=!1}))},n.prototype.isCartLineMatched=function(n){return n.materialBaseNumber===this.product.materialBaseNumber&&n.voucherGuid===this.selectedVoucher.voucherGuid},n}();n.$inject=["eventsService","cartService","featureData"];angular.module("ns").component("voucherProductSummary",new t)}(ns||(ns={}));ExitVoucherBannerComponent=function(){function n(){this.templateUrl="/js/ns/voucher-top-bar/exit-voucher-banner-component.html";this.controllerAs="ctrl";this.controller=ExitVoucherBannerController;this.bindings={voucherName:"<",voucherGuid:"<",collectionCode:"<",isVoucherShop:"<",isUsable:"<"}}return n}();ExitVoucherBannerController=function(){function n(n,t,i,r,u){var f=this;this.eventsService=n;this.navigationService=t;this.apiService=i;this.$window=r;this.$timeout=u;this.apiService.getVoucherContext().then(function(n){n.data&&(f.voucherGuid=n.data.guid,f.voucherName=n.data.name,f.collectionCode=n.data.collectionCode,f.isVoucherShop=n.data.isVoucherShop,f.isUsable=n.data.isUsable)})}return n.prototype.$postLink=function(){var n=this;this.$window.document.dispatchEvent(new Event(events.VoucherTopBarEvents.BannerLoaded));this.$timeout(function(){n.$window.dispatchEvent(new Event("resize"))}.bind(this),0,!1)},n.prototype.triggerBeginExitVoucher=function(){this.eventsService.trigger(events.VoucherHubEvents.BeginExitVoucher,this.voucherGuid,this.voucherName)},n.prototype.goToVoucherHub=function(){this.navigationService.goToVoucherHub()},n.prototype.shopNow=function(){this.isVoucherShop?this.navigationService.goToVoucherShop():this.collectionCode?this.navigationService.goToCollection(this.collectionCode):this.navigationService.goToVoucherHub()},n}();ExitVoucherBannerController.$inject=["eventsService","navigationService","apiService","$window","$timeout"];angular.module("ns").component("exitVoucherBanner",new ExitVoucherBannerComponent);ExitVoucherModalComponent=function(){function n(){this.templateUrl="/js/ns/voucher-top-bar/exit-voucher-modal-component.html";this.controllerAs="ctrl";this.controller=ExitVoucherModalController;this.bindings={}}return n}();ExitVoucherModalController=function(){function n(n,t,i,r,u,f,e){e===void 0&&(e=events.VoucherHubEvents);this.apiService=n;this.cookieService=t;this.cartService=i;this.navigationService=r;this.$q=u;this.eventsService=f;this.voucherHubEvents=e;this.isLoadingExitMessage=!1;this.isRemovingVoucherContextCartLines=!1;this.isExiting=!1;this.exitVoucherModalSelector="#exit-voucher-modal";this.voucherContextCartLines=[];this.eventsService.on(e.VoucherSelected,this.onVoucherSelected.bind(this));this.eventsService.on(e.BeginExitVoucher,this.onBeginExitVoucher.bind(this))}return n.prototype.onBeginExitVoucher=function(n,t){this.voucherGuid=t[0][0];var i=t[0][1];this.beginExitVoucher(i)},n.prototype.onVoucherSelected=function(n,t){var i=this;this.changeVoucherCallback=t[0][0];var r=this.cartService.getCart(),u=r.cartLines&&r.cartLines.length>0?r.cartLines.filter(function(n){return!!n.voucherGuid}).map(function(n){return n.voucherGuid}):[],f=u.filter(function(n,t){return u.indexOf(n)==t});this.voucherGuid=f[0];this.apiService.getVoucherContext().then(function(n){var r=!!n.data,u=!r&&!!i.voucherGuid,t;u?i.apiService.getEmployeeVoucher(i.voucherGuid).then(function(n){var t=n.data?n.data.name:undefined;i.beginExitVoucher(t)}):(t=n.data?n.data.name:undefined,i.beginExitVoucher(t))})},n.prototype.beginExitVoucher=function(n,t){var i=this,f,r,u;if(t===void 0&&(t=$),this.isLoadingExitMessage=!0,f=function(){t(i.exitVoucherModalSelector).modal({show:!0,backdrop:"static"});t(i.exitVoucherModalSelector).appendTo("body")},f(),r=function(){i.preExitMessage=(n?"You are exiting the voucher '"+n+"'. ":"You are exiting the currently selected voucher. ")+(i.voucherContextCartLines.length===0?"You will no longer shop for this voucher.":"You have "+i.voucherContextCartLines.length+" item(s) that qualify for this voucher. Do you want to purchase the item(s), or remove them from the cart? ")},u=this.getCartId(),!u){this.voucherContextCartLines=[];this.isLoadingExitMessage=!1;r();return}this.apiService.getCart(u).then(function(n){i.voucherContextCartLines=n.data.cartLines.filter(function(n){return!!n.voucherGuid}).map(function(n){return{lineId:n.lineId}});r();i.isLoadingExitMessage=!1})},n.prototype.cancelExitVoucherContext=function(n){n===void 0&&(n=$);n(this.exitVoucherModalSelector).modal("hide");this.unsetChangeVoucherCallback()},n.prototype.removeVoucherContextItemsFromCart=function(){this.isRemovingVoucherContextCartLines=!0;this.unsetEmployeeVoucher()},n.prototype.checkOut=function(){this.navigationService.goToCheckOut();this.unsetChangeVoucherCallback()},n.prototype.exitVoucher=function(){this.isExiting=!0;this.unsetEmployeeVoucher()},n.prototype.unsetEmployeeVoucher=function(){var n=this,t=this.cookieService.getCartCookie();return this.apiService.unsetEmployeeVoucher(t).then(function(){if(n.changeVoucherCallback){n.handleChangeVoucherCallback();return}n.navigationService.goToVoucherHub();n.unsetChangeVoucherCallback()})},n.prototype.handleChangeVoucherCallback=function(){this.changeVoucherCallback&&(this.changeVoucherCallback(),this.unsetChangeVoucherCallback())},n.prototype.unsetChangeVoucherCallback=function(){this.changeVoucherCallback=undefined},n.prototype.getCartId=function(){return this.cookieService.getCartCookie()},n}();ExitVoucherModalController.$inject=["apiService","cookieService","cartService","navigationService","$q","eventsService"];typeof window!="object"||!window.document||typeof process!="undefined"?module.exports={ExitVoucherModalController:ExitVoucherModalController}:angular.module("ns").component("exitVoucherModal",new ExitVoucherModalComponent),function(n){"use strict";n.factory("youMayAlsoLikeService",["cookieService","apiService",function(n,t){var i=function(t,i){return i?{numberOfYmalItems:t,materialBaseId:i.materialBaseId,materialBaseGroup:i.materialBaseGroup}:{cartId:n.getCartCookie()||null,numberOfYmalItems:t}};return{getYmal:function(r,u,f){var e=i(r,u);t.getYmalItems(e).then(function(t){f(t.data);n.slideExpirationDates()})}}}])}(angular.module("ns")),function(n){var t=function(){function n(){}return n}();t.AllCondition="All";t.NoneCondition="None";t.AboveSpecificAmountCondition="AboveSpecificAmount";n.ApproversManagementConstants=t}(ns||(ns={}))