1!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["unified-onload"]=t():e["unified-onload"]=t()}(window,()=>((()=>{window.SWY=window.SWY||{},window.AB=window.AB||{};var e=window.SWY,t=window.AB;function o(e,t){for(var o=0;o<t.length;o+=1)e[t[o]]={}}function i(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}o(e,["CONFIGSERVICE","OKTA","ENFORCEMENT","ENFORCEMENTUTILS","RESTRICTEDRESOURCE","USERTYPESTATE","STORESELECTION","QUERYSTRING","STOREFLAGUTIL"]),window.StoreFlagService=e.STOREFLAGUTIL,i(e,{configService:{},popularSearches:{},allowedUserTypes:{},redirections:{},allowedZipcodeModal:{},isGuestAuthAllowed:{},isEscapeSSOAllowed:{},previousLogin:{},deepLinkData:{},authenticateGuestPath:"/bin/safeway/authenticate/guest",storeInfoPath:"/bin/safeway/store",ssoPath:"/bin/safeway/sso"}),t.$=null,o(t,["COMMON","DIVISIONAL","ALERT","MINICART","RECIPECAROUSEL","PRINT","RIGHTDRAWER","PRODUCTGRID","BREADCRUMB","CART","DELIVERYPREF","PROMOTIONS","VALIDATOR","ARIA","NOTIFYME","WWWHEADER","SLICKCAROUSEL","VALIDATION","UCACURRENTORDER","UCASERVICES","UCASUBSCRIPTIONSERVICES","UCAUPDATEDELIVERYADDRESS","GETPROFILE","FILTERS","POPULARSEARCH","AUTOSUGGEST","EDITORDER","LAZYLOAD","CHECKPROFILE","RECIPECAROUSEL_V2","SETSTORE","RECIPESTABS","ISL","AUTOCLIP_MESSAGES","BOXTOPS","GASGROCERY","SYNDICATEDCOOKIE","SIGNINOTP"]),t.SHOPBYCATEGORY={Carousel:{},Util:{},ABTest:{},SponsoredCategoryUtil:{}},i(t,{checkCategoryTileL3View:"",dealGridList:{},productGridList:[],departmentsFilterList:[],gridDataURL:"",userInfo:{},previousLogin:{},storeInfo:{},anchorTags:["#prop65-title","#bookmark-disclaimer","#error"],attendDeliveryTxt:"Available only with Attended Delivery",itemNotAvailableTxt:"This item is not available right now",CBAitemNotAvailableTxt:"This item is currently out of stock.",unattendedDeliveryIsEnabled:!1,rewardSummaryTime:1e4,slotLSTime:72e5,checkOutFlashDelivery:4,mktpShippingInfoLS:108e5,mktpSellerLS:108e5,ucaRewardsTrigger:!0,productCardTest:"",categoryTileL3Test:"",wineShippingInfoLS:108e5,pendingOrderPath:"/bin/safeway/order/pending/alert.json",addToCartPath:"/bin/safeway/cart/add",productPriceDetailPath:"/bin/safeway/product/price",reserveTimePath:"/bin/safeway/order/selected/slot",removeProductHistoryPath:"/bin/safeway/product/historylist",validationPath:"/ecom/api/modern1/route",authenticateGuestPath:"/bin/safeway/authenticate/guest",viewSimilarLinkPath:"/bin/safeway/product/similar",storeInfoPath:"/bin/safeway/store",promoSearchUrl:"/bin/safeway/promos.single.json?includeAds=Y&searchTerms=",offerPath:"/bin/safeway/ecomgallery?offerProgram=ALL",j4uPath:"/abs/dvpub/web/j4u/api/offers/gallery/anonymous?storeId=1786",j4uPathAuthorized:"/abs/dvpub/web/j4u/api/offers/gallery?storeId=1953&offerPgm=PD-CC",couponClipPath:"/abs/dvpub/web/j4u/api/offers/clip",getDeliveryAddressPath:"/apps/wcax-commons/clientlibs/clientlib-site/shop-commons/datastore/deliveryAddress.json",getDugStorePath:"/apps/wcax-commons/clientlibs/clientlib-site/shop-commons/datastore/dugStore.json",getEditCartOrderIdPath:"/bin/safeway/editcart/orderid",updatePendingOrderPath:"/bin/safeway/pendingorder/update",dealsFilter:"/bin/safeway/department",storeLocator:"/bin/safeway/store/locator",storeResolverPath:"/bin/safeway/store/resolver",offerDetailXfPath:"/content/experience-fragments/www/(banner)/en/generic_content/offer-detail-xf/offer-detail-xf/jcr:content/root/responsivegrid",offerDisclaimerXfPath:"/content/experience-fragments/www/Disclaimers/Offer-Disclaimer/offer-disclaimer.content.html",isLSEnable:!1,cookie:{},storeFlagsLoaded:!1,storeFlagsData:null,arFlagLoaded:!1,arFlag:{},doDnfRedirect:!1,deliveryPreferencePagePath:"/content/shop/{banner}/en/welcome/delivery-preference"}),elevateBanner=[];var n=n||{};o(n,["COMMON","CONFIGSERVICE"])})(),AB.preInitializeObject=function(){function e(){return null!=AB.userInfo?.branchId?AB.userInfo.branchId:JSON.parse(AB.COMMON.getCookie("ECommTokens")).branchId}function t(e){const t=SWY.CONFIGSERVICE.getDatapowerConfig(),o={"X-SWY_VERSION":e,"X-SWY_BANNER":SWY.CONFIGSERVICE.getResolvedBanner(),"X-IBM-Client-Id":t.clientId,"X-IBM-Client-Secret":t.clientSecret,"Content-Type":"application/json","X-SWY_API_KEY":"emjou"};return AB.COMMON.authorize()?(o["X-swyConsumerDirectoryPro"]=AB.userInfo.SWY_SHOP_TOKEN,o.SWY_SSO_TOKEN=AB.userInfo.SWY_SHOP_TOKEN,o["x-swy-correlation-id"]=AB.COMMON.generateUUID(AB.userInfo.houseId,AB.userInfo.firstName)):o["x-swy-correlation-id"]=AB.COMMON.generateUUID(),o}AB.loadDynamicURL(),Object.defineProperty(AB,"userInfoPath",{configurable:!0,get:function(){return"/bin/safeway/unified/userinfo?rand="+Math.floor(1e6*Math.random())+"&banner="+SWY.CONFIGSERVICE.getResolvedBanner()}}),Object.defineProperty(AB,"userSessionInfoPath",{configurable:!0,get:function(){return SWY.CONFIGSERVICE.getDatapowerConfig().datapowerApimBasePath+"/usersession/api/v1/session/info"}}),Object.defineProperty(AB,"userSessionInfoOptions",{configurable:!0,get:function(){return{"ocp-apim-subscription-key":SWY.CONFIGSERVICE.getDatapowerConfig().userSessionSubscriptionKey}}}),Object.defineProperty(AB,"isWWW",{configurable:!0,get:function(){const e=$("meta[name=bannerType]").attr("content");return null!=e&&("www"===e||"shop"!==e&&void 0)}}),Object.defineProperties(AB,{htmlProductDetailPath:{configurable:!0,get:()=>"/shop/product-details.(bpn).html"},winePdpPath:{configurable:!0,get:()=>"/shop/vineandcellar/product-details.(bpn).html"},mkpPdpPath:{configurable:!0,get:()=>"/shop/marketplace/product-details.(bpn).html"},htmlOfferDetailPathShop:{configurable:!0,get:()=>"/content/shop/"+SWY.CONFIGSERVICE.getResolvedBanner()+"/en/offer-details"},htmlOfferDetailPathWww:{configurable:!0,get:()=>"/content/www/"+SWY.CONFIGSERVICE.getResolvedBanner()+"/en/foru/offer-details"},htmlRewardDetailPathWww:{configurable:!0,get:()=>"/content/www/"+SWY.CONFIGSERVICE.getResolvedBanner()+"/en/foru/rewards/reward-detail
1s"},htmlOfferDetailPathB2b:{configurable:!0,get:()=>"/content/b2b/www/"+SWY.CONFIGSERVICE.getResolvedBanner()+"/en/foru/offer-details"},htmlRewardDetailPathB2b:{configurable:!0,get:()=>"/content/b2b/www/"+SWY.CONFIGSERVICE.getResolvedBanner()+"/en/foru/rewards/reward-details"},signInLinkPath:{configurable:!0,get:()=>"/content/www/"+SWY.CONFIGSERVICE.getResolvedBanner()+"/en/account/sign-in.html"}}),Object.defineProperties(AB,{aisleHTMLPath:{configurable:!0,get:function(){return"/content/shop/"+SWY.CONFIGSERVICE.getResolvedBanner()+"/en/aisles/jcr:content/root/responsivegrid/column_control/par_1/productaislelist."+e()+".html"}},aisleHTMLTitlePath:{configurable:!0,get:function(){return"/content/shop/"+SWY.CONFIGSERVICE.getResolvedBanner()+"/en/aisles/jcr:content/root/responsivegrid/column_control/par_1/simple_page_title."+e()+".html"}}}),Object.defineProperties(AB,{j4uHttpOptions:{configurable:!0,get:()=>t("1.0")},j4uHttpOptions11:{configurable:!0,get:()=>t("1.1")},j4uHttpOptions30:{configurable:!0,get:()=>t("3.0")}}),Object.defineProperty(AB,"preUcaHttpOptions",{get:function(){return{Accept:"application/vnd.safeway.v1+json","X-SWY_BANNER":SWY.CONFIGSERVICE.getResolvedBanner(),"Ocp-Apim-Subscription-Key":SWY.CONFIGSERVICE.getDatapowerConfig().cncSubscriptionKey,"Content-Type":"application/vnd.safeway.v1+json","x-swy-client-id":"web-portal","x-swy-correlation-id":AB.COMMON.generateUUID(),"x-swy-date":new Date,"Cache-Control":"no-cache"}}}),Object.defineProperty(AB,"companionOffersxAPIHttpOptions",{configurable:!0,get:function(){const e={"Content-Type":"application/vnd.safeway.v2+json",Accept:"application/json","X-SWY-APPLICATION-TYPE":"web","X-SWY_API_KEY":"emjou","X-SWY_VERSION":"1.1","X-SWY_BANNER":SWY.CONFIGSERVICE.getResolvedBanner()};return AB.COMMON.authorize()&&(e.Authorization="Bearer "+AB.userInfo.SWY_SHOP_TOKEN),e}}),Object.defineProperty(AB,"offerDetailxAPIHttpOptions",{configurable:!0,get:function(){const e={"X-SWY_VERSION":"2.1","Content-Type":"application/vnd.safeway.v2+json","X-SWY_API_KEY":"emjou","X-SWY-APPLICATION-TYPE":"web"};return AB.COMMON.authorize()&&(e.Authorization="Bearer "+AB.userInfo.SWY_SHOP_TOKEN),e}}),Object.defineProperty(AB,"ecomOfferDetailxAPIHttpOptions",{configurable:!0,get:function(){const e={"X-SWY_VERSION":"2.1","Content-Type":"application/vnd.safeway.v2+json","X-SWY_API_KEY":"emjou","X-SWY-APPLICATION-TYPE":"web"};return AB.COMMON.authorize()&&(e.Authorization="Bearer "+AB.userInfo.SWY_SHOP_TOKEN),e}})},AB.postInitializeObject=function(){},AB.loadDynamicURL=function(){var e=SWY.CONFIGSERVICE.nimbusConfig.usePcfEndpoint,t=SWY.CONFIGSERVICE.getDatapowerConfig(),o=t.clientHost+t.datapowerBasePath,i=t.clientHost+t.datapowerxAPIBasePath,n=t.clientHost+t.apimPcfJ4uBasePath,s=t.clientHost+t.extBasePath,r=e?n:o,a=e?"":"/web/j4u/api",c=t.clientHost+t.cncCtxPath,l=t.clientHost+t.cncCtxPath+"/ucaservice",d=t.clientHost+t.cncCtxPath+"/cpsaservice",u=t.ppmsApiEndpoint;AB.offerGuestPath=r+a+"/ecomgallery/anonymous",AB.offerRegisterPath=r+a+"/ecomgallery",AB.offerDetailPath=r+a+"/offer",AB.offerDetailxAPIPath=i+"/xapi/offers",AB.checkUnclipDetail=i+"/xapi/ocrp/rewards/clippedrewards",AB.getRewardHistoryV2Path=i+"/xapi/ocrp/rewards/v2/rewardsHistory",AB.getRewardHistoryV3Path=i+"/xapi/ocrp/rewards/v3/rewardsHistory",AB.offerPersonalizedContent=r+a+"/personalizedcontent",AB.couponClipPath=r+a+"/offers/clip",AB.couponUnclipPath=r+a+"/offers/unclip",AB.rewardUnclipPath=r+a+"/rewards/unclip?storeId={storeId}",AB.myListPath=r+a+"/mylist",AB.myListCountPath=r+a+"/mylist/count",AB.rewardPath=r+a+"/grocery/rewards/offers",AB.xAPIgalleryPath=i+"/xapi/offers/companiongalleryoffer",AB.offerGalleryFilterPath=i+"/dce/offergallery/offers/filter",AB.instantAllocation=i+"/xapi/offers/instantAllocationGallery",AB.galleryRegisterPath=r+a+"/offers/gallery",AB.infiniteScroll="client",AB.selectedRewardsPath=r+a+"/grocery/rewards/mylist",AB.hiddenEventsPath=r+a+"/CC/offer/allocations?view=campaign&_dc=1537490356206&",AB.eligibleOfferDetailxAPIPath=i+"/xapi/offers/event/new_registration/offers",AB.savingsAPIPath=i+"/dce/mycard/J4UProgram1/services/mycard/savings",AB.storeByIdPathV2=t.datapowerxAPIBasePath+"/xapi/storeresolver/v2/storesByIds",AB.clippedCouponPath=i+"/dce/offergallery/J4UProgram1/services/gallery/companion/clipped",AB.resetPasswordPath=l+"/api/uca/pwd",AB.signInCsmsPath=c+"/csmsservice/api/csms/signin",AB.registerCsmsPath=c+"/csmsservice/api/csms/customers/register",AB.lookupCsmsPath=c+"/csmsservice/api/csms/customers/lookup",AB.kmsiCsmsPath=c+"/csmsservice/api/csms/kmsi",AB.nonKmsiCsmsPath=c+"/csmsservice/api/csms/nonkmsi",AB.resendOtpCsmsPath=c+"/csmsservice/api/csms/signup/factors/{factorId}/verify/resend",AB.rewardsInfoPath=l+"/api/uca/customers/{customerId}/rewards",AB.cancelOrderPath=o+"/web/ecom/api/orderdelete/",AB.deliveryAddressPath=l+"/api/uca/customers/{customerId}
1/addresses",AB.storeAddressPath=l+"/api/uca/customers/{customerId}/stores",AB.storeAddressPathV2=l+"/api/uca/customers/{UUID}/stores",AB.getProfileInfo=l+"/api/uca/customers",AB.getprofileAddressPath=l+"/api/uca/customers/{customerId}/profile",AB.shortRegPath=l+"/api/uca/customers/register",AB.userProfilePath=l+"/api/uca/customers/{customerId}/profile",AB.loyaltyPartnersPath=l+"/api/uca/customers/{customerId}/loyaltypartners",AB.kmsiPath=l+"/api/uca/customers/kmsi",AB.anonymousUnsubscribe=l+"/api/uca/unsubscribe",AB.pendingOrderMessage=o+"/web/ecom/api/ecomdb/commdata",AB.fulfillmentPreferences=l+"/api/uca/customers/{customerId}/preferences/fulfillment",AB.fulfillmentDefaultAddressV2=l+"/api/uca/customers/{customerId}/fulfillment",AB.erumsApiOrdersSummary=SWY.CONFIGSERVICE.erumsConfig["orders.service.endpoint"]+"/orders/summary",AB.erumsApiCancelOrder=SWY.CONFIGSERVICE.erumsConfig["orders.service.endpoint"]+"/orders/",AB.reserveTimePathErums=SWY.CONFIGSERVICE.erumsConfig["erums.slot.service.endpoint"]+"/reservationDetails/",AB.erumsOrderDelivery=SWY.CONFIGSERVICE.erumsConfig["orders.service.endpoint"]+"/orders/",AB.profileTokenDecryptionService=l+"/api/uca/customers/profile/token",AB.creditCardInfoPath=c+"/cwmsservice/api/cwms/customers/{customerId}/tenders",AB.creditCardInfoTokenvaultPath=t.tokenvaultEndpoint+"/customers/{customerId}/tenders",AB.tokenvaultSubscriptionKey=t.tokenvaultSubscriptionKey,AB.reserveTimePathOsdp=SWY.CONFIGSERVICE.osdpConfig["osdp.slot.promise.service.endpoint"]+"/reservationDetails/",AB.loyaltyPartnerPath=l+"/api/uca/customers/{uuid}/loyaltypartners",AB.postPutDeletePetProfilePath=u+"petprofile",AB.getAllPetProfilesPath=u+"petprofiles",AB.findPetProfilePath=u+"petprofile/{petId}",AB.updateBusinessProfileEndpoint=l+"/api/uca/customers/{{UUID}}/profile",AB.userAddresses=l+"/api/uca/customers/{uuid}/addresses",AB.mergeSkipPath=d+"/api/cpsa/customers/{customerId}/accounts/skip",AB.firstTimeLoginAcknowledgementPath=c+"/csmsservice/api/csms/customers/{customerId}/ack-first-time-login",AB.deliverySubAemPaymentURL="/delivery-subscription/payment.html?subscriptioncode=",AB.stackingLImitAPIPath=AB.ocrpRewardsStackingLimitEndpoint,AB.emrbGetRewardSummary=s+"/rewardshub/getRewards",AB.ocrpRewardScorecard=AB.ocrpRewardsScorecardEndpoint,AB.webPreloadPath=AB.preloadStoreFlagsEndpoint,AB.marketPlaceSearchResultsPath="marketplace/search-results.{sellerId}.html?q={q}",AB.marketPlaceSellerCarouselEndPoint="/search/seller-carousel",AB.wineShopSearchResultsPath="vineandcellar/search-results.html?q={q}",AB.marketPlaceCrossSellerSearchResultsPath="/shop/marketplace/seller-search.html?q={q}",AB.wineCarouselEndPoint="/search/wine-carousel",AB.healthHandshakePath="/health/users/session",AB.healthAppBasePath="/health/pharmacy/dashboard"},function(){this.SWY_SHOP_TOKEN="",this.banner="",this.branchId="",this.deliveryAddress="",this.deliveryPreference="",this.displayableBanner="",this.email="",this.driveUpAndGoIsEnabled="",this.extendedType="",this.orderCount="",this.pickupAddress="",this.registered="",this.unattendedDeliveryIsEnabled="",this.userId="",this.userType="",this.UUID="",this.zipcode="",this.houseId="",this.clubCard="",this.boxTopAuth=!1,this.firstName="",this.lastName="",this.isInNoServiceArea="",this.orderNumber="",this.expireTime="",this.earlyInitialize=!0,this.resolveEcomStore=!1,this.dprefVisited="",this.userData={},this.preferenceMode="",this.selectionType="",this.j4u={zipcode:"",storeId:"",isStoreIdEmpty:!1,userData:{},storeData:{storeLocation:{},storeRewards:{storeId:"",hasGroceryDelivery:"",hasDUG:"",hasRushDelivery:"",hasGroceryRewards:"",gasRewardsId:"",rewardsProgramId:"",partnerFuelLogo:"",partnerMaxRedemption:"",ownMaxRedemption:""}}}
1,this.geolocation={zipcodeJ4U:null,storeIDJ4U:null,zipcodeSHOP:null,storeIDSHOP:null,storeData:null},this.geoYextAJAXCall="",this.triggerUserInfoAJAXCall=!1,this.profileEmail="",this.profilePhone="",this.siteType="",this.customerType="",this.resolvedBy="",this.deliveryAddr="",this.addressName="",this.multiAccounts="",this.phoneVerified="",this.emailVerified="",this.emailPrompt180="",this.phonePrompt180="";const e=["",0,void 0,"undefined",null,"0","PRIMARY","null"];this.prepareSharedInfo=function(){let e=AB.COMMON.getCookie("SWY_SHARED_SESSION_INFO");if(""!==e){try{e=JSON.parse(unescape(e))}catch(t){console.error("sharedInfo: Parsing failed",t),e={info:""}}AB.userInfo.mapSharedInfo(e)}},this.mapSharedInfo=function(e){if(AB.COMMON.isEmpty(e.info))return;const t=e.info.COMMON;if(!AB.COMMON.isEmpty(t)){if(null!=t.dprefVisited&&(this.dprefVisited=t.dprefVisited),t.preference&&(this.preferenceMode=t.preference),t.Selection&&(this.selectionType=t.Selection),this.userType=t.userType??"",t.isClosed&&(this.isClosed="true"===t.isClosed),t.isCrossBannerMFCUser&&(this.isCrossBannerMFCUser="true"===t.isCrossBannerMFCUser),null!=t.isARenrolled){const e=String(t.isARenrolled).toLowerCase();this.isARenrolled="null"===e?null:"undefined"===e?void 0:"true"===e}t.siteType&&(this.siteType=t.siteType??""),t.customerType&&(this.customerType=t.customerType??""),t.resolvedBy&&(this.resolvedBy=t.resolvedBy??""),t.multiAccounts&&(this.multiAccounts=t.multiAccounts??""),t.phoneVerified&&(this.phoneVerified=t.phoneVerified??""),t.emailVerified&&(this.emailVerified=t.emailVerified??""),t.emailPrompt180&&(this.emailPrompt180=t.emailPrompt180??""),t.phonePrompt180&&(this.phonePrompt180=t.phonePrompt180??""),this.houseId=t.houseId??"",this.clubCard=t.clubCard??""}const o=e.info.SHOP;if(!AB.COMMON.isEmpty(o)){if(this.branchId=o.storeId??"",AB.COMMON.checkPendingOrder()){this.orderNumber=AB.COMMON.getCookie("OrderNumber");const e=AB.COMMON.getCookie("BranchNumber");e&&(this.branchId=e)}else this.orderNumber="";this.zipcode=o.zipcode??"",this.banner=o.banner&&o.storeId?o.banner:SWY.CONFIGSERVICE.getResolvedBanner(),o.userData&&(this.expireTime=o.userData.expireTime??""),this.userData=o.userData??{}}const i=e.info.J4U;if(!AB.COMMON.isEmpty(i)){if(this.j4u.zipcode=i.zipcode??"",this.j4u.storeId=i.storeId??"",AB.COMMON.checkForEditOrderMode()){const e=AB.COMMON.getCookie("BranchNumber");this.j4u.storeId!==e&&(this.j4u.storeId=e)}this.j4u.userData=i.userData??{}}},this.resolveDisplayableBanner=function(){this.banner=SWY.CONFIGSERVICE.resolvedBanner,this.displayableBanner=SWY.CONFIGSERVICE.displayableBanner},this.prepareUserInfo=function(e){try{"string"==typeof e&&(AB.userInfo.mapUserInfo(JSON.parse(e)),PastOrdersComp.init())}catch(e){console.error("Userinfo: Parsing failed",e)}},this.mapUserInfo=function(e){if(!AB.COMMON.isEmpty(e)&&(["SWY_SHOP_TOKEN","customerId","deliveryAddress","deliveryPreference","driveUpAndGoIsEnabled","orderCount","extendedType","pickupAddress","registered","userId","firstName","lastName","unattendedDeliveryIsEnabled","isInNoServiceArea","UUID","email","profileEmail","profilePhone","clubCard","houseId"].forEach(t=>{void 0!==e[t]&&(this[t]=e[t])}),void 0!==e.deliveryAddr&&void 0!==e.type)){const t=e.deliveryAddr.split(",");let o=t.length>4?{type:e.type,adr1:t[0],adr2:t[1],city:t[2],zip:t[4],st:t[3]}:{type:e.type,adr1:t[0],city:t[1],zip:t[3],st:t[2]};e.addressName&&(o.addressName=e.addressName),this.deliveryAddr=o}},this.getValue=function(e){return"appBranchId"===e?this.j4u.storeId||this.branchId:AB.userInfo[e]},this.updateTokenRefreshProperty=function(){let e=SWY.CONFIGSERVICE.getCookie("SWY_SHARED_SESSION_INFO");const t=!!SWY.CONFIGSERVICE.featureToggleConfig.enableCookieRestructure;if(""!==e&&(e=JSON.parse(unescape(e)),!AB.COMMON.isEmpty(e.info)))if(t)this.userType=e.userType??"",e.userData&&(this.expireTime=e.userData.expireTime??""),this.j4u.userType=e.userType??"";else{const t=e.info.SHOP;AB.COMMON.isEmpty(t)||(this.userType=t.userType??"",t.userData&&(this.expireTime=t.userData.expireTime??""));const o=e.info.J4U;AB.COMMON.isEmpty(o)||(this.j4u.userType=o.userType??"")}},this.updateSessionCookies=function(e){const t=new Date;t.setTime(t.getTime()+1e3*SWY.CONFIGSERVICE.oktaConfig.maxAge);const o=SWY.CONFIGSERVICE.oktaConfig.maxAge>0?[encodeURIComponent(JSON.stringify(e)),"expires="+t.toUTCString(),"true"]:[encodeURIComponent(JSON.stringify(e))];SWY.CONFIGSERVICE.setCookie("SWY_SHARED_SESSION_INFO",...o)},this.usePreviousInfoForSession=function(e,t){AB.userInfo.generateEstablishmentSession(e.J4U.zipcode,e.J4U.storeId,e.SHOP.zipcode,e.SHOP.storeId,e.COMMON.preference,t,e.COMMON.resolvedBy)},this.useStoreSelectorForSession=function(e){const{store:t,ecomStore:o}=e.validRequest;AB.userInfo.generateEstablishmentSession(t.zipcode,t.storeId,o.zipcode,o.storeId,"J4U","user")},this.useDefaultForSession=function(){const e=SWY.CONFIGSERVICE.storeResolutionConfig;AB.userInfo.generateEstablishmentSession(e.bannerDefaultZipcode,e.bannerDefaultStoreId,null,null,"J4U","default")},this.checkForMultipleDelivery=function(e){const t={zipcode:e.SHOP.zipcode,radius:50,size:10},o={"ocp-apim-subscription-key":AB.wcaxXapiApimKey};AB.COMMON.getStoreResolverPayload(window.location.origin,AB.storeResolverDeliveryEndpointV2,t,o,!1,function(t){const o=t.delivery;o.count>0&&o.stores.some(t=>t.polarisBannerName===SWY.CONFIGSERVICE.getResolvedBanner()&&t.locationId===e.SHOP.storeId)?AB.userInfo.usePreviousInfoForSession(e,"user"):AB.userInfo.useDefaultForSession()},function(){AB.userInfo.usePreviousInfoForSession(e,"user")})}
1,this.setMultipleDeliveryCookie=function(){const e=new Date;e.setHours(24,0,0,0),SWY.CONFIGSERVICE.setCookie("multipleDeliveryCheck",!0,"expires="+e.toUTCString(),"true")},this.checkForStoreSelector=function(){if(!SWY.CONFIGSERVICE.featureToggleConfig.enableStoreIdSelector)return!1;const e=window.location.pathname;if(void 0===e||-1!==e.indexOf(".(")||"true"!==SWY.CONFIGSERVICE.isEnableStoreIdSelectorOnPage)return!1;const t=e.indexOf("."),o=e.indexOf(".html");if(-1===t||-1===o||o<=t)return!1;const i=e.substring(t+1,o);return!(!i||!/^\d{2,4}$/.test(i)||(AB.currentStoreIdSelector=i,0))},this.validateStoreIdSelector=function(){const e={banner:SWY.CONFIGSERVICE.getResolvedBanner(),storeid:AB.currentStoreIdSelector,preference:"instore"},t={"ocp-apim-subscription-key":AB.wcaxXapiApimKey};AB.COMMON.getStoreResolverPayload(window.location.protocol+"//"+window.location.host,AB.storeResolverValidateEndpoint,e,t,!1,function(e){!0===e.validRequest.isValid?AB.userInfo.useStoreSelectorForSession(e):AB.userInfo.useDefaultForSession()},function(){AB.userInfo.useDefaultForSession()})},this.establishUnifiedGuestSession=function(){if(SWY.deepLinkData.info){const e=SWY.deepLinkData.info;this.usePreviousInfoForSession(e,e.COMMON.Selection)}else if(SWY.ENFORCEMENTUTILS.isPreviouslyLoggedInWWW()){const t=SWY.previousLogin.info;if(-1===e.indexOf(t.SHOP.storeId)&&-1===e.indexOf(t.J4U.storeId)){const e=SWY.CONFIGSERVICE.featureToggleConfig?.useStoreResolverV2;e&&"delivery"===t.COMMON.preference.toLowerCase()?AB.COMMON.getCookie("multipleDeliveryCheck")||(this.checkForMultipleDelivery(t),this.setMultipleDeliveryCookie()):this.usePreviousInfoForSession(t,"user")}else this.useDefaultForSession()}else AB.userInfo.checkForStoreSelector()?AB.userInfo.validateStoreIdSelector():AB.userInfo.useDefaultForSession()},this.generateEstablishmentSession=function(e,t,o,i,n,s,r){const a=!!SWY.CONFIGSERVICE.featureToggleConfig.enableCookieRestructure,c=()=>JSON.parse(AB.COMMON.getCookie("SincerelyFoodBanner")),l={info:{COMMON:{},J4U:{},SHOP:{}}},d=l.info.COMMON,u=l.info.J4U,p=l.info.SHOP;if(d.Selection=s,d.preference=n,d.userType="G",d.zipcode="J4U"===n?e:o,d.banner=AB.userInfo.banner,d.siteType=AB.userInfo.siteType,d.customerType=AB.userInfo.customerType,d.resolvedBy=r||AB.userInfo.resolvedBy,u.zipcode=e,a&&(d.zipcode=e),null!=t)u.storeId=t.toString(),a&&(d.storeId=t.toString());else{const e=c();u.storeId=e.storeId,d.banner=e.banner,a&&(d.storeId=e.storeId)}if(null===o)if(p.zipcode=e,null!=t)p.storeId=t.toString(),a&&(d.storeId=t.toString());else{const e=c();p.storeId=e.storeId,a&&(d.storeId=e.storeId)}else p.zipcode=o,p.storeId=i.toString(),a&&(d.zipcode=o,d.storeId=i.toString());AB.userInfo.userType="G",AB.userInfo.preferenceMode=n,AB.userInfo.selectionType=s,a?(AB.userInfo.zipcode=d.zipcode,AB.userInfo.branchId=d.storeId,AB.userInfo.userData=d.userData,AB.userInfo.j4u.zipcode=d.zipcode,AB.userInfo.j4u.storeId=d.storeId):(AB.userInfo.zipcode=p.zipcode,AB.userInfo.branchId=p.storeId,AB.userInfo.userData=p.userData,AB.userInfo.j4u.zipcode=u.zipcode,AB.userInfo.j4u.storeId=u.storeId),AB.COMMON.updateUserSession(l)},this.resolveSiteType=function(){this.siteType=AB.COMMON.isB2BSite()?"B":"C"}}.call(AB.userInfo),function(){this.queryParams={},this.referrerUrl=null;let e=null;this.init=function(){let t=window.location.search;t?(0===t.indexOf("?")&&(t=t.substring(1)),t.length>0&&(e=this.parseQueryString(t),this.filterParameters(e))):SWY.QUERYSTRING.addReferrerToQueryParams(!1)},this.parseQueryString=function(e){const t={};return e&&e.split("&").forEach(e=>{const o=e.split("=")[0];t[o]=e.substr(o.length+1)}),t},this.filterParameters=function(e){if(e)for(const t in e)this.isParameterInList(t)&&(this.queryParams[t]=e[t]);SWY.QUERYSTRING.addReferrerToQueryParams(!1)},this.addReferrerToQueryParams=function(e){const t=SWY.QUERYSTRING.getReferrer(e);!this.queryParams.r&&t&&(this.queryParams.r=t)},this.isParameterInList=function(e){if(!e)return!1;const t=SWY.CONFIGSERVICE.queryStringConfig;if(!t)return!1;for(const o in t)if(t.hasOwnProperty(o)){const i=t[o];for(const t in i)if(i[t]===e)return!0}return!1},this.buildUrlParameters=function(){let e="";if(this.queryParams)for(const t in this.queryParams){const o=this.generateUrlParameter(t,this.queryParams[t]);e=e?e+"&"+o:o}return e},this.generateUrlParameter=function(e,t){return e?e+"="+t:null},this.getCurrentURI=function(e){return location.pathname+(e?window.location.search:"")},this.getURIWithMarketingParams=function(){const e=SWY.QUERYSTRING.buildUrlParameters();return e?this.getCurrentURI(!1)+"?"+e:this.getCurrentURI(!0)},this.getReferrer=function(e){const t=document.referrer;return t?encodeURIComponent(e?t:t.split("?",2)[0]):""},this.mergeMarketingParams=function(e,t){let o=e;return t&&t.split("&").forEach(t=>{const i=t.split("=");if(!SWY.QUERYSTRING.hasParam(i[0],e)){const e=t.substr(i[0].length+1),n=SWY.QUERYSTRING.generateUrlParameter(i[0],e);o=o?o+"&"+n:"?"+n}}),o},this.hasParam=function(e,t){return new RegExp("([?&])*"+e+"=.*?(&|$)","i").test(t)}}.call(SWY.QUERYSTRING),function(){this.popularSearchesConfig={popularSearches:{}},this.bannerDomainMap={},this.nonShopBanners={},this.carouselOfferAPIBased,this.carouselProductAPIBased,this.carouselRolloutBanners={},this.bannerConventionsJson={},this.sessionCookiePrefixes=["SWY_","EComm","USED_","SAFEWAY_","abs_","absV"],this.topLevelSessionCookies=["USED_CREDENTIALS","SAFEWAY_KMSI","SAFEWAY_RE_SIGN_IN"],this.ACIStrictCookies=["ACI_S_B_convt_acc","ACI_S_B_convt_acc_success","ECommSignInCount","B_ECommSignInCount","USED_CREDENTIALS","B_USED_CREDENTIALS","abs_previouslogin","B_abs_previouslogin","ECommBanner","B_ECommBanner","ECommRedirectURL","B_ECommRedirectURL"],this.ACIStrictReleaseCookies=["ECommReInit","B_ECommReInit"],this.ACIFunctionalCookies=[],this.ACIAnalyticsCookies=[],this.realTimePopularSearchConfig={popularSearchItems:{}},this._initJsonConfig=function(e,t){this[t]=""!==e?JSON.parse(e):{}},this.init=function(e,t,o){if(SWY.CONFIGSERVICE.featureToggleConfig?.enableReleaseACICookie&&(this.ACIStrictCookies=this.ACIStrictCookies.concat(this.ACIStrictReleaseCookies)),SWY.configService=JSON.parse(e),this.resolvedBanner="",this.displayableBanner="",AB.isLSEnabled=this.isLSCompatible(),t){const e=JSON.parse(t);
1this.resolvedBanner=e.banner,this.displayableBanner=e.displayableBanner}this.bannerConventionsJson=""!==o?JSON.parse(o):{},this.getPreUserInfo(),this.checkGotoReferralURL(),this.checkLocalStorageRefresh(),SWY.configService.nonShopBanners&&(this.nonShopBanners=SWY.configService.nonShopBanners),-1===window.location.search.indexOf("log=true")&&this.disableLog(),this.getCurrentEnviormentVal()},this.initNimbusConfig=function(e){this._initJsonConfig(e,"nimbusConfig")},this.initFeatureToggleConfig=function(e){this._initJsonConfig(e,"featureToggleConfig")},this.initDatapowerConfig=function(e){this._initJsonConfig(e,"datapowerConfig")},this.initOktaConfig=function(e){""!==e?(this.oktaConfig=JSON.parse(e),this.oktaConfig.logoutRedirectURI=window.location.origin+this.oktaConfig.logoutRedirectURI,this.oktaConfig.ossmLogoutRedirectURI=window.location.origin+this.oktaConfig.ossmLogoutRedirectURI):this.oktaConfig={}},this.initStoreResolutionConfig=function(e){this._initJsonConfig(e,"storeResolutionConfig")},this.initBannerDomainMapConfig=function(e){""!==e&&(this.bannerDomainMap=JSON.parse(e))},this.initQueryStringConfig=function(e){this._initJsonConfig(e,"queryStringConfig")},this.initSearchConfig=function(e){this._initJsonConfig(e,"searchConfig")},this.initPopularSearches=function(e){""!==e&&(this.popularSearchesConfig=JSON.parse(e))},this.initDeliverySubscriptionConfig=function(e){this._initJsonConfig(e,"DSConfig")},this.initErumsConfig=function(e){if(""!==e){this.erumsConfig=JSON.parse(e);const t={cartbaseurl:"cart.service.endpoint",cartapimkey:"cart.apim.key",cartapimtrace:"cart.apim.trace",carturl:"cart.path",getcartbycusturl:"cart.by.customer.path",storebaseurl:"store.service.endpoint",storeapimkey:"store.apim.key",storeapimtrace:"store.apim.trace",erumsflag:"erums.enabled",checkouturl:"checkout.endpoint",fullcarturl:"fullcart.endpoint",dnfcarturl:"dnfcart.endpoint",omsOrderSummaryBaseUrl:"oms.ordersummary.basepath",omsOrderSummaryEndPoint:"oms.ordersummary.endpoint"};Object.keys(t).forEach(e=>{window.AB[e]=this.erumsConfig[t[e]]})}else this.erumsConfig={}},this.initBringgConfig=function(e){this._initJsonConfig(e,"bringgConfig")},this.initOMSConfig=function(e){""!==e?(this.omsConfig=JSON.parse(e),window.AB.omsOrderSummaryBaseUrl=this.omsConfig["oms.ordersummary.basepath"]):this.omsConfig={}},this.initCatalogConfig=function(e){if(""!==e){this.catalogConfig=JSON.parse(e);const t={catalogServiceEnable:"catalog.xapi.enable",catalogServiceBaseurl:"swy.api.apim.catalog.service.baseurl",catalogServiceEndpoint:"swy.api.catalog.service.endpoint",catalogServiceSubscriptionKey:"swy.api.catalog.service.apim.key"};Object.keys(t).forEach(e=>{window.AB[e]=this.catalogConfig[t[e]]});const o=this.catalogConfig["apim.api.catalog.path"];window.AB.catalogXapiProductsBpnEndpoint=o+this.catalogConfig["apim.api.catalog.product.bpn.endpoint"],window.AB.catalogXapiProductsUpcEndpoint=o+this.catalogConfig["apim.api.catalog.product.upc.endpoint"],window.AB.catalogIncrementPriceListEndpoint=o+this.catalogConfig["apim.api.catalog.increment.price.list.endpoint"],window.AB.catalogXapiCbaEndpoint=o+this.catalogConfig["apim.api.catalog.cba.endpoint"]}else this.catalogConfig={}},this.initWcaxXapiConfig=function(e){if(""!==e){this.wcaxXapiConfig=JSON.parse(e);const t={wcaxXapiApimKey:"wcax.xapi.apim.key",storeResolverAllEndpoint:"store.resolver.all.endpoint",storeResolverAllEndpointV2:"store.resolver.all.endpoint.v2",sponsoredBannerEndpointV2:"sponsoredbanner.xapi.v2.endpoint",spotlightBannerEndpoint:"spotlightbanner.xapi.endpoint",spotlightVideoEndpoint:"spotlightvideo.xapi.endpoint",sponsoredAdsDomainApiApimKey:"wcax.domain.api.apim.key",sponsoredAdsDomainEndpoint:"sponsoredads.domainapi.endpoint",sponsoredAdsDomainEndpointV2:"sponsoredads.domainapi.v2.endpoint",sponsoredIconsDomainEndpointV2:"sponsoredicons.domainapi.v2.endpoint",storeResolverRecordEndpoint:"store.resolver.wiremock.recorder.endpoint",storeResolverPlaybackEndpoint:"store.resolver.wiremock.playback.endpoint",allowWiremockService:"allow.wiremock.service",wiremockRecorderBaseUrl:"wiremock.recorder.baseUrl",wiremockPlaybackBaseUrl:"wiremock.playback.baseUrl",storeResolverInstoreEndpoint:"store.resolver.instore.endpoint",storeResolverPickupEndpoint:"store.resolver.pickup.endpoint",storeResolverDeliveryEndpoint:"store.resolver.delivery.endpoint",storeResolverDeliveryEndpointV2:"store.resolver.delivery.endpoint.v2",storeResolverValidateEndpoint:"store.resolver.validate.endpoint",storeResolverStoreAddressEndpoint:"store.resolver.storeaddress.endpoint",storesByAddressEndpoint:"store.resolver.storesByAddress.endpoint",storeResolverDerivedEcomEndpoint:"store.resolver.derivedecom.endpoint",storeResolverZipToCityEndpoint:"store.resolver.ziptocity.endpoint",storeResolverZipcodeToShoppingEndpoint:"store.resolver.zipcodetoshopping.endpoint",storeResolverStoreToShoppingEndpoint:"store.resolver.storetoshopping.endpoint",snsContentServiceGetZoneEndpoint:"sns.contentservice.getzone.endpoint",snsContentServiceApimSubkey:"sns.contentservice.apim.subkey",ocrpRewardsXapiApimKey:"ocrp.rewards.xapi.apim.key",ocrpRewardsScorecardEndpoint:"ocrp.rewards.scorecard.endpoint",ocrpRewardsStackingLimitEndpoint:"ocrp.rewards.stackinglimit.endpoint",ocrpRewardsRewardsHistoryEndpoint:"ocrp.rewards.rewardshistory.endpoint",ocrpRewardsTransactionEndpoint:"ocrp.rewards.transaction.endpoint",preloadStoreFlagsXapiApimKey:"webpreload.storeflags.apim.key",preloadStoreFlagsEndpoint:"webpreload.storeflags.endpoint",sellerShipMethodsBaseUrl:"promiseapi.sellermethods.baseurl",sellerShipMethodsEndpoint:"promiseapi.sellermethods.endpoint",sellerShipMethodsSubKey:"promiseapi.sellermethods.subkey",sellerApiSellerIdBaseUrl:"sellerapi.sellerid.baseurl",sellerApiSellerIdEndpoint:"sellerapi.sellerid.endpoint",sellerApiZipCodeEndpoint:"sellerapi.zipCode.endpoint",sellerApiSellerIdSubKey:"sellerapi.sellerid.subkey",storeHierarchymktpApiEndpoint:"storehierarchymktp.endpoint",storehierarchymktpSubkey:"storehierarchymktp.subkey",sellerApiMarkettype:"sellerapi.markettype",s7Domain:"s7.domain",s7ContextPath:"s7.contextPath",wineLandingPromiseEndpoint:"promiseapi.winelandingpromise.endpoint",wineLandingPromiseSubKey:"promiseapi.winelandingpromise.subkey",plannedMealsEndpoint:"plannedmeals.endpoint",plannedMealsSubKey:"plannedmeals.subkey",mealsBundlesEndpoint:"mealsbundles.endpoint",mealsBundlesSubKey:"mealsbundles.subkey",targetedContentEndpoint:"targetedcontent.endpoint",targetedContentV2Endpoint:"targetedcontentv2.endpoint",targetedContentSubKey:"targetedcontent.subkey",targetedContentV2SubKey:"targetedcontentv2.subkey",webgenNotificationEndpoint:"webgen.notification.endpoint",webgenNotificationSubkey:"webgen.notification.subkey",webgenNotificationExpiry:"webgen.notification.expiry",targetedContentLandingEndpoint:"targetedContentLanding.endpoint",targetedContentLandingEndpointSubkey:"targetedContentLanding.subkey",curatedMealsV2Endpoint:"curatedmealsv2.mockendpoint",curatedMealsV2SubKey:"curatedmealsv2.mocksubkey",globalHeaderGetNavigationEndpoint:"globalHeader.getNavigation.endpoint",globalHeaderGetNavigationSubKey:"globalHeader.getNavigation.subkey"};
1Object.keys(t).forEach(e=>{window.AB[e]=this.wcaxXapiConfig[t[e]]}),window.AB.globalHeaderGetNavigationTimeout=this.wcaxXapiConfig["globalHeader.getNavigation.timeout"]||3e3,this.carouselOfferAPIBased=this.wcaxXapiConfig["carousel.offer.apibased.flag"],this.carouselProductAPIBased=this.wcaxXapiConfig["carousel.product.apibased.flag"],this.carouselRolloutBanners=this.wcaxXapiConfig["carousel.rollout.banners"]}else this.wcaxXapiConfig={}},this.initOCGPConfig=function(e){if(""!==e){this.ocgpConfig=JSON.parse(e),window.AB.ocgp={};const t={apimKey:"ocgp.apim.key",endpoint:"ocgp.endpoint",optin:"ocgp.endpoint",programs:"ocgp.programs",programPoints:"ocgp.programPoints",prizes:"ocgp.prizes",redemption:"ocgp.redemption",sweepstakeWinner:"ocgp.sweepstakeWinner",sweepstakesWinDisplay:"ocgp.sweepstakesWinDisplay",gameActivity:"ocgp.gameActivity",postGameDetails:"ocgp.postGameDetails",userPrizeTransactions:"ocgp.userPrizeTransactions",userGameActivity:"ocgp.userGameActivity"};Object.keys(t).forEach(e=>{window.AB.ocgp[e]=this.ocgpConfig[t[e]]})}else this.ocgpConfig={}},this.initESFFConfig=function(e){""!==e?(this.esffConfig=JSON.parse(e),window.AB.esff={},window.AB.esff.apimKey=this.esffConfig["esff.apim.key"],window.AB.esff.endpoint=this.esffConfig["esff.endpoint"]):this.esffConfig={}},this.initPastOrderStatusConfig=function(e){""!==e?(this.pastOrderStatusConfig=JSON.parse(e),window.AB.pastOrderStatusApimKey=this.pastOrderStatusConfig["past.order.status.apim.key"],window.AB.pastOrderStatusEndpoint=this.pastOrderStatusConfig["past.order.status.endpoint"]):this.pastOrderStatusConfig={}},this.initThemeBuilderFlag=function(e){this.isThemeBuilderEnabled=e},this.initPharmacyRxConfig=function(e){this._initJsonConfig(e,"pharmacyRxConfig")},this.getBannerConventions=function(){return this.bannerConventionsJson},this.getConfigforPromoDesc=function(){const e=this.getBannerConventions();return[{rule:new RegExp("(buy.*get.*one)","gi"),value:e.buy_one_get_one_free||"",priceColor:!1,showStrikeThrough:!1,offerText:e.bogoOfferText},{rule:new RegExp("(reward|club|sale|alert|remarkable)\\s(card|price|now)","gi"),value:e.promoDescription||"",priceColor:!0,offerText:"",showStrikeThrough:!0}]},this.getResolvedBanner=function(){return this.resolvedBanner},this.isNonShopBanner=function(e){return-1!==Object.values(this.nonShopBanners).indexOf(e)},this.tagCookiesSecure=function(){return"false"!==SWY.configService.cookiesSecureFlag},this.enablePrebookSlotModal=function(){return"false"!==SWY.configService.enablePrebookSlotModalFlag},this.generateRedirectUrl=function(e,t){let o=e;return SWY.ENFORCEMENTUTILS.isHtmlPage(o)||(o+=".html"),o.replace("{banner}",t)},this.getOktaConfig=function(){const e=SWY.CONFIGSERVICE.oktaConfig,t=SWY.CONFIGSERVICE?.featureToggleConfig?.enableOktaSingleDomain||!1;return{url:e.url,clientId:e.webClientId,redirectUri:window.location.origin+e.unifiedLoginRedirectURI,signOutLink:e.logoutRedirectURI,issuer:t?e.issuerSingleDomain:e.issuer,authParams:{responseType:["code"],responseMode:"form_post",scope:["openid","profile","email"]}}},this.getOktaAssistantSignInConfig=function(){const e=SWY.CONFIGSERVICE.oktaConfig;return{url:e.url,clientId:localStorage.getItem("assistant_client_id"),redirectUri:localStorage.getItem("assistant_redirect_uri"),signOutLink:e.logoutRedirectURI,issuer:e.issuer,state:localStorage.getItem("assistant_state"),userLocale:"en-US",authParams:{responseType:["code"],responseMode:"form_post",scope:localStorage.getItem("assistant_scope")}}},this.getDatapowerConfig=function(){return SWY.CONFIGSERVICE.datapowerConfig},this.setCookie=function(e,t,o,i){"SAFEWAY_KMSI"!==(e=SWY.CONFIGSERVICE.getResolvedCookieName(e))||AB.COMMON.isB2BSite()?"B_SAFEWAY_KMSI"===e&&AB.COMMON.isB2BSite()&&(e="ACI_S_B_SAFEWAY_KMSI"):e="ACI_S_SAFEWAY_KMSI";const n=SWY.CONFIGSERVICE.tagCookiesSecure()?";secure;":";";if(SWY.CONFIGSERVICE.isCookieEnabled())if("true"===i)document.cookie=e+"="+t+";"+o+";path=/"+n;else if(o>0){const i=new Date;i.setTime(i.getTime()+864e5*o),document.cookie=e+"="+t+";expires="+i.toUTCString()+";path=/"+n}else document.cookie=e+"="+t+";path=/"+n;else AB.cookie[e]={value:t,expires:new Date((new Date).getTime()+864e5*o).toUTCString()}},this.deleteCookie=(e,t)=>{const o="=; expires=Thu, 05-Mar-1992 00:00:01 GMT; path=/;domain="+t;
1Array.isArray(e)?e.forEach(e=>{document.cookie=e+o}):document.cookie=e+o},this.setDomainCookie=function(e,t,o,i){if(AB.COMMON.isB2BSite()&&this.topLevelSessionCookies.includes(e))return void this.setCookie(e,t,i);"SAFEWAY_KMSI"!==(e=SWY.CONFIGSERVICE.getResolvedCookieName(e))||AB.COMMON.isB2BSite()?"B_SAFEWAY_KMSI"===e&&AB.COMMON.isB2BSite()&&(e="ACI_S_B_SAFEWAY_KMSI"):e="ACI_S_SAFEWAY_KMSI";const n=SWY.CONFIGSERVICE.tagCookiesSecure()?";secure;":";";if(SWY.CONFIGSERVICE.isCookieEnabled())if(i>0){const s=new Date;s.setTime(s.getTime()+864e5*i),document.cookie=e+"="+t+";expires="+s.toUTCString()+";path=/"+n+"domain=."+o}else document.cookie=e+"="+t+";path=/"+n+"domain=."+o;else AB.cookie[e]={value:t,expires:new Date((new Date).getTime()+864e5*i).toUTCString()}},this._readCookieValue=function(e){if(!SWY.CONFIGSERVICE.isCookieEnabled()){const t=AB.cookie[e];return t&&!this.hasTimeExpired(t.expires)?decodeURIComponent(t.value):""}const t=e+"=",o=decodeURIComponent(document.cookie).split(";").find(e=>e.trim().startsWith(t));return o?o.trim().substring(t.length):""},this.getCookie=function(e){return e="absVisitorId"===e?"absVisitorId":SWY.CONFIGSERVICE.getResolvedCookieName(e),SWY.CONFIGSERVICE._readCookieValue(e)},this.checkforOldKMSI=function(e){return new RegExp("(^|;\\s*)(SAFEWAY_KMSI|B_SAFEWAY_KMSI)=").test(e)},this.getKmsiValue=function(e){return SWY.CONFIGSERVICE._readCookieValue(e)},this.checkGotoReferralURL=function(){this.isLSCompatible()&&localStorage.getItem("referralUrl")&&localStorage.removeItem("referralUrl")},this.getPreUserInfo=function(){AB.userInfo.prepareSharedInfo(),AB.userInfo.resolveDisplayableBanner(),AB.userInfo.resolveSiteType(),AB.preInitializeObject()},this.isLSCompatible=function(){if(void 0===this.isLSEnabled)try{localStorage.setItem("test","test"),localStorage.removeItem("test"),this.isLSEnabled=!0}catch(e){this.isLSEnabled=!1}return this.isLSEnabled},this.clearLocalStroage=function(){if(this.isLSCompatible()){const e=localStorage.getItem("storeData");e&&localStorage.setItem("previousStoreData",e),["abCart","abRewards","abJ4uCoupons","behaviorCoupons","storeData","cartId","showBoxtop","abSlot","abSlotEditOrder","abOrderCount","assistant_redirect_uri","assistant_client_id","assistant_scope","assistant_state","RPLNM.DEV","rp_localCart","abSubscriptions","abNgSubscriptions","realTimePopularSearchItems","oosBPNs","freshPassModalClosedOn","abPreFetchExperiment"].forEach(e=>localStorage.removeItem(e))}else document.cookie="cartId=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;",this.setCookie("abSlot","",-1);["OrderNumber","OrderStoreId","SlotInfo","rp_retailerAuthCode","ACI_S_EXP_PF"].forEach(e=>{document.cookie=e+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"}),["rp_userToken","rp_userLastAccessed","rp_autoDeliveryUser","rp_authState","rp_retailerUserSpoofing"].forEach(e=>{sessionStorage.removeItem(e)})},this.getProp65Details=function(){const e=this.getBannerConventions();return{prop65Flag:!0===SWY.configService.prop65WarningFlag||"true"===SWY.configService.prop65WarningFlag,prop65Title:e.prop65WarningHeader||"",prop65PDPTitle:e.proposition65WarningHeader||""}},this.isWCMModeDisabled=function(){const e=this.getCookie("wcmmode");return!(e&&"edit"===e)},this.checkLocalStorageRefresh=function(){SWY.ENFORCEMENTUTILS.checkReInitSite("wwwlocal")?(this.isLSCompatible()&&(localStorage.removeItem("abRewards"),localStorage.removeItem("abJ4uCoupons"),localStorage.removeItem("storeData")),SWY.ENFORCEMENTUTILS.removeReInitSite("wwwlocal")):(AB.COMMON.isAnonymous()||""==AB.userInfo.j4u.storeId)&&this.isLSCompatible()&&(localStorage.removeItem("abRewards"),localStorage.removeItem("abJ4uCoupons")),SWY.ENFORCEMENTUTILS.checkReInitSite("shoplocal")&&(this.isLSCompatible()?(localStorage.removeItem("abCart"),localStorage.removeItem("abSlot")):this.setCookie("abSlot","",-1),SWY.ENFORCEMENTUTILS.updateReInitSite("slot"),SWY.ENFORCEMENTUTILS.removeReInitSite("shoplocal")),"weeklyadclip"==window.SWY.CONFIGSERVICE.getCookie("ECommReInit")&&(localStorage.removeItem("abJ4uCoupons"),localStorage.removeItem("behaviorCoupons"),window.SWY.CONFIGSERVICE.setDomainCookie("ECommReInit","",window.SWY.CONFIGSERVICE.resolvedBanner+".com",0))},this.initDomainConfig=function(e){this._initJsonConfig(e,"domainConfig")},this.isCookieEnabled=function(){return!!navigator.cookieEnabled||void 0===navigator.cookieEnabled&&(document.cookie="testcookie",-1!==document.cookie.indexOf("testcookie"))},this.hasTimeExpired=function(e){try{return!!e&&(new Date).getTime()>
1new Date(e).getTime()}catch(e){return!0}},this.disableLog=function(){window.console.log=function(){},window.console.debug=function(){},window.console.info=function(){}},this.getCurrentEnviormentVal=function(){const e=window.location.host;SWY.CONFIGSERVICE.env=[["-local-origin","local-origin"],["-dev1","dev1"],["-qa1","qa1"],["-dev2","dev2"],["-qa2","qa2"],["-dev3","dev3"],["-qa3","qa3"],["-stage","stage"],["-beta","beta"],["-prod","prod"]].find(([t])=>e.includes(t))?.[1]||"prod"},this.initOsdpConfig=function(e){this._initJsonConfig(e,"osdpConfig")},this.getResolvedCookieName=function(e){if(SWY.CONFIGSERVICE.featureToggleConfig?.isCookieACIPrefixEnabled){if(e&&this.ACIStrictCookies.includes(e))return this.resolveACICookie(e,"S_");if(e&&this.ACIFunctionalCookies.includes(e))return this.resolveACICookie(e,"F_");if(e&&this.ACIAnalyticsCookies.includes(e))return this.resolveACICookie(e,"A_")}return SWY.CONFIGSERVICE.isB2CSessionCookieOnB2B(e)?"B_"+e:e},this.isB2CSessionCookieOnB2B=function(e){return""===AB.userInfo?.siteType&&AB.userInfo.resolveSiteType(),!(!e||e.startsWith("B_")||"B"!==AB.userInfo.siteType||!this.sessionCookiePrefixes.some(t=>e.startsWith(t)))},this.resolveACICookie=function(e,t){const o="ACI_"+t;return e.startsWith(o)||AB.COMMON.isB2BSite()?!e.startsWith(o)&&AB.COMMON.isB2BSite()&&e.startsWith("B_")?o+e:SWY.CONFIGSERVICE.isACISessionCookieOnB2B(e,o)?o+"B_"+e:e:o+e},this.isACISessionCookieOnB2B=function(e,t){const o=t+"_B_";return!(!e||e.startsWith(o)||!AB.COMMON.isB2BSite()||!this.sessionCookiePrefixes.some(t=>e.startsWith(t)))}}.call(SWY.CONFIGSERVICE),function(){function e(e){const t=SWY.CONFIGSERVICE.getOktaConfig(),o={client_id:t.clientId,redirect_uri:t.redirectUri,response_type:"code",response_mode:"query",state:crypto.randomUUID(),nonce:"ovJgrUobDYQKhiownVT9jU1GvtkRdpC4Eoyal2SfgGu6ezXG5b03393l08xbDGw8",scope:"openid profile email offline_access used_credentials"},i=Object.fromEntries(Object.entries(e).filter(([,e])=>null!=e));return t.issuer+"/v1/authorize?"+new URLSearchParams(Object.assign(o,i)).toString()}this.generateWords=function(){return crypto.randomUUID()},this.reviewOKTASessionToRefresh=function(){const e=SWY.CONFIGSERVICE.getOktaConfig().url;$.ajax({url:e+"/api/v1/sessions/me/lifecycle/refresh",type:"POST",xhrFields:{withCredentials:!0},accept:"application/json"}).done(function(e){e&&e.status&&(e.login&&(SWY.previousLogin.email=e.login),"ACTIVE"!==e.status&&"MFA_ENROLL"!==e.status||(SWY.CONFIGSERVICE.setCookie("ECommSignInCount",0,0),"G"===AB.userInfo.userType&&SWY.CONFIGSERVICE.featureToggleConfig.enableBannerSwitchSSO&&(window.location.href=window.location.origin+SWY.ssoPath)))}).fail(function(e){const t={403:"Forbidden - cannot refresh session.",404:"Not Found - cannot refresh session.",429:"Too many requests - ignoring."}[e.status]||"Invalid URL or cross-origin request blocked for: "+window.location.origin;console.log("reviewOKTASessionToRefresh ["+e.status+"]: "+t)})},this.refreshSession=function(e){new OktaAuth(SWY.CONFIGSERVICE.getOktaConfig()).session.refresh().then(function(){console.log("Okta session refreshed.")}).catch(function(t){console.log("Okta session refresh failed - forcing sign-out.",t),SWY.OKTA.signOut(e),SWY.OKTA.system_error_logout()})},this.kmsi_prefilled_check=function(){"true"===SWY.ENFORCEMENT.getCookie("SAFEWAY_KMSI")&&$("#rememberMe").prop("checked",!0)},this.system_error_logout=function(){SWY.CONFIGSERVICE.getCookie("SAFEWAY_KMSI")&&SWY.CONFIGSERVICE.setDomainCookie("SAFEWAY_KMSI","Error",SWY.CONFIGSERVICE.resolvedBanner+".com",0)},this.autoSignInWithSessionToken=function(t,o){if(!t)return;const i=e({sessionToken:t});SWY.CONFIGSERVICE.checkLocalStorageRefresh(),SWY.CONFIGSERVICE.setDomainCookie("SAFEWAY_KMSI",!0,SWY.CONFIGSERVICE.resolvedBanner+".com",90),o?SWY.CONFIGSERVICE.setCookie("ACI_S_ECommRedirectURL","/pharmacy.html",1):(AB.COMMON.userNotifyReloadPage("Password successfully updated!"),localStorage.setItem("analyticsPwdResetSuccess",!0)),window.location.href=i},this.autoSignInAfterRegistration=function(t,o){if(!t)return;const i=localStorage.getItem("assistant_client_id"),n=localStorage.getItem("assistant_redirect_uri"),s=localStorage.getItem("assistant_scope"),r=localStorage.getItem("assistant_state"),a="true"===o&&(n||i||s||r),c=e(a?{client_id:i,redirect_uri:n,scope:s,state:r,sessionToken:t}:{sessionToken:t});AB.COMMON.userNotifyReloadPage("Account successfully created! You are now signed in."),localStorage.setItem("create-account-success",!0),AB.DATALAYER&&AB.DATALAYER.setEmailAndSmsOptIn(),SWY.CONFIGSERVICE.checkLocalStorageRefresh(),AB.COMMON.authorize()?(AB.COMMON.setCookie("ECommRedirectURL","/?newPharmacyAccount=true&sessionToken="+t,0),SWY.OKTA.silentSignOutFromOkta(event)):(a||SWY.CONFIGSERVICE.setDomainCookie("SAFEWAY_KMSI",!0,SWY.CONFIGSERVICE.resolvedBanner+".com",90),window.location.href=c)}}.call(SWY.OKTA),function(e,t){function o(e){const t=window.SWY.CONFIGSERVICE.getDatapowerConfig();return{"Content-Type":"application/vnd.safeway.v"+e+"+json",Accept:"application/vnd.safeway.v"+e+"+json",Authorization:"Bearer "+window.AB.userInfo.SWY_SHOP_TOKEN,"x-swy-banner":window.SWY.CONFIGSERVICE.getResolvedBanner(),"x-swy-correlation-id":window.AB.COMMON.generateUUID(),"x-swy-client-id":"web-portal","Ocp-Apim-Subscription-Key":t.cncSubscriptionKey}}function i(e,t,o,i){const n=JSON.parse(JSON.stringify(e)),s=JSON.parse(JSON.stringify(e));if(n.shippingInfo={},s.shippingInfo={}
1,Object.keys(e.shippingInfo).forEach(function(t){const o=e.shippingInfo[t];(o.displayArriveByTS?n:s).shippingInfo[t]=o}),Object.keys(n.shippingInfo).length>0&&localStorage.setItem(t,JSON.stringify(n)),o&&o.errors){const e={errors:o.errors};Object.keys(s.shippingInfo).length>0&&(e.shippingInfo=s),i(e)}}function n(e){return null!=e&&"null"!==e&&"undefined"!==e}function s(e,t,o){const i=RegExp("[?&]"+t+"=([^&]*)").exec(e);if(!i)return null;const n=i[1].replace(/\+/g," ");return!1===o?n:decodeURIComponent(n)}function r(e,t){SWY.CONFIGSERVICE.isLSCompatible()&&localStorage.setItem(e,JSON.stringify({message:t,isDisplayed:!1}))}function a(e){e=e.replace(/-/g,"+").replace(/_/g,"/"),e+="=".repeat((4-e.length%4)%4);const t=window.atob(e),o=new Uint8Array(t.length);for(let e=0;e<t.length;e++)o[e]=t.charCodeAt(e);return o}function c(e){return btoa(new Uint8Array(e).reduce(function(e,t){return e+String.fromCharCode(t)},""))}this.doInit=function(){},this.sitePreInit=function(){},this.siteCoreUPreInit=function(){},this.siteUCAPreInit=function(){},this.siteJ4UPreInit=function(){},this.siteWWWPreInit=function(){},this.siteRecipesPreInit=function(){},this.doCoreInit=function(){},this.doUCAInit=function(){},this.doJ4UInit=function(){},this.doShopInit=function(){},this.doWWWInit=function(){},this.doRecipesInit=function(){},this.resolveJquery=function(){return null!=AB.$?AB.$:jQuery},this.getBreakpoint=function(){const e=$(window).width();return e<768?"mobile":e<992?"tablet":"desktop"},this.setCookie=function(e,t,o){SWY.CONFIGSERVICE.setCookie(e,t,o)},this.getCookie=function(e){return SWY.CONFIGSERVICE.getCookie(e)},this.modalTrapKeyboard=function(e){const t=document.querySelector(e);t&&t.addEventListener("keydown",function(e){if("Tab"!==e.key&&9!==e.keyCode)return;const t=e.currentTarget.querySelectorAll('[data-tabindex="first"]')[0],o=e.currentTarget.querySelectorAll('[data-tabindex="last"]')[0];e.shiftKey?document.activeElement===t&&(o.focus(),e.preventDefault()):document.activeElement===o&&(t.focus(),e.preventDefault())})},this.checkAndRedirectUrl=function(e){"true"==$("meta[name=syndicatedHeader]").attr("content")&&(window.location.href=e)},this.checkRedirectParameter=function(){let e=this.getURLParameterByName("goto",!1);null==e||n(localStorage.getItem("gotoRedirectUrl"))||(e=AB.COMMON.updateGotoUrl(decodeURIComponent(e)),this.updateRedirectURLCookie(e))},this.updateGotoUrl=function(e){if(!e)return e;const t=e.split("?",2);let o=AB.COMMON.removeURLParameterByName(window.location.search,"goto");return 0===o?.indexOf("?")&&(o=o.substr(1)),t[0]+"?"+(t[1]?SWY.QUERYSTRING.mergeMarketingParams(t[1],o):o)},this.checkRedirectParameterReferralUrl=function(e){const t=this.getURLParameterByNameReferralUrl(e,"goto",!1);null!=t?n(localStorage.getItem("gotoRedirectUrl"))||this.updateRedirectURLCookie(decodeURIComponent(t)):this.updateRedirectURLCookie(e)},this.checkRedirectParameterReferralUrlPartners=function(e){const t=this.getURLParameterByNameReferralUrl(e,"goto",!0);this.isEmpty(t)||(localStorage.setItem("gotoRedirectUrl",t),this.updateRedirectURLCookie(""),location.reload())},this.updateRedirectURLCookie=function(e){const t=encodeURIComponent(e);if(null!=e&&e.length>0)this.setCookie("ECommRedirectURL",t,0);else{const e=this.getCookie("ECommRedirectURL");null!=e&&e.length>0&&this.setCookie("ECommRedirectURL",t,0)}},this.authorize=function(){const e=String(AB.userInfo.userType).toLowerCase();return void 0!==AB.userInfo.userType&&""!==e&&"g"!==e&&"a"!==e&&null!==e},this.isAnonymous=function(){const e=String(AB.userInfo.userType).toLowerCase();return void 0===AB.userInfo.userType||""===e||"a"===e},this.updateGlobalNavigation=function(){$(".global-navigation-list").find("li a").each(function(){AB.COMMON.updateHrefPlaceholder(this)})},this.create_UUID=function(e){let t=(new Date).getTime();const o="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const o=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?o:3&o|8).toString(16)});return e?e+"-"+o:o},this.setUpdateVisitorIdForGrs=function(){const e=new Date,t=7776e6;if(SWY.CONFIGSERVICE.isLSCompatible())if(null===localStorage.getItem("visitor_id")){const o={id:AB.COMMON.create_UUID("visitor"),expires:e.getTime()+t};localStorage.setItem("visitor_id",JSON.stringify(o))}else{const o=JSON.parse(localStorage.getItem("visitor_id"));o.expires=e.getTime()+t,localStorage.setItem("visitor_id",JSON.stringify(o))}},this.setSessionIdForGrs=function(){const e=new Date,t={id:AB.COMMON.create_UUID("session"),expires:e.getTime()+7776e6};sessionStorage.setItem("session_id",JSON.stringify(t))}
1,this.updateAttributionToken=function(e){SWY.CONFIGSERVICE.isLSCompatible()&&localStorage.setItem("attribution_token","mock"===e?AB.COMMON.create_UUID():e)},this.updatePlaceholdersInOtherHref=function(){const e=$("#globalNav").find("li a");$("a[href]").not(e).each(function(){AB.COMMON.updateHrefPlaceholder(this)}),AB.COMMON.updateHrefPlaceholder(document.querySelector("a.aisle-flyout-link")),AB.COMMON.updateHrefPlaceholder(document.querySelector("link[rel=canonical]"))},this.updateHrefPlaceholder=function(e){if(!e)return;const t=window.location.href,o=t.includes("shop/brands/")||t.includes("shop/brand-index");let i=this.applyChangeToUrlPatterns(e.getAttribute("href"));(o||this.canPassLOC(i)&&"canonical"===e.getAttribute("rel"))&&(i=e.getAttribute("href")),e.setAttribute("href",i)},this.handleSelectedBrand=function(e){$(".bi-alph-list__alphabets-item .bi-alph-list__alphabets-item-link").removeClass(),$(e).addClass("bi-alph-list__alphabets-item-link")},this.applyChangeToUrlPatterns=function(e){if(!e)return e;const t=e.includes("/aisles")&&!e.includes("(")&&!e.includes(")"),o=t?e.indexOf("."):e.indexOf("("),i=t?e.indexOf(".html"):e.indexOf(")");if(-1===o||-1===i)return e;const n=String(e).substring(o+1,i).split("."),s=n[n.length-1];if(t&&this.canPassLOC(e)){if(-1!==e.indexOf("loc="))e=e.replace(e.substring(e.indexOf(".html")+5),"?loc="+AB.userInfo.getValue("branchId"));else if(i>o){const t=-1!==e.indexOf("?")?"&":"?";e=e.replace("."+s,"")+t+"loc="+AB.userInfo.getValue("branchId")}return e}if(n.length>1&&(!s||isNaN(s))||Number(s)===Number(AB.userInfo.getValue("branchId")))return e;let r="";if("aisleId"===s){const e=document.querySelector(".dynamic-page-title .dynamic-page-title__container");e&&(r=e.dataset.aisleId)}else r=t?AB.userInfo.getValue("branchId"):AB.userInfo.getValue(s);return r?(e=t&&!isNaN(s)?String(e).replace(s,r):String(e).replace("("+s+")",r),this.applyChangeToUrlPatterns(e)):e},this.canPassLOC=function(e){const t=e?.toLowerCase();return!t?.includes("vineandcellar")&&!t?.includes("marketplace")},this.removeURLParameterByName=function(e,t){return e.replace(new RegExp("[?&]"+t+"=[^&#]*(#.*)?$"),"$1").replace(new RegExp("([?&])"+t+"=[^&]*&"),"$1")},this.getURLParameterByName=function(e,t){return s(window.location.search,e,t)},this.getURLParameterByNameReferralUrl=function(e,t,o){return s(e,t,o)},this.checkPendingOrder=function(){const e=!0===window.SWY?.CONFIGSERVICE?.featureToggleConfig?.isB2BDisabled||"B"!==AB?.userInfo?.siteType?"OrderNumber":"B_OrderNumber",t=AB.COMMON.getCookie(e);return null!=t&&""!==t},this.isLSCompatible=function(){return SWY.CONFIGSERVICE.isLSCompatible()},this.isEmpty=function(e){return null==e||!(e.length>0)&&(0===e.length||"object"!=typeof e||0===Object.keys(e).length)},this.redirectErrorPage=function(){window.location.href="/error-page/500.html"},this.reloadForOkta=function(){SWY.CONFIGSERVICE.isLSCompatible()&&localStorage.refresh&&(localStorage.removeItem("refresh"),SWY.STORESELECTION.reloadPage(1e3))},this.initAngularServiceCall=function(){const e=window.appConfigServiceRef;if(null==e)return;const t=["initServiceCall","initPopupWrapper","initProfileCompletion","initSpecialOccasions"],o=window?.SWY?.CONFIGSERVICE?.featureToggleConfig?.enableProfileComplete,i=window?.SWY?.CONFIGSERVICE?.featureToggleConfig?.enablePostAuthNotifyMessage;o&&t.push("initUtilityBarWrapper"),i&&t.push("initPostAuthNotification"),t.forEach(function(t){e.zone.run(function(){e.service[t]()})})},this.openAuthenticateModal=function(e,t){"account"===t&&AB.COMMON.setCookie("ECommRedirectURL",encodeURIComponent(window.location.href),0),null!=window.signInModal&&(window.signInModal.zone.run(function(){window.signInModal.component.showModal(e)}),window.AB?.DATALAYER&&window.AB.DATALAYER.setSignInModalEvents("view","signIn"===e?"otp:lets-find-your-account|view":"createAccount Modal|view","",t));const o=HtmlUtil.readElement(".sign-in-background");$("#signin-dropdown").hide(),o.css("display","none"),$(".button__item.menu-nav__red-caret-down").removeClass("menu-nav__red-caret-up")},this.mapSyndicatedCookie=function(){const e=SWY.CONFIGSERVICE.getCookie("SWY_SYND_USER_INFO");if(e){const t=JSON.parse(e);AB.userInfo.j4u.storeId=t.storeId,AB.userInfo.j4u.zipcode=t.storeZip,AB.userInfo.j4u.storeData.storeLocation.address=t.storeAddress}},this.isErumsPage=function(){return window.location.href.indexOf("/erums")>0},this.isSignInPage=function(){return window.location.href.indexOf("sign-in.html")>0},this.autoSignInIfSessionTokenAvailable=function(){if(!this.authorize()){const e=this.getURLParameterByName("sessionToken",!1),t=this.getURLParameterByName("newPharmacyAccount",!1);e&&e.length>0&&SWY.OKTA.autoSignInWithSessionToken(e,t)}},this.userNotifyReloadPage=function(e){r("notifyMessage",e)},this.postAuthUserNotifyReload=function(e){r("postAuthNotifyMessage",e)},this.setDeviceId=function(e){if("function"!=typeof md5)return console.warn("MD5 function not available - make sure the script is loaded before calling getDeviceToken."),null;const t=navigator.userAgent+navigator.mimeTypes.length+navigator.plugins.length+window.screen.width+window.screen.height+window.screen.pixelDepth,o=md5(t),i=AB.COMMON.getCookie(e),n=i?JSON.parse(i):{info:{COMMON:{}}};return n.info.COMMON.deviceId=o,AB.COMMON.setCookie(e,encodeURIComponent(JSON.stringify(n)),0),o},this.getDeviceId=function(){const e="SWY_SHARED_SESSION_INFO",t=AB.COMMON.getCookie(e),o=t?JSON.parse(t):{info:{COMMON:{}}};return o?.info?.COMMON?.deviceId||this.setDeviceId(e)},this.checkForEditOrderMode=function(){const e=AB.COMMON.getCookie("SlotInfo"),t=AB.COMMON.getCookie("OrderStoreId");return"undefined"!==e&&"undefined"!==t&&""!==e&&""!==t},this.isSessionTokenValid=function(){if(!AB.COMMON.authorize()||!AB.userInfo.customerId||!AB.userInfo.SWY_SHOP_TOKEN)return!1;let e=!1,t=!1;try{const t=JSON.parse(SWY.CONFIGSERVICE.getCookie("SWY_SHARED_SESSION_INFO")||"null");if(t){const o=t.info.COMMON.userType;e="object"==typeof t&&("C"===o||"R"===o)}}catch(t){e=!1}try{t=SWY.ENFORCEMENT.isTokenActive()}catch(e){t=!1}return e&&t},this.getActiveSessionUser=function(){const e=AB.userInfo.j4u.zipcode||JSON.parse(localStorage.getItem("abStoreAddress")).storeZipcode||"",t={customerId:null,tokenExpiration:null,SWY_SHOP_TOKEN:null,firstName:AB.userInfo.firstName,clubCardNumber:AB.userInfo.clubCard,hhid:AB.userInfo.houseId,uuid:"",storeId:AB.userInfo.j4u.storeId,zipcode:e,channel:AB.COMMON.getUserChannel(),storeAddress:AB.storeInfo.storeAddress,searchUid:AB.COMMON.getCookie("_br_uid_2")};if(AB.COMMON.isSessionTokenValid()){["customerId","SWY_SHOP_TOKEN","storeId","zipcode"].forEach(function(e){t[e]=AB.userInfo[e]||AB.userInfo.j4u[e]});const e=AB.COMMON.getCookie("SWY_SHARED_PII_SESSION_INFO");t.uuid=e?JSON.parse(e).uuid:""}return AB.userInfo?.expireTime&&(t.tokenExpiration=AB.userInfo.expireTime),t},this.setTopNavPreviousPage=function(e,t,o,i){AB.DATALAYER?(AB.DATALAYER.setTopNavPreviousPage(e,t),"shop_leftnavigation"!==o&&"account_rightnavigation"!==o&&"top_headernavigation"!==o||AB.DATALAYER.setB2BModalEvent("modalClick",o+"|"+i)):localStorage.getItem("analyticsPageInfo")&&(localStorage.setItem("topNavPreviousPage",localStorage.getItem("analyticsPageInfo")),localStorage.removeItem("analyticsPageInfo"))},this.trackShopFlyout=function(e){AB.DATALAYER&&AB.DATALAYER.trackShopFlyout(e)},this.trackAccFlyout=function(){AB.DATALAYER&&AB.DATALAYER.trackAccFlyout()},this.validateSession=function(e){AB.COMMON.authorize()&&(SWY.ENFORCEMENT.isTokenActive()&&AB.userInfo.SWY_SHOP_TOKEN?e():SWY.ENFORCEMENT.checkAuthorizedCookie()?$.get({url:AB.userInfoPath,mimeType:"text/plain"}
1).done(function(){AB.userInfo.updateTokenRefreshProperty(),e()}).fail(function(e){console.error(e),$("#sessionTimeoutModal").modal({show:!0})}):$("#sessionTimeoutModal").modal({show:!0}))},this.getStoreResolverPayload=function(e,t,o,i,n,s,r){const a={type:"GET",headers:i,url:e+t,data:o,dataType:"json"};if(n)return new Promise(function(e,t){$.ajax(Object.assign({},a,{success:e,error:t}))});$.ajax(Object.assign({},a,{async:!1,success:s,error:function(e){throw r(e),"Error in store resolver "+e}}))},this.switchOTPContentSignIn=function(e,t,o){$("#"+e).removeClass("mask"),$("#"+t).addClass("mask"),$("#signInOTPForm").trigger("reset"),AB.SIGNINOTP.showHideSection(["otp-modal","otp-modal-buttons","kmsi-modal-otp"],["verify-otp-modal","verify-otp-modal-buttons","enter-password-modal","enter-password-modal-buttons"]),AB.SIGNINOTP.hideSpinner(),$("#idform").trigger("reset"),o&&$("."+o).focus(),AB.COMMON.reSignIn(!0),AB.COMMON.prepopulateEmailFieldProgProf()},this.prepopulateEmailFieldProgProf=function(){if(!new URLSearchParams(window.location.search).get("progProfUser"))return;const e=sessionStorage.getItem("ppUsername");["#email-mobile-otp","#label-email"].forEach(function(t){const o=$(t);null!=o&&o.val(e).blur().attr("disabled","true")})},this.resetKmsiUser=function(){const e=window.location.href,t=window.location.hash;e.includes("/account/sign-in")&&(t.length>0&&t.includes("error")||e.includes("IAUC408.html"))&&SWY.OKTA.system_error_logout()},this.getPromiseApiShippingInfo=function(e){const t=new Date,o=window.AB.mktpShippingInfoLS,n=function(e){const t=localStorage.getItem(e);if(!t)return null;const o=JSON.parse(t),i=o.expiry-(new Date).getTime();return i<=0?(localStorage.removeItem(e),null):(setTimeout(function(){localStorage.removeItem(e)},i),o)}("mkpShipping");if(window.AB.isLSEnabled&&n)return Promise.resolve(n);const s=AB.sellerShippingMethodsOptions,r=window.AB.sellerShipMethodsBaseUrl.replace("{banner}",SWY.CONFIGSERVICE.getResolvedBanner())+window.AB.sellerShipMethodsEndpoint,a={zipcode:window.AB.userInfo.zipcode,shippingInfo:{},expiry:{}};return new Promise(function(n,c){$.ajax({type:"POST",headers:s,url:r,data:JSON.stringify(e),dataType:"json",async:!1,success:function(e,s,r){e?.shipMethods?.length>0&&(a.shippingInfo=e.shipMethods.reduce(function(e,t){return Object.assign(e,{[t.sellerId]:t})},{}),a.expiry=t.getTime()+o,200===r.status&&(localStorage.setItem("mkpShipping",JSON.stringify(a)),n(a)),206===r.status&&i(a,"mkpShipping",e,n))},error:function(e){c({status:e.status,statusText:e.statusText})}})})},this.getPromiseApiWineShopShippingInfo=function(e){const t=new Date,o=window.AB.wineShippingInfoLS,n={zipcode:window.AB.userInfo.zipcode,branchId:window.AB.userInfo.branchId,wfcStoreId:AB?.storeFlagsData?.flags?.ecomStore?.wfcStoreId,shippingInfo:{},expiry:{}};return new Promise(function(s,r){$.ajax({type:"POST",headers:AB.wineShippingMethodsOptions,url:window.AB.wineLandingPromiseEndpoint,data:JSON.stringify(e),dataType:"json",async:!1,success:function(e,r,a){e?.shipMethods?.length>0&&(n.shippingInfo=e.shipMethods,n.expiry=t.getTime()+o,200===a.status&&(localStorage.setItem("wineShopShipping",JSON.stringify(n)),s(n)),206===a.status&&i(n,"wineShopShipping",e,s))},error:function(e){r({status:e.status,statusText:e.statusText})}})})},this.getShipInfoByProgram=function(e,t){return"wine"===e?this.getPromiseApiWineShopShippingInfo(t):"marketplace"===e?this.getPromiseApiShippingInfo(t):void 0},this.isB2BSite=function(){return!(!window.location.hostname||!window.location.hostname.startsWith("business"))},this.updateUserFirstName=function(e){const t=window.innerWidth;if(null!=e&&void 0!==e&&e.length>0){const t=19,o=e.length>t?e.substring(0,t-3)+"...":e;$(".user-greeting").text("Hi, "+o).css({"text-decoration":"none"})}if(t>1279&&$(".user-greeting")?.width()>154){const e="d-lg-inline-block";$(".user-greeting")?.removeClass(e),$(".button__item.menu-nav__red-caret-down")?.removeClass(e);const t=HtmlUtil.readElement(".sidebar__user-welcome.sidebar__show-user-welcome");t?.length>0&&(t[0].style.display="flex",t.hasClass("d-lg-none")&&t.removeClass("d-lg-none"))}},this.removeP13nOOSLocalStorage=function(){AB.COMMON.isLSCompatible()&&localStorage.removeItem("oosBPNs")},this.addAngularComponent=function(e){const t=document.createElement(e);let o=document.body,i=t;if("utility-bar-wrapper"===e){o=document.getElementById("utility-bar-wrapper")||document.body;const e=document.createElement("div");e.className="my-4",e.appendChild(t),i=e}o.appendChild(i)},this.addPassKey=async function(){try{const e=await async function(){try{const e=window.SWY.CONFIGSERVICE.getDatapowerConfig(),t=window.AB.userInfo.UUID,i=await fetch(e.csmsApiEndpoint+"/customers/"+t+"/factors",{method:"POST",headers:o(2),body:JSON.stringify({factorType:"webauthn",provider:"FIDO"})});if(!i.ok)throw new Error("Failed to create factors: "+i.statusText);const n=await i.json();return{factorId:n.id,activation:n.activation}}catch(e){throw{errorType:"UCA",errorValue:e}}}();if(!e?.activation||!e.factorId)throw new Error("Invalid data received from createFactors");const t=e.activation,i=(t.excludeCredentials||[]).map(function(e){return e.id?Object.assign({},e,{id:a(e.id)}):e}),n=await navigator.credentials.create({publicKey:{rp:t.rp,user:{displayName:t.user.displayName,name:t.user.name,id:a(t.user.id)},pubKeyCredParams:t.pubKeyCredParams,challenge:a(t.challenge),attestation:t.attestation,authenticatorSelection:t.authenticatorSelection,u2fParams:t.u2fParams,excludeCredentials:i}});if(!n)throw new Error("Failed to create credential");return{success:!0,response:await async function(e,t,i){const n=window.SWY.CONFIGSERVICE.getDatapowerConfig().csmsApiEndpoint+"/customers/"+window.AB.userInfo.UUID+"/factors/"+e+"/lifecycle/activate";try{const e=await fetch(n,{method:"POST",headers:o(3),body:JSON.stringify({attestation:t,clientData:i})});if(!e.ok)throw new Error("Failed to activate factor: "+e.statusText);return await e.json()}catch(e){throw{errorType:"UCA",errorValue:e}}}(e.factorId,c(n.response.attestationObject),c(n.response.clientDataJSON))}}catch(e){return{error:!0,errorDetails:e}}},this.getFactors=async function(){try{const e=window.SWY.CONFIGSERVICE.getDatapowerConfig(),t=window.AB.userInfo.UUID,i=await fetch(e.csmsApiEndpoint+"/customers/"+t+"/factors",{method:"GET",headers:o(2)});if(!i.ok)throw new Error("HTTP error! status: "+i.status);try{return await i.json()}catch(e){throw new Error("Failed to parse JSON response")}}catch(e){console.error("Error in submitUsername:",e.message,{error:e})}}}.call(AB.COMMON),AB.DIVISIONAL.modalTrapKeyboard=AB.COMMON.modalTrapKeyboard.bind(AB.DIVISIONAL),function(){this.updateUserSession=function(e,t,o,i,n,s,r){if("object"!=typeof e||""===e||void 0===e)return"Parameter passed is either empty or not an object";if(!e.info||void 0===e.info.COMMON&&void 0===e.info.J4U&&void 0===e.info.SHOP&&void 0===e.info.offbanner)return"Parameter passed doesn't match appropriate format";const a=AB.userInfo.userType.toLowerCase(),c=!!e.info.offbanner;if("g"===a||"a"===a)if(c)window.location=window.location.protocol+"//"+this.buildHost(e.info.offbanner.banner)+"/?storeId="+e.info.offbanner.storeId+"&preference="+e.info.offbanner.preference;else{const t=["abs_gsession","SWY_SHARED_SESSION_INFO","abs_previouslogin","SWY_SYND_USER_INFO"];if(t.forEach(t=>{this.isCookieEmpty(SWY.CONFIGSERVICE.getCookie(t))&&this.createSessionCookie(t,e)}),this.updateUserCookieList(t,e),n&&o(),"a"!==window.ABTestUtil?.getABTestValue("abACIP295974","isGuestAddToCartDisabled","ACIP295974")&&window?.cartServiceRefAL){const t=e.info.COMMON.preference??"";cartServiceRefAL.service.updateStoreForExistingCart(e.info.SHOP.storeId,t.toLowerCase(),"",e.info?.offbanner?.banner,o,"J4U"===t?e.info.J4U.zipcode:e.info.SHOP.zipcode)}}else if("r"===a||"c"===a){const n=["SWY_SHARED_SESSION_INFO","abs_previouslogin","SWY_SYND_USER_INFO"],a=SWY.CONFIGSERVICE.getCookie(n[0]);if(!1===t)return void this.updateUserCookieList(n,e);if(c){const t=e.info.offbanner;if(!t.preference.length)throw"Preference is empty";if(!t.storeId.length)throw"StoreId is empty";if(!t.banner.length)throw"Banner is empty";if(!t.zipcode.length)throw"Zipcode is empty";const a=t.preference.toUpperCase(),c="J4U"===a?t.storeId:null,l="J4U"!==a?t.storeId:null;return this.updateUcaProfile(a,c,l,t.banner,t.zipcode,e,n,!0,o,i,s,r)}{const t=e.info.COMMON.preference.length>0?e.info.COMMON.preference:a.info.COMMON.preference,i=SWY.CONFIGSERVICE.getResolvedBanner(),c="J4U"===t?e.info.J4U.zipcode:e.info.SHOP.zipcode,l=null;if(SWY.CONFIGSERVICE.featureToggleConfig.enableCookieRestructure){const t=e.info.COMMON.storeId&&e.info.COMMON.storeId.length>0?e.info.COMMON.storeId:a.info.COMOMN.storeId;return this.updateUcaProfile("UCA",t,t,i,e.info.COMMON.zipcode,e,n,l,o,null,s)}const d=t.toUpperCase();if("J4U"===d){const t=e.info.J4U.storeId&&e.info.J4U.storeId.length>0?e.info.J4U.storeId:a.info.J4U.storeId;return this.updateUcaProfile("J4U",t,l,i,c,e,n,l,o)}if("DUG"===d){const t=e.info.SHOP.storeId&&e.info.SHOP.storeId.length>0?e.info.SHOP.storeId:a.info.SHOP.storeId;return this.updateUcaProfile("DUG",l,t,i,c,e,n,l,o)}{const t=e.info.SHOP.storeId&&e.info.SHOP.storeId.length>0?e.info.SHOP.storeId:a.info.SHOP.storeId;return this.updateUcaProfile("DELIVERY",l,t,i,c,e,n,l,o,null,s,r)}}}},this.updateUcaProfile=function(e,t,o,i,n,s,r,a,c,l,d,u){const p=AB.userInfo.UUID;if(i=i.replace(/\s|-/g,""),!p){const e=new Error("CustomerId is not Available to Update Profile");return e.name="CustomerId","function"==typeof c?c(e):e}let f,S,h,C,g=!0,I="";"J4U"===e?(h=t,g=!1,f='{"stores":[{"storeId":"'+h+'","storePreference":"Preferred","address":{"zipCode":"'+n+'"},"banner":"'+i+'"}],"preferences":[{"categoryCode":"FULFILLMENT","subCategoryCode":"METHOD","value":"J4U","bannerId":"'+i+'"}]}'):"DUG"===e?(h=o,S="dug",f='{"stores":[{"storeId":"'+h+'","storePreference":"DriveUp","address":{"zipCode":"'+n+'"},"banner":"'+i+'"}],"preferences":[{"categoryCode":"FULFILLMENT","subCategoryCode":"METHOD","value":"DUG","bannerId":"'+i+'"}]}'):"DELIVERY"===e&&(h=o,I="attended",S="delivery",f='{"preferences":[{"categoryCode":"FULFILLMENT","subCategoryCode":"METHOD","value":"DELIVERY", "bannerId":"'+i+'"}],"postalCodes":[{"purposes":["DELIVERY"],"postalCode":"'+n+'","bannerId":"'+i+'"}]}'),null===AB.COMMON.getCartId("cartId")&&(g=!1);let m=SWY.CONFIGSERVICE.datapowerConfig.cncCtxPath+"/ucaservice/api/uca/customers/"+p+"/stores",E=AB.ucaHttpOptionsUpdateProfileV2;this.isGeoFlowEnabled(d)&&(m=AB.fulfillmentServlet,E=AB.ucaHttpOptionsFulfillmentServlet,f=this.createDataObject(e,t,o,i,d)),$.ajax({url:m,type:"POST",headers:E,dataType:"json",data:f,async:!1,success:function(t,o,d){SWY.ENFORCEMENTUTILS.updateReInitSite("slot"),AB.CART.removeLocalStorage(),AB.COMMON.removeP13nOOSLocalStorage(),localStorage.removeItem("abPreFetchExperiment"),SWY.CONFIGSERVICE.deleteCookie("ACI_S_EXP_PF","");const p=()=>
1{if(!0===a)window.location=(()=>{let t=window.location.protocol+"//"+AB.COMMON.buildHost(i)+SWY.ssoPath;return l&&(t+="?ml="+l),""!==u&&"DELIVERY"===e&&(t+=(l?"&":"?")+"goto="+window.location.pathname+window.location.search),t})();else{if(AB.COMMON.updateUserCookieList(r,s),C={success:!0,message:"We have Successfully updated your profile"},"function"!=typeof c)return C;c(C)}};g?cartServiceRefAL.service.updateStoreForExistingCart(h,S,I,a,p,n):p()},error:function(e){if(C={success:!1,message:e.statusText},401===e.status||403===e.status)"true"===SWY.ENFORCEMENT.getCookie("SAFEWAY_KMSI")?SWY.ENFORCEMENT.sendRedirect(SWY.ssoPath+"?goto="+window.location.href):window.location.reload();else{if("function"!=typeof c)return C;c(C)}}})},this.createDataObject=function(e,t,o,i,n){const s={preferenceDefId:"2f779a23-f979-4dac-8b67-ae8a4c469e16",value:e,banner:i};let r={};return"DELIVERY"===e?r=n?.address?.addressId?{preferences:[{...s}],selectedAddress:{addressId:n.address.addressId,banner:i,purposes:[{name:"DELIVERY"}]}}:{address:{addressName:n?.address?.bName||null,address1:n?.address?.addressLine1,address2:n?.address?.addressLine2||null,city:n?.address?.city,stateCode:n?.address?.stateCode,country:null,postalCode:this.normalizePostalCode(n?.address?.postalCode),postalCodeExtn:this.extractPostalCode(n?.address?.postalCode),isSelectedAddress:"true",selectedAddressBanner:i,selectedAddressPurposes:[{name:"DELIVERY"}],addressTypes:[{type:n?.address?.type}],purposes:[{name:"DELIVERY"}],addressHash:""},preferences:[{preferenceDefId:"2f779a23-f979-4dac-8b67-ae8a4c469e16",value:"DELIVERY",banner:i}]}:"DUG"===e?r={preferences:[{...s},{preferenceDefId:"8d17909f-9055-44dd-bc68-93f5fb63e616",value:o,banner:i}]}:"J4U"===e&&(r={preferences:[{...s},{preferenceDefId:"24c286a7-2e43-45f1-9c81-7238b93758ef",value:t}]}),JSON.stringify(r)},this.normalizePostalCode=function(e){return e&&e.length>5?e.substring(0,e.indexOf("-"))||e:e||""},this.extractPostalCode=function(e){if(e&&e.length>5){const t=e.split("-");if(t.length>1)return t[1]}return""},this.getHost=function(){const e=window.location.hostname;return e.substr(0,e.indexOf("."))},this.buildHost=function(e){const t=this.getHost(),o=window.location.port;return t+"."+e+".com"+(o?":"+o:"")},this.updateUserCookieList=function(e,t){$.each(e,function(e,o){AB.COMMON.isCookieEmpty(SWY.CONFIGSERVICE.getCookie(o))||AB.COMMON.updateAbsCookies(o,t)})},this.isCookieEmpty=e=>""===e||null==e,this.updateAbsCookies=(e,t)=>{let o=JSON.parse(SWY.CONFIGSERVICE.getCookie(e));if("abs_gsession"===e||"SWY_SHARED_SESSION_INFO"===e||"abs_previouslogin"===e){o=this.compareAndUpdateObj(t,o);const i=encodeURIComponent(JSON.stringify(o)),n=SWY.CONFIGSERVICE.getResolvedCookieName(e),s=SWY.CONFIGSERVICE.tagCookiesSecure();document.cookie=n+"="+i+"; path=/"+(s?";secure;":"")}else if("SWY_SYND_USER_INFO"===e&&(null!==t.info.J4U||null!==t.info.SHOP)&&null!==o){const i=t.info.COMMON.preference,n="j4u"===i?.toLowerCase(),s=void 0!==i?n?t.info.J4U.storeId:t.info.SHOP.storeId:"",r=void 0!==i?n?t.info.J4U.zipcode:t.info.SHOP.zipcode:"",a=void 0!==i?n?t.info.J4U.address:t.info.SHOP.address:"",c=t.info.COMMON.xDTags;r&&(o.storeZip=r),s&&(o.storeId=s),null!=a&&(o.storeAddress=a),i&&(o.preference=i),c&&(o.xDTags=c);const l=encodeURIComponent(JSON.stringify(o)),d=SWY.CONFIGSERVICE.resolvedBanner+".com",u=SWY.CONFIGSERVICE?.oktaConfig?.maxAge,p=new Date;p.setTime(p.getTime()+1e3*u);const f="expires="+p.toUTCString(),S=SWY.CONFIGSERVICE.getResolvedCookieName(e),h=SWY.CONFIGSERVICE.tagCookiesSecure();document.cookie=S+"="+l+";"+f+";path=/;"+(h?"secure;":"")+"domain=."+d}},this.compareAndUpdateObj=(e,t)=>(Object.keys(e).forEach(o=>{Object.keys(t).forEach(i=>{o===i&&("object"==typeof e[o]&&"object"==typeof t[i]?this.compareAndUpdateObj(e[o],t[i]):t[i]=e[o])})}),t),this.createSessionCookie=(e,t)=>{if("SWY_SYND_USER_INFO"===e){const o={storeAddress:"",storeZip:"",storeId:"",preference:""};if(null!==t.info.J4U||null!==t.info.SHOP){const e=t.info.COMMON.preference,i="j4u"===e?.toLowerCase(),n=void 0!==e?i?t.info.J4U.storeId:t.info.SHOP.storeId:"",s=void 0!==e?i?t.info.J4U.zipcode:t.info.SHOP.zipcode:"",r=void 0!==e?i?t.info.J4U.address:t.info.SHOP.address:"";s&&(o.storeZip=s),n&&(o.storeId=n),null!=r&&(o.storeAddress=r),e&&(o.preference=e),t=o}SWY.CONFIGSERVICE.setDomainCookie(e,encodeURIComponent(JSON.stringify(t)),SWY.CONFIGSERVICE.resolvedBanner+".com",0)}else SWY.CONFIGSERVICE.setCookie(e,encodeURIComponent(JSON.stringify(t)),0)},this.isGeoFlowEnabled=e=>!(!e?.address?.addressId&&!e?.address?.addressLine1)}.call(AB.COMMON),function(){let e=0,t={},o="",i={},n=!1;
1this.init=function(){SWY.QUERYSTRING.init(),SWY.RESTRICTEDRESOURCE.init(),SWY?.CONFIGSERVICE?.featureToggleConfig?.enableCheckReinitCookieOnLoad&&this.checkForLoginInEcommReInitCookie(),this.readSessionCookies(),this.isAlertDismissed(),SWY.CONFIGSERVICE.setCookie("ECommBanner",SWY.CONFIGSERVICE.resolvedBanner,0),this.checkForFirstTimeLogin(),this.triggerOnboardingModal()},this.checkForLoginInEcommReInitCookie=function(){SWY.ENFORCEMENTUTILS.checkReInitSite("login")&&(AB.COMMON.setCookie("ECommRedirectURL",encodeURIComponent(window.location.href),0),SWY.ENFORCEMENTUTILS.removeReInitSite("login"),window.location.href=window.location.origin+SWY.ssoPath)},this.checkForFirstTimeLogin=function(){const e="ECommReInit",t=AB.COMMON.getCookie(e);AB.firstTimeLogin=!1,t?.includes("|firstTimeLogin")&&(SWY.CONFIGSERVICE.setDomainCookie(e,t.replace("|firstTimeLogin",""),SWY.CONFIGSERVICE.resolvedBanner+".com",0),AB.firstTimeLogin=!0)},this.triggerOnboardingModal=function(){const e="ACI_S_onboardEvent",t=AB.COMMON.getCookie(e),{isReceiptsOnboardEventEnabled:o,referralProgramEnabled:i,enableUnityWelcomeModal:n,enableNoUserPreference:s}=SWY.CONFIGSERVICE.featureToggleConfig;if(t){const r=JSON.parse(t);"normalSignIn"===r.event?AB.onBoardingSigninFlow=!0:n&&"unity"===r.event?AB.onUnitySigninFlow=!0:o&&("STORE_ONLINE_USER_SIGN"===r.event||"STORE_ONLINE_USER_REG"===r.event)&&"success"===r.status||i&&"success"===r.status&&("referrer"===r.pgm||"socialReg"===r.event)?AB.onboardingEvent=r:s&&"NO_PREFERNCE_USER_SIGN"===r.event&&(AB.noPreferenceSigninFlow=!0),document.cookie=e+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"}},this.getUnifiedPreviousLoginCookie=function(){const e=SWY.ENFORCEMENTUTILS.parseSessionCookie("abs_previouslogin");return e?.info?.COMMON?e:{}},this.assistantSignInURLParams=function(){const e=AB.COMMON.getURLParameterByName("client_id"),t=AB.COMMON.getURLParameterByName("redirect_uri"),o=AB.COMMON.getURLParameterByName("scope"),i=AB.COMMON.getURLParameterByName("state");null!=e&&null!=t&&null!=o&&null!=i&&(localStorage.setItem("assistant_client_id",e),localStorage.setItem("assistant_redirect_uri",t),localStorage.setItem("assistant_scope",o),localStorage.setItem("assistant_state",i))},this.readSessionCookies=function(){SWY.previousLogin=this.getUnifiedPreviousLoginCookie();const o=AB.COMMON.isB2BSite()?SWY.CONFIGSERVICE.getCookie("B_ECommSignInCount"):SWY.CONFIGSERVICE.getCookie("ECommSignInCount");o?.length>0&&(e=parseInt(o)),t=SWY.ENFORCEMENTUTILS.parseReInitCookie(),AB.COMMON.authorize()||AB.COMMON.resetKmsiUser()},this.isAlertDismissed=function(){"false"===sessionStorage.getItem("displayNotificationComponent")&&(document.getElementById("allAlertCSS").innerHTML+=".hideAllAlert{display:none!important}")},this.performPageEnforcement=function(){const e=AB.COMMON.getURLParameterByName("ml");e&&(SWY.CONFIGSERVICE.setDomainCookie("SAFEWAY_MODAL_LINK",e,SWY.CONFIGSERVICE.resolvedBanner+".com",0),window.history.replaceState("",document.title,SWY.ENFORCEMENT.removeDeeplinkURLParameters(window.location.href,"ml"))),this.init();const t=String(location.pathname);if(t.indexOf("auth/service/sign-in")>0&&(document.cookie="ACI_S_SWY_SESSION=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"),this.isPageEnforced(t))if(this.assistantSignInURLParams(),SWY.CONFIGSERVICE.isCookieEnabled())if(this.doSingleSignOn())this.isUnifiedDeepLinkUser()&&(this.useDeepLinkGoto=!0),!1===this.handleSingleSignOn()&&this.handlePageEnforcement();else if(this.isUnifiedDeepLinkUser())SWY.ENFORCEMENT.validateDeepLinkParams().then(function(e){!0===e.validRequest.isValid&&(SWY.deepLinkData=SWY.ENFORCEMENT.setSessionObj()),n=!0,SWY.ENFORCEMENT.handlePageEnforcement()}).catch(function(){SWY.ENFORCEMENT.handlePageEnforcement()});else{const e=decodeURIComponent(this.getCookie("ECommRedirectURL"));this.doRedirection(e)?(SWY.CONFIGSERVICE.setCookie("ECommRedirectURL","",-1),this.sendRedirect(e,!1,null)):this.handlePageEnforcement()}else AB.userInfo.establishUnifiedGuestSession(),this.handlePageEnforcement();else AB.userInfo.earlyInitialize=this.checkEarlyInitialize()},this.setSessionObj=function(){if(deepLinkUpdateObj={info:{COMMON:{Selection:"query",userType:"G"},J4U:{},SHOP:{}}},["DELIVERY","PICKUP","INSTORE"].includes(o)){if(i?.zipcode){const e=i.zipcode;deepLinkUpdateObj.info.SHOP.zipcode=e,deepLinkUpdateObj.info.J4U.zipcode=e,deepLinkUpdateObj.info.COMMON.zipcode=e}i?.storeId&&(deepLinkUpdateObj.info.J4U.storeId=i.storeId,deepLinkUpdateObj.info.SHOP.storeId=i.storeId),i?.resolvedBy&&(deepLinkUpdateObj.info.COMMON.resolvedBy=i.resolvedBy);const e={DELIVERY:"Delivery",PICKUP:"Dug",INSTORE:"J4U"};deepLinkUpdateObj.info.COMMON.preference=e[o]}return deepLinkUpdateObj},this.isUnifiedDeepLinkUser=function(){const e=["INSTORE","DELIVERY","PICKUP"],t=AB.COMMON.getURLParameterByName("storeId"),n=AB.COMMON.getURLParameterByName("preference"),s=AB.COMMON.getURLParameterByName("zipcode"),r=AB.COMMON.getURLParameterByName("state"),a=AB.COMMON.getURLParameterByName("resolvedBy"),c=AB.COMMON.getURLParameterByName("addr"),l=AB.COMMON.getURLParameterByName("guestCartId");if(l&&localStorage.setItem("abCart",JSON.stringify({guestCartId:l})),this.deepLinkUrl=window.location.href,i.resolvedBy=a,t&&n&&!r){let e=window.location.href;const t=["storeId","preference","zipcode"];
1if(a&&t.push("resolvedBy"),l&&t.push("guestCartId"),c){const e="B"===AB?.userInfo?.siteType?"ACI_F_B_DELIVERY_ADDR":"ACI_F_DELIVERY_ADDR",o=JSON.parse(atob(c)),i=window.dataLayer?.find(e=>"OneTrustGroupsUpdated"===e.event),n=t=>{t?.includes("C0003")&&this.setGeoDeliveryCookie(e,o)};i?n(i.OnetrustActiveGroups):window.addEventListener("OneTrustGroupsUpdated",e=>n(e?.detail),{once:!0}),t.push("addr")}for(const o of t)e=SWY.ENFORCEMENT.removeDeeplinkURLParameters(e,o);window.history.replaceState("",document.title,e)}if(!AB.COMMON.isAnonymous()&&"G"!==AB.userInfo.userType.toUpperCase()&&!AB.COMMON.authorize())return!1;let d=!1,u=!1;if(n){const t=n.toUpperCase();o=t,d=e.includes(t)}u=/^\d{1,4}$/.test(t);const p=!(!s||!/^\d{5}$|^\d{5}-\d{4}$/.test(s));return!(!d||!u||(i.storeId=t,i.intent="PICKUP"===n.toUpperCase()?"dug":n.toUpperCase(),p&&(i.zipcode=s),0))},this.setGeoDeliveryCookie=function(e,t){const o=new Date;o.setTime(o.getTime()+27e5),document.cookie=`${e}=${encodeURIComponent(JSON.stringify(t))}; expires=${o.toUTCString()}; path=/;`},this.removeDeeplinkURLParameters=function(e,t){const o=e.split("?");if(o.length>=2){const e=encodeURIComponent(t)+"=",i=o[1].split(/[&;]/g).filter(t=>-1===t.lastIndexOf(e,0));return o[0]+(i.length>0?"?"+i.join("&"):"")}return e},this.validateDeepLinkParams=function(){let e=window.location.protocol+"//"+window.location.host+AB.storeResolverValidateEndpoint+"?banner="+SWY.CONFIGSERVICE.getResolvedBanner()+"&storeid="+i.storeId+"&preference="+i.intent;return i?.zipcode&&(e+="&zipcode="+i.zipcode),new Promise((t,o)=>{$.ajax({headers:{"ocp-apim-subscription-key":AB.wcaxXapiApimKey},async:!1,url:e,type:"GET",success:t,error:o})})},this.isPageEnforced=function(e){return!(SWY.ENFORCEMENTUTILS.isEditorPage(e)||SWY.ENFORCEMENTUTILS.isContentPage(e))},this.doSingleSignOn=function(){return!(e>=1||SWY.isEscapeSSOAllowed)&&(SWY.ENFORCEMENT.checkExpiredKmsiUser()||this.doReInit()||!!(AB.userInfo&&SWY.ENFORCEMENTUTILS.isValidUserType("A")&&AB.userInfo.houseId))},this.checkExpiredKmsiUser=function(){return!("true"!==SWY.ENFORCEMENT.getCookie("SAFEWAY_KMSI")||SWY.ENFORCEMENT.checkAuthorizedCookie()&&(!AB.userInfo||"C"===AB.userInfo.userType||"R"===AB.userInfo.userType))},this.doReInit=function(){if(!t?.length)return!1;const e=window.location.hostname;return!!e&&t.some(t=>t&&0===e.indexOf(t.trim()))},this.handleSingleSignOn=function(){let t="",o=!1;const i=window.location.pathname,n=null!=SWY.CONFIGSERVICE.pharmacyRxConfig?SWY.CONFIGSERVICE.pharmacyRxConfig["rx.pharmacy.create.account.page.path"]:SWY.configService.wwwSignInPagePath;if(!SWY.ENFORCEMENTUTILS.isPageMatched({path:i,configPagePath:n})||!(e>0||SWY.ENFORCEMENT.isErrorPage(i))){if(t=decodeURIComponent(this.getCookie("ECommRedirectURL")),!t||AB.userInfo&&SWY.ENFORCEMENTUTILS.isValidUserType("A")&&AB.userInfo.houseId)t=SWY.QUERYSTRING.getURIWithMarketingParams();else{if(this.doRedirection(t))return SWY.CONFIGSERVICE.setCookie("ECommRedirectURL","",-1),o=!0,this.sendRedirect(t,!1,null),o;if(SWY.ENFORCEMENTUTILS.isPageMatched({path:t,configPagePath:SWY.configService.wwwSignInPagePath}))return SWY.CONFIGSERVICE.setCookie("ECommRedirectURL","",-1),o}return e<1&&(this.useDeepLinkGoto&&(t=""),o=!0,this.singleSignOnUser(t)),o}SWY.CONFIGSERVICE.setCookie("ECommRedirectURL","",-1)},this.getCookie=function(e){if("SAFEWAY_KMSI"===e&&!AB.COMMON.isB2BSite()){let e=SWY.CONFIGSERVICE.getKmsiValue("SAFEWAY_KMSI");return e||(e=SWY.CONFIGSERVICE.getKmsiValue("ACI_S_SAFEWAY_KMSI")),e}if("B_SAFEWAY_KMSI"===e&&AB.COMMON.isB2BSite()){let e=SWY.CONFIGSERVICE.getKmsiValue("B_SAFEWAY_KMSI");return e||(e=SWY.CONFIGSERVICE.getKmsiValue("ACI_S_B_SAFEWAY_KMSI")),e}const t=SWY.CONFIGSERVICE.getResolvedCookieName(e)+"=",o=document.cookie.split(";").find(e=>e.trim().startsWith(t));return o?o.trim().substring(t.length):""},this.doRedirection=function(e){return!!(e&&SWY.ENFORCEMENTUTILS.isPageMatched({configPagePath:SWY.configService.wwwSignInPagePath})&&AB.COMMON.getURLParameterByName("SAMLRequest"))},this.handlePageEnforcement=function(){if(this.isUserAllowed()){const e=AB.userInfo.userType.toUpperCase();if(!AB.COMMON.checkForEditOrderMode()||"R"!==e&&"C"!==e)if(n)AB.COMMON.authorize()?SWY.ENFORCEMENT.deepLinkSetGSessionCookie():AB.userInfo.establishUnifiedGuestSession(),AB.COMMON.getURLParameterByName("state")||window.location.reload();else if(AB.COMMON.isAnonymous())if(AB.userInfo.establishUnifiedGuestSession(),AB.userInfo.resolveEcomStore=!1,SWY.CONFIGSERVICE.isCookieEnabled()){const e=AB.COMMON.getURLParameterByName("goto",!0);null!=e&&"/set-store.html"!==window.location.pathname&&this.sendRedirect(e,!1,!1)}else AB.userInfo.establishUnifiedGuestSession();else AB.userInfo.j4u.storeId||(AB.userInfo.j4u.isStoreIdEmpty=!0,AB.userInfo.establishUnifiedGuestSession());else{const e=AB.COMMON.getCookie("OrderStoreId"),t={info:{COMMON:{preference:"dug"},J4U:{storeId:e},SHOP:{storeId:e}}};if(AB.userInfo.preferenceMode="dug",AB.COMMON.isLSCompatible()){const e=JSON.parse(localStorage.getItem("eRumsDeliveryType"));e?.deliveryType&&(t.info.COMMON.preference="delivery",AB.userInfo.preferenceMode="delivery")}AB.COMMON.updateUserSession(t,!1)}}else{let e=SWY.RESTRICTEDRESOURCE.getRedirectPath(SWY.USERTYPESTATE.getUserType());const t=AB.COMMON.getURLParameterByName("goto",!0);if(null!=t)SWY.CONFIGSERVICE.setCookie("ECommRedirectURL","",-1),this.sendRedirect(AB.COMMON.updateGotoUrl(t),!1,null);else{if(e&&!SWY.ENFORCEMENTUTILS.isHtmlPage(e)&&(e+=".html"),e?.indexOf("re-sign-in")>-1)SWY.QUERYSTRING.queryParams.goto=window.location.href;else if(e?.indexOf("sign-in")>-1)SWY.CONFIGSERVICE.setCookie("ECommRedirectURL",encodeURIComponent(window.location.href),0);else if(e){const t=window.location.search;t.length>0&&(e+=t)}else"sincerely-food"===AB.userInfo.banner&&(e="/bin/safeway/sso","G"!==AB.userInfo.userType&&"#error=login_required"===window.location.hash&&(e="/bin/safeway/unified/logout",AB.COMMON.updateRedirectURLCookie(window.location.origin+"/bin/safeway/sso?goto="+AB.COMMON.getCookie("ECommRedirectURL"))));this.sendRedirect(e,!1,null)}}this.checkAndRedirectShopStoreInUrl(),AB.COMMON.setCookie("ECommSignInCount",0,0),SWY.OKTA.reviewOKTASessionToRefresh(),AB.userInfo.earlyInitialize=this.checkEarlyInitialize()},this.isUserAllowed=function(){return this.checkSessionInfo(),SWY.USERTYPESTATE.isAuthorized()},this.checkSessionInfo=function(){SWY.USERTYPESTATE.setAuthorized(!0),SWY.ENFORCEMENTUTILS.isAuthenticated()?SWY.ENFORCEMENTUTILS.isAuthenticatedAsGuest()?(SWY.USERTYPESTATE.setUserType("G"),SWY.RESTRICTEDRESOURCE.isAllowed("G")||SWY.USERTYPESTATE.setAuthorized(!1)):SWY.ENFORCEMENTUTILS.isAuthenticatedAsRegistered()&&(SWY.ENFORCEMENTUTILS.isValidUserType("C")&&!this.isTokenActive()?(SWY.USERTYPESTATE.setUserType("R"),SWY.RESTRICTEDRESOURCE.isAllowed("R")||SWY.USERTYPESTATE.setAuthorized(!1)):(SWY.USERTYPESTATE.setUserType(AB.userInfo.userType),SWY.RESTRICTEDRESOURCE.isAllowed(AB.userInfo.userType)?"/account/setpassword.html"===window.location.pathname&&(AB.COMMON.getCookie("OTP-SET-PASSWORD")?SWY.CONFIGSERVICE.setCookie("OTP-SET-PASSWORD","",-1):SWY.USERTYPESTATE.setAuthorized(!1)):SWY.USERTYPESTATE.setAuthorized(!1))):SWY.ENFORCEMENTUTILS.isAnonymousUser()?(SWY.USERTYPESTATE.setUserType("A"),SWY.RESTRICTEDRESOURCE.isAllowed("A")||SWY.USERTYPESTATE.setAuthorized(!1)):(SWY.USERTYPESTATE.setUserType(""),SWY.USERTYPESTATE.setAuthorized(!1))},this.singleSignOnUser=function(e){null!=e&&SWY.CONFIGSERVICE.setCookie("ECommRedirectURL",encodeURIComponent(e),0),AB.COMMON.setCookie("ECommSignInCount",1,0);let t=SWY.ssoPath+"?banner="+SWY.CONFIGSERVICE.resolvedBanner+"&idp=false";this.useDeepLinkGoto&&(t+="&goto="+encodeURIComponent(this.deepLinkUrl)),window.location.href=this.doReInit()&&e?t+"&goto="+e:t},this.sendRedirect=function(e,t,o){if(!e)return;let i=t?SWY.CONFIGSERVICE.generateRedirectUrl(e,SWY.CONFIGSERVICE.getResolvedBanner()):e;o&&(i+=o),SWY.ENFORCEMENTUTILS.isTrustedDomain(i)?window.location.href=i:"/account/auth/service/sign-in.html"===window.location.pathname?window.location.href=window.location.href:window.location.href=SWY.CONFIGSERVICE.domainConfig.defaultRedirectUrl},this.checkAndRedirectShopStoreInUrl=function(){const e=SWY.CONFIGSERVICE.featureToggleConfig.enableStoreIdSelector,t=window.location.pathname;let o=window.location.href;if(e){if(t&&-1===t.indexOf(".(")&&"true"===SWY.CONFIGSERVICE.isEnableStoreIdSelectorOnPage){const e=t.indexOf("."),i=t.indexOf(".html");if(-1!==e&&-1!==i&&AB.userInfo.branchId){const n=e=>{const t=SWY.ENFORCEMENT.getReferrerFromBrowser();return t.length>0?e+(window.location.search.length>0?"&":"?")+"referrer="+t:e};if(i>e){let s=t.substring(e+1,i);s!==AB.userInfo.branchId&&(t.toLowerCase().indexOf("product-details")>
1-1||t.toLowerCase().indexOf("reward-details")>-1?window.location.href=o.replace(s,s+"."+AB.userInfo.branchId):t.toLowerCase().indexOf("brand-index")>-1?(s=s.substring(s.indexOf(".")+1),s!==AB.userInfo.branchId&&(window.location.href=n(o).replace(s,AB.userInfo.branchId))):window.location.href=n(o).replace(s,AB.userInfo.branchId))}else o=n(o),window.location.href=o.substring(0,o.indexOf("html"))+AB.userInfo.branchId+".html"}}}else{const e=t?.toLowerCase();if(t&&-1===t.indexOf(".(")&&(-1!==e.indexOf("aisles")||-1!==e.indexOf("/shop/brands")||AB.COMMON.isB2BSite()&&-1!==e.indexOf("/shop/brand-index"))){const i=t.indexOf("."),n=t.indexOf(".html"),s=t.indexOf("/mf/");if(-1!==i&&-1!==n&&AB.userInfo.branchId){if(this.aislesCanPassLoc(t)||this.brandsCanPassLoc(t)){const e=new URL(o),t=new URLSearchParams(e.search);t.get("loc")!==AB.userInfo.branchId&&(t.set("loc",AB.userInfo.branchId),e.search=t,window.location.href=e.toString())}if(n>i){let e=t.substring(i+1,n);const s=e.indexOf(".");s>-1&&(e=e.substring(s+1)),e!==AB.userInfo.branchId&&(window.location.href=o.replace(e,AB.userInfo.branchId))}else(-1!==e.indexOf("aisles")&&!this.aislesCanPassLoc(t)||(-1!==e.indexOf("/shop/brands")||AB.COMMON.isB2BSite()&&-1!==e.indexOf("/shop/brand-index"))&&!this.brandsCanPassLoc(t))&&(window.location.href=o.substring(0,o.indexOf("html"))+AB.userInfo.branchId+".html")}if(-1!=s&&AB?.userInfo?.branchId&&this.aislesCanPassLoc(t)){let e=new URL(o),t=new URLSearchParams(e.search);t.get("loc")!==AB?.userInfo?.branchId&&(t.set("loc",AB?.userInfo?.branchId),e.search=t,o=e.toString(),window.location.href=o)}}}},this.aislesCanPassLoc=function(e){const t=e.toLowerCase();return-1===t.indexOf("vineandcellar")&&-1===t.indexOf("marketplace")&&-1!==t.indexOf("aisles")},this.brandsCanPassLoc=function(e){const t=e.toLowerCase();return-1!==t.indexOf("/shop/brands")||AB.COMMON.isB2BSite()&&-1!==t.indexOf("shop/brand-index")},this.getReferrerFromBrowser=function(){const e=document.referrer||"",t=("prod"!==SWY.CONFIGSERVICE.env?"www-"+SWY.CONFIGSERVICE.env+".":"www.")+SWY.CONFIGSERVICE.getResolvedBanner();return 0===e.length?"direct":e.includes(t)?"":e},this.isTokenActive=function(){return!!(AB.userInfo?.expireTime&&parseInt(AB.userInfo.expireTime)>(new Date).getTime())},this.checkAuthorizedCookie=function(){try{const e=SWY.CONFIGSERVICE.getCookie("SWY_SHARED_SESSION_INFO");return!(!e||"object"!=typeof JSON.parse(e))}catch(e){return!1}},this.checkEarlyInitialize=function(){return!AB.COMMON.authorize()||SWY.ENFORCEMENT.isTokenActive()},this.isErrorPage=function(e){return"string"==typeof e&&(/sign-in\.error-/.test(e)||/create-account\.error-/.test(e))},this.useCallBack=function(e,t){return e?e(t):t},this.generateSessionUpdateObject=function(e,t,o,i,n,s,r,a,c){const l=e.toUpperCase(),d=!!SWY.CONFIGSERVICE.featureToggleConfig.enableCookieRestructure;let u={info:{COMMON:{},J4U:{},SHOP:{}}};const p=()=>{d&&(u.info.COMMON.storeId=t,u.info.COMMON.zipcode=o)},f=("R"===i.toUpperCase()||"C"===i.toUpperCase())&&AB.userInfo.banner.toUpperCase()!==s.toUpperCase();"INSTORE"===l?(u.info.COMMON.preference="J4U",u.info.COMMON.Selection=n,u.info.COMMON.zipcode=o,u.info.COMMON.wfcStoreId=c,u.info.J4U.storeId=t,u.info.J4U.zipcode=o,p(),f?u.info.offbanner={storeId:t,zipcode:o,preference:"J4U",banner:s}:(u.info.SHOP.storeId=t,u.info.SHOP.zipcode=o,p()),this.useCallBack(r,u)):"DELIVERY"===l||"PICKUP"===l?(u.info.COMMON.preference="DELIVERY"===l?"Delivery":"Dug",u.info.COMMON.Selection=n,u.info.COMMON.zipcode=o,u.info.COMMON.wfcStoreId=c,u.info.SHOP.storeId=t,u.info.SHOP.zipcode=o,u.info.J4U.storeId=t,u.info.J4U.zipcode=o,p(),f&&(u.info.offbanner={storeId:t,zipcode:o,preference:u.info.COMMON.preference,banner:s,wfcStoreId:c}),this.useCallBack(r,u)):this.useCallBack(r,{})},this.deepLinkSetGSessionCookie=function(){const e={info:{COMMON:{},J4U:{},SHOP:{}}};if(SWY.deepLinkData?.info&&prevLoginCookie){const t=SWY.deepLinkData.info;e.info.J4U.zipcode=t.J4U.zipcode,e.info.J4U.storeId=t.J4U.storeId,e.info.SHOP.zipcode=t.SHOP.zipcode,e.info.SHOP.storeId=t.SHOP.storeId,e.info.COMMON.zipcode=t.SHOP.zipcode,e.info.COMMON.Selection=t.COMMON.Selection,e.info.COMMON.preference=t.COMMON?.resolvedBy??t.COMMON.preference}SWY.CONFIGSERVICE.setCookie("abs_gsession",JSON.stringify(e))},this.storeFlagsInit=function(){StoreFlagService.init()}}.call(SWY.ENFORCEMENT),function(){const e="^https?:\\/\\/(.+?\\.)?";let t="";this.parseSessionCookie=function(e){const t=SWY.CONFIGSERVICE.getCookie(e);return"string"==typeof t&&t.length>0?JSON.parse(t):{}},this.isHtmlPage=function(e){if("string"==typeof e&&""!==e){const t=(e=$("<a></a>").attr("href",e)[0].pathname).substr(e.lastIndexOf(".")+1);return/(html)$/gi.test(t)}return!1},this.isEditorPage=function(e){return"string"==typeof e&&/^\/libs/.test(e)},this.isContentPage=function(e){return"string"==typeof e&&/jcr:content/.test(e)},this.isPageMatched=function(e){let t=void 0!==e.path?e.path:location.pathname;const o=e.configPagePath;if(!t.length)return!1;let i=t;const n=i.indexOf("?");n>0&&(i=i.substr(0,n)),"/"!==i&&(i=i.split("/").pop());const s=i.indexOf(".");return s>0&&(i=i.substr(0,s)),!(!o||o.substr(o.length-i.length)!==i)},this.isAuthenticated=function(){return this.isAuthenticatedAsGuest()||this.isAuthenticatedAsRegistered()},this.isPreviouslyLoggedIn=function(){return this.isPreviouslyLoggedInAsGuest()||this.isPreviouslyLoggedInAsRegistered()},this.isPreviouslyLoggedInWWW=function(){return!(!SWY.previousLogin.info||"object"!=typeof SWY.previousLogin.info.J4U)},this.isAuthenticatedAsGuest=function(){return!(!AB.userInfo||!this.isValidUserType("G")||null==AB.userInfo.zipcode||""===AB.userInfo.zipcode)},this.isPreviouslyLoggedInAsGuest=function(){return void 0!==SWY.previousLogin&&Object.keys(SWY.previousLogin).length>0&&"G"===SWY.previousLogin.userType},this.isAuthenticatedAsRegistered=function(){return!(!AB.userInfo||!this.isValidUserType("R")&&!this.isValidUserType("C"))},this.isPreviouslyLoggedInAsRegistered=function(){return void 0!==SWY.previousLogin&&Object.keys(SWY.previousLogin).length>0&&("R"===SWY.previousLogin.userType||"C"===SWY.previousLogin.userType)},this.isAnonymousUser=function(){return!this.isAuthenticated()&&!this.isPreviouslyLoggedIn()},this.updateReInitSite=function(e){const t=SWY.ENFORCEMENTUTILS.parseReInitCookie();t.includes(e)||t.push(e),"slot"===e&&localStorage.getItem("abSlot")&&localStorage.removeItem("abSlot"),SWY.ENFORCEMENTUTILS.buildReInitCookie(t)},this.removeReInitSite=function(e){const t=SWY.ENFORCEMENTUTILS.parseReInitCookie().filter(t=>t.trim()!==e);SWY.ENFORCEMENTUTILS.buildReInitCookie(t)},this.parseReInitCookie=function(){const e=decodeURIComponent(SWY.CONFIGSERVICE.getCookie("ECommReInit"));return e?e.split("|"):[]},this.buildReInitCookie=function(e){Array.isArray(e)&&SWY.CONFIGSERVICE.setDomainCookie("ECommReInit",e.join("|"),SWY.CONFIGSERVICE.resolvedBanner+".com",0)},this.checkReInitSite=function(e){const t=SWY.CONFIGSERVICE.getCookie("ECommReInit");return!(!t||!e)&&t.split("|").includes(e)},this.isTrustedDomain=function(o){return!!o&&(0===o.indexOf("/")||!!new RegExp(e).test(o)&&(SWY.ENFORCEMENTUTILS.generateTrustedDomainPattern(),new RegExp(t).test(o.split("?",2)[0])))},this.generateTrustedDomainPattern=function(){if(t)return;const o=SWY.CONFIGSERVICE.domainConfig.allTrustedDomains;if(o){const i=Object.values(o).map(e=>e.replace(".","\\.")).join("|");t=e+"("+i+")"}},this.isValidUserType=function(e){return AB.userInfo.userType===e}}.call(SWY.ENFORCEMENTUTILS),function(){const e=e=>$(`meta[name=${e}]`).attr("content"),t=t=>!AB.COMMON.isEmpty(e(t))&&"true"===e(t);this.init=function(){this.readMetaData()},this.readMetaData=function(){SWY.allowedUserTypes=this.formatAsJson(e("allowedUserTypes")),SWY.redirections=this.formatAsJson(e("redirections")),SWY.showZipcodeModal="true"===e("showZipcodeModal"),SWY.isShopGuestAuthAllowed=t("allowGuestAuthentication"),SWY.isEscapeSSOAllowed=t("escapeSSO")},this.formatAsJson=function(e){return null!=e?JSON.parse(decodeURIComponent(e)):{}},this.isAllowed=function(e){return!!(e&&SWY.allowedUserTypes&&this.userInList(e,SWY.allowedUserTypes))},this.userInList=function(e,t){return!!(e&&t&&Object.values(t).includes(e))},this.getRedirectPath=function(e){return e&&SWY.redirections?this.checkForRedirectPaths(e,SWY.redirections):null},this.checkForRedirectPaths=function(e,t){let o="",i="";for(const n of Object.values(t))for(const t of Object.values(n.userType))e===t?o=n.redirectPath:"DEFAULT"===t&&(i=n.redirectPath);return o||i}}.call(SWY.RESTRICTEDRESOURCE),function(){let e="A",t=!1;this.setUserType=t=>{e=t},this.getUserType=()=>e,this.setAuthorized=e=>{t=e},this.isAuthorized=()=>t}.call(SWY.USERTYPESTATE),SWY.STOREFLAGUTIL.storeFlagsLoadComplete=new Event("storeFlagsLoadComplete"),SWY.STOREFLAGUTIL.setStoreFlagsState=function(e){AB.storeFlagsData=e,AB.storeFlagsLoaded=!0,document.dispatchEvent(SWY.STOREFLAGUTIL.storeFlagsLoadComplete)},SWY.STOREFLAGUTIL.updateTimezoneInStorage=function(e){if(AB&&AB.COMMON&&"function"==typeof AB.COMMON.isLSCompatible&&AB.COMMON.isLSCompatible())try{localStorage.removeItem("timezone"),e&&e.timezone&&localStorage.setItem("timezone",e.timezone)}catch(e){console.warn("Failed to update timezone in localStorage:",e)}},SWY.STOREFLAGUTIL.init=function(){const e=window.location.hostname;"localhost"!==e&&"127.0.0.1"!==e?AB.userInfo.branchId?SWY.STOREFLAGUTIL.getStoreFlags():(console.warn("== STORE FLAG: No branchId found, skipping store flags request"),SWY.STOREFLAGUTIL.setStoreFlagsState({})):SWY.STOREFLAGUTIL.setStoreFlagsState({})},SWY.STOREFLAGUTIL.getStoreFlags=function(){const e=AB.userInfo;let t=window.location.protocol+"//"+window.location.host+AB.webPreloadPath+"/"+e.branchId;e.zipcode&&(t+="?zipcode="+e.zipcode),$.ajax({url:t,type:"GET",headers:{"ocp-apim-subscription-key":AB.preloadStoreFlagsXapiApimKey},accept:"application/json"}).done(function(t){const o=t&&Object.keys(t).length>0;SWY.STOREFLAGUTIL.updateTimezoneInStorage(t),SWY.STOREFLAGUTIL.setStoreFlagsState(o?{storeId:e.branchId,flags:t}:{})}).fail(function(e,t,o){console.error("== STORE FLAG FAILED:",e.status,t,o),SWY.STOREFLAGUTIL.updateTimezoneInStorage(null),SWY.STOREFLAGUTIL.setStoreFlagsState({})})},{}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.