(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{1130:function(e,t,r){"use strict";r.r(t),r.d(t,"default",(function(){return hr})),"undefined"!=typeof globalThis&&(globalThis.regeneratorRuntime=void 0);var n={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){try{if(window.btoa&&window.atob)return window.btoa(unescape(encodeURIComponent(e)))}catch(e){console.error("Error encoding cookie values into Base64:"+e)}return this._encode(e)},_encode:function(e){var t,r,o,s,a,c,u,d="",l=0;for(e=i.encode(e);l<e.length;)s=(t=e.charCodeAt(l++))>>2,a=(3&t)<<4|(r=e.charCodeAt(l++))>>4,c=(15&r)<<2|(o=e.charCodeAt(l++))>>6,u=63&o,isNaN(r)?c=u=64:isNaN(o)&&(u=64),d=d+n._keyStr.charAt(s)+n._keyStr.charAt(a)+n._keyStr.charAt(c)+n._keyStr.charAt(u);return d},decode:function(e){try{if(window.btoa&&window.atob)return decodeURIComponent(escape(window.atob(e)))}catch(e){}return n._decode(e)},_decode:function(e){var t,r,o,s,a,c,u="",d=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");d<e.length;)t=n._keyStr.indexOf(e.charAt(d++))<<2|(s=n._keyStr.indexOf(e.charAt(d++)))>>4,r=(15&s)<<4|(a=n._keyStr.indexOf(e.charAt(d++)))>>2,o=(3&a)<<6|(c=n._keyStr.indexOf(e.charAt(d++))),u+=String.fromCharCode(t),64!==a&&(u+=String.fromCharCode(r)),64!==c&&(u+=String.fromCharCode(o));return u=i.decode(u)}},i={encode:function(e){for(var t,r="",n=0;n<e.length;n++)128>(t=e.charCodeAt(n))?r+=String.fromCharCode(t):127<t&&2048>t?(r+=String.fromCharCode(192|t>>6),r+=String.fromCharCode(128|63&t)):(r+=String.fromCharCode(224|t>>12),r+=String.fromCharCode(128|63&t>>6),r+=String.fromCharCode(128|63&t));return r},decode:function(e){for(var t="",r=0,n=0,i=0,o=0;r<e.length;)128>(n=e.charCodeAt(r))?(t+=String.fromCharCode(n),r++):191<n&&224>n?(i=e.charCodeAt(r+1),t+=String.fromCharCode((31&n)<<6|63&i),r+=2):(i=e.charCodeAt(r+1),o=e.charCodeAt(r+2),t+=String.fromCharCode((15&n)<<12|(63&i)<<6|63&o),r+=3);return t}},o={forEach:function(e,t){var r,n;if(null==this)throw new TypeError(" this is null or not defined");var i=Object(this),o=i.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(1<arguments.length&&(r=t),n=0;n<o;){var s;n in i&&(s=i[n],e.call(r,s,n,i)),n++}},map:function(e,t){var r,n,i;if(null===this)throw new TypeError(" this is null or not defined");var o=Object(this),s=o.length>>>0;if("function"!=typeof e)throw new TypeError(e+" is not a function");for(1<arguments.length&&(r=t),n=Array(s),i=0;i<s;){var a,c;i in o&&(a=o[i],c=e.call(r,a,i,o),n[i]=c),i++}return n},filter:function(e){if(null==this)throw new TypeError;var t=Object(this),r=t.length>>>0;if("function"!=typeof e)throw new TypeError;for(var n=[],i=2<=arguments.length?arguments[1]:void 0,o=0;o<r;o++)if(o in t){var s=t[o];e.call(i,s,o,t)&&n.push(s)}return n},isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},Base64:n};function s(e){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s(e)}function a(e){var t=function(e,t){if("object"!==s(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==s(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===s(t)?t:String(t)}function c(e,t,r){return(t=a(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var u,d={SessionStart:1,SessionEnd:2,PageView:3,PageEvent:4,CrashReport:5,OptOut:6,AppStateTransition:10,Profile:14,Commerce:16,Media:20,UserAttributeChange:17,UserIdentityChange:18},l=(c(u={},d.Commerce,1),c(u,d.UserIdentityChange,1),u),g={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9,getName:function(e){return e===g.Unknown?"Unknown":e===g.Navigation?"Navigation":e===g.Location?"Location":e===g.Search?"Search":e===g.Transaction?"Transaction":e===g.UserContent?"User Content":e===g.UserPreference?"User Preference":e===g.Social?"Social":e===p.ProductAddToCart?"Product Added to Cart":e===p.ProductAddToWishlist?"Product Added to Wishlist":e===p.ProductCheckout?"Product Checkout":e===p.ProductCheckoutOption?"Product Checkout Options":e===p.ProductClick?"Product Click":e===p.ProductImpression?"Product Impression":e===p.ProductPurchase?"Product Purchased":e===p.ProductRefund?"Product Refunded":e===p.ProductRemoveFromCart?"Product Removed From Cart":e===p.ProductRemoveFromWishlist?"Product Removed from Wishlist":e===p.ProductViewDetail?"Product View Details":e===p.PromotionClick?"Promotion Click":e===p.PromotionView?"Promotion View":"Other"}},p={ProductAddToCart:10,ProductRemoveFromCart:11,ProductCheckout:12,ProductCheckoutOption:13,ProductClick:14,ProductViewDetail:15,ProductPurchase:16,ProductRefund:17,PromotionView:18,PromotionClick:19,ProductAddToWishlist:20,ProductRemoveFromWishlist:21,ProductImpression:22},v={Other:0,CustomerId:1,Facebook:2,Twitter:3,Google:4,Microsoft:5,Yahoo:6,Email:7,FacebookCustomAudienceId:9,Other2:10,Other3:11,Other4:12,Other5:13,Other6:14,Other7:15,Other8:16,Other9:17,Other10:18,MobileNumber:19,PhoneNumber2:20,PhoneNumber3:21,isValid:function(e){if("number"==typeof e)for(var t in v)if(v.hasOwnProperty(t)&&v[t]===e)return!0;return!1},getName:function(e){return e===window.mParticle.IdentityType.CustomerId?"Customer ID":e===window.mParticle.IdentityType.Facebook?"Facebook ID":e===window.mParticle.IdentityType.Twitter?"Twitter ID":e===window.mParticle.IdentityType.Google?"Google ID":e===window.mParticle.IdentityType.Microsoft?"Microsoft ID":e===window.mParticle.IdentityType.Yahoo?"Yahoo ID":e===window.mParticle.IdentityType.Email?"Email":e===window.mParticle.IdentityType.FacebookCustomAudienceId?"Facebook App User ID":"Other ID"},getIdentityType:function(e){return"other"===e?v.Other:"customerid"===e?v.CustomerId:"facebook"===e?v.Facebook:"twitter"===e?v.Twitter:"google"===e?v.Google:"microsoft"===e?v.Microsoft:"yahoo"===e?v.Yahoo:"email"===e?v.Email:"facebookcustomaudienceid"===e?v.FacebookCustomAudienceId:"other2"===e?v.Other2:"other3"===e?v.Other3:"other4"===e?v.Other4:"other5"===e?v.Other5:"other6"===e?v.Other6:"other7"===e?v.Other7:"other8"===e?v.Other8:"other9"===e?v.Other9:"other10"===e?v.Other10:"mobile_number"===e?v.MobileNumber:"phone_number_2"===e?v.PhoneNumber2:!("phone_number_3"!=e)&&v.PhoneNumber3},getIdentityName:function(e){return e===v.Other?"other":e===v.CustomerId?"customerid":e===v.Facebook?"facebook":e===v.Twitter?"twitter":e===v.Google?"google":e===v.Microsoft?"microsoft":e===v.Yahoo?"yahoo":e===v.Email?"email":e===v.FacebookCustomAudienceId?"facebookcustomaudienceid":e===v.Other2?"other2":e===v.Other3?"other3":e===v.Other4?"other4":e===v.Other5?"other5":e===v.Other6?"other6":e===v.Other7?"other7":e===v.Other8?"other8":e===v.Other9?"other9":e===v.Other10?"other10":e===v.MobileNumber?"mobile_number":e===v.PhoneNumber2?"phone_number_2":e===v.PhoneNumber3?"phone_number_3":void 0}},m={Unknown:0,AddToCart:1,RemoveFromCart:2,Checkout:3,CheckoutOption:4,Click:5,ViewDetail:6,Purchase:7,Refund:8,AddToWishlist:9,RemoveFromWishlist:10,getName:function(e){return e===m.AddToCart?"Add to Cart":e===m.RemoveFromCart?"Remove from Cart":e===m.Checkout?"Checkout":e===m.CheckoutOption?"Checkout Option":e===m.Click?"Click":e===m.ViewDetail?"View Detail":e===m.Purchase?"Purchase":e===m.Refund?"Refund":e===m.AddToWishlist?"Add to Wishlist":e===m.RemoveFromWishlist?"Remove from Wishlist":"Unknown"},getExpansionName:function(e){return e===m.AddToCart?"add_to_cart":e===m.RemoveFromCart?"remove_from_cart":e===m.Checkout?"checkout":e===m.CheckoutOption?"checkout_option":e===m.Click?"click":e===m.ViewDetail?"view_detail":e===m.Purchase?"purchase":e===m.Refund?"refund":e===m.AddToWishlist?"add_to_wishlist":e===m.RemoveFromWishlist?"remove_from_wishlist":"unknown"}},f={Unknown:0,PromotionView:1,PromotionClick:2,getName:function(e){return e===f.PromotionView?"view":e===f.PromotionClick?"click":"unknown"},getExpansionName:function(e){return e===f.PromotionView?"view":e===f.PromotionClick?"click":"unknown"}},h={MessageType:d,EventType:g,CommerceEventType:p,IdentityType:v,ProfileMessageType:{Logout:3},ApplicationTransitionType:{AppInit:1},ProductActionType:m,PromotionActionType:f,TriggerUploadType:l,Environment:{Production:"production",Development:"development"}},y={sdkVersion:"2.26.3",sdkVendor:"mparticle",platform:"web",Messages:{DeprecationMessages:{MethodIsDeprecatedPostfix:"is a deprecated method and will be removed in future releases",AlternativeMethodPrefix:"Please use the alternate method:"},ErrorMessages:{NoToken:"A token must be specified.",EventNameInvalidType:"Event name must be a valid string value.",EventDataInvalidType:"Event data must be a valid object hash.",LoggingDisabled:"Event logging is currently disabled.",CookieParseError:"Could not parse cookie",EventEmpty:"Event object is null or undefined, cancelling send",APIRequestEmpty:"APIRequest is null or undefined, cancelling send",NoEventType:"Event type must be specified.",TransactionIdRequired:"Transaction ID is required",TransactionRequired:"A transaction attributes object is required",PromotionIdRequired:"Promotion ID is required",BadAttribute:"Attribute value cannot be object or array",BadKey:"Key value cannot be object or array",BadLogPurchase:"Transaction attributes and a product are both required to log a purchase, https://docs.mparticle.com/?javascript#measuring-transactions",AudienceAPINotEnabled:"Your workspace is not enabled to retrieve user audiences."},InformationMessages:{CookieSearch:"Searching for cookie",CookieFound:"Cookie found, parsing values",CookieNotFound:"Cookies not found",CookieSet:"Setting cookie",CookieSync:"Performing cookie sync",SendBegin:"Starting to send event",SendIdentityBegin:"Starting to send event to identity server",SendWindowsPhone:"Sending event to Windows Phone container",SendIOS:"Calling iOS path: ",SendAndroid:"Calling Android JS interface method: ",SendHttp:"Sending event to mParticle HTTP service",SendAliasHttp:"Sending alias request to mParticle HTTP service",SendIdentityHttp:"Sending event to mParticle HTTP service",StartingNewSession:"Starting new Session",StartingLogEvent:"Starting to log event",StartingLogOptOut:"Starting to log user opt in/out",StartingEndSession:"Starting to end session",StartingInitialization:"Starting to initialize",StartingLogCommerceEvent:"Starting to log commerce event",StartingAliasRequest:"Starting to Alias MPIDs",LoadingConfig:"Loading configuration options",AbandonLogEvent:"Cannot log event, logging disabled or developer token not set",AbandonAliasUsers:"Cannot Alias Users, logging disabled or developer token not set",AbandonStartSession:"Cannot start session, logging disabled or developer token not set",AbandonEndSession:"Cannot end session, logging disabled or developer token not set",NoSessionToEnd:"Cannot end session, no active session found"},ValidationMessages:{ModifyIdentityRequestUserIdentitiesPresent:"identityRequests to modify require userIdentities to be present. Request not sent to server. Please fix and try again",IdentityRequesetInvalidKey:"There is an invalid key on your identityRequest object. It can only contain a `userIdentities` object and a `onUserAlias` function. Request not sent to server. Please fix and try again.",OnUserAliasType:"The onUserAlias value must be a function.",UserIdentities:"The userIdentities key must be an object with keys of identityTypes and values of strings. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidKey:"There is an invalid identity key on your `userIdentities` object within the identityRequest. Request not sent to server. Please fix and try again.",UserIdentitiesInvalidValues:"All user identity values must be strings or null. Request not sent to server. Please fix and try again.",AliasMissingMpid:"Alias Request must contain both a destinationMpid and a sourceMpid",AliasNonUniqueMpid:"Alias Request's destinationMpid and sourceMpid must be unique",AliasMissingTime:"Alias Request must have both a startTime and an endTime",AliasStartBeforeEndTime:"Alias Request's endTime must be later than its startTime"}},NativeSdkPaths:{LogEvent:"logEvent",SetUserTag:"setUserTag",RemoveUserTag:"removeUserTag",SetUserAttribute:"setUserAttribute",RemoveUserAttribute:"removeUserAttribute",SetSessionAttribute:"setSessionAttribute",AddToCart:"addToCart",RemoveFromCart:"removeFromCart",ClearCart:"clearCart",LogOut:"logOut",SetUserAttributeList:"setUserAttributeList",RemoveAllUserAttributes:"removeAllUserAttributes",GetUserAttributesLists:"getUserAttributesLists",GetAllUserAttributes:"getAllUserAttributes",Identify:"identify",Logout:"logout",Login:"login",Modify:"modify",Alias:"aliasUsers",Upload:"upload"},StorageNames:{localStorageName:"mprtcl-api",localStorageNameV3:"mprtcl-v3",cookieName:"mprtcl-api",cookieNameV2:"mprtcl-v2",cookieNameV3:"mprtcl-v3",localStorageNameV4:"mprtcl-v4",localStorageProductsV4:"mprtcl-prodv4",cookieNameV4:"mprtcl-v4",currentStorageName:"mprtcl-v4",currentStorageProductsName:"mprtcl-prodv4"},DefaultConfig:{cookieDomain:null,cookieExpiration:365,logLevel:null,timeout:300,sessionTimeout:30,maxProducts:20,forwarderStatsTimeout:5e3,integrationDelayTimeout:5e3,maxCookieSize:3e3,aliasMaxWindow:90,uploadInterval:0},DefaultBaseUrls:{v1SecureServiceUrl:"jssdks.mparticle.com/v1/JS/",v2SecureServiceUrl:"jssdks.mparticle.com/v2/JS/",v3SecureServiceUrl:"jssdks.mparticle.com/v3/JS/",configUrl:"jssdkcdns.mparticle.com/JS/v2/",identityUrl:"identity.mparticle.com/v1/",aliasUrl:"jssdks.mparticle.com/v1/identity/",userAudienceUrl:"nativesdks.mparticle.com/v1/"},Base64CookieKeys:{csm:1,sa:1,ss:1,ua:1,ui:1,csd:1,ia:1,con:1},SDKv2NonMPIDCookieKeys:{gs:1,cu:1,l:1,globalSettings:1,currentUserMPID:1},HTTPCodes:{noHttpCoverage:-1,activeIdentityRequest:-2,activeSession:-3,validationIssue:-4,nativeIdentityRequest:-5,loggingDisabledOrMissingAPIKey:-6,tooManyRequests:429},FeatureFlags:{ReportBatching:"reportBatching",EventBatchingIntervalMillis:"eventBatchingIntervalMillis",OfflineStorage:"offlineStorage",DirectUrlRouting:"directURLRouting",CacheIdentity:"cacheIdentity",AudienceAPI:"audienceAPI"},DefaultInstance:"default_instance",CCPAPurpose:"data_sale_opt_out",IdentityMethods:{Modify:"modify",Logout:"logout",Login:"login",Identify:"identify"}},S=function(e,t){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},S(e,t)};function _(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}S(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var P,b,I,C=function(){return C=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},C.apply(this,arguments)};function A(e,t,r,n){return new(r||(r=Promise))((function(i,o){function s(e){try{c(n.next(e))}catch(t){o(t)}}function a(e){try{c(n.throw(e))}catch(t){o(t)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(s,a)}c((n=n.apply(e,t||[])).next())}))}function w(e,t){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(c){a=[6,c],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function E(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,(b=P||(P={}))[b.Unknown=0]="Unknown",b[b.AddToCart=1]="AddToCart",b[b.RemoveFromCart=2]="RemoveFromCart",b[b.Checkout=3]="Checkout",b[b.CheckoutOption=4]="CheckoutOption",b[b.Click=5]="Click",b[b.ViewDetail=6]="ViewDetail",b[b.Purchase=7]="Purchase",b[b.Refund=8]="Refund",b[b.AddToWishlist=9]="AddToWishlist",b[b.RemoveFromWishlist=10]="RemoveFromWishlist",function(e){e.other="other",e.customerId="customerid",e.facebook="facebook",e.twitter="twitter",e.google="google",e.microsoft="microsoft",e.yahoo="yahoo",e.email="email",e.alias="alias",e.facebookCustomAudienceId="facebookcustomaudienceid",e.otherId2="other2",e.otherId3="other3",e.otherId4="other4",e.otherId5="other5",e.otherId6="other6",e.otherId7="other7",e.otherId8="other8",e.otherId9="other9",e.otherId10="other10",e.mobileNumber="mobile_number",e.phoneNumber2="phone_number_2",e.phoneNumber3="phone_number_3"}(I||(I={}));var T,k,D,O,U,M,L,N,F,R,V,H,x,K,j,q,B,W={};T=W,Object.defineProperty(T,"__esModule",{value:!0}),(k=T.ApplicationInformationOsEnum||(T.ApplicationInformationOsEnum={})).unknown="Unknown",k.iOS="IOS",k.android="Android",k.windowsPhone="WindowsPhone",k.mobileWeb="MobileWeb",k.unityIOS="UnityIOS",k.unityAndroid="UnityAndroid",k.desktop="Desktop",k.tvOS="TVOS",k.roku="Roku",k.outOfBand="OutOfBand",k.alexa="Alexa",k.smartTV="SmartTV",k.fireTV="FireTV",k.xbox="Xbox",(T.ApplicationStateTransitionEventEventTypeEnum||(T.ApplicationStateTransitionEventEventTypeEnum={})).applicationStateTransition="application_state_transition",(D=T.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum||(T.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum={})).applicationInitialized="application_initialized",D.applicationExit="application_exit",D.applicationBackground="application_background",D.applicationForeground="application_foreground",(O=T.BatchEnvironmentEnum||(T.BatchEnvironmentEnum={})).unknown="unknown",O.development="development",O.production="production",(T.BreadcrumbEventEventTypeEnum||(T.BreadcrumbEventEventTypeEnum={})).breadcrumb="breadcrumb",(T.CommerceEventEventTypeEnum||(T.CommerceEventEventTypeEnum={})).commerceEvent="commerce_event",(U=T.CommerceEventDataCustomEventTypeEnum||(T.CommerceEventDataCustomEventTypeEnum={})).addToCart="add_to_cart",U.removeFromCart="remove_from_cart",U.checkout="checkout",U.checkoutOption="checkout_option",U.click="click",U.viewDetail="view_detail",U.purchase="purchase",U.refund="refund",U.promotionView="promotion_view",U.promotionClick="promotion_click",U.addToWishlist="add_to_wishlist",U.removeFromWishlist="remove_from_wishlist",U.impression="impression",(T.CrashReportEventEventTypeEnum||(T.CrashReportEventEventTypeEnum={})).crashReport="crash_report",(T.CustomEventEventTypeEnum||(T.CustomEventEventTypeEnum={})).customEvent="custom_event",(M=T.CustomEventDataCustomEventTypeEnum||(T.CustomEventDataCustomEventTypeEnum={})).navigation="navigation",M.location="location",M.search="search",M.transaction="transaction",M.userContent="user_content",M.userPreference="user_preference",M.social="social",M.media="media",M.other="other",M.unknown="unknown",(L=T.DeviceCurrentStateDeviceOrientationEnum||(T.DeviceCurrentStateDeviceOrientationEnum={})).portrait="portrait",L.portraitUpsideDown="portrait_upside_down",L.landscape="landscape",L.landscapeLeft="LandscapeLeft",L.landscapeRight="LandscapeRight",L.faceUp="FaceUp",L.faceDown="FaceDown",L.square="Square",(N=T.DeviceCurrentStateStatusBarOrientationEnum||(T.DeviceCurrentStateStatusBarOrientationEnum={})).portrait="portrait",N.portraitUpsideDown="portrait_upside_down",N.landscape="landscape",N.landscapeLeft="LandscapeLeft",N.landscapeRight="LandscapeRight",N.faceUp="FaceUp",N.faceDown="FaceDown",N.square="Square",(F=T.DeviceInformationPlatformEnum||(T.DeviceInformationPlatformEnum={})).iOS="iOS",F.android="Android",F.web="web",F.desktop="desktop",F.tvOS="tvOS",F.roku="roku",F.outOfBand="out_of_band",F.smartTV="smart_tv",F.xbox="xbox",function(e){e.unknown="unknown",e.sessionStart="session_start",e.sessionEnd="session_end",e.screenView="screen_view",e.customEvent="custom_event",e.crashReport="crash_report",e.optOut="opt_out",e.firstRun="first_run",e.preAttribution="pre_attribution",e.pushRegistration="push_registration",e.applicationStateTransition="application_state_transition",e.pushMessage="push_message",e.networkPerformance="network_performance",e.breadcrumb="breadcrumb",e.profile="profile",e.pushReaction="push_reaction",e.commerceEvent="commerce_event",e.userAttributeChange="user_attribute_change",e.userIdentityChange="user_identity_change",e.uninstall="uninstall",e.validationResult="validation_result"}(T.EventTypeEnum||(T.EventTypeEnum={})),(R=T.IdentityTypeEnum||(T.IdentityTypeEnum={})).other="other",R.customerId="customer_id",R.facebook="facebook",R.twitter="twitter",R.google="google",R.microsoft="microsoft",R.yahoo="yahoo",R.email="email",R.alias="alias",R.facebookCustomAudienceId="facebook_custom_audience_id",R.otherId2="other_id_2",R.otherId3="other_id_3",R.otherId4="other_id_4",R.otherId5="other_id_5",R.otherId6="other_id_6",R.otherId7="other_id_7",R.otherId8="other_id_8",R.otherId9="other_id_9",R.otherId10="other_id_10",R.mobileNumber="mobile_number",R.phoneNumber2="phone_number_2",R.phoneNumber3="phone_number_3",(T.NetworkPerformanceEventEventTypeEnum||(T.NetworkPerformanceEventEventTypeEnum={})).networkPerformance="network_performance",(T.OptOutEventEnum||(T.OptOutEventEnum={})).optOut="opt_out",(V=T.ProductActionActionEnum||(T.ProductActionActionEnum={})).unknown="unknown",V.addToCart="add_to_cart",V.removeFromCart="remove_from_cart",V.checkout="checkout",V.checkoutOption="checkout_option",V.click="click",V.viewDetail="view_detail",V.purchase="purchase",V.refund="refund",V.addToWishlist="add_to_wishlist",V.removeFromWishlist="remove_from_wish_list",(T.ProfileEventEventTypeEnum||(T.ProfileEventEventTypeEnum={})).profile="profile",(H=T.ProfileEventDataProfileEventTypeEnum||(T.ProfileEventDataProfileEventTypeEnum={})).signup="signup",H.login="login",H.logout="logout",H.update="update",H.delete="delete",(x=T.PromotionActionActionEnum||(T.PromotionActionActionEnum={})).view="view",x.click="click",(T.PushMessageEventEventTypeEnum||(T.PushMessageEventEventTypeEnum={})).pushMessage="push_message",(K=T.PushMessageEventDataPushMessageTypeEnum||(T.PushMessageEventDataPushMessageTypeEnum={})).sent="sent",K.received="received",K.action="action",(j=T.PushMessageEventDataApplicationStateEnum||(T.PushMessageEventDataApplicationStateEnum={})).notRunning="not_running",j.background="background",j.foreground="foreground",(q=T.PushMessageEventDataPushMessageBehaviorEnum||(T.PushMessageEventDataPushMessageBehaviorEnum={})).received="Received",q.directOpen="DirectOpen",q.read="Read",q.influencedOpen="InfluencedOpen",q.displayed="Displayed",(T.PushRegistrationEventEventTypeEnum||(T.PushRegistrationEventEventTypeEnum={})).pushRegistration="push_registration",(T.SessionEndEventEventTypeEnum||(T.SessionEndEventEventTypeEnum={})).sessionEnd="session_end",(T.SessionStartEventEventTypeEnum||(T.SessionStartEventEventTypeEnum={})).sessionStart="session_start",(B=T.SourceInformationChannelEnum||(T.SourceInformationChannelEnum={})).native="native",B.javascript="javascript",B.pixel="pixel",B.desktop="desktop",B.partner="partner",B.serverToServer="server_to_server",(T.UserAttributeChangeEventEventTypeEnum||(T.UserAttributeChangeEventEventTypeEnum={})).userAttributeChange="user_attribute_change",(T.UserIdentityChangeEventEventTypeEnum||(T.UserIdentityChangeEventEventTypeEnum={})).userIdentityChange="user_identity_change";var z=y.Messages,J=function(e){return ne(se(e))},Q=function(e){return ie(oe(e))},G=function(e,t){var r=0;if(Array.prototype.indexOf)return 0<=e.indexOf(t,0);for(var n=e.length;r<n;r++)if(r in e&&e[r]===t)return!0;return!1},Y=function(e,t){if(t&&e)for(var r in e)if(e.hasOwnProperty(r)&&r.toLowerCase()===t.toLowerCase())return r;return null},X=function(e,t){var r=[e,z.DeprecationMessages.MethodIsDeprecatedPostfix];return t&&(r.push(t),r.push(z.DeprecationMessages.MethodIsDeprecatedPostfix)),r.join(" ")};function $(e){var t=0;if(null==e)return 0;if(e=e.toString().toLowerCase(),Array.prototype.reduce)return e.split("").reduce((function(e,t){return(e=(e<<5)-e+t.charCodeAt(0))&e}),0);if(0===e.length)return t;for(var r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return t}var Z=function e(t){return void 0===t&&(t=""),t?function(){var e,t;return window.crypto&&window.crypto.getRandomValues&&(e=window.crypto.getRandomValues(new Uint8Array(1))),e?(t^e[0]%16>>NaN).toString(16):(t^16*Math.random()>>NaN).toString(16)}():"".concat(1e7,"-").concat(1e3,"-").concat(4e3,"-").concat(8e3,"-").concat(1e11).replace(/[018]/g,e)},ee=function(e){var t=Object.prototype.toString.call(e);return"[object Object]"===t||"[object Error]"===t},te=function(e){if(isNaN(e)||!isFinite(e))return 0;var t=parseFloat(e);return isNaN(t)?0:t},re=function(e){return me(e)?e:null},ne=function(e){return e.replace(/,/g,"|")},ie=function(e){return e.replace(/\|/g,",")},oe=function(e){return e.replace(/\'/g,'"')},se=function(e){return e.replace(/\"/g,"'")},ae=function(e){return"false"!==e&&"0"!==e&&!!e},ce=function(e){return decodeURIComponent(e.replace(/\+/g," "))},ue=function(e){return 0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")),e},de=function(e){return"string"==typeof e},le=function(e){return"number"==typeof e},ge=function(e){return"function"==typeof e},pe=function(e){return le(e)||de(e)||function(e){return"boolean"==typeof e}(e)},ve=function(e){return e===function(e){return me(e)?e.toString().toLowerCase().replace(/[^0-9a-zA-Z]+/g,"_"):""}(e)},me=function(e){return de(e)||le(e)},fe=function(e){return null==e||!(Object.keys(e)||e).length};function he(e,t,r){if(!e)return null;if(!t||1>t.length)return null;for(var n,i=r.Identity.getCurrentUser(),o=[],s=null,a=0,c=t;a<c.length;a++)if(n=c[a]){s=n;var u=be(n);u&&o.push(u)}if(!s)return null;var d=null;fe(s.ConsentState)?!fe(i)&&(d=i.getConsentState()):d=s.ConsentState;var l={source_request_id:r._Helpers.generateUniqueId(),mpid:e,timestamp_unixtime_ms:(new Date).getTime(),environment:s.Debug?W.BatchEnvironmentEnum.development:W.BatchEnvironmentEnum.production,events:o,mp_deviceid:s.DeviceId,sdk_version:s.SDKVersion,application_info:{application_version:s.AppVersion,application_name:s.AppName,package:s.Package,sideloaded_kits_count:r._Store.sideloadedKitsCount},device_info:{platform:W.DeviceInformationPlatformEnum.web,screen_width:window.screen.width,screen_height:window.screen.height},user_attributes:s.UserAttributes,user_identities:Pe(s.UserIdentities),consent_state:ye(d),integration_attributes:s.IntegrationAttributes};return s.DataPlan&&s.DataPlan.PlanId&&(l.context={data_plan:{plan_id:s.DataPlan.PlanId,plan_version:s.DataPlan.PlanVersion||void 0}}),l}function ye(e){return fe(e)?null:{gdpr:Se(e.getGDPRConsentState()),ccpa:_e(e.getCCPAConsentState())}}function Se(e){if(!e)return null;var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]={consented:e[r].Consented,hardware_id:e[r].HardwareId,document:e[r].ConsentDocument,timestamp_unixtime_ms:e[r].Timestamp,location:e[r].Location});return t}function _e(e){return e?{data_sale_opt_out:{consented:e.Consented,hardware_id:e.HardwareId,document:e.ConsentDocument,timestamp_unixtime_ms:e.Timestamp,location:e.Location}}:null}function Pe(e){if(!e||!e.length)return null;for(var t,r={},n=0,i=e;n<i.length;n++)switch((t=i[n]).Type){case h.IdentityType.CustomerId:r.customer_id=t.Identity;break;case h.IdentityType.Email:r.email=t.Identity;break;case h.IdentityType.Facebook:r.facebook=t.Identity;break;case h.IdentityType.FacebookCustomAudienceId:r.facebook_custom_audience_id=t.Identity;break;case h.IdentityType.Google:r.google=t.Identity;break;case h.IdentityType.Microsoft:r.microsoft=t.Identity;break;case h.IdentityType.Other:r.other=t.Identity;break;case h.IdentityType.Other2:r.other_id_2=t.Identity;break;case h.IdentityType.Other3:r.other_id_3=t.Identity;break;case h.IdentityType.Other4:r.other_id_4=t.Identity;break;case h.IdentityType.Other5:r.other_id_5=t.Identity;break;case h.IdentityType.Other6:r.other_id_6=t.Identity;break;case h.IdentityType.Other7:r.other_id_7=t.Identity;break;case h.IdentityType.Other8:r.other_id_8=t.Identity;break;case h.IdentityType.Other9:r.other_id_9=t.Identity;break;case h.IdentityType.Other10:r.other_id_10=t.Identity;break;case h.IdentityType.MobileNumber:r.mobile_number=t.Identity;break;case h.IdentityType.PhoneNumber2:r.phone_number_2=t.Identity;break;case h.IdentityType.PhoneNumber3:r.phone_number_3=t.Identity}return r}function be(e){if(!e)return null;switch(e.EventDataType){case h.MessageType.AppStateTransition:return function(e){var t=Oe(e),r={application_transition_type:W.ApplicationStateTransitionEventDataApplicationTransitionTypeEnum.applicationInitialized,is_first_run:e.IsFirstRun,is_upgrade:!1,launch_referral:e.LaunchReferral};return r=Object.assign(r,t),{event_type:W.EventTypeEnum.applicationStateTransition,data:r}}(e);case h.MessageType.Commerce:return function(e){var t=Oe(e),r={custom_flags:e.CustomFlags,product_action:Ce(e),promotion_action:we(e),product_impressions:Te(e),shopping_cart:ke(e),currency_code:e.CurrencyCode};return r=Object.assign(r,t),{event_type:W.EventTypeEnum.commerceEvent,data:r}}(e);case h.MessageType.CrashReport:return function(e){var t=Oe(e),r={message:e.EventName};return r=Object.assign(r,t),{event_type:W.EventTypeEnum.crashReport,data:r}}(e);case h.MessageType.OptOut:return function(e){var t=Oe(e),r={is_opted_out:e.OptOut};return r=Object.assign(r,t),{event_type:W.EventTypeEnum.optOut,data:r}}(e);case h.MessageType.PageEvent:return function(e){var t=Oe(e),r={custom_event_type:De(e.EventCategory),custom_flags:e.CustomFlags,event_name:e.EventName};return r=Object.assign(r,t),{event_type:W.EventTypeEnum.customEvent,data:r}}(e);case h.MessageType.PageView:return function(e){var t=Oe(e),r={custom_flags:e.CustomFlags,screen_name:e.EventName};return r=Object.assign(r,t),{event_type:W.EventTypeEnum.screenView,data:r}}(e);case h.MessageType.Profile:return null;case h.MessageType.SessionEnd:return function(e){var t=Oe(e),r={session_duration_ms:e.SessionLength};return r=Object.assign(r,t),{event_type:W.EventTypeEnum.sessionEnd,data:r}}(e);case h.MessageType.SessionStart:return function(e){var t=Oe(e),r={};return r=Object.assign(r,t),{event_type:W.EventTypeEnum.sessionStart,data:r}}(e);case h.MessageType.UserAttributeChange:return function(e){var t=Oe(e),r={user_attribute_name:e.UserAttributeChanges.UserAttributeName,new:e.UserAttributeChanges.New,old:e.UserAttributeChanges.Old,deleted:e.UserAttributeChanges.Deleted,is_new_attribute:e.UserAttributeChanges.IsNewAttribute};return r=C(C({},r),t),{event_type:W.EventTypeEnum.userAttributeChange,data:r}}(e);case h.MessageType.UserIdentityChange:return function(e){var t=Oe(e),r={new:{identity_type:Me(e.UserIdentityChanges.New.IdentityType),identity:e.UserIdentityChanges.New.Identity||null,timestamp_unixtime_ms:e.Timestamp,created_this_batch:e.UserIdentityChanges.New.CreatedThisBatch},old:{identity_type:Me(e.UserIdentityChanges.Old.IdentityType),identity:e.UserIdentityChanges.Old.Identity||null,timestamp_unixtime_ms:e.Timestamp,created_this_batch:e.UserIdentityChanges.Old.CreatedThisBatch}};return r=Object.assign(r,t),{event_type:W.EventTypeEnum.userIdentityChange,data:r}}(e)}return null}function Ie(e){return e?e===P.AddToCart?W.ProductActionActionEnum.addToCart:e===P.AddToWishlist?W.ProductActionActionEnum.addToWishlist:e===P.Checkout?W.ProductActionActionEnum.checkout:e===P.CheckoutOption?W.ProductActionActionEnum.checkoutOption:e===P.Click?W.ProductActionActionEnum.click:e===P.Purchase?W.ProductActionActionEnum.purchase:e===P.Refund?W.ProductActionActionEnum.refund:e===P.RemoveFromCart?W.ProductActionActionEnum.removeFromCart:e===P.RemoveFromWishlist?W.ProductActionActionEnum.removeFromWishlist:e===P.ViewDetail?W.ProductActionActionEnum.viewDetail:W.ProductActionActionEnum.unknown:W.ProductActionActionEnum.unknown}function Ce(e){return e.ProductAction?{action:Ie(e.ProductAction.ProductActionType),checkout_step:e.ProductAction.CheckoutStep,checkout_options:e.ProductAction.CheckoutOptions,transaction_id:e.ProductAction.TransactionId,affiliation:e.ProductAction.Affiliation,total_amount:e.ProductAction.TotalAmount,tax_amount:e.ProductAction.TaxAmount,shipping_amount:e.ProductAction.ShippingAmount,coupon_code:e.ProductAction.CouponCode,products:Ae(e.ProductAction.ProductList)}:null}function Ae(e){if(!e||!e.length)return null;for(var t=[],r=0,n=e;r<n.length;r++){var i=n[r],o={id:i.Sku,name:i.Name,brand:i.Brand,category:i.Category,variant:i.Variant,total_product_amount:i.TotalAmount,position:i.Position,price:i.Price,quantity:i.Quantity,coupon_code:i.CouponCode,custom_attributes:i.Attributes};t.push(o)}return t}function we(e){return e.PromotionAction?{action:e.PromotionAction.PromotionActionType,promotions:Ee(e.PromotionAction.PromotionList)}:null}function Ee(e){if(!e||!e.length)return null;for(var t=[],r=0,n=e;r<n.length;r++){var i=n[r],o={id:i.Id,name:i.Name,creative:i.Creative,position:i.Position};t.push(o)}return t}function Te(e){if(!e.ProductImpressions)return null;for(var t=[],r=0,n=e.ProductImpressions;r<n.length;r++){var i=n[r],o={product_impression_list:i.ProductImpressionList,products:Ae(i.ProductList)};t.push(o)}return t}function ke(e){return e.ShoppingCart&&e.ShoppingCart.ProductList&&e.ShoppingCart.ProductList.length?{products:Ae(e.ShoppingCart.ProductList)}:null}function De(e){return e===h.EventType.Other?W.CustomEventDataCustomEventTypeEnum.other:e===h.EventType.Location?W.CustomEventDataCustomEventTypeEnum.location:e===h.EventType.Navigation?W.CustomEventDataCustomEventTypeEnum.navigation:e===h.EventType.Search?W.CustomEventDataCustomEventTypeEnum.search:e===h.EventType.Social?W.CustomEventDataCustomEventTypeEnum.social:e===h.EventType.Transaction?W.CustomEventDataCustomEventTypeEnum.transaction:e===h.EventType.UserContent?W.CustomEventDataCustomEventTypeEnum.userContent:e===h.EventType.UserPreference?W.CustomEventDataCustomEventTypeEnum.userPreference:e===h.EventType.Media?W.CustomEventDataCustomEventTypeEnum.media:e===h.CommerceEventType.ProductAddToCart?W.CommerceEventDataCustomEventTypeEnum.addToCart:e===h.CommerceEventType.ProductAddToWishlist?W.CommerceEventDataCustomEventTypeEnum.addToWishlist:e===h.CommerceEventType.ProductCheckout?W.CommerceEventDataCustomEventTypeEnum.checkout:e===h.CommerceEventType.ProductCheckoutOption?W.CommerceEventDataCustomEventTypeEnum.checkoutOption:e===h.CommerceEventType.ProductClick?W.CommerceEventDataCustomEventTypeEnum.click:e===h.CommerceEventType.ProductImpression?W.CommerceEventDataCustomEventTypeEnum.impression:e===h.CommerceEventType.ProductPurchase?W.CommerceEventDataCustomEventTypeEnum.purchase:e===h.CommerceEventType.ProductRefund?W.CommerceEventDataCustomEventTypeEnum.refund:e===h.CommerceEventType.ProductRemoveFromCart?W.CommerceEventDataCustomEventTypeEnum.removeFromCart:e===h.CommerceEventType.ProductRemoveFromWishlist?W.CommerceEventDataCustomEventTypeEnum.removeFromWishlist:e===h.CommerceEventType.ProductViewDetail?W.CommerceEventDataCustomEventTypeEnum.viewDetail:e===h.CommerceEventType.PromotionClick?W.CommerceEventDataCustomEventTypeEnum.promotionClick:e===h.CommerceEventType.PromotionView?W.CommerceEventDataCustomEventTypeEnum.promotionView:W.CustomEventDataCustomEventTypeEnum.unknown}function Oe(e){return{timestamp_unixtime_ms:e.Timestamp,session_uuid:e.SessionId,session_start_unixtime_ms:e.SessionStartDate,custom_attributes:e.EventAttributes,location:Ue(e.Location),source_message_id:e.SourceMessageId}}function Ue(e){return e&&Object.keys(e).length?{latitude:e.lat,longitude:e.lng}:null}function Me(e){return e===I.other?W.IdentityTypeEnum.other:e===I.customerId?W.IdentityTypeEnum.customerId:e===I.facebook?W.IdentityTypeEnum.facebook:e===I.twitter?W.IdentityTypeEnum.twitter:e===I.google?W.IdentityTypeEnum.google:e===I.microsoft?W.IdentityTypeEnum.microsoft:e===I.yahoo?W.IdentityTypeEnum.yahoo:e===I.email?W.IdentityTypeEnum.email:e===I.alias?W.IdentityTypeEnum.alias:e===I.facebookCustomAudienceId?W.IdentityTypeEnum.facebookCustomAudienceId:e===I.otherId2?W.IdentityTypeEnum.otherId2:e===I.otherId3?W.IdentityTypeEnum.otherId3:e===I.otherId4?W.IdentityTypeEnum.otherId4:e===I.otherId5?W.IdentityTypeEnum.otherId5:e===I.otherId6?W.IdentityTypeEnum.otherId6:e===I.otherId7?W.IdentityTypeEnum.otherId7:e===I.otherId8?W.IdentityTypeEnum.otherId8:e===I.otherId9?W.IdentityTypeEnum.otherId9:e===I.otherId10?W.IdentityTypeEnum.otherId10:e===I.mobileNumber?W.IdentityTypeEnum.mobileNumber:e===I.phoneNumber2?W.IdentityTypeEnum.phoneNumber2:e===I.phoneNumber3?W.IdentityTypeEnum.phoneNumber3:void 0}var Le=function(){function e(e,t,r){this._storageKey=e,this.storageObject=t,this.logger=(null==r?void 0:r.logger)||{verbose:function(){},warning:function(){},error:function(){}},this.contents=this.retrieve()}return e.prototype.store=function(e){this.contents=e;var t=fe(e)?"":JSON.stringify(e);try{this.storageObject.setItem(this._storageKey,t),this.logger.verbose("Saving item to Storage: ".concat(t))}catch(e){this.logger.error("Cannot Save items to Storage: ".concat(t)),this.logger.error(e)}},e.prototype.retrieve=function(){var e=this.storageObject.getItem(this._storageKey);return this.contents=e?JSON.parse(e):null,this.logger.verbose("Retrieving item from Storage: ".concat(e)),this.contents},e.prototype.purge=function(){this.logger.verbose("Purging Storage"),this.contents=null,this.storageObject.removeItem(this._storageKey)},e}(),Ne=function(e){function t(t,r){return e.call(this,t,window.localStorage,r)||this}return _(t,e),t}(Le),Fe=function(e){function t(t,r){return e.call(this,t,window.sessionStorage,r)||this}return _(t,e),t}(Le),Re=function(e){this.url=e},Ve=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return _(t,e),t.prototype.upload=function(e,t){return A(this,void 0,void 0,(function(){var r;return w(this,(function(n){switch(n.label){case 0:return r=t||this.url,[4,fetch(r,e)];case 1:return[2,n.sent()]}}))}))},t}(Re),He=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return _(t,e),t.prototype.upload=function(e){return A(this,void 0,void 0,(function(){return w(this,(function(t){switch(t.label){case 0:return[4,this.makeRequest(this.url,e.body)];case 1:return[2,t.sent()]}}))}))},t.prototype.makeRequest=function(e,t){return A(this,void 0,void 0,(function(){var r;return w(this,(function(){return r=new XMLHttpRequest,[2,new Promise((function(n,i){r.onreadystatechange=function(){4!==r.readyState||(200<=r.status&&300>r.status?n(r):i(r))},r.open("post",e),r.send(t)}))]}))}))},t}(Re),xe=function(){function e(t,r){var n;this.offlineStorageEnabled=!1,this.mpInstance=t,this.uploadIntervalMillis=r,this.batchingEnabled=r>=e.MINIMUM_INTERVAL_MILLIS,this.uploadIntervalMillis<e.MINIMUM_INTERVAL_MILLIS&&(this.uploadIntervalMillis=e.MINIMUM_INTERVAL_MILLIS),this.eventsQueuedForProcessing=[],this.batchesQueuedForProcessing=[],this.offlineStorageEnabled=this.isOfflineStorageAvailable(),this.offlineStorageEnabled&&(this.eventVault=new Fe("".concat(t._Store.storageName,"-events"),{logger:t.Logger}),this.batchVault=new Ne("".concat(t._Store.storageName,"-batches"),{logger:t.Logger}),(n=this.eventsQueuedForProcessing).push.apply(n,this.eventVault.retrieve()));var i=this.mpInstance._Store,o=i.SDKConfig,s=i.devToken,a=this.mpInstance._Helpers.createServiceUrl(o.v3SecureServiceUrl,s);this.uploadUrl="".concat(a,"/events"),this.uploader=window.fetch?new Ve(this.uploadUrl):new He(this.uploadUrl),this.triggerUploadInterval(!0,!1),this.addEventListeners()}return e.prototype.isOfflineStorageAvailable=function(){var e=this.mpInstance,t=e._Helpers.getFeatureFlag,r=e._Store.deviceId,n=t(y.FeatureFlags.OfflineStorage),i=parseInt(n,10),o=function(e){if(!e)return 100;var t=$(e);return Math.abs(t%100)+1}(r);return i>=o},e.prototype.addEventListeners=function(){var e=this;document.addEventListener("visibilitychange",(function(){e.prepareAndUpload(!1,e.isBeaconAvailable())})),window.addEventListener("beforeunload",(function(){e.prepareAndUpload(!1,e.isBeaconAvailable())})),window.addEventListener("pagehide",(function(){e.prepareAndUpload(!1,e.isBeaconAvailable())}))},e.prototype.isBeaconAvailable=function(){return!!navigator.sendBeacon},e.prototype.triggerUploadInterval=function(e,t){var r=this;void 0===e&&(e=!1),void 0===t&&(t=!1),setTimeout((function(){r.prepareAndUpload(e,t)}),this.uploadIntervalMillis)},e.prototype.queueEvent=function(e){fe(e)||(this.eventsQueuedForProcessing.push(e),this.offlineStorageEnabled&&this.eventVault&&this.eventVault.store(this.eventsQueuedForProcessing),this.mpInstance.Logger.verbose("Queuing event: ".concat(JSON.stringify(e))),this.mpInstance.Logger.verbose("Queued event count: ".concat(this.eventsQueuedForProcessing.length)),(!this.batchingEnabled||h.TriggerUploadType[e.EventDataType])&&this.prepareAndUpload(!1,!1))},e.createNewBatches=function(e,t,r){if(!t||!e||!e.length)return null;for(var n=[],i=new Map,o=0,s=e;o<s.length;o++){if(!(f=s[o]).MPID){var a=t.getMPID();f.MPID=a}(m=i.get(f.MPID))||(m=[]),m.push(f),i.set(f.MPID,m)}for(var c=0,u=Array.from(i.entries());c<u.length;c++){for(var d=u[c],l=(a=d[0],d[1]),g=new Map,p=0,v=l;p<v.length;p++){var m,f=v[p];(m=g.get(f.SessionId))||(m=[]),m.push(f),g.set(f.SessionId,m)}for(var h=0,y=Array.from(g.entries());h<y.length;h++){var S=he(a,y[h][1],r),_=r._Store.SDKConfig.onCreateBatch;_&&((S=_(S))?S.modified=!0:r.Logger.warning("Skiping batch upload because no batch was returned from onCreateBatch callback")),S&&n.push(S)}}return n},e.prototype.prepareAndUpload=function(t,r){return A(this,void 0,void 0,(function(){var n,i,o,s,a,c,u,d;return w(this,(function(l){switch(l.label){case 0:return n=this.mpInstance.Identity.getCurrentUser(),i=this.eventsQueuedForProcessing,this.eventsQueuedForProcessing=[],this.offlineStorageEnabled&&this.eventVault&&this.eventVault.store([]),o=[],fe(i)||(o=e.createNewBatches(i,n,this.mpInstance)),this.offlineStorageEnabled&&this.batchVault&&((c=this.batchesQueuedForProcessing).unshift.apply(c,this.batchVault.retrieve()),this.batchVault.purge()),fe(o)||(u=this.batchesQueuedForProcessing).push.apply(u,o),s=this.batchesQueuedForProcessing,this.batchesQueuedForProcessing=[],[4,this.uploadBatches(this.mpInstance.Logger,s,r)];case 1:return a=l.sent(),fe(a)||(d=this.batchesQueuedForProcessing).unshift.apply(d,a),!r&&this.offlineStorageEnabled&&this.batchVault&&(this.batchVault.store(this.batchesQueuedForProcessing),this.batchesQueuedForProcessing=[]),t&&this.triggerUploadInterval(t,!1),[2]}}))}))},e.prototype.uploadBatches=function(t,r,n){return A(this,void 0,void 0,(function(){var i,o,s,a,c,u;return w(this,(function(d){switch(d.label){case 0:if(i=r.filter((function(e){return!fe(e.events)})),fe(i))return[2,null];t.verbose("Uploading batches: ".concat(JSON.stringify(i))),t.verbose("Batch count: ".concat(i.length)),o=0,d.label=1;case 1:return o<i.length?(s={method:"POST",headers:{Accept:e.CONTENT_TYPE,"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify(i[o])},n&&this.isBeaconAvailable()?(a=new Blob([s.body],{type:"text/plain;charset=UTF-8"}),navigator.sendBeacon(this.uploadUrl,a),[3,5]):[3,2]):[3,6];case 2:return d.trys.push([2,4,,5]),[4,this.uploader.upload(s)];case 3:if(!(200<=(c=d.sent()).status&&300>c.status)){if(500<=c.status||429===c.status)return t.error("HTTP error status ".concat(c.status," received")),[2,i.slice(o,i.length)];if(401<=c.status)return t.error("HTTP error status ".concat(c.status," while uploading - please verify your API key.")),[2,null];throw console.error("HTTP error status ".concat(c.status," while uploading events."),c),new Error("Uncaught HTTP Error ".concat(c.status,". Batch upload will be re-attempted."))}return t.verbose("Upload success for request ID: ".concat(i[o].source_request_id)),[3,5];case 4:return u=d.sent(),t.error("Error sending event to mParticle servers. ".concat(u)),[2,i.slice(o,i.length)];case 5:return o++,[3,1];case 6:return[2,null]}}))}))},e.CONTENT_TYPE="text/plain;charset=UTF-8",e.MINIMUM_INTERVAL_MILLIS=500,e}();function Ke(e,t){this.uploader=null;var r=this;this.queueEventForBatchUpload=function(t){if(!this.uploader){var r=te(e._Helpers.getFeatureFlag(y.FeatureFlags.EventBatchingIntervalMillis));this.uploader=new xe(e,r)}this.uploader.queueEvent(t),e._Persistence.update()},this.processQueuedEvents=function(){var t,n=e.Identity.getCurrentUser();if(n&&(t=n.getMPID()),e._Store.eventQueue.length&&t){var i=e._Store.eventQueue;e._Store.eventQueue=[],this.appendUserInfoToEvents(n,i),i.forEach((function(e){r.sendEventToServer(e)}))}},this.appendUserInfoToEvents=function(t,r){r.forEach((function(r){r.MPID||e._ServerModel.appendUserInfo(t,r)}))},this.sendEventToServer=function(r,n){var i=e._Helpers.extend({shouldUploadEvent:!0},n);if(!e._Store.webviewBridgeEnabled){var o,s=e.Identity.getCurrentUser();return s&&(o=s.getMPID()),e._Store.requireDelay=e._Helpers.isDelayedByIntegration(e._preInit.integrationDelays,e._Store.integrationDelayTimeoutStart,Date.now()),o&&!e._Store.requireDelay&&e._Store.configurationLoaded?(this.processQueuedEvents(),void(fe(r)||(i.shouldUploadEvent&&this.queueEventForBatchUpload(r),r.EventName!==h.MessageType.AppStateTransition&&(t&&t.kitBlockingEnabled&&(r=t.createBlockedEvent(r)),r&&e._Forwarders.sendEventToForwarders(r))))):(e.Logger.verbose("Event was added to eventQueue. eventQueue will be processed once a valid MPID is returned or there is no more integration imposed delay."),void e._Store.eventQueue.push(r))}e._NativeSdkHelpers.sendToNative(y.NativeSdkPaths.LogEvent,JSON.stringify(r))},this.sendBatchForwardingStatsToServer=function(t,r){var n,i;try{n=e._Helpers.createServiceUrl(e._Store.SDKConfig.v2SecureServiceUrl,e._Store.devToken),i={uuid:e._Helpers.generateUniqueId(),data:t},r&&(r.open("post",n+"/Forwarding"),r.send(JSON.stringify(i)))}catch(t){e.Logger.error("Error sending forwarding stats to mParticle servers.")}},this.sendSingleForwardingStatsToServer=function(t){var r,n;try{var i=e._Helpers.createXHR((function(){4===i.readyState&&202===i.status&&e.Logger.verbose("Successfully sent "+i.statusText+" from server")}));r=e._Helpers.createServiceUrl(e._Store.SDKConfig.v1SecureServiceUrl,e._Store.devToken),n=t,i&&(i.open("post",r+"/Forwarding"),i.send(JSON.stringify(n)))}catch(t){e.Logger.error("Error sending forwarding stats to mParticle servers.")}},this.prepareForwardingStats=function(t,n){var i,o=e._Forwarders.getForwarderStatsQueue();t&&t.isVisible&&(i={mid:t.id,esid:t.eventSubscriptionId,n:n.EventName,attrs:n.EventAttributes,sdk:n.SDKVersion,dt:n.EventDataType,et:n.EventCategory,dbg:n.Debug,ct:n.Timestamp,eec:n.ExpandedEventCount,dp:n.DataPlan},e._Helpers.getFeatureFlag(y.FeatureFlags.ReportBatching)?(o.push(i),e._Forwarders.setForwarderStatsQueue(o)):r.sendSingleForwardingStatsToServer(i))}}var je=y.IdentityMethods.Modify,qe={isNumber:le,isFunction:ge,isStringOrNumber:me,isValidAttributeValue:function(e){return void 0!==e&&!ee(e)&&!Array.isArray(e)},isValidKeyValue:function(e){return!(!e||ee(e)||Array.isArray(e)||this.isFunction(e))},validateIdentities:function(e,t){var r={userIdentities:1,onUserAlias:1,copyUserAttributes:1};if(e){if(t===je&&(ee(e.userIdentities)&&!Object.keys(e.userIdentities).length||!ee(e.userIdentities)))return{valid:!1,error:y.Messages.ValidationMessages.ModifyIdentityRequestUserIdentitiesPresent};for(var n in e)if(e.hasOwnProperty(n)){if(!r[n])return{valid:!1,error:y.Messages.ValidationMessages.IdentityRequesetInvalidKey};if("onUserAlias"===n&&!qe.isFunction(e[n]))return{valid:!1,error:y.Messages.ValidationMessages.OnUserAliasType}}if(0===Object.keys(e).length)return{valid:!0};if(void 0===e.userIdentities)return{valid:!1,error:y.Messages.ValidationMessages.UserIdentities};if(null!==e.userIdentities&&!ee(e.userIdentities))return{valid:!1,error:y.Messages.ValidationMessages.UserIdentities};if(ee(e.userIdentities)&&Object.keys(e.userIdentities).length)for(var i in e.userIdentities)if(e.userIdentities.hasOwnProperty(i)){if(!1===h.IdentityType.getIdentityType(i))return{valid:!1,error:y.Messages.ValidationMessages.UserIdentitiesInvalidKey};if("string"!=typeof e.userIdentities[i]&&null!==e.userIdentities[i])return{valid:!1,error:y.Messages.ValidationMessages.UserIdentitiesInvalidValues}}}return{valid:!0}}},Be=function(){function e(){}return e.hashEventType=function(e){return $(e)},e.hashEventName=function(e,t){return $(t+e)},e.hashEventAttributeKey=function(e,t,r){return $(e+t+r)},e.hashUserAttribute=function(e){return $(e)},e.hashUserIdentity=function(e){return e},e.hashConsentPurpose=function(e,t){return $(e+t)},e.hashAttributeConditionalForwarding=function(e){return $(e).toString()},e.hashConsentPurposeConditionalForwarding=function(e,t){return this.hashConsentPurpose(e,t).toString()},e}(),We=y.StorageNames;function ze(e){var t=this;this.canLog=function(){return!(!e._Store.isEnabled||!e._Store.devToken&&!e._Store.webviewBridgeEnabled)},this.getFeatureFlag=function(t){return e._Store.SDKConfig.flags.hasOwnProperty(t)?e._Store.SDKConfig.flags[t]:null},this.invokeCallback=function(r,n,i,o,s){r||e.Logger.warning("There is no callback provided");try{t.Validators.isFunction(r)&&r({httpCode:n,body:i,getUser:function(){return o||e.Identity.getCurrentUser()},getPreviousUser:function(){if(!s){var t=e.Identity.getUsers(),r=t.shift(),n=o||e.Identity.getCurrentUser();return r&&n&&r.getMPID()===n.getMPID()&&(r=t.shift()),r||null}return e.Identity.getUser(s)}})}catch(t){e.Logger.error("There was an error with your callback: "+t)}},this.invokeAliasCallback=function(r,n,i){r||e.Logger.warning("There is no callback provided");try{if(t.Validators.isFunction(r)){var o={httpCode:n};i&&(o.message=i),r(o)}}catch(t){e.Logger.error("There was an error with your callback: "+t)}},this.extend=function(){var e,r,n,i,o,a,c=arguments[0]||{},u=1,d=arguments.length,l=!1,g={hasOwn:Object.prototype.hasOwnProperty,class2type:{},type:function(e){return null==e?e+"":g.class2type[Object.prototype.toString.call(e)]||"object"},isPlainObject:function(e){if(!e||"object"!==g.type(e)||e.nodeType||g.isWindow(e))return!1;try{if(e.constructor&&!g.hasOwn.call(e,"constructor")&&!g.hasOwn.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}for(var t in e);return void 0===t||g.hasOwn.call(e,t)},isArray:Array.isArray||function(e){return"array"===g.type(e)},isFunction:function(e){return"function"===g.type(e)},isWindow:function(e){return null!=e&&e==e.window}};for("boolean"==typeof c&&(l=c,c=arguments[1]||{},u=2),"object"===s(c)||g.isFunction(c)||(c={}),d===u&&(c=this,--u);u<d;u++)if(null!=(e=arguments[u]))for(r in e)n=c[r],c!==(i=e[r])&&(l&&i&&(g.isPlainObject(i)||(o=g.isArray(i)))?(o?(o=!1,a=n&&g.isArray(n)?n:[]):a=n&&g.isPlainObject(n)?n:{},c[r]=t.extend(l,a,i)):void 0!==i&&(c[r]=i));return c},this.createServiceUrl=function(t,r){var n,i=window.mParticle&&e._Store.SDKConfig.forceHttps?"https://":window.location.protocol+"//";return n=e._Store.SDKConfig.forceHttps?"https://"+t:i+t,r&&(n+=r),n},this.createXHR=function(t){var r;try{r=new window.XMLHttpRequest}catch(t){e.Logger.error("Error creating XMLHttpRequest object.")}if(r&&t&&"withCredentials"in r)r.onreadystatechange=t;else if(void 0!==window.XDomainRequest){e.Logger.verbose("Creating XDomainRequest object");try{(r=new window.XDomainRequest).onload=t}catch(t){e.Logger.error("Error creating XDomainRequest object")}}return r},this.filterUserIdentities=function(e,r){var n=[];if(e&&Object.keys(e).length)for(var i in e)if(e.hasOwnProperty(i)){var o=h.IdentityType.getIdentityType(i);if(!t.inArray(r,o)){var s={Type:o,Identity:e[i]};o===h.IdentityType.CustomerId?n.unshift(s):n.push(s)}}return n},this.filterUserIdentitiesForForwarders=function(e,r){var n={};if(e&&Object.keys(e).length)for(var i in e)if(e.hasOwnProperty(i)){var o=Be.hashUserIdentity(h.IdentityType.getIdentityType(i));t.inArray(r,o)||(n[i]=e[i])}return n},this.filterUserAttributes=function(e,r){var n={};if(e&&Object.keys(e).length)for(var i in e)if(e.hasOwnProperty(i)){var o=Be.hashUserAttribute(i);t.inArray(r,o)||(n[i]=e[i])}return n},this.isFilteredUserAttribute=function(e,r){var n=Be.hashUserAttribute(e);return r&&t.inArray(r,n)},this.isEventType=function(e){for(var t in h.EventType)if(h.EventType.hasOwnProperty(t)&&h.EventType[t]===e)return!0;return!1},this.sanitizeAttributes=function(r,n){if(!r||!t.isObject(r))return null;var i={};for(var o in r)r.hasOwnProperty(o)&&t.Validators.isValidAttributeValue(r[o])?i[o]=r[o]:e.Logger.warning("For '"+n+"', the corresponding attribute value of '"+o+"' must be a string, number, boolean, or null.");return i},this.isDelayedByIntegration=function(t,r,n){if(n-r>e._Store.SDKConfig.integrationDelayTimeout)return!1;for(var i in t)if(!0===t[i])return!0;return!1},this.createMainStorageName=function(e){return e?We.currentStorageName+"_"+e:We.currentStorageName},this.createProductStorageName=function(e){return e?We.currentStorageProductsName+"_"+e:We.currentStorageProductsName},this.converted=ue,this.findKeyInObject=Y,this.parseNumber=te,this.inArray=G,this.isObject=ee,this.decoded=ce,this.parseStringOrNumber=re,this.generateHash=$,this.generateUniqueId=Z,this.Validators=qe}var Je=y.Messages,Qe="mParticleAndroid",Ge="mParticle";function Ye(e){var t=this;this.initializeSessionAttributes=function(e){var r=y.NativeSdkPaths.SetSessionAttribute,n=JSON.stringify({key:"$src_env",value:"webview"}),i=JSON.stringify({key:"$src_key",value:e});t.sendToNative(r,n),e&&t.sendToNative(r,i)},this.isBridgeV2Available=function(e){if(!e)return!1;var t=Ge+"_"+e+"_v2";return!!(window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.hasOwnProperty(t))||!(!window.mParticle||!window.mParticle.uiwebviewBridgeName||window.mParticle.uiwebviewBridgeName!==t)||!!window.hasOwnProperty(Qe+"_"+e+"_v2")},this.isWebviewEnabled=function(r,n){return e._Store.bridgeV2Available=t.isBridgeV2Available(r),e._Store.bridgeV1Available=t.isBridgeV1Available(),2===n?e._Store.bridgeV2Available:!(window.mParticle&&window.mParticle.uiwebviewBridgeName&&window.mParticle.uiwebviewBridgeName!==Ge+"_"+r+"_v2")&&!!(2>n)&&(e._Store.bridgeV2Available||e._Store.bridgeV1Available)},this.isBridgeV1Available=function(){return!!(e._Store.SDKConfig.useNativeSdk||window.mParticleAndroid||e._Store.SDKConfig.isIOS)},this.sendToNative=function(r,n){return e._Store.bridgeV2Available&&2===e._Store.SDKConfig.minWebviewBridgeVersion||e._Store.bridgeV2Available&&2>e._Store.SDKConfig.minWebviewBridgeVersion?void t.sendViaBridgeV2(r,n,e._Store.SDKConfig.requiredWebviewBridgeName):e._Store.bridgeV1Available&&2>e._Store.SDKConfig.minWebviewBridgeVersion?void t.sendViaBridgeV1(r,n):void 0},this.sendViaBridgeV1=function(r,n){window.mParticleAndroid&&window.mParticleAndroid.hasOwnProperty(r)?(e.Logger.verbose(Je.InformationMessages.SendAndroid+r),window.mParticleAndroid[r](n)):e._Store.SDKConfig.isIOS&&(e.Logger.verbose(Je.InformationMessages.SendIOS+r),t.sendViaIframeToIOS(r,n))},this.sendViaIframeToIOS=function(e,t){var r=document.createElement("IFRAME");r.setAttribute("src","mp-sdk://"+e+"/"+encodeURIComponent(t)),document.documentElement.appendChild(r),r.parentNode.removeChild(r)},this.sendViaBridgeV2=function(r,n,i){if(i){var o,s,a=window[Qe+"_"+i+"_v2"],c=Ge+"_"+i+"_v2";return window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers[c]&&(o=window.webkit.messageHandlers[c]),e.uiwebviewBridgeName===c&&(s=e[c]),a&&a.hasOwnProperty(r)?(e.Logger.verbose(Je.InformationMessages.SendAndroid+r),void a[r](n)):void(o?(e.Logger.verbose(Je.InformationMessages.SendIOS+r),o.postMessage(JSON.stringify({path:r,value:n?JSON.parse(n):null}))):s&&(e.Logger.verbose(Je.InformationMessages.SendIOS+r),t.sendViaIframeToIOS(r,n)))}}}var Xe=y.Messages;function $e(e){var t=this;this.attemptCookieSync=function(r,n,i){var o,s,a,c,u,d;n&&!e._Store.webviewBridgeEnabled&&e._Store.pixelConfigurations.forEach((function(l){d=!1,l.filteringConsentRuleValues&&l.filteringConsentRuleValues.values&&l.filteringConsentRuleValues.values.length&&(d=!0),o={moduleId:l.moduleId,frequencyCap:l.frequencyCap,pixelUrl:t.replaceAmp(l.pixelUrl),redirectUrl:l.redirectUrl?t.replaceAmp(l.redirectUrl):null,filteringConsentRuleValues:l.filteringConsentRuleValues},a=t.replaceMPID(o.pixelUrl,n),c=o.redirectUrl?t.replaceMPID(o.redirectUrl,n):"",u=a+encodeURIComponent(c);var g=e._Persistence.getPersistence();return r&&r!==n?void(g&&g[n]&&(!g[n].csd&&(g[n].csd={}),t.performCookieSync(u,o.moduleId,n,g[n].csd,o.filteringConsentRuleValues,i,d))):void(g[n]&&(!g[n].csd&&(g[n].csd={}),s=g[n].csd[o.moduleId.toString()]?g[n].csd[o.moduleId.toString()]:null,s?(new Date).getTime()>new Date(s).getTime()+60*o.frequencyCap*1e3*60*24&&t.performCookieSync(u,o.moduleId,n,g[n].csd,o.filteringConsentRuleValues,i,d):t.performCookieSync(u,o.moduleId,n,g[n].csd,o.filteringConsentRuleValues,i,d)))}))},this.replaceMPID=function(e,t){return e.replace("%%mpid%%",t)},this.replaceAmp=function(e){return e.replace(/&/g,"&")},this.performCookieSync=function(t,r,n,i,o,s,a){if((!a||!s)&&e._Consent.isEnabledForUserConsent(o,e.Identity.getCurrentUser())){var c=document.createElement("img");e.Logger.verbose(Xe.InformationMessages.CookieSync),c.onload=function(){i[r.toString()]=(new Date).getTime(),e._Persistence.saveUserCookieSyncDatesToPersistence(n,i)},c.src=t}}}var Ze=y.Messages;function et(e){var t=this;this.initialize=function(){if(e._Store.sessionId){var r=6e4*e._Store.SDKConfig.sessionTimeout;if(new Date>new Date(e._Store.dateLastEventSent.getTime()+r))t.endSession(),t.startNewSession();else{var n=e._Persistence.getPersistence();n&&!n.cu&&(e.Identity.identify(e._Store.SDKConfig.identifyRequest,e._Store.SDKConfig.identityCallback),e._Store.identifyCalled=!0,e._Store.SDKConfig.identityCallback=null)}}else t.startNewSession()},this.getSession=function(){return e.Logger.warning(X("SessionManager.getSession()","SessionManager.getSessionId()")),this.getSessionId()},this.getSessionId=function(){return e._Store.sessionId},this.startNewSession=function(){if(e.Logger.verbose(Ze.InformationMessages.StartingNewSession),e._Helpers.canLog()){e._Store.sessionId=e._Helpers.generateUniqueId().toUpperCase();var r=e.Identity.getCurrentUser(),n=r?r.getMPID():null;if(n&&(e._Store.currentSessionMPIDs=[n]),!e._Store.sessionStartDate){var i=new Date;e._Store.sessionStartDate=i,e._Store.dateLastEventSent=i}t.setSessionTimer(),e._Store.identifyCalled||(e.Identity.identify(e._Store.SDKConfig.identifyRequest,e._Store.SDKConfig.identityCallback),e._Store.identifyCalled=!0,e._Store.SDKConfig.identityCallback=null),e._Events.logEvent({messageType:h.MessageType.SessionStart})}else e.Logger.verbose(Ze.InformationMessages.AbandonStartSession)},this.endSession=function(r){var n;if(e.Logger.verbose(Ze.InformationMessages.StartingEndSession),r)return e._Events.logEvent({messageType:h.MessageType.SessionEnd}),void e._Store.nullifySession();if(e._Helpers.canLog()){var i,o=e._Persistence.getPersistence();if(!o||o.gs&&!o.gs.sid)e.Logger.verbose(Ze.InformationMessages.NoSessionToEnd);else if(o.gs.sid&&e._Store.sessionId!==o.gs.sid&&(e._Store.sessionId=o.gs.sid),null===(n=null==o?void 0:o.gs)||void 0===n?void 0:n.les)i=6e4*e._Store.SDKConfig.sessionTimeout,(new Date).getTime()-o.gs.les<i?t.setSessionTimer():(e._Events.logEvent({messageType:h.MessageType.SessionEnd}),e._Store.sessionStartDate=null,e._Store.nullifySession())}else e.Logger.verbose(Ze.InformationMessages.AbandonEndSession)},this.setSessionTimer=function(){var r=6e4*e._Store.SDKConfig.sessionTimeout;e._Store.globalTimer=window.setTimeout((function(){t.endSession()}),r)},this.resetSessionTimer=function(){e._Store.webviewBridgeEnabled||(!e._Store.sessionId&&t.startNewSession(),t.clearSessionTimeout(),t.setSessionTimer()),t.startNewSessionIfNeeded()},this.clearSessionTimeout=function(){clearTimeout(e._Store.globalTimer)},this.startNewSessionIfNeeded=function(){if(!e._Store.webviewBridgeEnabled){var r=e._Persistence.getPersistence();!e._Store.sessionId&&r&&(r.sid?e._Store.sessionId=r.sid:t.startNewSession())}}}var tt=y.Messages;function rt(e){var t=this;this.convertTransactionAttributesToProductAction=function(e,t){e.hasOwnProperty("Id")&&(t.TransactionId=e.Id),e.hasOwnProperty("Affiliation")&&(t.Affiliation=e.Affiliation),e.hasOwnProperty("CouponCode")&&(t.CouponCode=e.CouponCode),e.hasOwnProperty("Revenue")&&(t.TotalAmount=this.sanitizeAmount(e.Revenue,"Revenue")),e.hasOwnProperty("Shipping")&&(t.ShippingAmount=this.sanitizeAmount(e.Shipping,"Shipping")),e.hasOwnProperty("Tax")&&(t.TaxAmount=this.sanitizeAmount(e.Tax,"Tax")),e.hasOwnProperty("Step")&&(t.CheckoutStep=e.Step),e.hasOwnProperty("Option")&&(t.CheckoutOptions=e.Option)},this.getProductActionEventName=function(e){switch(e){case h.ProductActionType.AddToCart:return"AddToCart";case h.ProductActionType.AddToWishlist:return"AddToWishlist";case h.ProductActionType.Checkout:return"Checkout";case h.ProductActionType.CheckoutOption:return"CheckoutOption";case h.ProductActionType.Click:return"Click";case h.ProductActionType.Purchase:return"Purchase";case h.ProductActionType.Refund:return"Refund";case h.ProductActionType.RemoveFromCart:return"RemoveFromCart";case h.ProductActionType.RemoveFromWishlist:return"RemoveFromWishlist";case h.ProductActionType.ViewDetail:return"ViewDetail";case h.ProductActionType.Unknown:default:return"Unknown"}},this.getPromotionActionEventName=function(e){return e===h.PromotionActionType.PromotionClick?"PromotionClick":e===h.PromotionActionType.PromotionView?"PromotionView":"Unknown"},this.convertProductActionToEventType=function(t){return t===h.ProductActionType.AddToCart?h.CommerceEventType.ProductAddToCart:t===h.ProductActionType.AddToWishlist?h.CommerceEventType.ProductAddToWishlist:t===h.ProductActionType.Checkout?h.CommerceEventType.ProductCheckout:t===h.ProductActionType.CheckoutOption?h.CommerceEventType.ProductCheckoutOption:t===h.ProductActionType.Click?h.CommerceEventType.ProductClick:t===h.ProductActionType.Purchase?h.CommerceEventType.ProductPurchase:t===h.ProductActionType.Refund?h.CommerceEventType.ProductRefund:t===h.ProductActionType.RemoveFromCart?h.CommerceEventType.ProductRemoveFromCart:t===h.ProductActionType.RemoveFromWishlist?h.CommerceEventType.ProductRemoveFromWishlist:t===h.ProductActionType.Unknown?h.EventType.Unknown:t===h.ProductActionType.ViewDetail?h.CommerceEventType.ProductViewDetail:(e.Logger.error("Could not convert product action type "+t+" to event type"),null)},this.convertPromotionActionToEventType=function(t){return t===h.PromotionActionType.PromotionClick?h.CommerceEventType.PromotionClick:t===h.PromotionActionType.PromotionView?h.CommerceEventType.PromotionView:(e.Logger.error("Could not convert promotion action type "+t+" to event type"),null)},this.generateExpandedEcommerceName=function(e,t){return"eCommerce - "+e+" - "+(t?"Total":"Item")},this.extractProductAttributes=function(e,t){t.CouponCode&&(e["Coupon Code"]=t.CouponCode),t.Brand&&(e.Brand=t.Brand),t.Category&&(e.Category=t.Category),t.Name&&(e.Name=t.Name),t.Sku&&(e.Id=t.Sku),t.Price&&(e["Item Price"]=t.Price),t.Quantity&&(e.Quantity=t.Quantity),t.Position&&(e.Position=t.Position),t.Variant&&(e.Variant=t.Variant),e["Total Product Amount"]=t.TotalAmount||0},this.extractTransactionId=function(e,t){t.TransactionId&&(e["Transaction Id"]=t.TransactionId)},this.extractActionAttributes=function(e,r){t.extractTransactionId(e,r),r.Affiliation&&(e.Affiliation=r.Affiliation),r.CouponCode&&(e["Coupon Code"]=r.CouponCode),r.TotalAmount&&(e["Total Amount"]=r.TotalAmount),r.ShippingAmount&&(e["Shipping Amount"]=r.ShippingAmount),r.TaxAmount&&(e["Tax Amount"]=r.TaxAmount),r.CheckoutOptions&&(e["Checkout Options"]=r.CheckoutOptions),r.CheckoutStep&&(e["Checkout Step"]=r.CheckoutStep)},this.extractPromotionAttributes=function(e,t){t.Id&&(e.Id=t.Id),t.Creative&&(e.Creative=t.Creative),t.Name&&(e.Name=t.Name),t.Position&&(e.Position=t.Position)},this.buildProductList=function(e,t){return t?Array.isArray(t)?t:[t]:e.ShoppingCart.ProductList},this.createProduct=function(t,r,n,i,o,s,a,c,u,d){return d=e._Helpers.sanitizeAttributes(d,t),"string"!=typeof t?(e.Logger.error("Name is required when creating a product"),null):e._Helpers.Validators.isStringOrNumber(r)?e._Helpers.Validators.isStringOrNumber(n)?(n=e._Helpers.parseNumber(n),c&&!e._Helpers.Validators.isNumber(c)&&(e.Logger.error("Position must be a number, it will be set to null."),c=null),{Name:t,Sku:r,Price:n,Quantity:i=e._Helpers.Validators.isStringOrNumber(i)?e._Helpers.parseNumber(i):1,Brand:a,Variant:o,Category:s,Position:c,CouponCode:u,TotalAmount:i*n,Attributes:d}):(e.Logger.error("Price is required when creating a product, and must be a string or a number"),null):(e.Logger.error("SKU is required when creating a product, and must be a string or a number"),null)},this.createPromotion=function(t,r,n,i){return e._Helpers.Validators.isStringOrNumber(t)?{Id:t,Creative:r,Name:n,Position:i}:(e.Logger.error(tt.ErrorMessages.PromotionIdRequired),null)},this.createImpression=function(t,r){return"string"==typeof t?r?{Name:t,Product:r}:(e.Logger.error("Product is required when creating an impression."),null):(e.Logger.error("Name is required when creating an impression."),null)},this.createTransactionAttributes=function(t,r,n,i,o,s){return e._Helpers.Validators.isStringOrNumber(t)?{Id:t,Affiliation:r,CouponCode:n,Revenue:i,Shipping:o,Tax:s}:(e.Logger.error(tt.ErrorMessages.TransactionIdRequired),null)},this.expandProductImpression=function(r){var n=[];return r.ProductImpressions?(r.ProductImpressions.forEach((function(i){i.ProductList&&i.ProductList.forEach((function(o){var s=e._Helpers.extend(!1,{},r.EventAttributes);if(o.Attributes)for(var a in o.Attributes)s[a]=o.Attributes[a];t.extractProductAttributes(s,o),i.ProductImpressionList&&(s["Product Impression List"]=i.ProductImpressionList);var c=e._ServerModel.createEventObject({messageType:h.MessageType.PageEvent,name:t.generateExpandedEcommerceName("Impression"),data:s,eventType:h.EventType.Transaction});n.push(c)}))})),n):n},this.expandCommerceEvent=function(e){return e?t.expandProductAction(e).concat(t.expandPromotionAction(e)).concat(t.expandProductImpression(e)):null},this.expandPromotionAction=function(r){var n=[];return r.PromotionAction?(r.PromotionAction.PromotionList.forEach((function(i){var o=e._Helpers.extend(!1,{},r.EventAttributes);t.extractPromotionAttributes(o,i);var s=e._ServerModel.createEventObject({messageType:h.MessageType.PageEvent,name:t.generateExpandedEcommerceName(h.PromotionActionType.getExpansionName(r.PromotionAction.PromotionActionType)),data:o,eventType:h.EventType.Transaction});n.push(s)})),n):n},this.expandProductAction=function(r){var n=[];if(!r.ProductAction)return n;var i=!1;if(r.ProductAction.ProductActionType===h.ProductActionType.Purchase||r.ProductAction.ProductActionType===h.ProductActionType.Refund){var o=e._Helpers.extend(!1,{},r.EventAttributes);o["Product Count"]=r.ProductAction.ProductList?r.ProductAction.ProductList.length:0,t.extractActionAttributes(o,r.ProductAction),r.CurrencyCode&&(o["Currency Code"]=r.CurrencyCode);var s=e._ServerModel.createEventObject({messageType:h.MessageType.PageEvent,name:t.generateExpandedEcommerceName(h.ProductActionType.getExpansionName(r.ProductAction.ProductActionType),!0),data:o,eventType:h.EventType.Transaction});n.push(s)}else i=!0;var a=r.ProductAction.ProductList;return a?(a.forEach((function(o){var s=e._Helpers.extend(!1,r.EventAttributes,o.Attributes);i?t.extractActionAttributes(s,r.ProductAction):t.extractTransactionId(s,r.ProductAction),t.extractProductAttributes(s,o);var a=e._ServerModel.createEventObject({messageType:h.MessageType.PageEvent,name:t.generateExpandedEcommerceName(h.ProductActionType.getExpansionName(r.ProductAction.ProductActionType)),data:s,eventType:h.EventType.Transaction});n.push(a)})),n):n},this.createCommerceEventObject=function(t){var r;return e.Logger.verbose(tt.InformationMessages.StartingLogCommerceEvent),e._Helpers.canLog()?((r=e._ServerModel.createEventObject({messageType:h.MessageType.Commerce})).EventName="eCommerce - ",r.CurrencyCode=e._Store.currencyCode,r.ShoppingCart=[],r.CustomFlags=t,r):(e.Logger.verbose(tt.InformationMessages.AbandonLogEvent),null)},this.sanitizeAmount=function(t,r){if(!e._Helpers.Validators.isStringOrNumber(t)){var n=[r,"must be of type number. A",s(t),"was passed. Converting to 0"].join(" ");return e.Logger.warning(n),0}return e._Helpers.parseNumber(t)}}function nt(e,t,r){var n=this,i=t._Helpers,o=i.createMainStorageName,a=i.createProductStorageName,c=t._NativeSdkHelpers.isWebviewEnabled,u={isEnabled:!0,sessionAttributes:{},currentSessionMPIDs:[],consentState:null,sessionId:null,isFirstRun:null,clientId:null,deviceId:null,devToken:null,serverSettings:{},dateLastEventSent:null,sessionStartDate:null,currentPosition:null,isTracking:!1,watchPositionId:null,cartProducts:[],eventQueue:[],currencyCode:null,globalTimer:null,context:null,configurationLoaded:!1,identityCallInFlight:!1,SDKConfig:{},nonCurrentUserMPIDs:{},identifyCalled:!1,isLoggedIn:!1,cookieSyncDates:{},integrationAttributes:{},requireDelay:!0,isLocalStorageAvailable:null,storageName:null,prodStorageName:null,activeForwarders:[],kits:{},sideloadedKits:[],configuredForwarders:[],pixelConfigurations:[],wrapperSDKInfo:{name:"none",version:null,isInfoSet:!1},persistenceData:{cu:null,gs:{sid:null,ie:null,sa:null,ss:null,dt:null,av:null,cgid:null,das:null,ia:null,c:null,csm:null,les:null,ssd:null},l:null}};for(var d in u)this[d]=u[d];if(this.devToken=r||null,this.integrationDelayTimeoutStart=Date.now(),this.SDKConfig=function(e){var t={};for(var r in y.DefaultConfig)y.DefaultConfig.hasOwnProperty(r)&&(t[r]=y.DefaultConfig[r]);if(e)for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);for(var r in y.DefaultBaseUrls)t[r]=y.DefaultBaseUrls[r];return t}(e),e){e.hasOwnProperty("flags")||(this.SDKConfig.flags={}),this.SDKConfig.flags=it(e),e.deviceId&&(this.deviceId=e.deviceId),this.SDKConfig.isDevelopmentMode=!!e.hasOwnProperty("isDevelopmentMode")&&ae(e.isDevelopmentMode);var l=function(e,t,r){return r?t.directURLRouting?function(e,t){var r=y.DefaultBaseUrls,n={},i=t.split("-"),o=1>=i.length?"us1":i[0];for(var s in r)if("configUrl"!=s)if(e.hasOwnProperty(s))n[s]=e[s];else{var a=r[s].split(".");n[s]=E([a[0],o],a.slice(1),!0).join(".")}else n[s]=e[s]||r[s];return n}(e,r):function(e){var t=y.DefaultBaseUrls,r={};for(var n in t)r[n]=e[n]||t[n];return r}(e):{}}(e,this.SDKConfig.flags,r);for(var g in l)this.SDKConfig[g]=l[g];if(e.hasOwnProperty("logLevel")&&(this.SDKConfig.logLevel=e.logLevel),this.SDKConfig.useNativeSdk=!!e.useNativeSdk,this.SDKConfig.kits=e.kits||{},this.SDKConfig.sideloadedKits=e.sideloadedKits||[],this.SDKConfig.isIOS=e.hasOwnProperty("isIOS")?e.isIOS:!(!window.mParticle||!window.mParticle.isIOS)&&window.mParticle.isIOS,this.SDKConfig.useCookieStorage=!!e.hasOwnProperty("useCookieStorage")&&e.useCookieStorage,this.SDKConfig.maxProducts=e.hasOwnProperty("maxProducts")?e.maxProducts:y.DefaultConfig.maxProducts,this.SDKConfig.maxCookieSize=e.hasOwnProperty("maxCookieSize")?e.maxCookieSize:y.DefaultConfig.maxCookieSize,e.hasOwnProperty("appName")&&(this.SDKConfig.appName=e.appName),e.hasOwnProperty("package")&&(this.SDKConfig.package=e.package),this.SDKConfig.integrationDelayTimeout=e.hasOwnProperty("integrationDelayTimeout")?e.integrationDelayTimeout:y.DefaultConfig.integrationDelayTimeout,e.hasOwnProperty("identifyRequest")&&(this.SDKConfig.identifyRequest=e.identifyRequest),e.hasOwnProperty("identityCallback")){var p=e.identityCallback;t._Helpers.Validators.isFunction(p)?this.SDKConfig.identityCallback=e.identityCallback:t.Logger.warning("The optional callback must be a function. You tried entering a(n) "+s(p)+" . Callback not set. Please set your callback again.")}if(e.hasOwnProperty("appVersion")&&(this.SDKConfig.appVersion=e.appVersion),e.hasOwnProperty("appName")&&(this.SDKConfig.appName=e.appName),e.hasOwnProperty("sessionTimeout")&&(this.SDKConfig.sessionTimeout=e.sessionTimeout),e.hasOwnProperty("dataPlan")){this.SDKConfig.dataPlan={PlanVersion:null,PlanId:null};var v=e.dataPlan;v.planId&&(ve(v.planId)?this.SDKConfig.dataPlan.PlanId=v.planId:t.Logger.error("Your data plan id must be a string and match the data plan slug format (i.e. under_case_slug)")),v.planVersion&&(le(v.planVersion)?this.SDKConfig.dataPlan.PlanVersion=v.planVersion:t.Logger.error("Your data plan version must be a number"))}else this.SDKConfig.dataPlan={};if(this.SDKConfig.forceHttps=!e.hasOwnProperty("forceHttps")||e.forceHttps,this.SDKConfig.customFlags=e.customFlags||{},this.SDKConfig.minWebviewBridgeVersion=e.hasOwnProperty("minWebviewBridgeVersion")?e.minWebviewBridgeVersion:1,this.SDKConfig.aliasMaxWindow=e.hasOwnProperty("aliasMaxWindow")?e.aliasMaxWindow:y.DefaultConfig.aliasMaxWindow,e.hasOwnProperty("dataPlanOptions")){var m=e.dataPlanOptions;m.hasOwnProperty("dataPlanVersion")&&m.hasOwnProperty("blockUserAttributes")&&m.hasOwnProperty("blockEventAttributes")&&m.hasOwnProperty("blockEvents")&&m.hasOwnProperty("blockUserIdentities")||t.Logger.error('Ensure your config.dataPlanOptions object has the following keys: a "dataPlanVersion" object, and "blockUserAttributes", "blockEventAttributes", "blockEvents", "blockUserIdentities" booleans')}e.hasOwnProperty("onCreateBatch")&&("function"==typeof e.onCreateBatch?this.SDKConfig.onCreateBatch=e.onCreateBatch:(t.Logger.error("config.onCreateBatch must be a function"),this.SDKConfig.onCreateBatch=void 0))}this.hasInvalidIdentifyRequest=function(){var e=n.SDKConfig.identifyRequest;return ee(e)&&ee(e.userIdentities)&&fe(e.userIdentities)||!e},this.getDeviceId=function(){return n.deviceId},this.setDeviceId=function(e){n.deviceId=e,n.persistenceData.gs.das=e,t._Persistence.update()},this.getFirstSeenTime=function(e){return e&&n.persistenceData&&n.persistenceData[e]&&n.persistenceData[e].fst?n.persistenceData[e].fst:null},this.setFirstSeenTime=function(e,r){if(e){var i=r||(new Date).getTime();n.persistenceData&&(!n.persistenceData[e]&&(n.persistenceData[e]={}),!n.persistenceData[e].fst&&(n.persistenceData[e].fst=i,t._Persistence.savePersistence(n.persistenceData)))}},this.getLastSeenTime=function(e){if(!e)return null;var r=t.Identity.getCurrentUser();return e===(null==r?void 0:r.getMPID())?(new Date).getTime():n.persistenceData&&n.persistenceData[e]&&n.persistenceData[e].lst?n.persistenceData[e].lst:null},this.setLastSeenTime=function(e,r){if(e){var i=r||(new Date).getTime();n.persistenceData&&(!n.persistenceData[e]&&(n.persistenceData[e]={}),!n.persistenceData[e].lst&&(n.persistenceData[e].lst=i,t._Persistence.savePersistence(n.persistenceData)))}},this.nullifySession=function(){n.sessionId=null,n.dateLastEventSent=null,n.sessionAttributes={},t._Persistence.update()},this.processConfig=function(e){var r=e.workspaceToken,i=e.requiredWebviewBridgeName;n.SDKConfig.flags=it(e),r?n.SDKConfig.workspaceToken=r:t.Logger.warning("You should have a workspaceToken on your config object for security purposes."),n.storageName=o(r),n.prodStorageName=a(r),n.SDKConfig.requiredWebviewBridgeName=i||r,n.webviewBridgeEnabled=c(n.SDKConfig.requiredWebviewBridgeName,n.SDKConfig.minWebviewBridgeVersion),n.configurationLoaded=!0}}function it(e){var t={},r=y.FeatureFlags,n=r.ReportBatching,i=r.EventBatchingIntervalMillis,o=r.OfflineStorage,s=r.DirectUrlRouting,a=r.CacheIdentity,c=r.AudienceAPI;return e.flags?(t[n]=e.flags[n]||!1,t[i]=te(e.flags[i])||y.DefaultConfig.uploadInterval,t[o]=e.flags[o]||"0",t[s]="True"===e.flags[s],t[a]="True"===e.flags[a],t[c]="True"===e.flags[c],t):{}}function ot(e){var t=this,r=e.logLevel||"warning";this.logger=e.hasOwnProperty("logger")?e.logger:new st,this.verbose=function(e){"none"!==r&&t.logger.verbose&&"verbose"===r&&t.logger.verbose(e)},this.warning=function(e){"none"!==r&&t.logger.warning&&("verbose"===r||"warning"===r)&&t.logger.warning(e)},this.error=function(e){"none"!==r&&t.logger.error&&t.logger.error(e)},this.setLogLevel=function(e){r=e}}function st(){this.verbose=function(e){console&&console.info&&console.info(e)},this.error=function(e){console&&console.error&&console.error(e)},this.warning=function(e){console&&console.warn&&console.warn(e)}}var at=o.Base64,ct=y.Messages,ut=y.Base64CookieKeys,dt=y.SDKv2NonMPIDCookieKeys,lt=y.StorageNames;function gt(e){function t(t){var r=e._Store;return t.gs.sid=r.sessionId,t.gs.ie=r.isEnabled,t.gs.sa=r.sessionAttributes,t.gs.ss=r.serverSettings,t.gs.dt=r.devToken,t.gs.les=r.dateLastEventSent?r.dateLastEventSent.getTime():null,t.gs.av=r.SDKConfig.appVersion,t.gs.cgid=r.clientId,t.gs.das=r.deviceId,t.gs.c=r.context,t.gs.ssd=r.sessionStartDate?r.sessionStartDate.getTime():0,t.gs.ia=r.integrationAttributes,t}function r(e){localStorage.removeItem(e)}function n(e,t,r){return i.encodePersistence(JSON.stringify(e))+";expires="+t+";path=/"+r}var i=this;this.useLocalStorage=function(){return!e._Store.SDKConfig.useCookieStorage&&e._Store.isLocalStorageAvailable},this.initializeStorage=function(){try{var t,r,n=i.getLocalStorage(),o=i.getCookie();n||o?e._Store.isFirstRun=!1:(e._Store.isFirstRun=!0,e._Store.mpid=0),e._Store.isLocalStorageAvailable||(e._Store.SDKConfig.useCookieStorage=!0),e._Store.isLocalStorageAvailable?(t=window.localStorage,e._Store.SDKConfig.useCookieStorage?(n?(r=o?e._Helpers.extend(!1,n,o):n,t.removeItem(e._Store.storageName)):o&&(r=o),i.storeDataInMemory(r)):o?(r=n?e._Helpers.extend(!1,n,o):o,i.storeDataInMemory(r),i.expireCookies(e._Store.storageName)):i.storeDataInMemory(n)):i.storeDataInMemory(o);try{if(e._Store.isLocalStorageAvailable){var s=localStorage.getItem(e._Store.prodStorageName);if(s)var a=JSON.parse(at.decode(s));e._Store.mpid&&i.storeProductsInMemory(a,e._Store.mpid)}}catch(t){e._Store.isLocalStorageAvailable&&localStorage.removeItem(e._Store.prodStorageName),e._Store.cartProducts=[],e.Logger.error("Error loading products in initialization: "+t)}for(var c in r)r.hasOwnProperty(c)&&(dt[c]||(e._Store.nonCurrentUserMPIDs[c]=r[c]));i.update()}catch(t){i.useLocalStorage()&&e._Store.isLocalStorageAvailable?localStorage.removeItem(e._Store.storageName):i.expireCookies(e._Store.storageName),e.Logger.error("Error initializing storage: "+t)}},this.update=function(){e._Store.webviewBridgeEnabled||(e._Store.SDKConfig.useCookieStorage&&i.setCookie(),i.setLocalStorage())},this.storeProductsInMemory=function(t,r){if(t)try{e._Store.cartProducts=t[r]&&t[r].cp?t[r].cp:[]}catch(t){e.Logger.error(ct.ErrorMessages.CookieParseError)}},this.storeDataInMemory=function(t,r){try{t?(e._Store.mpid=r||(t.cu||0),t.gs=t.gs||{},e._Store.sessionId=t.gs.sid||e._Store.sessionId,e._Store.isEnabled=void 0===t.gs.ie?e._Store.isEnabled:t.gs.ie,e._Store.sessionAttributes=t.gs.sa||e._Store.sessionAttributes,e._Store.serverSettings=t.gs.ss||e._Store.serverSettings,e._Store.devToken=e._Store.devToken||t.gs.dt,e._Store.SDKConfig.appVersion=e._Store.SDKConfig.appVersion||t.gs.av,e._Store.clientId=t.gs.cgid||e._Store.clientId||e._Helpers.generateUniqueId(),e._Store.deviceId=e._Store.deviceId||t.gs.das||e._Helpers.generateUniqueId(),e._Store.integrationAttributes=t.gs.ia||{},e._Store.context=t.gs.c||e._Store.context,e._Store.currentSessionMPIDs=t.gs.csm||e._Store.currentSessionMPIDs,e._Store.isLoggedIn=!0===t.l,t.gs.les&&(e._Store.dateLastEventSent=new Date(t.gs.les)),e._Store.sessionStartDate=t.gs.ssd?new Date(t.gs.ssd):new Date,t=r?t[r]:t[t.cu]):(e.Logger.verbose(ct.InformationMessages.CookieNotFound),e._Store.clientId=e._Store.clientId||e._Helpers.generateUniqueId(),e._Store.deviceId=e._Store.deviceId||e._Helpers.generateUniqueId())}catch(t){e.Logger.error(ct.ErrorMessages.CookieParseError)}},this.determineLocalStorageAvailability=function(e){var t;window.mParticle&&window.mParticle._forceNoLocalStorage&&(e=void 0);try{return e.setItem("mparticle","test"),t="test"===e.getItem("mparticle"),e.removeItem("mparticle"),t&&e}catch(e){return!1}},this.getUserProductsFromLS=function(t){if(!e._Store.isLocalStorageAvailable)return[];var r,n,i=localStorage.getItem(e._Store.prodStorageName);if(i&&(r=at.decode(i)),!t)return[];try{return r&&(n=JSON.parse(r)),r&&n[t]&&n[t].cp&&Array.isArray(n[t].cp)?n[t].cp:[]}catch(e){return[]}},this.getAllUserProductsFromLS=function(){var t,r,n=localStorage.getItem(e._Store.prodStorageName);n&&(t=at.decode(n));try{r=JSON.parse(t)}catch(e){r={}}return r},this.setLocalStorage=function(){if(e._Store.isLocalStorageAvailable){var r=e._Store.storageName,n=i.getAllUserProductsFromLS(),o=i.getLocalStorage()||{},s=e.Identity.getCurrentUser(),a=s?s.getMPID():null,c={cp:n[a]?n[a].cp:[]};if(a){(n=n||{})[a]=c;try{window.localStorage.setItem(encodeURIComponent(e._Store.prodStorageName),at.encode(JSON.stringify(n)))}catch(t){e.Logger.error("Error with setting products on localStorage.")}}if(!e._Store.SDKConfig.useCookieStorage){o.gs=o.gs||{},o.l=e._Store.isLoggedIn?1:0,e._Store.sessionId&&(o.gs.csm=e._Store.currentSessionMPIDs),o.gs.ie=e._Store.isEnabled,a&&(o.cu=a),Object.keys(e._Store.nonCurrentUserMPIDs).length&&(o=e._Helpers.extend({},o,e._Store.nonCurrentUserMPIDs),e._Store.nonCurrentUserMPIDs={}),o=t(o);try{window.localStorage.setItem(encodeURIComponent(r),i.encodePersistence(JSON.stringify(o)))}catch(t){e.Logger.error("Error with setting localStorage item.")}}}},this.getLocalStorage=function(){if(!e._Store.isLocalStorageAvailable)return null;var t,r=e._Store.storageName,n=i.decodePersistence(window.localStorage.getItem(r)),o={};if(n)for(t in n=JSON.parse(n))n.hasOwnProperty(t)&&(o[t]=n[t]);return Object.keys(o).length?o:null},this.expireCookies=function(e){var t,r,n,o=new Date;r=""===(n=i.getCookieDomain())?"":";domain="+n,o.setTime(o.getTime()-864e5),t="; expires="+o.toUTCString(),document.cookie=e+"="+t+"; path=/"+r},this.getCookie=function(){var t,r,n,o,s,a=window.document.cookie.split("; "),c=e._Store.storageName,u=c?void 0:{};for(e.Logger.verbose(ct.InformationMessages.CookieSearch),t=0,r=a.length;t<r;t++){try{o=(n=a[t].split("=")).shift(),s=n.join("=")}catch(t){e.Logger.verbose("Unable to parse cookie: "+o+". Skipping.")}if(c&&c===o){u=e._Helpers.converted(s);break}c||(u[o]=e._Helpers.converted(s))}return u?(e.Logger.verbose(ct.InformationMessages.CookieFound),JSON.parse(i.decodePersistence(u))):null},this.setCookie=function(){var r,n=e.Identity.getCurrentUser();n&&(r=n.getMPID());var o,s,a,c=new Date,u=e._Store.storageName,d=i.getCookie()||{},l=new Date(c.getTime()+24*e._Store.SDKConfig.cookieExpiration*60*60*1e3).toGMTString();s=""===(o=i.getCookieDomain())?"":";domain="+o,d.gs=d.gs||{},e._Store.sessionId&&(d.gs.csm=e._Store.currentSessionMPIDs),r&&(d.cu=r),d.l=e._Store.isLoggedIn?1:0,d=t(d),Object.keys(e._Store.nonCurrentUserMPIDs).length&&(d=e._Helpers.extend({},d,e._Store.nonCurrentUserMPIDs),e._Store.nonCurrentUserMPIDs={}),a=i.reduceAndEncodePersistence(d,l,s,e._Store.SDKConfig.maxCookieSize),e.Logger.verbose(ct.InformationMessages.CookieSet),window.document.cookie=encodeURIComponent(u)+"="+a},this.reduceAndEncodePersistence=function(t,r,i,o){var s,a=t.gs.csm?t.gs.csm:[];if(a.length){var c={};for(var u in t)t.hasOwnProperty(u)&&(dt[u]||u===t.cu||(c[u]=1));if(Object.keys(c).length)for(var d in c)(s=n(t,r,i)).length>o&&c.hasOwnProperty(d)&&-1===a.indexOf(d)&&delete t[d];for(var l,g=0;g<a.length&&(s=n(t,r,i)).length>o;g++)t[l=a[g]]?(e.Logger.verbose("Size of new encoded cookie is larger than maxCookieSize setting of "+o+". Removing from cookie the earliest logged in MPID containing: "+JSON.stringify(t[l],0,2)),delete t[l]):e.Logger.error("Unable to save MPID data to cookies because the resulting encoded cookie is larger than the maxCookieSize setting of "+o+". We recommend using a maxCookieSize of 1500.")}else for(var p in t)t.hasOwnProperty(p)&&((s=n(t,r,i)).length>o&&!dt[p]&&p!==t.cu&&delete t[p]);return s},this.findPrevCookiesBasedOnUI=function(t){var r,n=e._Persistence.getPersistence();if(t)for(var o in t.userIdentities)if(n&&Object.keys(n).length)for(var s in n)if(n[s].mpid){var a=n[s].ui;for(var c in a)if(o===c&&t.userIdentities[o]===a[c]){r=s;break}}r&&i.storeDataInMemory(n,r)},this.encodePersistence=function(t){for(var r in(t=JSON.parse(t)).gs)t.gs.hasOwnProperty(r)&&(ut[r]?t.gs[r]&&(Array.isArray(t.gs[r])&&t.gs[r].length||e._Helpers.isObject(t.gs[r])&&Object.keys(t.gs[r]).length)?t.gs[r]=at.encode(JSON.stringify(t.gs[r])):delete t.gs[r]:"ie"===r?t.gs[r]=t.gs[r]?1:0:!t.gs[r]&&delete t.gs[r]);for(var n in t)if(t.hasOwnProperty(n)&&!dt[n])for(r in t[n])t[n].hasOwnProperty(r)&&ut[r]&&(e._Helpers.isObject(t[n][r])&&Object.keys(t[n][r]).length?t[n][r]=at.encode(JSON.stringify(t[n][r])):delete t[n][r]);return J(JSON.stringify(t))},this.decodePersistence=function(t){try{if(t){if(t=JSON.parse(Q(t)),e._Helpers.isObject(t)&&Object.keys(t).length){for(var r in t.gs)t.gs.hasOwnProperty(r)&&(ut[r]?t.gs[r]=JSON.parse(at.decode(t.gs[r])):"ie"===r&&(t.gs[r]=!!t.gs[r]));for(var n in t)if(t.hasOwnProperty(n))if(dt[n])"l"===n&&(t[n]=!!t[n]);else for(r in t[n])t[n].hasOwnProperty(r)&&ut[r]&&t[n][r].length&&(t[n][r]=JSON.parse(at.decode(t[n][r])))}return JSON.stringify(t)}}catch(t){e.Logger.error("Problem with decoding cookie",t)}},this.getCookieDomain=function(){if(e._Store.SDKConfig.cookieDomain)return e._Store.SDKConfig.cookieDomain;var t=i.getDomain(document,location.hostname);return""===t?"":"."+t},this.getDomain=function(e,t){var r,n,i=t.split(".");for(r=i.length-1;0<=r;r--)if(n=i.slice(r).join("."),e.cookie="mptest=cookie;domain=."+n+";",-1<e.cookie.indexOf("mptest=cookie"))return e.cookie="mptest=;domain=."+n+";expires=Thu, 01 Jan 1970 00:00:01 GMT;",n;return""},this.getUserIdentities=function(e){var t=i.getPersistence();return t&&t[e]&&t[e].ui?t[e].ui:{}},this.getAllUserAttributes=function(e){var t=i.getPersistence();return t&&t[e]&&t[e].ua?t[e].ua:{}},this.getCartProducts=function(t){var r,n=localStorage.getItem(e._Store.prodStorageName);return n&&((r=JSON.parse(at.decode(n)))&&r[t]&&r[t].cp)?r[t].cp:[]},this.setCartProducts=function(t){if(e._Store.isLocalStorageAvailable)try{window.localStorage.setItem(encodeURIComponent(e._Store.prodStorageName),at.encode(JSON.stringify(t)))}catch(t){e.Logger.error("Error with setting products on localStorage.")}},this.saveUserIdentitiesToPersistence=function(e,t){if(t){var r=i.getPersistence();r&&(r[e]?r[e].ui=t:r[e]={ui:t},i.savePersistence(r))}},this.saveUserAttributesToPersistence=function(e,t){var r=i.getPersistence();t&&(r&&(r[e]?r[e].ui=t:r[e]={ui:t}),i.savePersistence(r))},this.saveUserCookieSyncDatesToPersistence=function(e,t){if(t){var r=i.getPersistence();r&&(r[e]?r[e].csd=t:r[e]={csd:t}),i.savePersistence(r)}},this.saveUserConsentStateToCookies=function(t,r){if(r||null===r){var n=i.getPersistence();n&&(n[t]?n[t].con=e._Consent.ConsentSerialization.toMinifiedJsonObject(r):n[t]={con:e._Consent.ConsentSerialization.toMinifiedJsonObject(r)},i.savePersistence(n))}},this.savePersistence=function(t){var r,n=i.encodePersistence(JSON.stringify(t)),o=new Date,s=e._Store.storageName,a=new Date(o.getTime()+24*e._Store.SDKConfig.cookieExpiration*60*60*1e3).toGMTString(),c=i.getCookieDomain();if(r=""===c?"":";domain="+c,e._Store.SDKConfig.useCookieStorage){var u=i.reduceAndEncodePersistence(t,a,r,e._Store.SDKConfig.maxCookieSize);window.document.cookie=encodeURIComponent(s)+"="+u}else e._Store.isLocalStorageAvailable&&localStorage.setItem(e._Store.storageName,n)},this.getPersistence=function(){return this.useLocalStorage()?this.getLocalStorage():this.getCookie()},this.getConsentState=function(t){var r=i.getPersistence();return r&&r[t]&&r[t].con?e._Consent.ConsentSerialization.fromMinifiedJsonObject(r[t].con):null},this.getFirstSeenTime=function(e){if(!e)return null;var t=i.getPersistence();return t&&t[e]&&t[e].fst?t[e].fst:null},this.setFirstSeenTime=function(e,t){if(e){t||(t=(new Date).getTime());var r=i.getPersistence();r&&(!r[e]&&(r[e]={}),!r[e].fst&&(r[e].fst=t,i.savePersistence(r)))}},this.getLastSeenTime=function(t){if(!t)return null;if(t===e.Identity.getCurrentUser().getMPID())return(new Date).getTime();var r=i.getPersistence();return r&&r[t]&&r[t].lst?r[t].lst:null},this.setLastSeenTime=function(e,t){if(e){t||(t=(new Date).getTime());var r=i.getPersistence();r&&r[e]&&(r[e].lst=t,i.savePersistence(r))}},this.getDeviceId=function(){return e._Store.deviceId},this.setDeviceId=function(t){e._Store.deviceId=t,i.update()},this.resetPersistence=function(){r(lt.localStorageName),r(lt.localStorageNameV3),r(lt.localStorageNameV4),r(e._Store.prodStorageName),r(e._Store.storageName),r(lt.localStorageProductsV4),i.expireCookies(lt.cookieName),i.expireCookies(lt.cookieNameV2),i.expireCookies(lt.cookieNameV3),i.expireCookies(lt.cookieNameV4),i.expireCookies(e._Store.prodStorageName),i.expireCookies(e._Store.storageName),mParticle._isTestEnv&&(r(e._Helpers.createMainStorageName("abcdef")),i.expireCookies(e._Helpers.createMainStorageName("abcdef")),r(e._Helpers.createProductStorageName("abcdef")))},this.forwardingStatsBatches={uploadsTable:{},forwardingStatsEventQueue:[]}}var pt=y.Messages;function vt(e){var t=this;this.logEvent=function(t,r){if(e.Logger.verbose(pt.InformationMessages.StartingLogEvent+": "+t.name),e._Helpers.canLog()){var n=e._ServerModel.createEventObject(t);e._APIClient.sendEventToServer(n,r)}else e.Logger.verbose(pt.InformationMessages.AbandonLogEvent)},this.startTracking=function(t){function r(t,r){if(t)try{r?t(r):t()}catch(t){e.Logger.error("Error invoking the callback passed to startTrackingLocation."),e.Logger.error(t)}}if(e._Store.isTracking){var n={coords:{latitude:e._Store.currentPosition.lat,longitude:e._Store.currentPosition.lng}};r(t,n)}else"geolocation"in navigator&&(e._Store.watchPositionId=navigator.geolocation.watchPosition((function(n){e._Store.currentPosition={lat:n.coords.latitude,lng:n.coords.longitude},r(t,n),t=null,e._Store.isTracking=!0}),(function(){r(t),t=null,e._Store.isTracking=!1})))},this.stopTracking=function(){e._Store.isTracking&&(navigator.geolocation.clearWatch(e._Store.watchPositionId),e._Store.currentPosition=null,e._Store.isTracking=!1)},this.logOptOut=function(){e.Logger.verbose(pt.InformationMessages.StartingLogOptOut);var t=e._ServerModel.createEventObject({messageType:h.MessageType.OptOut,eventType:h.EventType.Other});e._APIClient.sendEventToServer(t)},this.logAST=function(){t.logEvent({messageType:h.MessageType.AppStateTransition})},this.logCheckoutEvent=function(r,n,i,o){var s=e._Ecommerce.createCommerceEventObject(o);s&&(s.EventName+=e._Ecommerce.getProductActionEventName(h.ProductActionType.Checkout),s.EventCategory=h.CommerceEventType.ProductCheckout,s.ProductAction={ProductActionType:h.ProductActionType.Checkout,CheckoutStep:r,CheckoutOptions:n,ProductList:[]},t.logCommerceEvent(s,i))},this.logProductActionEvent=function(r,n,i,o,s,a){var c=e._Ecommerce.createCommerceEventObject(o),u=Array.isArray(n)?n:[n];u.forEach((function(t){t.TotalAmount&&(t.TotalAmount=e._Ecommerce.sanitizeAmount(t.TotalAmount,"TotalAmount")),t.Position&&(t.Position=e._Ecommerce.sanitizeAmount(t.Position,"Position")),t.Price&&(t.Price=e._Ecommerce.sanitizeAmount(t.Price,"Price")),t.Quantity&&(t.Quantity=e._Ecommerce.sanitizeAmount(t.Quantity,"Quantity"))})),c&&(c.EventCategory=e._Ecommerce.convertProductActionToEventType(r),c.EventName+=e._Ecommerce.getProductActionEventName(r),c.ProductAction={ProductActionType:r,ProductList:u},e._Helpers.isObject(s)&&e._Ecommerce.convertTransactionAttributesToProductAction(s,c.ProductAction),t.logCommerceEvent(c,i,a))},this.logPurchaseEvent=function(r,n,i,o){var s=e._Ecommerce.createCommerceEventObject(o);s&&(s.EventName+=e._Ecommerce.getProductActionEventName(h.ProductActionType.Purchase),s.EventCategory=h.CommerceEventType.ProductPurchase,s.ProductAction={ProductActionType:h.ProductActionType.Purchase},s.ProductAction.ProductList=e._Ecommerce.buildProductList(s,n),e._Ecommerce.convertTransactionAttributesToProductAction(r,s.ProductAction),t.logCommerceEvent(s,i))},this.logRefundEvent=function(r,n,i,o){if(r){var s=e._Ecommerce.createCommerceEventObject(o);s&&(s.EventName+=e._Ecommerce.getProductActionEventName(h.ProductActionType.Refund),s.EventCategory=h.CommerceEventType.ProductRefund,s.ProductAction={ProductActionType:h.ProductActionType.Refund},s.ProductAction.ProductList=e._Ecommerce.buildProductList(s,n),e._Ecommerce.convertTransactionAttributesToProductAction(r,s.ProductAction),t.logCommerceEvent(s,i))}else e.Logger.error(pt.ErrorMessages.TransactionRequired)},this.logPromotionEvent=function(r,n,i,o,s){var a=e._Ecommerce.createCommerceEventObject(o);a&&(a.EventName+=e._Ecommerce.getPromotionActionEventName(r),a.EventCategory=e._Ecommerce.convertPromotionActionToEventType(r),a.PromotionAction={PromotionActionType:r,PromotionList:Array.isArray(n)?n:[n]},t.logCommerceEvent(a,i,s))},this.logImpressionEvent=function(r,n,i,o){var s=e._Ecommerce.createCommerceEventObject(i);s&&(s.EventName+="Impression",s.EventCategory=h.CommerceEventType.ProductImpression,!Array.isArray(r)&&(r=[r]),s.ProductImpressions=[],r.forEach((function(e){s.ProductImpressions.push({ProductImpressionList:e.Name,ProductList:Array.isArray(e.Product)?e.Product:[e.Product]})})),t.logCommerceEvent(s,n,o))},this.logCommerceEvent=function(t,r,n){return e.Logger.verbose(pt.InformationMessages.StartingLogCommerceEvent),t.ProductAction&&null===t.EventCategory?void e.Logger.error("Commerce event not sent. The mParticle.ProductActionType you passed was invalid. Re-check your code."):(r=e._Helpers.sanitizeAttributes(r,t.EventName),void(e._Helpers.canLog()?(e._Store.webviewBridgeEnabled&&(t.ShoppingCart={}),r&&(t.EventAttributes=r),e._APIClient.sendEventToServer(t,n),e._Persistence.update()):e.Logger.verbose(pt.InformationMessages.AbandonLogEvent)))},this.addEventHandler=function(r,n,i,o,s){var a,c,u=[],d=function(r){e.Logger.verbose("DOM event triggered, handling event"),t.logEvent({messageType:h.MessageType.PageEvent,name:"function"==typeof i?i(a):i,data:"function"==typeof o?o(a):o,eventType:s||h.EventType.Other}),(a.href&&"_blank"!==a.target||a.submit)&&(r.preventDefault?r.preventDefault():r.returnValue=!1,setTimeout((function(){a.href?window.location.href=a.href:a.submit&&a.submit()}),e._Store.SDKConfig.timeout))};if(n)if("string"==typeof n?u=document.querySelectorAll(n):n.nodeType&&(u=[n]),u.length)for(e.Logger.verbose("Found "+u.length+" element"+(1<u.length?"s":"")+", attaching event handlers"),c=0;c<u.length;c++)(a=u[c]).addEventListener?a.addEventListener(r,d,!1):a.attachEvent?a.attachEvent("on"+r,d):a["on"+r]=d;else e.Logger.verbose("No elements found");else e.Logger.error("Can't bind event, selector is required")}}function mt(e,t,r,n){var i=this;return{getUserIdentities:function(){var i={},o=r._Persistence.getUserIdentities(e);for(var s in o)if(o.hasOwnProperty(s)){var a=h.IdentityType.getIdentityName(r._Helpers.parseNumber(s));n&&(!n||n.isIdentityBlocked(a))||(i[a]=o[s])}return{userIdentities:i=r._Helpers.filterUserIdentitiesForForwarders(i,t.userIdentityFilters)}},getMPID:function(){return e},getUserAttributesLists:function(e){var t,o={};for(var s in t=i.getAllUserAttributes())t.hasOwnProperty(s)&&Array.isArray(t[s])&&(n&&(!n||n.isAttributeKeyBlocked(s))||(o[s]=t[s].slice()));return o=r._Helpers.filterUserAttributes(o,e.userAttributeFilters)},getAllUserAttributes:function(){var i={},o=r._Persistence.getAllUserAttributes(e);if(o)for(var s in o)o.hasOwnProperty(s)&&(n&&(!n||n.isAttributeKeyBlocked(s))||(Array.isArray(o[s])?i[s]=o[s].slice():i[s]=o[s]));return i=r._Helpers.filterUserAttributes(i,t.userAttributeFilters)}}}var ft=y.IdentityMethods,ht=ft.Modify,yt=ft.Identify,St=ft.Login,_t=ft.Logout;function Pt(e,t){var r=this,n="setUserAttribute",i="removeUserAttribute";this.initForwarders=function(t,n){var i=e.Identity.getCurrentUser();!e._Store.webviewBridgeEnabled&&e._Store.configuredForwarders&&(e._Store.configuredForwarders.sort((function(e,t){return e.settings.PriorityValue=e.settings.PriorityValue||0,t.settings.PriorityValue=t.settings.PriorityValue||0,-1*(e.settings.PriorityValue-t.settings.PriorityValue)})),e._Store.activeForwarders=e._Store.configuredForwarders.filter((function(o){if(!e._Consent.isEnabledForUserConsent(o.filteringConsentRuleValues,i))return!1;if(!r.isEnabledForUserAttributes(o.filteringUserAttributeValue,i))return!1;if(!r.isEnabledForUnknownUser(o.excludeAnonymousUser,i))return!1;var s=e._Helpers.filterUserIdentities(t,o.userIdentityFilters),a=e._Helpers.filterUserAttributes(i?i.getAllUserAttributes():{},o.userAttributeFilters);return o.initialized||(o.logger=e.Logger,o.init(o.settings,n,!1,null,a,s,e._Store.SDKConfig.appVersion,e._Store.SDKConfig.appName,e._Store.SDKConfig.customFlags,e._Store.clientId),o.initialized=!0),!0})))},this.isEnabledForUserAttributes=function(t,r){if(!t||!e._Helpers.isObject(t)||!Object.keys(t).length)return!0;var n,i,o;if(!r)return!1;o=r.getAllUserAttributes();var s=!1;try{if(o&&e._Helpers.isObject(o)&&Object.keys(o).length)for(var a in o)if(o.hasOwnProperty(a)&&(n=Be.hashAttributeConditionalForwarding(a),i=Be.hashAttributeConditionalForwarding(o[a]),n===t.userAttributeName&&i===t.userAttributeValue)){s=!0;break}return!t||t.includeOnMatch===s}catch(e){return!0}},this.isEnabledForUnknownUser=function(e,t){return!!(t&&t.isLoggedIn()||!e)},this.applyToForwarders=function(t,r){e._Store.activeForwarders.length&&e._Store.activeForwarders.forEach((function(n){if(n[t])try{var i=n[t](r);i&&e.Logger.verbose(i)}catch(t){e.Logger.verbose(t)}}))},this.sendEventToForwarders=function(t){var r,n,i,o=function(t,r){t.UserIdentities&&t.UserIdentities.length&&t.UserIdentities.forEach((function(n,i){e._Helpers.inArray(r,Be.hashUserIdentity(n.Type))&&(t.UserIdentities.splice(i,1),0<i&&i--)}))},s=function(t,r){var n;if(r)for(var i in t.EventAttributes)t.EventAttributes.hasOwnProperty(i)&&(n=Be.hashEventAttributeKey(t.EventCategory,t.EventName,i),e._Helpers.inArray(r,n)&&delete t.EventAttributes[i])},a=function(t,r){return!!(t&&t.length&&e._Helpers.inArray(t,r))},c=[h.MessageType.PageEvent,h.MessageType.PageView,h.MessageType.Commerce];if(!e._Store.webviewBridgeEnabled&&e._Store.activeForwarders){n=Be.hashEventName(t.EventName,t.EventCategory),i=Be.hashEventType(t.EventCategory);for(var u=0;u<e._Store.activeForwarders.length;u++){if(-1<c.indexOf(t.EventDataType)&&e._Store.activeForwarders[u].filteringEventAttributeValue&&e._Store.activeForwarders[u].filteringEventAttributeValue.eventAttributeName&&e._Store.activeForwarders[u].filteringEventAttributeValue.eventAttributeValue){var d=null;if(t.EventAttributes)for(var l in t.EventAttributes){var g;if((g=Be.hashAttributeConditionalForwarding(l))===e._Store.activeForwarders[u].filteringEventAttributeValue.eventAttributeName&&(d={name:g,value:Be.hashAttributeConditionalForwarding(t.EventAttributes[l])}),d)break}var p=null!==d&&d.value===e._Store.activeForwarders[u].filteringEventAttributeValue.eventAttributeValue;if(!(!0===e._Store.activeForwarders[u].filteringEventAttributeValue.includeOnMatch?p:!p))continue}if((r={},r=e._Helpers.extend(!0,r,t),t.EventDataType!==h.MessageType.PageEvent||!a(e._Store.activeForwarders[u].eventNameFilters,n)&&!a(e._Store.activeForwarders[u].eventTypeFilters,i))&&((t.EventDataType!==h.MessageType.Commerce||!a(e._Store.activeForwarders[u].eventTypeFilters,i))&&(t.EventDataType!==h.MessageType.PageView||!a(e._Store.activeForwarders[u].screenNameFilters,n))&&(r.EventAttributes&&(t.EventDataType===h.MessageType.PageEvent?s(r,e._Store.activeForwarders[u].attributeFilters):t.EventDataType===h.MessageType.PageView&&s(r,e._Store.activeForwarders[u].screenAttributeFilters)),o(r,e._Store.activeForwarders[u].userIdentityFilters),r.UserAttributes=e._Helpers.filterUserAttributes(r.UserAttributes,e._Store.activeForwarders[u].userAttributeFilters),e._Store.activeForwarders[u].process))){e.Logger.verbose("Sending message to forwarder: "+e._Store.activeForwarders[u].name);var v=e._Store.activeForwarders[u].process(r);v&&e.Logger.verbose(v)}}}},this.handleForwarderUserAttributes=function(r,o,s){t&&t.isAttributeKeyBlocked(o)||!e._Store.activeForwarders.length||e._Store.activeForwarders.forEach((function(t){if(t[r]&&!e._Helpers.isFilteredUserAttribute(o,t.userAttributeFilters))try{var a;r===n?a=t.setUserAttribute(o,s):r===i&&(a=t.removeUserAttribute(o)),a&&e.Logger.verbose(a)}catch(t){e.Logger.error(t)}}))},this.setForwarderUserIdentities=function(t){e._Store.activeForwarders.forEach((function(r){var n=e._Helpers.filterUserIdentities(t,r.userIdentityFilters);r.setUserIdentity&&n.forEach((function(t){var n=r.setUserIdentity(t.Identity,t.Type);n&&e.Logger.verbose(n)}))}))},this.setForwarderOnUserIdentified=function(r){e._Store.activeForwarders.forEach((function(n){var i=mt(r.getMPID(),n,e,t);if(n.onUserIdentified){var o=n.onUserIdentified(i);o&&e.Logger.verbose(o)}}))},this.setForwarderOnIdentityComplete=function(r,n){var i;e._Store.activeForwarders.forEach((function(o){var s=mt(r.getMPID(),o,e,t),a=s.getUserIdentities();n===yt?o.onIdentifyComplete&&((i=o.onIdentifyComplete(s,a))&&e.Logger.verbose(i)):n===St?o.onLoginComplete&&((i=o.onLoginComplete(s,a))&&e.Logger.verbose(i)):n===_t?o.onLogoutComplete&&((i=o.onLogoutComplete(s,a))&&e.Logger.verbose(i)):n===ht&&o.onModifyComplete&&((i=o.onModifyComplete(s,a))&&e.Logger.verbose(i))}))},this.getForwarderStatsQueue=function(){return e._Persistence.forwardingStatsBatches.forwardingStatsEventQueue},this.setForwarderStatsQueue=function(t){e._Persistence.forwardingStatsBatches.forwardingStatsEventQueue=t},this.processForwarders=function(t,n){t?(this.processUIEnabledKits(t),this.processSideloadedKits(t),r.initForwarders(e._Store.SDKConfig.identifyRequest.userIdentities,n)):e.Logger.warning("No config was passed. Cannot process forwarders")},this.processUIEnabledKits=function(t){var n=this.returnKitConstructors();try{Array.isArray(t.kitConfigs)&&t.kitConfigs.length&&t.kitConfigs.forEach((function(e){r.configureUIEnabledKit(e,n)}))}catch(t){e.Logger.error("MP Kits not configured propertly. Kits may not be initialized. "+t)}},this.returnKitConstructors=function(){var t={};return fe(e._Store.SDKConfig.kits)?!fe(e._preInit.forwarderConstructors)&&e._preInit.forwarderConstructors.forEach((function(e){if(e.suffix){var r="".concat(e.name,"-").concat(e.suffix);t[r]=e}else t[e.name]=e})):t=e._Store.SDKConfig.kits,t},this.configureUIEnabledKit=function(t,r){var n=null,i=t;for(var o in r){var s=void 0;if(i.suffix&&(s="".concat(i.name,"-").concat(i.suffix)),!(o!==s&&o!==i.name||i.isDebug!==e._Store.SDKConfig.isDevelopmentMode&&i.isSandbox!==e._Store.SDKConfig.isDevelopmentMode)){n=this.returnConfiguredKit(r[o],i),e._Store.configuredForwarders.push(n);break}}},this.processSideloadedKits=function(t){try{if(Array.isArray(t.sideloadedKits)){var n={kits:{}},i=t.sideloadedKits;for(var o in i.forEach((function(e){try{e.kitInstance.register(n);var t=e.kitInstance.name;n.kits[t].filters=e.filterDictionary}catch(t){console.error("Error registering sideloaded kit "+e.kitInstance.name)}})),n.kits){var s=n.kits[o];r.configureSideloadedKit(s)}if(!fe(n.kits)){var a=Object.keys(n.kits);e._Store.sideloadedKitsCount=a.length}}}catch(t){e.Logger.error("Sideloaded Kits not configured propertly. Kits may not be initialized. "+t)}},this.configureSideloadedKit=function(t){e._Store.configuredForwarders.push(this.returnConfiguredKit(t,t.filters))},this.returnConfiguredKit=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=new e.constructor;return r.id=t.moduleId,r.isSandbox=t.isDebug||t.isSandbox,r.hasSandbox="true"===t.hasDebugString,r.isVisible=t.isVisible||!0,r.settings=t.settings||{},r.eventNameFilters=t.eventNameFilters||[],r.eventTypeFilters=t.eventTypeFilters||[],r.attributeFilters=t.attributeFilters||[],r.screenNameFilters=t.screenNameFilters||[],r.screenAttributeFilters=t.screenAttributeFilters||[],r.userIdentityFilters=t.userIdentityFilters||[],r.userAttributeFilters=t.userAttributeFilters||[],r.filteringEventAttributeValue=t.filteringEventAttributeValue||{},r.filteringUserAttributeValue=t.filteringUserAttributeValue||{},r.eventSubscriptionId=t.eventSubscriptionId||null,r.filteringConsentRuleValues=t.filteringConsentRuleValues||{},r.excludeAnonymousUser=t.excludeAnonymousUser||!1,r},this.configurePixel=function(t){(t.isDebug===e._Store.SDKConfig.isDevelopmentMode||t.isProduction!==e._Store.SDKConfig.isDevelopmentMode)&&e._Store.pixelConfigurations.push(t)},this.processPixelConfigs=function(t){try{fe(t.pixelConfigs)||t.pixelConfigs.forEach((function(e){r.configurePixel(e)}))}catch(t){e.Logger.error("Cookie Sync configs not configured propertly. Cookie Sync may not be initialized. "+t)}}}var bt=h.MessageType,It=h.ApplicationTransitionType;function Ct(e){return e?e.map((function(e){return function(e){return{id:re(e.Sku),nm:re(e.Name),pr:te(e.Price),qt:te(e.Quantity),br:re(e.Brand),va:re(e.Variant),ca:re(e.Category),ps:te(e.Position),cc:re(e.CouponCode),tpa:te(e.TotalAmount),attrs:e.Attributes}}(e)})):[]}function At(e){var t=this;this.appendUserInfo=function(t,r){if(r){if(!t)return r.MPID=null,r.ConsentState=null,r.UserAttributes=null,void(r.UserIdentities=null);if(!r.MPID||r.MPID!==t.getMPID()){r.MPID=t.getMPID(),r.ConsentState=t.getConsentState(),r.UserAttributes=t.getAllUserAttributes();var n=t.getUserIdentities().userIdentities,i={};for(var o in n){var s=h.IdentityType.getIdentityType(o);!1!==s&&(i[s]=n[o])}var a=[];if(e._Helpers.isObject(i)&&Object.keys(i).length)for(var c in i){var u={};u.Identity=i[c],u.Type=e._Helpers.parseNumber(c),a.push(u)}r.UserIdentities=a}}},this.convertToConsentStateV2DTO=function(e){if(!e)return null;var t={},r=e.getGDPRConsentState();if(r){var n={};for(var i in t.gdpr=n,r)if(r.hasOwnProperty(i)){var o=r[i];t.gdpr[i]={},"boolean"==typeof o.Consented&&(n[i].c=o.Consented),"number"==typeof o.Timestamp&&(n[i].ts=o.Timestamp),"string"==typeof o.ConsentDocument&&(n[i].d=o.ConsentDocument),"string"==typeof o.Location&&(n[i].l=o.Location),"string"==typeof o.HardwareId&&(n[i].h=o.HardwareId)}}var s=e.getCCPAConsentState();return s&&(t.ccpa={data_sale_opt_out:{c:s.Consented,ts:s.Timestamp,d:s.ConsentDocument,l:s.Location,h:s.HardwareId}}),t},this.createEventObject=function(r,n){var i={},o={},s=r.messageType===h.MessageType.OptOut?!e._Store.isEnabled:null;if(e._Store.sessionId||r.messageType===h.MessageType.OptOut||e._Store.webviewBridgeEnabled){o=r.hasOwnProperty("toEventAPIObject")?r.toEventAPIObject():{EventName:r.name||r.messageType,EventCategory:r.eventType,EventAttributes:e._Helpers.sanitizeAttributes(r.data,r.name),SourceMessageId:r.sourceMessageId||e._Helpers.generateUniqueId(),EventDataType:r.messageType,CustomFlags:r.customFlags||{},UserAttributeChanges:r.userAttributeChanges,UserIdentityChanges:r.userIdentityChanges},r.messageType!==h.MessageType.SessionEnd&&(e._Store.dateLastEventSent=new Date),i={Store:e._Store.serverSettings,SDKVersion:y.sdkVersion,SessionId:e._Store.sessionId,SessionStartDate:e._Store.sessionStartDate?e._Store.sessionStartDate.getTime():0,Debug:e._Store.SDKConfig.isDevelopmentMode,Location:e._Store.currentPosition,OptOut:s,ExpandedEventCount:0,AppVersion:e.getAppVersion(),AppName:e.getAppName(),Package:e._Store.SDKConfig.package,ClientGeneratedId:e._Store.clientId,DeviceId:e._Store.deviceId,IntegrationAttributes:e._Store.integrationAttributes,CurrencyCode:e._Store.currencyCode,DataPlan:e._Store.SDKConfig.dataPlan?e._Store.SDKConfig.dataPlan:{}},o.EventDataType===bt.AppStateTransition&&(o.IsFirstRun=e._Store.isFirstRun,o.LaunchReferral=window.location.href||null),o.CurrencyCode=e._Store.currencyCode;var a=n||e.Identity.getCurrentUser();return t.appendUserInfo(a,o),r.messageType===h.MessageType.SessionEnd&&(o.SessionLength=e._Store.dateLastEventSent.getTime()-e._Store.sessionStartDate.getTime(),o.currentSessionMPIDs=e._Store.currentSessionMPIDs,o.EventAttributes=e._Store.sessionAttributes,e._Store.currentSessionMPIDs=[],e._Store.sessionStartDate=null),i.Timestamp=e._Store.dateLastEventSent.getTime(),e._Helpers.extend({},o,i)}return null},this.convertEventToV2DTO=function(r){var n={n:r.EventName,et:r.EventCategory,ua:r.UserAttributes,ui:r.UserIdentities,ia:r.IntegrationAttributes,str:r.Store,attrs:r.EventAttributes,sdk:r.SDKVersion,sid:r.SessionId,sl:r.SessionLength,ssd:r.SessionStartDate,dt:r.EventDataType,dbg:r.Debug,ct:r.Timestamp,lc:r.Location,o:r.OptOut,eec:r.ExpandedEventCount,av:r.AppVersion,cgid:r.ClientGeneratedId,das:r.DeviceId,mpid:r.MPID,smpids:r.currentSessionMPIDs};r.DataPlan&&r.DataPlan.PlanId&&(n.dp_id=r.DataPlan.PlanId,r.DataPlan.PlanVersion&&(n.dp_v=r.DataPlan.PlanVersion));var i=t.convertToConsentStateV2DTO(r.ConsentState);return i&&(n.con=i),r.EventDataType===bt.AppStateTransition&&(n.fr=r.IsFirstRun,n.iu=!1,n.at=It.AppInit,n.lr=r.LaunchReferral,n.attrs=null),r.CustomFlags&&function(e,t){var r=[];for(var n in t.flags={},e.CustomFlags)r=[],e.CustomFlags.hasOwnProperty(n)&&(Array.isArray(e.CustomFlags[n])?e.CustomFlags[n].forEach((function(e){pe(e)&&r.push(e.toString())})):pe(e.CustomFlags[n])&&r.push(e.CustomFlags[n].toString()),r.length&&(t.flags[n]=r))}(r,n),r.EventDataType===bt.Commerce?(n.cu=r.CurrencyCode,r.ShoppingCart&&(n.sc={pl:Ct(r.ShoppingCart.ProductList)}),r.ProductAction?n.pd={an:r.ProductAction.ProductActionType,cs:e._Helpers.parseNumber(r.ProductAction.CheckoutStep),co:r.ProductAction.CheckoutOptions,pl:Ct(r.ProductAction.ProductList),ti:r.ProductAction.TransactionId,ta:r.ProductAction.Affiliation,tcc:r.ProductAction.CouponCode,tr:e._Helpers.parseNumber(r.ProductAction.TotalAmount),ts:e._Helpers.parseNumber(r.ProductAction.ShippingAmount),tt:e._Helpers.parseNumber(r.ProductAction.TaxAmount)}:r.PromotionAction?n.pm={an:r.PromotionAction.PromotionActionType,pl:r.PromotionAction.PromotionList.map((function(e){return{id:e.Id,nm:e.Name,cr:e.Creative,ps:e.Position?e.Position:0}}))}:r.ProductImpressions&&(n.pi=r.ProductImpressions.map((function(e){return{pil:e.ProductImpressionList,pl:Ct(e.ProductList)}})))):r.EventDataType===bt.Profile&&(n.pet=r.ProfileMessageType),n}}function wt(e){this.startForwardingStatsTimer=function(){mParticle._forwardingStatsTimer=setInterval((function(){!function(){var t=e._Forwarders.getForwarderStatsQueue(),r=e._Persistence.forwardingStatsBatches.uploadsTable,n=Date.now();for(var i in t.length&&(r[n]={uploading:!1,data:t},e._Forwarders.setForwarderStatsQueue([])),r)!function(t){if(r.hasOwnProperty(t)&&!1===r[t].uploading){var n=e._Helpers.createXHR((function(){4===n.readyState&&(200===n.status||202===n.status?(e.Logger.verbose("Successfully sent "+n.statusText+" from server"),delete r[t]):"4"===n.status.toString()[0]?429!==n.status&&delete r[t]:r[t].uploading=!1)})),i=r[t].data;r[t].uploading=!0,e._APIClient.sendBatchForwardingStatsToServer(i,n)}}(i)}()}),e._Store.SDKConfig.forwarderStatsTimeout)}}var Et=y.IdentityMethods,Tt=Et.Identify,kt=Et.Modify,Dt=Et.Login,Ot=Et.Logout,Ut=function(e,t,r,n,i){if(!i){var o=(new Date).getTime(),s=o+864e5;n.getAllResponseHeaders().includes("x-mp-max-age")&&(s=o+1e3*te(n.getResponseHeader("x-mp-max-age"))),e===Dt||e===Tt?Mt(e,t,s,r,n):(e===kt||e===Ot)&&r.purge()}},Mt=function(e,t,r,n,i){var o=n.retrieve()||{},s=$(Lt(e,t)),a=JSON.parse(i.responseText),c=a.mpid,u=a.is_logged_in;o[s]={responseText:JSON.stringify({mpid:c,is_logged_in:u}),status:i.status,expireTimestamp:r},n.store(o)},Lt=function(e,t){var r="".concat(e,":").concat("device_application_stamp","=").concat(t.device_application_stamp,";"),n="";if(Object.keys(t).length){var i=[];for(var o in t)"device_application_stamp"!==o&&(i[h.IdentityType.getIdentityType(o)]=t[o]);n=i.reduce((function(e,t,r){var n=h.IdentityType.getIdentityName(r);return"".concat(e).concat(n,"=").concat(t,";")}),r)}return n},Nt=function(e,t){var r={};if(ee(null==e?void 0:e.userIdentities))for(var n in e.userIdentities)r[n]=e.userIdentities[n];return r.device_application_stamp=t,r},Ft=function(e){var t=e.retrieve()||{},r=(new Date).getTime();for(var n in t)t[n].expireTimestamp<r&&delete t[n];e.store(t)},Rt=function(e,t,r,n,i,o,s){var a=function(e,t,r){var n=null==r?void 0:r.retrieve();if(!n)return!1;var i=$(Lt(e,t));return!(!n.hasOwnProperty(i)||n[i].expireTimestamp<(new Date).getTime())}(s,e,t);if(a){var c=function(e,t,r){var n=$(Lt(e,t)),i=r.retrieve();return i?i[n]:null}(s,e,t);return r(c,n,i,o,s,e,!0),!0}return!1},Vt=function(){function e(e,t,r){this.url="",this.logger=r,this.url="https://".concat(e).concat(t,"/audience"),this.userAudienceAPI=window.fetch?new Ve(this.url):new He(this.url)}return e.prototype.sendGetUserAudienceRequest=function(e,t){return A(this,void 0,void 0,(function(){var r,n,i,o,s,a;return w(this,(function(c){switch(c.label){case 0:this.logger.verbose("Fetching user audiences from server"),r={method:"GET",headers:{Accept:"*/*"}},n="".concat(this.url,"?mpid=").concat(e),c.label=1;case 1:return c.trys.push([1,6,,7]),[4,this.userAudienceAPI.upload(r,n)];case 2:return 200<=(i=c.sent()).status&&300>i.status?(this.logger.verbose("User Audiences successfully received"),[4,i.json()]):[3,4];case 3:o=c.sent(),s={currentAudienceMemberships:null==o?void 0:o.audience_memberships};try{t(s)}catch(e){throw new Error("Error invoking callback on user audience response.")}return[3,5];case 4:throw 401===i.status?new Error("`HTTP error status ${userAudiencePromise.status} while retrieving User Audiences - please verify your API key.`"):403===i.status?new Error("`HTTP error status ${userAudiencePromise.status} while retrieving User Audiences - please verify your workspace is enabled for audiences.`"):new Error("Uncaught HTTP Error ".concat(i.status,"."));case 5:return[3,7];case 6:return a=c.sent(),this.logger.error("Error retrieving audiences. ".concat(a)),[3,7];case 7:return[2]}}))}))},e}(),Ht=y.Messages,xt=y.HTTPCodes,Kt=y.FeatureFlags,jt=Ht.ErrorMessages,qt=y.IdentityMethods,Bt=qt.Identify,Wt=qt.Modify,zt=qt.Login,Jt=qt.Logout;function Qt(e){var t=this;this.idCache=null,this.audienceManager=null,this.checkIdentitySwap=function(t,r,n){if(t&&r&&t!==r){var i=e._Persistence.getPersistence();i&&(i.cu=r,i.gs.csm=n,e._Persistence.savePersistence(i))}},this.IdentityRequest={preProcessIdentityRequest:function(t,r,n){e.Logger.verbose(Ht.InformationMessages.StartingLogEvent+": "+n);var i=e._Helpers.Validators.validateIdentities(t,n);if(!i.valid)return e.Logger.error("ERROR: "+i.error),{valid:!1,error:i.error};if(r&&!e._Helpers.Validators.isFunction(r)){var o="The optional callback must be a function. You tried entering a(n) "+s(r);return e.Logger.error(o),{valid:!1,error:o}}return{valid:!0}},createIdentityRequest:function(t,r,n,i,o,s,a){return{client_sdk:{platform:r,sdk_vendor:n,sdk_version:i},context:s,environment:e._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:e._Helpers.generateUniqueId(),request_timestamp_ms:(new Date).getTime(),previous_mpid:a||null,known_identities:Nt(t,o)}},createModifyIdentityRequest:function(t,r,n,i,o,s){return{client_sdk:{platform:n,sdk_vendor:i,sdk_version:o},context:s,environment:e._Store.SDKConfig.isDevelopmentMode?"development":"production",request_id:e._Helpers.generateUniqueId(),request_timestamp_ms:(new Date).getTime(),identity_changes:this.createIdentityChanges(t,r)}},createIdentityChanges:function(t,r){var n,i=[];if(r&&e._Helpers.isObject(r)&&t&&e._Helpers.isObject(t))for(n in r)i.push({old_value:t[n]||null,new_value:r[n],identity_type:n});return i},combineUserIdentities:function(t,r){var n={},i=e._Helpers.extend(t,r);for(var o in i){var s=h.IdentityType.getIdentityType(o);!1!==s&&0<=s&&(n[h.IdentityType.getIdentityType(o)]=i[o])}return n},createAliasNetworkRequest:function(t){return{request_id:e._Helpers.generateUniqueId(),request_type:"alias",environment:e._Store.SDKConfig.isDevelopmentMode?"development":"production",api_key:e._Store.devToken,data:{destination_mpid:t.destinationMpid,source_mpid:t.sourceMpid,start_unixtime_ms:t.startTime,end_unixtime_ms:t.endTime,scope:t.scope,device_application_stamp:e._Store.deviceId}}},convertAliasToNative:function(e){return{DestinationMpid:e.destinationMpid,SourceMpid:e.sourceMpid,StartUnixtimeMs:e.startTime,EndUnixtimeMs:e.endTime}},convertToNative:function(e){var t=[];if(e&&e.userIdentities){for(var r in e.userIdentities)e.userIdentities.hasOwnProperty(r)&&t.push({Type:h.IdentityType.getIdentityType(r),Identity:e.userIdentities[r]});return{UserIdentities:t}}}},this.IdentityAPI={HTTPCodes:xt,identify:function(r,n){var i,o=e.Identity.getCurrentUser(),s=e._Identity.IdentityRequest.preProcessIdentityRequest(r,n,Bt);if(o&&(i=o.getMPID()),s.valid){var a=e._Identity.IdentityRequest.createIdentityRequest(r,y.platform,y.sdkVendor,y.sdkVersion,e._Store.deviceId,e._Store.context,i);if(e._Helpers.getFeatureFlag(y.FeatureFlags.CacheIdentity))if(Rt(a.known_identities,t.idCache,t.parseIdentityResponse,i,n,r,Bt))return;e._Helpers.canLog()?e._Store.webviewBridgeEnabled?(e._NativeSdkHelpers.sendToNative(y.NativeSdkPaths.Identify,JSON.stringify(e._Identity.IdentityRequest.convertToNative(r))),e._Helpers.invokeCallback(n,xt.nativeIdentityRequest,"Identify request sent to native sdk")):e._IdentityAPIClient.sendIdentityRequest(a,Bt,n,r,t.parseIdentityResponse,i,a.known_identities):(e._Helpers.invokeCallback(n,xt.loggingDisabledOrMissingAPIKey,Ht.InformationMessages.AbandonLogEvent),e.Logger.verbose(Ht.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,xt.validationIssue,s.error),e.Logger.verbose(s)},logout:function(r,n){var i,o=e.Identity.getCurrentUser(),s=e._Identity.IdentityRequest.preProcessIdentityRequest(r,n,Jt);if(o&&(i=o.getMPID()),s.valid){var a,c=e._Identity.IdentityRequest.createIdentityRequest(r,y.platform,y.sdkVendor,y.sdkVersion,e._Store.deviceId,e._Store.context,i);e._Helpers.canLog()?e._Store.webviewBridgeEnabled?(e._NativeSdkHelpers.sendToNative(y.NativeSdkPaths.Logout,JSON.stringify(e._Identity.IdentityRequest.convertToNative(r))),e._Helpers.invokeCallback(n,xt.nativeIdentityRequest,"Logout request sent to native sdk")):(e._IdentityAPIClient.sendIdentityRequest(c,Jt,n,r,t.parseIdentityResponse,i),(a=e._ServerModel.createEventObject({messageType:h.MessageType.Profile})).ProfileMessageType=h.ProfileMessageType.Logout,e._Store.activeForwarders.length&&e._Store.activeForwarders.forEach((function(e){e.logOut&&e.logOut(a)}))):(e._Helpers.invokeCallback(n,xt.loggingDisabledOrMissingAPIKey,Ht.InformationMessages.AbandonLogEvent),e.Logger.verbose(Ht.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,xt.validationIssue,s.error),e.Logger.verbose(s)},login:function(r,n){var i,o=e.Identity.getCurrentUser(),s=e._Identity.IdentityRequest.preProcessIdentityRequest(r,n,zt);if(o&&(i=o.getMPID()),s.valid){var a=e._Identity.IdentityRequest.createIdentityRequest(r,y.platform,y.sdkVendor,y.sdkVersion,e._Store.deviceId,e._Store.context,i);if(e._Helpers.getFeatureFlag(y.FeatureFlags.CacheIdentity))if(Rt(a.known_identities,t.idCache,t.parseIdentityResponse,i,n,r,zt))return;e._Helpers.canLog()?e._Store.webviewBridgeEnabled?(e._NativeSdkHelpers.sendToNative(y.NativeSdkPaths.Login,JSON.stringify(e._Identity.IdentityRequest.convertToNative(r))),e._Helpers.invokeCallback(n,xt.nativeIdentityRequest,"Login request sent to native sdk")):e._IdentityAPIClient.sendIdentityRequest(a,zt,n,r,t.parseIdentityResponse,i,a.known_identities):(e._Helpers.invokeCallback(n,xt.loggingDisabledOrMissingAPIKey,Ht.InformationMessages.AbandonLogEvent),e.Logger.verbose(Ht.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,xt.validationIssue,s.error),e.Logger.verbose(s)},modify:function(r,n){var i,o=e.Identity.getCurrentUser(),s=e._Identity.IdentityRequest.preProcessIdentityRequest(r,n,Wt);o&&(i=o.getMPID());var a=r&&r.userIdentities?r.userIdentities:{};if(s.valid){var c=e._Identity.IdentityRequest.createModifyIdentityRequest(o?o.getUserIdentities().userIdentities:{},a,y.platform,y.sdkVendor,y.sdkVersion,e._Store.context);e._Helpers.canLog()?e._Store.webviewBridgeEnabled?(e._NativeSdkHelpers.sendToNative(y.NativeSdkPaths.Modify,JSON.stringify(e._Identity.IdentityRequest.convertToNative(r))),e._Helpers.invokeCallback(n,xt.nativeIdentityRequest,"Modify request sent to native sdk")):e._IdentityAPIClient.sendIdentityRequest(c,Wt,n,r,t.parseIdentityResponse,i,c.known_identities):(e._Helpers.invokeCallback(n,xt.loggingDisabledOrMissingAPIKey,Ht.InformationMessages.AbandonLogEvent),e.Logger.verbose(Ht.InformationMessages.AbandonLogEvent))}else e._Helpers.invokeCallback(n,xt.validationIssue,s.error),e.Logger.verbose(s)},getCurrentUser:function(){var r;return e._Store?(r=e._Store.mpid)?(r=e._Store.mpid.slice(),t.mParticleUser(r,e._Store.isLoggedIn)):e._Store.webviewBridgeEnabled?t.mParticleUser():null:null},getUser:function(r){var n=e._Persistence.getPersistence();return n&&n[r]&&!y.SDKv2NonMPIDCookieKeys.hasOwnProperty(r)?t.mParticleUser(r):null},getUsers:function(){var r=e._Persistence.getPersistence(),n=[];if(r)for(var i in r)y.SDKv2NonMPIDCookieKeys.hasOwnProperty(i)||n.push(t.mParticleUser(i));return n.sort((function(e,t){return(e.getLastSeenTime()||0)>(t.getLastSeenTime()||0)?-1:1})),n},aliasUsers:function(t,r){var n;if(t.destinationMpid&&t.sourceMpid||(n=Ht.ValidationMessages.AliasMissingMpid),t.destinationMpid===t.sourceMpid&&(n=Ht.ValidationMessages.AliasNonUniqueMpid),t.startTime&&t.endTime||(n=Ht.ValidationMessages.AliasMissingTime),t.startTime>t.endTime&&(n=Ht.ValidationMessages.AliasStartBeforeEndTime),n)return e.Logger.warning(n),void e._Helpers.invokeAliasCallback(r,xt.validationIssue,n);if(e._Helpers.canLog())if(e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(y.NativeSdkPaths.Alias,JSON.stringify(e._Identity.IdentityRequest.convertAliasToNative(t))),e._Helpers.invokeAliasCallback(r,xt.nativeIdentityRequest,"Alias request sent to native sdk");else{e.Logger.verbose(Ht.InformationMessages.StartingAliasRequest+": "+t.sourceMpid+" -> "+t.destinationMpid);var i=e._Identity.IdentityRequest.createAliasNetworkRequest(t);e._IdentityAPIClient.sendAliasRequest(i,r)}else e._Helpers.invokeAliasCallback(r,xt.loggingDisabledOrMissingAPIKey,Ht.InformationMessages.AbandonAliasUsers),e.Logger.verbose(Ht.InformationMessages.AbandonAliasUsers)},createAliasRequest:function(t,r){try{if(!r||!t)return e.Logger.error("'destinationUser' and 'sourceUser' must both be present"),null;var n=t.getFirstSeenTime();n||e.Identity.getUsers().forEach((function(e){e.getFirstSeenTime()&&(!n||e.getFirstSeenTime()<n)&&(n=e.getFirstSeenTime())}));var i=(new Date).getTime()-24*e._Store.SDKConfig.aliasMaxWindow*60*60*1e3,o=t.getLastSeenTime()||(new Date).getTime();return n<i&&(o<(n=i)&&e.Logger.warning("Source User has not been seen in the last "+e._Store.SDKConfig.maxAliasWindow+" days, Alias Request will likely fail")),{destinationMpid:r.getMPID(),sourceMpid:t.getMPID(),startTime:n,endTime:o}}catch(r){return e.Logger.error("There was a problem with creating an alias request: "+r),null}}},this.mParticleUser=function(t,r){var n=this;return{getUserIdentities:function(){var r={},n=e._Persistence.getUserIdentities(t);for(var i in n)n.hasOwnProperty(i)&&(r[h.IdentityType.getIdentityName(e._Helpers.parseNumber(i))]=n[i]);return{userIdentities:r}},getMPID:function(){return t},setUserTag:function(t){return e._Helpers.Validators.isValidKeyValue(t)?void this.setUserAttribute(t,null):void e.Logger.error(Ht.ErrorMessages.BadKey)},removeUserTag:function(t){return e._Helpers.Validators.isValidKeyValue(t)?void this.removeUserAttribute(t):void e.Logger.error(Ht.ErrorMessages.BadKey)},setUserAttribute:function(r,i){var o,s,a,c;if(e._SessionManager.resetSessionTimer(),e._Helpers.canLog()){if(!e._Helpers.Validators.isValidAttributeValue(i))return void e.Logger.error(Ht.ErrorMessages.BadAttribute);if(!e._Helpers.Validators.isValidKeyValue(r))return void e.Logger.error(Ht.ErrorMessages.BadKey);if(e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(y.NativeSdkPaths.SetUserAttribute,JSON.stringify({key:r,value:i}));else{o=e._Persistence.getPersistence(),s=this.getAllUserAttributes();var u=e._Helpers.findKeyInObject(s,r);u?(c=!1,a=s[u],delete s[u]):c=!0,s[r]=i,o&&o[t]&&(o[t].ua=s,e._Persistence.savePersistence(o,t)),n.sendUserAttributeChangeEvent(r,i,a,c,!1,this),e._Forwarders.initForwarders(n.IdentityAPI.getCurrentUser().getUserIdentities(),e._APIClient.prepareForwardingStats),e._Forwarders.handleForwarderUserAttributes("setUserAttribute",r,i)}}},setUserAttributes:function(t){if(e._SessionManager.resetSessionTimer(),e._Helpers.isObject(t)){if(e._Helpers.canLog())for(var r in t)t.hasOwnProperty(r)&&this.setUserAttribute(r,t[r])}else e.Logger.error("Must pass an object into setUserAttributes. You passed a "+s(t))},removeUserAttribute:function(r){var i,o;if(e._SessionManager.resetSessionTimer(),e._Helpers.Validators.isValidKeyValue(r))if(e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(y.NativeSdkPaths.RemoveUserAttribute,JSON.stringify({key:r,value:null}));else{i=e._Persistence.getPersistence(),o=this.getAllUserAttributes();var s=e._Helpers.findKeyInObject(o,r);s&&(r=s);var a=o[r]?o[r].toString():null;delete o[r],i&&i[t]&&(i[t].ua=o,e._Persistence.savePersistence(i,t)),n.sendUserAttributeChangeEvent(r,null,a,!1,!0,this),e._Forwarders.initForwarders(n.IdentityAPI.getCurrentUser().getUserIdentities(),e._APIClient.prepareForwardingStats),e._Forwarders.handleForwarderUserAttributes("removeUserAttribute",r,null)}else e.Logger.error(Ht.ErrorMessages.BadKey)},setUserAttributeList:function(r,i){var o,a,c,u,d;if(e._SessionManager.resetSessionTimer(),e._Helpers.Validators.isValidKeyValue(r))if(Array.isArray(i)){var l=i.slice();if(e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(y.NativeSdkPaths.SetUserAttributeList,JSON.stringify({key:r,value:l}));else{o=e._Persistence.getPersistence(),a=this.getAllUserAttributes();var g=e._Helpers.findKeyInObject(a,r);if(g?(u=!1,c=a[g],delete a[g]):u=!0,a[r]=l,o&&o[t]&&(o[t].ua=a,e._Persistence.savePersistence(o,t)),c&&Array.isArray(c)){if(i.length!==c.length)d=!0;else for(var p=0;p<i.length;p++)if(c[p]!==i[p]){d=!0;break}}else d=!0;d&&n.sendUserAttributeChangeEvent(r,i,c,u,!1,this),e._Forwarders.initForwarders(n.IdentityAPI.getCurrentUser().getUserIdentities(),e._APIClient.prepareForwardingStats),e._Forwarders.handleForwarderUserAttributes("setUserAttribute",r,l)}}else e.Logger.error("The value you passed in to setUserAttributeList must be an array. You passed in a "+("undefined"==typeof value?"undefined":s(value)));else e.Logger.error(Ht.ErrorMessages.BadKey)},removeAllUserAttributes:function(){var t;if(e._SessionManager.resetSessionTimer(),e._Store.webviewBridgeEnabled)e._NativeSdkHelpers.sendToNative(y.NativeSdkPaths.RemoveAllUserAttributes);else if(t=this.getAllUserAttributes(),e._Forwarders.initForwarders(n.IdentityAPI.getCurrentUser().getUserIdentities(),e._APIClient.prepareForwardingStats),t)for(var r in t)t.hasOwnProperty(r)&&e._Forwarders.handleForwarderUserAttributes("removeUserAttribute",r,null),this.removeUserAttribute(r)},getUserAttributesLists:function(){var e,t={};for(var r in e=this.getAllUserAttributes())e.hasOwnProperty(r)&&Array.isArray(e[r])&&(t[r]=e[r].slice());return t},getAllUserAttributes:function(){var r={},n=e._Persistence.getAllUserAttributes(t);if(n)for(var i in n)n.hasOwnProperty(i)&&(r[i]=Array.isArray(n[i])?n[i].slice():n[i]);return r},getCart:function(){return e.Logger.warning("Deprecated function Identity.getCurrentUser().getCart() will be removed in future releases"),n.mParticleUserCart(t)},getConsentState:function(){return e._Persistence.getConsentState(t)},setConsentState:function(r){e._Persistence.saveUserConsentStateToCookies(t,r),e._Forwarders.initForwarders(this.getUserIdentities().userIdentities,e._APIClient.prepareForwardingStats),e._CookieSyncManager.attemptCookieSync(null,this.getMPID())},isLoggedIn:function(){return r},getLastSeenTime:function(){return e._Persistence.getLastSeenTime(t)},getFirstSeenTime:function(){return e._Persistence.getFirstSeenTime(t)},getUserAudiences:function(r){return e._Helpers.getFeatureFlag(Kt.AudienceAPI)?(null===n.audienceManager&&(n.audienceManager=new Vt(e._Store.SDKConfig.userAudienceUrl,e._Store.devToken,e.Logger,t)),void n.audienceManager.sendGetUserAudienceRequest(t,r)):void e.Logger.error(jt.AudienceAPINotEnabled)}}},this.mParticleUserCart=function(t){return{add:function(r,n){var i,o,s;e.Logger.warning("Deprecated function Identity.getCurrentUser().getCart().add() will be removed in future releases"),(s=Array.isArray(r)?r.slice():[r]).forEach((function(t){t.Attributes=e._Helpers.sanitizeAttributes(t.Attributes)})),e._Store.webviewBridgeEnabled?e._NativeSdkHelpers.sendToNative(y.NativeSdkPaths.AddToCart,JSON.stringify(s)):(e._SessionManager.resetSessionTimer(),o=(o=e._Persistence.getUserProductsFromLS(t)).concat(s),!0===n&&e._Events.logProductActionEvent(h.ProductActionType.AddToCart,s),o.length>e._Store.SDKConfig.maxProducts&&(e.Logger.verbose("The cart contains "+o.length+" items. Only "+e._Store.SDKConfig.maxProducts+" can currently be saved in cookies."),o=o.slice(-e._Store.SDKConfig.maxProducts)),(i=e._Persistence.getAllUserProductsFromLS())[t].cp=o,e._Persistence.setCartProducts(i))},remove:function(r,n){e.Logger.warning("Deprecated function Identity.getCurrentUser().getCart().remove() will be removed in future releases");var i,o,s=-1,a=null;e._Store.webviewBridgeEnabled?e._NativeSdkHelpers.sendToNative(y.NativeSdkPaths.RemoveFromCart,JSON.stringify(r)):(e._SessionManager.resetSessionTimer(),(o=e._Persistence.getUserProductsFromLS(t))&&(o.forEach((function(e,t){e.Sku===r.Sku&&(s=t,a=e)})),-1<s&&(o.splice(s,1),!0===n&&e._Events.logProductActionEvent(h.ProductActionType.RemoveFromCart,a))),(i=e._Persistence.getAllUserProductsFromLS())[t].cp=o,e._Persistence.setCartProducts(i))},clear:function(){var r;e.Logger.warning("Deprecated function Identity.getCurrentUser().getCart().clear() will be removed in future releases"),e._Store.webviewBridgeEnabled?e._NativeSdkHelpers.sendToNative(y.NativeSdkPaths.ClearCart):(e._SessionManager.resetSessionTimer(),(r=e._Persistence.getAllUserProductsFromLS())&&r[t]&&r[t].cp&&(r[t].cp=[],r[t].cp=[],e._Persistence.setCartProducts(r)))},getCartProducts:function(){return e.Logger.warning("Deprecated function Identity.getCurrentUser().getCart().getCartProducts() will be removed in future releases"),e._Persistence.getCartProducts(t)}}},this.parseIdentityResponse=function(r,n,i,o,s,a,c){var u,d,l,g,p=e.Identity.getUser(n),v={},m=p?p.getUserIdentities().userIdentities:{},f=e._Helpers.extend({},m);e._Store.identityCallInFlight=!1;try{if(e.Logger.verbose('Parsing "'+s+'" identity response from server'),r.responseText&&((l=JSON.parse(r.responseText)).hasOwnProperty("is_logged_in")&&(e._Store.isLoggedIn=l.is_logged_in)),(!p||p.getMPID()&&l.mpid&&l.mpid!==p.getMPID())&&(e._Store.mpid=l.mpid,p&&e._Persistence.setLastSeenTime(n),!e._Persistence.getFirstSeenTime(l.mpid)&&(d=!0),e._Persistence.setFirstSeenTime(l.mpid)),200===r.status){if(e._Helpers.getFeatureFlag(y.FeatureFlags.CacheIdentity)&&Ut(s,a,t.idCache,r,c),s===Wt)v=e._Identity.IdentityRequest.combineUserIdentities(m,o.userIdentities),e._Persistence.saveUserIdentitiesToPersistence(n,v);else{var S=t.IdentityAPI.getUser(l.mpid),_=S?S.getUserIdentities().userIdentities:{},P=e._Helpers.extend({},_);e.Logger.verbose("Successfully parsed Identity Response"),s===Bt&&p&&l.mpid===p.getMPID()&&e._Persistence.setFirstSeenTime(l.mpid),g=e._Store.currentSessionMPIDs.indexOf(l.mpid),e._Store.sessionId&&l.mpid&&n!==l.mpid&&0>g&&e._Store.currentSessionMPIDs.push(l.mpid),-1<g&&(e._Store.currentSessionMPIDs=e._Store.currentSessionMPIDs.slice(0,g).concat(e._Store.currentSessionMPIDs.slice(g+1,e._Store.currentSessionMPIDs.length)),e._Store.currentSessionMPIDs.push(l.mpid)),e._CookieSyncManager.attemptCookieSync(n,l.mpid,d),t.checkIdentitySwap(n,l.mpid,e._Store.currentSessionMPIDs),o&&o.userIdentities&&Object.keys(o.userIdentities).length&&(v=t.IdentityRequest.combineUserIdentities(_,o.userIdentities)),e._Persistence.saveUserIdentitiesToPersistence(l.mpid,v),e._Persistence.update(),e._Persistence.findPrevCookiesBasedOnUI(o),e._Store.context=l.context||e._Store.context}if(u=e.Identity.getCurrentUser(),o&&o.onUserAlias&&e._Helpers.Validators.isFunction(o.onUserAlias))try{e.Logger.warning("Deprecated function onUserAlias will be removed in future releases"),o.onUserAlias(p,u)}catch(t){e.Logger.error("There was an error with your onUserAlias function - "+t)}var b=e._Persistence.getPersistence();u&&(e._Persistence.storeDataInMemory(b,u.getMPID()),(!p||u.getMPID()!==p.getMPID()||p.isLoggedIn()!==u.isLoggedIn())&&e._Forwarders.initForwarders(u.getUserIdentities().userIdentities,e._APIClient.prepareForwardingStats),e._Forwarders.setForwarderUserIdentities(u.getUserIdentities().userIdentities),e._Forwarders.setForwarderOnIdentityComplete(u,s),e._Forwarders.setForwarderOnUserIdentified(u));var I={};for(var C in v)I[h.IdentityType.getIdentityName(e._Helpers.parseNumber(C))]=v[C];t.sendUserIdentityChangeEvent(I,s,l.mpid,s===Wt?f:P)}i?0===r.status?e._Helpers.invokeCallback(i,xt.noHttpCoverage,l||null,u):e._Helpers.invokeCallback(i,r.status,l||null,u):l&&l.errors&&l.errors.length&&e.Logger.error("Received HTTP response code of "+r.status+" - "+l.errors[0].message),e._APIClient.processQueuedEvents()}catch(t){i&&e._Helpers.invokeCallback(i,r.status,l||null),e.Logger.error("Error parsing JSON response from Identity server: "+t)}},this.sendUserIdentityChangeEvent=function(r,n,i,o){var s,a;if(i||n===Wt)for(var c in s=this.IdentityAPI.getUser(i),r)if(o[c]!==r[c]){var u=!o[c];a=t.createUserIdentityChange(c,r[c],o[c],u,s),e._APIClient.sendEventToServer(a)}},this.createUserIdentityChange=function(t,r,n,i,o){return e._ServerModel.createEventObject({messageType:h.MessageType.UserIdentityChange,userIdentityChanges:{New:{IdentityType:t,Identity:r,CreatedThisBatch:i},Old:{IdentityType:t,Identity:n,CreatedThisBatch:!1}},userInMemory:o})},this.sendUserAttributeChangeEvent=function(r,n,i,o,s,a){var c=t.createUserAttributeChange(r,n,i,o,s,a);c&&e._APIClient.sendEventToServer(c)},this.createUserAttributeChange=function(t,r,n,i,o,s){var a;return void 0===n&&(n=null),r!==n&&(a=e._ServerModel.createEventObject({messageType:h.MessageType.UserAttributeChange,userAttributeChanges:{UserAttributeName:t,New:r,Old:n,Deleted:o,IsNewAttribute:i}},s)),a}}var Gt=y.CCPAPurpose;function Yt(e){var t=this;this.isEnabledForUserConsent=function(e,t){if(!e||!e.values||!e.values.length)return!0;if(!t)return!1;var r,n={},i=t.getConsentState();if(i){var o=i.getGDPRConsentState();if(o)for(var s in o)o.hasOwnProperty(s)&&(r=Be.hashConsentPurposeConditionalForwarding("1",s),n[r]=o[s].Consented);var a=i.getCCPAConsentState();a&&(r=Be.hashConsentPurposeConditionalForwarding("2",Gt),n[r]=a.Consented)}var c=e.values.some((function(e){var t=e.consentPurpose,r=e.hasConsented;return!!n.hasOwnProperty(t)&&n[t]===r}));return e.includeOnMatch===c},this.createPrivacyConsent=function(t,r,n,i,o){return"boolean"==typeof t?r&&isNaN(r)?(e.Logger.error("Timestamp must be a valid number when constructing a Consent object."),null):n&&"string"!=typeof n?(e.Logger.error("Document must be a valid string when constructing a Consent object."),null):i&&"string"!=typeof i?(e.Logger.error("Location must be a valid string when constructing a Consent object."),null):o&&"string"!=typeof o?(e.Logger.error("Hardware ID must be a valid string when constructing a Consent object."),null):{Consented:t,Timestamp:r||Date.now(),ConsentDocument:n,Location:i,HardwareId:o}:(e.Logger.error("Consented boolean is required when constructing a Consent object."),null)},this.ConsentSerialization={toMinifiedJsonObject:function(e){var t,r={};if(e){var n=e.getGDPRConsentState();if(n)for(var i in r.gdpr={},n)if(n.hasOwnProperty(i)){var o=n[i];r.gdpr[i]={},"boolean"==typeof o.Consented&&(r.gdpr[i].c=o.Consented),"number"==typeof o.Timestamp&&(r.gdpr[i].ts=o.Timestamp),"string"==typeof o.ConsentDocument&&(r.gdpr[i].d=o.ConsentDocument),"string"==typeof o.Location&&(r.gdpr[i].l=o.Location),"string"==typeof o.HardwareId&&(r.gdpr[i].h=o.HardwareId)}var s=e.getCCPAConsentState();s&&(r.ccpa=((t={})[Gt]={},t),"boolean"==typeof s.Consented&&(r.ccpa[Gt].c=s.Consented),"number"==typeof s.Timestamp&&(r.ccpa[Gt].ts=s.Timestamp),"string"==typeof s.ConsentDocument&&(r.ccpa[Gt].d=s.ConsentDocument),"string"==typeof s.Location&&(r.ccpa[Gt].l=s.Location),"string"==typeof s.HardwareId&&(r.ccpa[Gt].h=s.HardwareId))}return r},fromMinifiedJsonObject:function(e){var r=t.createConsentState();if(e.gdpr)for(var n in e.gdpr)if(e.gdpr.hasOwnProperty(n)){var i=t.createPrivacyConsent(e.gdpr[n].c,e.gdpr[n].ts,e.gdpr[n].d,e.gdpr[n].l,e.gdpr[n].h);r.addGDPRConsentState(n,i)}if(e.ccpa&&e.ccpa.hasOwnProperty(Gt)){var o=t.createPrivacyConsent(e.ccpa[Gt].c,e.ccpa[Gt].ts,e.ccpa[Gt].d,e.ccpa[Gt].l,e.ccpa[Gt].h);r.setCCPAConsentState(o)}return r}},this.createConsentState=function(r){function n(e){if("string"!=typeof e)return null;var t=e.trim();return t.length?t.toLowerCase():null}function i(){return delete s[Gt],this}var o={},s={};if(r){var a=t.createConsentState();return a.setGDPRConsentState(r.getGDPRConsentState()),a.setCCPAConsentState(r.getCCPAConsentState()),a}return{setGDPRConsentState:function(e){if(e){if(ee(e))for(var t in o={},e)e.hasOwnProperty(t)&&this.addGDPRConsentState(t,e[t])}else o={};return this},addGDPRConsentState:function(r,i){var s=n(r);if(!s)return e.Logger.error("Purpose must be a string."),this;if(!ee(i))return e.Logger.error("Invoked with a bad or empty consent object."),this;var a=t.createPrivacyConsent(i.Consented,i.Timestamp,i.ConsentDocument,i.Location,i.HardwareId);return a&&(o[s]=a),this},setCCPAConsentState:function(r){if(!ee(r))return e.Logger.error("Invoked with a bad or empty CCPA consent object."),this;var n=t.createPrivacyConsent(r.Consented,r.Timestamp,r.ConsentDocument,r.Location,r.HardwareId);return n&&(s[Gt]=n),this},getCCPAConsentState:function(){return s[Gt]},getGDPRConsentState:function(){return Object.assign({},o)},removeGDPRConsentState:function(e){var t=n(e);return t?(delete o[t],this):this},removeCCPAState:function(){return e.Logger.warning("removeCCPAState is deprecated and will be removed in a future release; use removeCCPAConsentState instead"),i()},removeCCPAConsentState:i}}}var Xt={ScreenView:"screen_view",CustomEvent:"custom_event",Commerce:"commerce",UserAttributes:"user_attributes",UserIdentities:"user_identities",ProductAction:"product_action",PromotionAction:"promotion_action",ProductImpression:"product_impression"},$t=function(){function e(e,t){var r,n,i,o,s,a,c,u,d,l,g,p,v,m,f,h=this;if(this.dataPlanMatchLookups={},this.blockEvents=!1,this.blockEventAttributes=!1,this.blockUserAttributes=!1,this.blockUserIdentities=!1,this.kitBlockingEnabled=!1,!e||e.document){this.kitBlockingEnabled=!0,this.mpInstance=t,this.blockEvents=null===(i=null===(n=null===(r=null==e?void 0:e.document)||void 0===r?void 0:r.dtpn)||void 0===n?void 0:n.blok)||void 0===i?void 0:i.ev,this.blockEventAttributes=null===(a=null===(s=null===(o=null==e?void 0:e.document)||void 0===o?void 0:o.dtpn)||void 0===s?void 0:s.blok)||void 0===a?void 0:a.ea,this.blockUserAttributes=null===(d=null===(u=null===(c=null==e?void 0:e.document)||void 0===c?void 0:c.dtpn)||void 0===u?void 0:u.blok)||void 0===d?void 0:d.ua,this.blockUserIdentities=null===(p=null===(g=null===(l=null==e?void 0:e.document)||void 0===l?void 0:l.dtpn)||void 0===g?void 0:g.blok)||void 0===p?void 0:p.id;var y=null===(f=null===(m=null===(v=null==e?void 0:e.document)||void 0===v?void 0:v.dtpn)||void 0===m?void 0:m.vers)||void 0===f?void 0:f.version_document,S=null==y?void 0:y.data_points;if(y)try{0<(null==S?void 0:S.length)&&S.forEach((function(e){return h.addToMatchLookups(e)}))}catch(e){this.mpInstance.Logger.error("There was an issue with the data plan: "+e)}}else this.kitBlockingEnabled=!1}return e.prototype.addToMatchLookups=function(e){var t,r,n;if(e.match&&e.validator){var i=this.generateMatchKey(e.match),o=this.getPlannedProperties(e.match.type,e.validator);this.dataPlanMatchLookups[i]=o,((null===(t=null==e?void 0:e.match)||void 0===t?void 0:t.type)===Xt.ProductImpression||(null===(r=null==e?void 0:e.match)||void 0===r?void 0:r.type)===Xt.ProductAction||(null===(n=null==e?void 0:e.match)||void 0===n?void 0:n.type)===Xt.PromotionAction)&&(i=this.generateProductAttributeMatchKey(e.match),o=this.getProductProperties(e.match.type,e.validator),this.dataPlanMatchLookups[i]=o)}else this.mpInstance.Logger.warning("Data Plan Point is not valid' + ".concat(e))},e.prototype.generateMatchKey=function(e){var t=e.criteria||"";switch(e.type){case Xt.CustomEvent:var r=t;return[Xt.CustomEvent,r.custom_event_type,r.event_name].join(":");case Xt.ScreenView:return[Xt.ScreenView,"",t.screen_name].join(":");case Xt.ProductAction:case Xt.PromotionAction:case Xt.ProductImpression:return[e.type,t.action].join(":");case Xt.UserIdentities:case Xt.UserAttributes:return[e.type].join(":");default:return null}},e.prototype.generateProductAttributeMatchKey=function(e){var t=e.criteria||"";switch(e.type){case Xt.ProductAction:case Xt.PromotionAction:return[e.type,t.action,"ProductAttributes"].join(":");case Xt.ProductImpression:return[e.type,"ProductAttributes"].join(":");default:return null}},e.prototype.getPlannedProperties=function(e,t){var r,n,i,o,s,a,c,u,d,l;switch(e){case Xt.CustomEvent:case Xt.ScreenView:case Xt.ProductAction:case Xt.PromotionAction:case Xt.ProductImpression:if(d=null===(o=null===(i=null===(n=null===(r=null==t?void 0:t.definition)||void 0===r?void 0:r.properties)||void 0===n?void 0:n.data)||void 0===i?void 0:i.properties)||void 0===o?void 0:o.custom_attributes){if(!0===d.additionalProperties||void 0===d.additionalProperties)return!0;for(var g={},p=0,v=Object.keys(d.properties);p<v.length;p++)g[v[p]]=!0;return g}return!1!==(null===(c=null===(a=null===(s=null==t?void 0:t.definition)||void 0===s?void 0:s.properties)||void 0===a?void 0:a.data)||void 0===c?void 0:c.additionalProperties)||{};case Xt.UserAttributes:case Xt.UserIdentities:if(!0===(l=null===(u=null==t?void 0:t.definition)||void 0===u?void 0:u.additionalProperties)||void 0===l)return!0;g={};for(var m=t.definition.properties,f=0,h=Object.keys(m);f<h.length;f++)g[h[f]]=!0;return g;default:return null}},e.prototype.getProductProperties=function(e,t){var r,n,i,o,s,a,c,u,d,l,g,p,v,m,f,h,y,S,_,P;switch(e){case Xt.ProductImpression:if(!1===(null==(P=null===(l=null===(d=null===(u=null===(c=null===(a=null===(s=null===(o=null===(i=null===(n=null===(r=null==t?void 0:t.definition)||void 0===r?void 0:r.properties)||void 0===n?void 0:n.data)||void 0===i?void 0:i.properties)||void 0===o?void 0:o.product_impressions)||void 0===s?void 0:s.items)||void 0===a?void 0:a.properties)||void 0===c?void 0:c.products)||void 0===u?void 0:u.items)||void 0===d?void 0:d.properties)||void 0===l?void 0:l.custom_attributes)?void 0:P.additionalProperties)){for(var b={},I=0,C=Object.keys(null==P?void 0:P.properties);I<C.length;I++)b[C[I]]=!0;return b}return!0;case Xt.ProductAction:case Xt.PromotionAction:if((P=null===(_=null===(S=null===(y=null===(h=null===(f=null===(m=null===(v=null===(p=null===(g=null==t?void 0:t.definition)||void 0===g?void 0:g.properties)||void 0===p?void 0:p.data)||void 0===v?void 0:v.properties)||void 0===m?void 0:m.product_action)||void 0===f?void 0:f.properties)||void 0===h?void 0:h.products)||void 0===y?void 0:y.items)||void 0===S?void 0:S.properties)||void 0===_?void 0:_.custom_attributes)&&!1===P.additionalProperties){b={};for(var A=0,w=Object.keys(null==P?void 0:P.properties);A<w.length;A++)b[w[A]]=!0;return b}return!0;default:return null}},e.prototype.getMatchKey=function(e){switch(e.event_type){case W.EventTypeEnum.screenView:var t=e;return t.data?["screen_view","",t.data.screen_name].join(":"):null;case W.EventTypeEnum.commerceEvent:var r=e,n=[];if(r&&r.data){var i=r.data,o=i.product_action,s=i.product_impressions,a=i.promotion_action;o?(n.push(Xt.ProductAction),n.push(o.action)):a?(n.push(Xt.PromotionAction),n.push(a.action)):s&&n.push(Xt.ProductImpression)}return n.join(":");case W.EventTypeEnum.customEvent:var c=e;return c.data?["custom_event",c.data.custom_event_type,c.data.event_name].join(":"):null;default:return null}},e.prototype.getProductAttributeMatchKey=function(e){if(e.event_type===W.EventTypeEnum.commerceEvent){var t=[],r=e.data,n=r.product_action,i=r.product_impressions,o=r.promotion_action;return n?(t.push(Xt.ProductAction),t.push(n.action),t.push("ProductAttributes")):o?(t.push(Xt.PromotionAction),t.push(o.action),t.push("ProductAttributes")):i&&(t.push(Xt.ProductImpression),t.push("ProductAttributes")),t.join(":")}return null},e.prototype.createBlockedEvent=function(e){try{return e&&(e=this.transformEventAndEventAttributes(e)),e&&e.EventDataType===h.MessageType.Commerce&&(e=this.transformProductAttributes(e)),e&&(e=this.transformUserAttributes(e),e=this.transformUserIdentities(e)),e}catch(t){return e}},e.prototype.transformEventAndEventAttributes=function(e){var t=C({},e),r=be(t),n=this.getMatchKey(r),i=this.dataPlanMatchLookups[n];if(this.blockEvents&&!i)return null;if(this.blockEventAttributes){if(!0===i)return t;if(i){for(var o,s=0,a=Object.keys(t.EventAttributes);s<a.length;s++)i[o=a[s]]||delete t.EventAttributes[o];return t}return t}return t},e.prototype.transformProductAttributes=function(e){function t(e,t){t.forEach((function(t){for(var r,n=0,i=Object.keys(t.Attributes);n<i.length;n++)r=i[n],e[r]||delete t.Attributes[r]}))}var r,n=C({},e),i=be(n),o=this.getProductAttributeMatchKey(i),s=this.dataPlanMatchLookups[o];if(this.blockEvents&&!s)return null;if(this.blockEventAttributes){if(!0===s)return n;if(s){switch(e.EventCategory){case h.CommerceEventType.ProductImpression:n.ProductImpressions.forEach((function(e){t(s,null==e?void 0:e.ProductList)}));break;case h.CommerceEventType.ProductPurchase:t(s,null===(r=n.ProductAction)||void 0===r?void 0:r.ProductList);break;default:this.mpInstance.Logger.warning("Product Not Supported ")}return n}return n}return n},e.prototype.transformUserAttributes=function(e){var t=C({},e);if(this.blockUserAttributes){var r=this.dataPlanMatchLookups.user_attributes;if(this.mpInstance._Helpers.isObject(r))for(var n,i=0,o=Object.keys(t.UserAttributes);i<o.length;i++)r[n=o[i]]||delete t.UserAttributes[n]}return t},e.prototype.isAttributeKeyBlocked=function(e){if(!this.blockUserAttributes)return!1;if(this.blockUserAttributes){var t=this.dataPlanMatchLookups.user_attributes;if(!0===t)return!1;if(!t[e])return!0}return!1},e.prototype.isIdentityBlocked=function(e){if(!this.blockUserIdentities)return!1;if(!this.blockUserIdentities)return!1;var t=this.dataPlanMatchLookups.user_identities;return!0!==t&&!t[e]},e.prototype.transformUserIdentities=function(e){var t,r=this,n=C({},e);if(this.blockUserIdentities){var i=this.dataPlanMatchLookups.user_identities;this.mpInstance._Helpers.isObject(i)&&(null===(t=null==n?void 0:n.UserIdentities)||void 0===t?void 0:t.length)&&n.UserIdentities.forEach((function(e,t){var o=h.IdentityType.getIdentityName(r.mpInstance._Helpers.parseNumber(e.Type));i[o]||n.UserIdentities.splice(t,1)}))}return n},e}();function Zt(){this.getSDKConfiguration=function(e,t,r,n){var i;try{var o=n._Helpers.createXHR((function(){4===o.readyState&&(200===o.status?(t=n._Helpers.extend({},t,JSON.parse(o.responseText)),r(e,t,n),n.Logger.verbose("Successfully received configuration from server")):(r(e,t,n),n.Logger.verbose("Issue with receiving configuration from server, received HTTP Code of "+o.status)))}));i="https://"+n._Store.SDKConfig.configUrl+e+"/config?env=",i+=t.isDevelopmentMode?"1":"0";var s=t.dataPlan;s&&(s.planId&&(i=i+"&plan_id="+s.planId||""),s.planVersion&&(i=i+"&plan_version="+s.planVersion||"")),o&&(o.open("get",i),o.send(null))}catch(a){r(e,t,n),n.Logger.error("Error getting forwarder configuration from mParticle servers.")}}}var er=y.HTTPCodes,tr=y.Messages,rr=y.IdentityMethods.Modify;function nr(e){this.sendAliasRequest=function(t,r){var n;if(e.Logger.verbose(tr.InformationMessages.SendAliasHttp),n=e._Helpers.createXHR((function(){if(4===n.readyState){if(e.Logger.verbose("Received "+n.statusText+" from server"),200!==n.status&&202!==n.status&&n.responseText){var t=JSON.parse(n.responseText);if(t.hasOwnProperty("message")){var i=t.message;return void e._Helpers.invokeAliasCallback(r,n.status,i)}}e._Helpers.invokeAliasCallback(r,n.status)}})),n)try{n.open("post",e._Helpers.createServiceUrl(e._Store.SDKConfig.aliasUrl,e._Store.devToken)+"/Alias"),n.send(JSON.stringify(t))}catch(t){e._Helpers.invokeAliasCallback(r,er.noHttpCoverage,t),e.Logger.error("Error sending alias request to mParticle servers. "+t)}},this.sendIdentityRequest=function(t,r,n,i,o,s,a){var c,u;if(e.Logger.verbose(tr.InformationMessages.SendIdentityBegin),t){if(e.Logger.verbose(tr.InformationMessages.SendIdentityHttp),c=e._Helpers.createXHR((function(){4===c.readyState&&(e.Logger.verbose("Received "+c.statusText+" from server"),o(c,u,n,i,r,a,!1))})))try{e._Store.identityCallInFlight?e._Helpers.invokeCallback(n,er.activeIdentityRequest,"There is currently an Identity request processing. Please wait for this to return before requesting again"):(u=s||null,r===rr?c.open("post",e._Helpers.createServiceUrl(e._Store.SDKConfig.identityUrl)+s+"/"+r):c.open("post",e._Helpers.createServiceUrl(e._Store.SDKConfig.identityUrl)+r),c.setRequestHeader("Content-Type","application/json"),c.setRequestHeader("x-mp-key",e._Store.devToken),e._Store.identityCallInFlight=!0,c.send(JSON.stringify(t)))}catch(t){e._Store.identityCallInFlight=!1,e._Helpers.invokeCallback(n,er.noHttpCoverage,t),e.Logger.error("Error sending identity request to servers with status code "+c.status+" - "+t)}}else e.Logger.error(tr.ErrorMessages.APIRequestEmpty)}}var ir=y.Messages,or=y.HTTPCodes,sr=y.FeatureFlags.ReportBatching,ar=ir.InformationMessages.StartingInitialization;function cr(e){var t=this;this._instanceName=e,this._NativeSdkHelpers=new Ye(this),this._SessionManager=new et(this),this._Persistence=new gt(this),this._Helpers=new ze(this),this._Events=new vt(this),this._CookieSyncManager=new $e(this),this._ServerModel=new At(this),this._Ecommerce=new rt(this),this._ForwardingStatsUploader=new wt(this),this._Consent=new Yt(this),this._IdentityAPIClient=new nr(this),this._preInit={readyQueue:[],integrationDelays:{},forwarderConstructors:[]},this.IdentityType=h.IdentityType,this.EventType=h.EventType,this.CommerceEventType=h.CommerceEventType,this.PromotionType=h.PromotionActionType,this.ProductActionType=h.ProductActionType,this._Identity=new Qt(this),this.Identity=this._Identity.IdentityAPI,this.generateHash=this._Helpers.generateHash,this.getDeviceId=this._Persistence.getDeviceId,"undefined"!=typeof window&&window.mParticle&&window.mParticle.config&&window.mParticle.config.hasOwnProperty("rq")&&(this._preInit.readyQueue=window.mParticle.config.rq),this.init=function(e,t){return t||console.warn("You did not pass a config object to init(). mParticle will not initialize properly"),function(e,t,r){e.Logger=new ot(r),e._Store=new nt(r,e,t),window.mParticle.Store=e._Store,e.Logger.verbose(ar);try{e._Store.isLocalStorageAvailable=e._Persistence.determineLocalStorageAvailability(window.localStorage)}catch(t){e.Logger.warning("localStorage is not available, using cookies if available"),e._Store.isLocalStorageAvailable=!1}}(this,e,t),t?void(!t.hasOwnProperty("requestConfig")||t.requestConfig?(new Zt).getSDKConfiguration(e,t,ur,this):ur(e,t,this)):void console.error("No config available on the window, please pass a config object to mParticle.init()")},this.setLogLevel=function(e){t.Logger.setLogLevel(e)},this.reset=function(e){try{e._Persistence.resetPersistence(),e._Store&&delete e._Store}catch(e){console.error("Cannot reset mParticle",e)}},this._resetForTests=function(e,t,r){r._Store&&delete r._Store,r._Store=new nt(e,r),r._Store.isLocalStorageAvailable=r._Persistence.determineLocalStorageAvailability(window.localStorage),r._Events.stopTracking(),t||r._Persistence.resetPersistence(),r._Persistence.forwardingStatsBatches.uploadsTable={},r._Persistence.forwardingStatsBatches.forwardingStatsEventQueue=[],r._preInit={readyQueue:[],pixelConfigurations:[],integrationDelays:{},forwarderConstructors:[],isDevelopmentMode:!1}},this.ready=function(e){t.isInitialized()&&"function"==typeof e?e():t._preInit.readyQueue.push(e)},this.getEnvironment=function(){return t._Store.SDKConfig.isDevelopmentMode?h.Environment.Development:h.Environment.Production},this.getVersion=function(){return y.sdkVersion},this.setAppVersion=function(e){dr((function(){t.setAppVersion(e)}),t)||(t._Store.SDKConfig.appVersion=e,t._Persistence.update())},this.setDeviceId=function(e){dr((function(){t.setDeviceId(e)}),t)||this._Store.setDeviceId(e)},this.isInitialized=function(){return!!t._Store&&t._Store.isInitialized},this.getAppName=function(){return t._Store.SDKConfig.appName},this.setAppName=function(e){dr((function(){t.setAppName(e)}),t)||(t._Store.SDKConfig.appName=e)},this.getAppVersion=function(){return t._Store.SDKConfig.appVersion},this.stopTrackingLocation=function(){t._SessionManager.resetSessionTimer(),t._Events.stopTracking()},this.startTrackingLocation=function(e){ge(e)||t.Logger.warning("Warning: Location tracking is triggered, but not including a callback into the `startTrackingLocation` may result in events logged too quickly and not being associated with a location."),t._SessionManager.resetSessionTimer(),t._Events.startTracking(e)},this.setPosition=function(e,r){dr((function(){t.setPosition(e,r)}),t)||(t._SessionManager.resetSessionTimer(),"number"==typeof e&&"number"==typeof r?t._Store.currentPosition={lat:e,lng:r}:t.Logger.error("Position latitude and/or longitude must both be of type number"))},this.startNewSession=function(){t._SessionManager.startNewSession()},this.endSession=function(){t._SessionManager.endSession(!0)},this.logBaseEvent=function(e,r){if(!dr((function(){t.logBaseEvent(e,r)}),t))return t._SessionManager.resetSessionTimer(),"string"!=typeof e.name?void t.Logger.error(ir.ErrorMessages.EventNameInvalidType):(e.eventType||(e.eventType=h.EventType.Unknown),t._Helpers.canLog()?void t._Events.logEvent(e,r):void t.Logger.error(ir.ErrorMessages.LoggingDisabled))},this.logEvent=function(e,r,n,i,o){if(!dr((function(){t.logEvent(e,r,n,i,o)}),t))return t._SessionManager.resetSessionTimer(),"string"!=typeof e?void t.Logger.error(ir.ErrorMessages.EventNameInvalidType):(r||(r=h.EventType.Unknown),t._Helpers.isEventType(r)?t._Helpers.canLog()?void t._Events.logEvent({messageType:h.MessageType.PageEvent,name:e,data:n,eventType:r,customFlags:i},o):void t.Logger.error(ir.ErrorMessages.LoggingDisabled):void t.Logger.error("Invalid event type: "+r+", must be one of: \n"+JSON.stringify(h.EventType)))},this.logError=function(e,r){if(!dr((function(){t.logError(e,r)}),t)&&(t._SessionManager.resetSessionTimer(),e)){"string"==typeof e&&(e={message:e});var n={m:e.message?e.message:e,s:"Error",t:e.stack||null};if(r){var i=t._Helpers.sanitizeAttributes(r,n.m);for(var o in i)n[o]=i[o]}t._Events.logEvent({messageType:h.MessageType.CrashReport,name:e.name?e.name:"Error",data:n,eventType:h.EventType.Other})}},this.logLink=function(e,r,n,i){t._Events.addEventHandler("click",e,r,i,n)},this.logForm=function(e,r,n,i){t._Events.addEventHandler("submit",e,r,i,n)},this.logPageView=function(e,r,n,i){if(!dr((function(){t.logPageView(e,r,n,i)}),t)){if(t._SessionManager.resetSessionTimer(),t._Helpers.canLog()){if(t._Helpers.Validators.isStringOrNumber(e)||(e="PageView"),r){if(!t._Helpers.isObject(r))return void t.Logger.error("The attributes argument must be an object. A "+s(r)+" was entered. Please correct and retry.")}else r={hostname:window.location.hostname,title:window.document.title};if(n&&!t._Helpers.isObject(n))return void t.Logger.error("The customFlags argument must be an object. A "+s(n)+" was entered. Please correct and retry.")}t._Events.logEvent({messageType:h.MessageType.PageView,name:e,data:r,eventType:h.EventType.Unknown,customFlags:n},i)}},this.upload=function(){t._Helpers.canLog()&&(t._Store.webviewBridgeEnabled?t._NativeSdkHelpers.sendToNative(y.NativeSdkPaths.Upload):t._APIClient.uploader.prepareAndUpload(!1,!1))},this.Consent={createCCPAConsent:t._Consent.createPrivacyConsent,createGDPRConsent:t._Consent.createPrivacyConsent,createConsentState:t._Consent.createConsentState},this.eCommerce={Cart:{add:function(e,r){t.Logger.warning("Deprecated function eCommerce.Cart.add() will be removed in future releases");var n,i=t.Identity.getCurrentUser();i&&(n=i.getMPID()),t._Identity.mParticleUserCart(n).add(e,r)},remove:function(e,r){t.Logger.warning("Deprecated function eCommerce.Cart.remove() will be removed in future releases");var n,i=t.Identity.getCurrentUser();i&&(n=i.getMPID()),t._Identity.mParticleUserCart(n).remove(e,r)},clear:function(){t.Logger.warning("Deprecated function eCommerce.Cart.clear() will be removed in future releases");var e,r=t.Identity.getCurrentUser();r&&(e=r.getMPID()),t._Identity.mParticleUserCart(e).clear()}},setCurrencyCode:function(e){return dr((function(){t.eCommerce.setCurrencyCode(e)}),t)?void 0:"string"==typeof e?(t._SessionManager.resetSessionTimer(),void(t._Store.currencyCode=e)):void t.Logger.error("Code must be a string")},createProduct:function(e,r,n,i,o,s,a,c,u,d){return t._Ecommerce.createProduct(e,r,n,i,o,s,a,c,u,d)},createPromotion:function(e,r,n,i){return t._Ecommerce.createPromotion(e,r,n,i)},createImpression:function(e,r){return t._Ecommerce.createImpression(e,r)},createTransactionAttributes:function(e,r,n,i,o,s){return t._Ecommerce.createTransactionAttributes(e,r,n,i,o,s)},logCheckout:function(e,r,n,i){return t.Logger.warning("mParticle.logCheckout is deprecated, please use mParticle.logProductAction instead"),t._Store.isInitialized?(t._SessionManager.resetSessionTimer(),void t._Events.logCheckoutEvent(e,r,n,i)):void t.ready((function(){t.eCommerce.logCheckout(e,r,n,i)}))},logProductAction:function(e,r,n,i,o,s){dr((function(){t.eCommerce.logProductAction(e,r,n,i,o,s)}),t)||(t._SessionManager.resetSessionTimer(),t._Events.logProductActionEvent(e,r,n,i,o,s))},logPurchase:function(e,r,n,i,o){return t.Logger.warning("mParticle.logPurchase is deprecated, please use mParticle.logProductAction instead"),t._Store.isInitialized?e&&r?(t._SessionManager.resetSessionTimer(),void t._Events.logPurchaseEvent(e,r,i,o)):void t.Logger.error(ir.ErrorMessages.BadLogPurchase):void t.ready((function(){t.eCommerce.logPurchase(e,r,n,i,o)}))},logPromotion:function(e,r,n,i,o){dr((function(){t.eCommerce.logPromotion(e,r,n,i,o)}),t)||(t._SessionManager.resetSessionTimer(),t._Events.logPromotionEvent(e,r,n,i,o))},logImpression:function(e,r,n,i){dr((function(){t.eCommerce.logImpression(e,r,n,i)}),t)||(t._SessionManager.resetSessionTimer(),t._Events.logImpressionEvent(e,r,n,i))},logRefund:function(e,r,n,i,o){return t.Logger.warning("mParticle.logRefund is deprecated, please use mParticle.logProductAction instead"),t._Store.isInitialized?(t._SessionManager.resetSessionTimer(),void t._Events.logRefundEvent(e,r,i,o)):void t.ready((function(){t.eCommerce.logRefund(e,r,n,i,o)}))},expandCommerceEvent:function(e){return t._Ecommerce.expandCommerceEvent(e)}},this.setSessionAttribute=function(e,r){if(!dr((function(){t.setSessionAttribute(e,r)}),t)&&t._Helpers.canLog()){if(!t._Helpers.Validators.isValidAttributeValue(r))return void t.Logger.error(ir.ErrorMessages.BadAttribute);if(!t._Helpers.Validators.isValidKeyValue(e))return void t.Logger.error(ir.ErrorMessages.BadKey);if(t._Store.webviewBridgeEnabled)t._NativeSdkHelpers.sendToNative(y.NativeSdkPaths.SetSessionAttribute,JSON.stringify({key:e,value:r}));else{var n=t._Helpers.findKeyInObject(t._Store.sessionAttributes,e);n&&(e=n),t._Store.sessionAttributes[e]=r,t._Persistence.update(),t._Forwarders.applyToForwarders("setSessionAttribute",[e,r])}}},this.setOptOut=function(e){dr((function(){t.setOptOut(e)}),t)||(t._SessionManager.resetSessionTimer(),t._Store.isEnabled=!e,t._Events.logOptOut(),t._Persistence.update(),t._Store.activeForwarders.length&&t._Store.activeForwarders.forEach((function(r){if(r.setOptOut){var n=r.setOptOut(e);n&&t.Logger.verbose(n)}})))},this.setIntegrationAttribute=function(e,r){if(!dr((function(){t.setIntegrationAttribute(e,r)}),t)){if("number"!=typeof e)return void t.Logger.error("integrationId must be a number");if(null===r)t._Store.integrationAttributes[e]={};else{if(!t._Helpers.isObject(r))return void t.Logger.error("Attrs must be an object with keys and values. You entered a "+s(r));if(0===Object.keys(r).length)t._Store.integrationAttributes[e]={};else for(var n in r)"string"==typeof n?"string"==typeof r[n]?(t._Helpers.isObject(t._Store.integrationAttributes[e])||(t._Store.integrationAttributes[e]={}),t._Store.integrationAttributes[e][n]=r[n]):t.Logger.error("Values for integration attributes must be strings. You entered a "+s(r[n])):t.Logger.error("Keys must be strings, you entered a "+s(n))}t._Persistence.update()}},this.getIntegrationAttributes=function(e){return t._Store.integrationAttributes[e]?t._Store.integrationAttributes[e]:{}},this.addForwarder=function(e){t._preInit.forwarderConstructors.push(e)},this.configurePixel=function(e){t._Forwarders.configurePixel(e)},this._getActiveForwarders=function(){return t._Store.activeForwarders},this._getIntegrationDelays=function(){return t._preInit.integrationDelays},this._setIntegrationDelay=function(e,r){if(t._preInit.integrationDelays[e]=r,!0!==r){var n=Object.keys(t._preInit.integrationDelays);if(0!==n.length){var i=n.some((function(e){return!0===t._preInit.integrationDelays[e]}));i||t._APIClient.processQueuedEvents()}}},this._setWrapperSDKInfo=function(e,r){dr((function(){t._setWrapperSDKInfo(e,r)}),t)||(void 0===t._Store.wrapperSDKInfo||!t._Store.wrapperSDKInfo.isInfoSet)&&(t._Store.wrapperSDKInfo={name:e,version:r,isInfoSet:!0})}}function ur(e,t,r){var n=function(e,t){var r,n,i,o;return e.dataPlanOptions&&(t.Logger.verbose("Customer provided data plan found"),o=e.dataPlanOptions,n={document:{dtpn:{vers:o.dataPlanVersion,blok:{ev:o.blockEvents,ea:o.blockEventAttributes,ua:o.blockUserAttributes,id:o.blockUserIdentities}}}}),n||(e.dataPlan&&e.dataPlan.document?e.dataPlan.document.error_message?i=e.dataPlan.document.error_message:(t.Logger.verbose("Data plan found from mParticle.js"),n=e.dataPlan):e.dataPlanResult&&(e.dataPlanResult.error_message?i=e.dataPlanResult.error_message:(t.Logger.verbose("Data plan found from /config"),n={document:e.dataPlanResult}))),i&&t.Logger.error(i),n&&(r=new $t(n,t)),r}(t,r);if(r._APIClient=new Ke(r,n),r._Forwarders=new Pt(r,n),r._Store.processConfig(t),r._Identity.idCache=function(e){return new Ne("".concat(e._Store.storageName,"-id-cache"),{logger:e.Logger})}(r),Ft(r._Identity.idCache),r._Store.webviewBridgeEnabled)r._NativeSdkHelpers.initializeSessionAttributes(e);else{r._Persistence.initializeStorage();var i=r.Identity.getCurrentUser(),o=i?i.getMPID():null,s=i?i.getUserIdentities().userIdentities:{};r._Store.SDKConfig.identifyRequest=r._Store.hasInvalidIdentifyRequest()?{userIdentities:s}:r._Store.SDKConfig.identifyRequest,r._Helpers.getFeatureFlag(sr)&&r._ForwardingStatsUploader.startForwardingStatsTimer(),r._Forwarders.processForwarders(t,r._APIClient.prepareForwardingStats),r._Forwarders.processPixelConfigs(t),r._SessionManager.initialize(),r._Events.logAST(),function(e,t,r,n){!e._Store.identifyCalled&&e._Store.SDKConfig.identityCallback&&t&&r&&e._Store.SDKConfig.identityCallback({httpCode:or.activeSession,getUser:function(){return e._Identity.mParticleUser(r)},getPreviousUser:function(){var t=e.Identity.getUsers(),n=t.shift(),i=n.getMPID();return n&&i===r&&(n=t.shift()),n||null},body:{mpid:r,is_logged_in:e._Store.isLoggedIn,matched_identities:n,context:null,is_ephemeral:!1}})}(r,i,o,s)}r._Store.isInitialized=!0;try{r._preInit.readyQueue=function(e){if(!fe(e))return e.forEach((function(e){ge(e)?e():Array.isArray(e)&&function(e){var t=e,r=t.splice(0,1)[0];if(mParticle[t[0]])mParticle[r].apply(this,t);else{var n=r.split(".");try{for(var i=mParticle,o=0;o<n.length;o++)i=i[n[o]];i.apply(this,t)}catch(e){throw new Error("Unable to compute proper mParticle function "+e)}}}(e)})),[]}(r._preInit.readyQueue)}catch(e){r.Logger.error(e)}r._Store.isFirstRun&&(r._Store.isFirstRun=!1)}function dr(e,t){return!t.isInitialized()&&(t.ready((function(){e()})),!0)}var lr,gr,pr,vr=function(){return null},mr=function(){function e(){}return e.prototype.getMPInstance=function(){return{_Helpers:{sanitizeAttributes:window.mParticle.getInstance()._Helpers.sanitizeAttributes,generateHash:function(){return"mockHash"},generateUniqueId:function(){return"mockId"},extend:window.mParticle.getInstance()._Helpers.extend,createServiceUrl:vr,parseNumber:vr,isObject:vr,Validators:null},_resetForTests:vr,_APIClient:null,MPSideloadedKit:null,_Consent:null,_Events:null,_Forwarders:null,_NativeSdkHelpers:null,_Persistence:null,_preInit:null,Consent:null,_ServerModel:null,_SessionManager:null,_Store:{sessionId:"mockSessionId",sideloadedKits:[],devToken:"test_dev_token",isFirstRun:!0,isEnabled:!0,sessionAttributes:{},currentSessionMPIDs:[],consentState:null,clientId:null,deviceId:null,serverSettings:{},dateLastEventSent:null,sessionStartDate:null,currentPosition:null,isTracking:!1,watchPositionId:null,cartProducts:[],eventQueue:[],currencyCode:null,globalTimer:null,context:null,configurationLoaded:!1,identityCallInFlight:!1,nonCurrentUserMPIDs:{},identifyCalled:!1,isLoggedIn:!1,cookieSyncDates:{},integrationAttributes:{},requireDelay:!0,isLocalStorageAvailable:null,integrationDelayTimeoutStart:null,storageName:null,prodStorageName:null,activeForwarders:[],kits:{},configuredForwarders:[],pixelConfigurations:[],wrapperSDKInfo:{name:"none",version:null,isInfoSet:!1},SDKConfig:{isDevelopmentMode:!1,onCreateBatch:vr}},config:null,eCommerce:null,Identity:{getCurrentUser:vr,IdentityAPI:{},identify:vr,login:vr,logout:vr,modify:vr},Logger:{verbose:vr,error:vr,warning:vr},ProductActionType:null,ServerModel:null,addForwarder:vr,generateHash:vr,getAppVersion:vr,getAppName:vr,getInstance:vr,getDeviceId:vr,init:vr,logBaseEvent:vr,logEvent:vr,logLevel:"none",setPosition:vr,upload:vr}},e.prototype.createSDKEventFunction=function(e){return new At(this.getMPInstance()).createEventObject(e)},e.prototype.returnBatch=function(e){var t=this,r=this.getMPInstance();return he("0",Array.isArray(e)?e.map((function(e){return t.createSDKEventFunction(e)})):[this.createSDKEventFunction(e)],r)},e}();!function(e){e[e.Unknown=0]="Unknown",e[e.Navigation=1]="Navigation",e[e.Location=2]="Location",e[e.Search=3]="Search",e[e.Transaction=4]="Transaction",e[e.UserContent=5]="UserContent",e[e.UserPreference=6]="UserPreference",e[e.Social=7]="Social",e[e.Other=8]="Other",e[e.Media=9]="Media"}(lr||(lr={})),function(e){e[e.SessionStart=1]="SessionStart",e[e.SessionEnd=2]="SessionEnd",e[e.PageView=3]="PageView",e[e.PageEvent=4]="PageEvent",e[e.CrashReport=5]="CrashReport",e[e.OptOut=6]="OptOut",e[e.AppStateTransition=10]="AppStateTransition",e[e.Profile=14]="Profile",e[e.Commerce=16]="Commerce",e[e.UserAttributeChange=17]="UserAttributeChange",e[e.UserIdentityChange=18]="UserIdentityChange",e[e.Media=20]="Media"}(gr||(gr={})),function(e){e[e.Other=0]="Other",e[e.CustomerId=1]="CustomerId",e[e.Facebook=2]="Facebook",e[e.Twitter=3]="Twitter",e[e.Google=4]="Google",e[e.Microsoft=5]="Microsoft",e[e.Yahoo=6]="Yahoo",e[e.Email=7]="Email",e[e.FacebookCustomAudienceId=9]="FacebookCustomAudienceId",e[e.Other2=10]="Other2",e[e.Other3=11]="Other3",e[e.Other4=12]="Other4",e[e.Other5=13]="Other5",e[e.Other6=14]="Other6",e[e.Other7=15]="Other7",e[e.Other8=16]="Other8",e[e.Other9=17]="Other9",e[e.Other10=18]="Other10",e[e.MobileNumber=19]="MobileNumber",e[e.PhoneNumber2=20]="PhoneNumber2",e[e.PhoneNumber3=21]="PhoneNumber3"}(pr||(pr={}));var fr=function(){function e(e){this.filterDictionary={eventTypeFilters:[],eventNameFilters:[],screenNameFilters:[],screenAttributeFilters:[],userIdentityFilters:[],userAttributeFilters:[],attributeFilters:[],consentRegulationFilters:[],consentRegulationPurposeFilters:[],messageTypeFilters:[],messageTypeStateFilters:[],filteringEventAttributeValue:{},filteringUserAttributeValue:{},filteringConsentRuleValues:{}},this.kitInstance=e}return e.prototype.addEventTypeFilter=function(e){var t=Be.hashEventType(e);this.filterDictionary.eventTypeFilters.push(t)},e.prototype.addEventNameFilter=function(e,t){var r=Be.hashEventName(t,e);this.filterDictionary.eventNameFilters.push(r)},e.prototype.addEventAttributeFilter=function(e,t,r){var n=Be.hashEventAttributeKey(e,t,r);this.filterDictionary.attributeFilters.push(n)},e.prototype.addScreenNameFilter=function(e){var t=Be.hashEventName(e,lr.Unknown);this.filterDictionary.screenNameFilters.push(t)},e.prototype.addScreenAttributeFilter=function(e,t){var r=Be.hashEventAttributeKey(lr.Unknown,e,t);this.filterDictionary.screenAttributeFilters.push(r)},e.prototype.addUserIdentityFilter=function(e){var t=Be.hashUserIdentity(e);this.filterDictionary.userIdentityFilters.push(t)},e.prototype.addUserAttributeFilter=function(e){var t=Be.hashUserAttribute(e);this.filterDictionary.userAttributeFilters.push(t)},e}();Array.prototype.forEach||(Array.prototype.forEach=o.forEach),Array.prototype.map||(Array.prototype.map=o.map),Array.prototype.filter||(Array.prototype.filter=o.filter),Array.isArray||(Array.prototype.isArray=o.isArray);var hr=new function(){var e=this;this.Store={},this._instances={},this.IdentityType=h.IdentityType,this.EventType=h.EventType,this.CommerceEventType=h.CommerceEventType,this.PromotionType=h.PromotionActionType,this.ProductActionType=h.ProductActionType,this.MPSideloadedKit=fr,"undefined"!=typeof window&&(this.isIOS=!(!window.mParticle||!window.mParticle.isIOS)&&window.mParticle.isIOS,this.config=window.mParticle&&window.mParticle.config?window.mParticle.config:{}),this.init=function(t,r,n){!r&&window.mParticle&&window.mParticle.config&&(console.warn("You did not pass a config object to mParticle.init(). Attempting to use the window.mParticle.config if it exists. Please note that in a future release, this may not work and mParticle will not initialize properly"),r=window.mParticle?window.mParticle.config:{}),n=(n&&0!==n.length?n:y.DefaultInstance).toLowerCase();var i=e._instances[n];void 0===i&&(i=new cr(t),e._instances[n]=i),i.init(t,r,n)},this.getInstance=function(t){var r;return t?(r=e._instances[t.toLowerCase()])||(console.log("You tried to initialize an instance named "+t+". This instance does not exist. Check your instance name or initialize a new instance with this name before calling it."),null):(t=y.DefaultInstance,(r=e._instances[t])||(r=new cr(t),e._instances[y.DefaultInstance]=r),r)},this.getDeviceId=function(){return e.getInstance().getDeviceId()},this.setDeviceId=function(t){return e.getInstance().setDeviceId(t)},this.isInitialized=function(){return e.getInstance().isInitialized()},this.startNewSession=function(){e.getInstance().startNewSession()},this.endSession=function(){e.getInstance().endSession()},this.setLogLevel=function(t){e.getInstance().setLogLevel(t)},this.ready=function(t){e.getInstance().ready(t)},this.setAppVersion=function(t){e.getInstance().setAppVersion(t)},this.getAppName=function(){return e.getInstance().getAppName()},this.setAppName=function(t){e.getInstance().setAppName(t)},this.getAppVersion=function(){return e.getInstance().getAppVersion()},this.getEnvironment=function(){return e.getInstance().getEnvironment()},this.stopTrackingLocation=function(){e.getInstance().stopTrackingLocation()},this.startTrackingLocation=function(t){e.getInstance().startTrackingLocation(t)},this.setPosition=function(t,r){e.getInstance().setPosition(t,r)},this.startNewSession=function(){e.getInstance().startNewSession()},this.endSession=function(){e.getInstance().endSession()},this.logBaseEvent=function(t,r){e.getInstance().logBaseEvent(t,r)},this.logEvent=function(t,r,n,i,o){e.getInstance().logEvent(t,r,n,i,o)},this.logError=function(t,r){e.getInstance().logError(t,r)},this.logLink=function(t,r,n,i){e.getInstance().logLink(t,r,n,i)},this.logForm=function(t,r,n,i){e.getInstance().logForm(t,r,n,i)},this.logPageView=function(t,r,n,i){e.getInstance().logPageView(t,r,n,i)},this.upload=function(){e.getInstance().upload()},this.eCommerce={Cart:{add:function(t,r){e.getInstance().eCommerce.Cart.add(t,r)},remove:function(t,r){e.getInstance().eCommerce.Cart.remove(t,r)},clear:function(){e.getInstance().eCommerce.Cart.clear()}},setCurrencyCode:function(t){e.getInstance().eCommerce.setCurrencyCode(t)},createProduct:function(t,r,n,i,o,s,a,c,u,d){return e.getInstance().eCommerce.createProduct(t,r,n,i,o,s,a,c,u,d)},createPromotion:function(t,r,n,i){return e.getInstance().eCommerce.createPromotion(t,r,n,i)},createImpression:function(t,r){return e.getInstance().eCommerce.createImpression(t,r)},createTransactionAttributes:function(t,r,n,i,o,s){return e.getInstance().eCommerce.createTransactionAttributes(t,r,n,i,o,s)},logCheckout:function(t,r,n,i){e.getInstance().eCommerce.logCheckout(t,r,n,i)},logProductAction:function(t,r,n,i,o,s){e.getInstance().eCommerce.logProductAction(t,r,n,i,o,s)},logPurchase:function(t,r,n,i,o){e.getInstance().eCommerce.logPurchase(t,r,n,i,o)},logPromotion:function(t,r,n,i,o){e.getInstance().eCommerce.logPromotion(t,r,n,i,o)},logImpression:function(t,r,n,i){e.getInstance().eCommerce.logImpression(t,r,n,i)},logRefund:function(t,r,n,i,o){e.getInstance().eCommerce.logRefund(t,r,n,i,o)},expandCommerceEvent:function(t){return e.getInstance().eCommerce.expandCommerceEvent(t)}},this.setSessionAttribute=function(t,r){e.getInstance().setSessionAttribute(t,r)},this.setOptOut=function(t){e.getInstance().setOptOut(t)},this.setIntegrationAttribute=function(t,r){e.getInstance().setIntegrationAttribute(t,r)},this.getIntegrationAttributes=function(t){return e.getInstance().getIntegrationAttributes(t)},this.Identity={HTTPCodes:y.HTTPCodes,aliasUsers:function(t,r){e.getInstance().Identity.aliasUsers(t,r)},createAliasRequest:function(t,r){return e.getInstance().Identity.createAliasRequest(t,r)},getCurrentUser:function(){return e.getInstance().Identity.getCurrentUser()},getUser:function(t){return e.getInstance().Identity.getUser(t)},getUsers:function(){return e.getInstance().Identity.getUsers()},identify:function(t,r){e.getInstance().Identity.identify(t,r)},login:function(t,r){e.getInstance().Identity.login(t,r)},logout:function(t,r){e.getInstance().Identity.logout(t,r)},modify:function(t,r){e.getInstance().Identity.modify(t,r)}},this.sessionManager={getSession:function(){return e.getInstance()._SessionManager.getSession()}},this.Consent={createConsentState:function(){return e.getInstance().Consent.createConsentState()},createGDPRConsent:function(t,r,n,i,o){return e.getInstance().Consent.createGDPRConsent(t,r,n,i,o)},createCCPAConsent:function(t,r,n,i,o){return e.getInstance().Consent.createGDPRConsent(t,r,n,i,o)}},this.reset=function(){e.getInstance().reset(e.getInstance())},this._resetForTests=function(t,r){"boolean"==typeof r?e.getInstance()._resetForTests(t,r,e.getInstance()):e.getInstance()._resetForTests(t,!1,e.getInstance())},this.configurePixel=function(t){e.getInstance().configurePixel(t)},this._setIntegrationDelay=function(t,r){e.getInstance()._setIntegrationDelay(t,r)},this._getIntegrationDelays=function(){return e.getInstance()._getIntegrationDelays()},this.getVersion=function(){return e.getInstance().getVersion()},this.generateHash=function(t){return e.getInstance().generateHash(t)},this.addForwarder=function(t){e.getInstance().addForwarder(t)},this._getActiveForwarders=function(){return e.getInstance()._getActiveForwarders()},this._setWrapperSDKInfo=function(t,r){e.getInstance()._setWrapperSDKInfo(t,r)}};"undefined"!=typeof window&&(window.mParticle=hr,window.mParticle._BatchValidator=new mr)}}]); //# sourceMappingURL=vendors~HomePage~mparticle_web-sdk-9c57af.js.map