!function(e){"use strict";function t(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);od[e]}setUseNativeDeclaration(e){this.useNativeDeclaration=e}setLogLevel(e){this.logLevel=e}setInitTimeout(e){this.initTimeout=e}setMode(e){this.mode=e}setMaxEventSize(e){this.maxEventSize=e}getMaxEventSize(){return this.maxEventSize}};class u extends Error{constructor(e,t){super(e),this.timestamp=Date.now(),this.code=t,this.message=e,"ERROR"!==c.logLevel&&"DEBUG"!==c.logLevel||console.error(this)}toJSON(){return this.valueOf()}toString(){return JSON.stringify(this.valueOf())}valueOf(){return{code:this.code,message:this.message,stack:this.stack,timestamp:this.timestamp}}}var v;!function(e){e.ANDROID="android",e.IOS="ios",e.UNKNOWN="N/A"}(v||(v={}));const p=e=>{var t;const n=/([a-z0-9.]+)/gi,i=Object.create(null),o=["vendor","platform","platformVersion","versionCode","versionNumber"];for(const r of o){const o=(null===(t=n.exec(e))||void 0===t?void 0:t[1])||"";switch(r){case"platform":/ios/.test(o)?i.platform=v.IOS:/android/.test(o)?i.platform=v.ANDROID:i.platform=v.UNKNOWN;break;case"versionCode":case"platformVersion":Object.assign(i,{[r]:Number(o||v.UNKNOWN)});break;default:Object.assign(i,{[r]:o||v.UNKNOWN})}}return i.featureFlags=Object.setPrototypeOf([],null),Object.freeze(i.featureFlags),Object.freeze(i)},g=l?p(window.navigator.userAgent):{featureFlags:[],platform:v.UNKNOWN,platformVersion:v.UNKNOWN,vendor:v.UNKNOWN,versionCode:v.UNKNOWN,versionNumber:v.UNKNOWN},h=v,f=()=>l&&window.AerWebView,w=e=>{try{g.platform===h.IOS&&window.webkit.messageHandlers.AerWebViewBridge.postMessage(e),g.platform===h.ANDROID&&window.AerWebViewBridge.postMessage(e)}catch(e){console.error(e)}};class _{constructor(){if(this.eventsMap=new Map,this.eventsBeforeInitQueue=[],this.isReady=!1,this.isReadinessChecked=!1,c.useNativeDeclaration&&f())return f();this.incomingEventListener=this.incomingEventListener.bind(this),l&&window.addEventListener("message",this.incomingEventListener)}setIsReady(e){this.isReady=e,this.isReadinessChecked=!0}static createRejectableFn(e,t){return n=>{n?e():t()}}flush(){this.eventsBeforeInitQueue.forEach((e=>{e(this.isReady)}))}checkIfSizeNotOverlapping(){return this.eventsMap.size>=c.maxEventSize}call(e){return"DEBUG"===c.logLevel&&console.log(e),new Promise((t=>{if(this.checkIfSizeNotOverlapping())t({data:null,error:new u(String(this.eventsMap.size),s.EXCEED_EVENT_MAX_LIMIT)});else if(l){this.eventsMap.set(e.tag,t);try{if(this.isReady||c.canPassWithoutBridgeBeingReady(e.type)||"LOOSE"===c.mode)w(_.toJSON(e));else{const n=()=>w(_.toJSON(e)),i=()=>{this.eventsMap.delete(e.tag),t({data:null,error:new u("failed to open bridge",s.BRIDGE_IS_NOT_AVAILABLE)})};if(this.isReadinessChecked&&!this.isReady&&"STRICT"===c.mode)return void i();this.eventsBeforeInitQueue.push(_.createRejectableFn(n,i))}}catch(n){this.eventsMap.delete(e.tag),t({data:null,error:new u((null==n?void 0:n.message)||"unknown",s.FAILED_TO_SEND)})}}else t({data:null,error:new u("",s.NOT_IN_BROWSER)})}))}incomingEventListener(e){var t,n;let i;try{i=_.fromJSON(e.data)}catch(e){return void("DEBUG"===c.logLevel&&console.error(e))}if(_.shouldProcessEvent(i)&&("DEBUG"===c.logLevel&&console.log(i),i.source===a.NATIVE&&this.eventsMap.has(i.tag))){const e=this.eventsMap.get(i.tag);this.eventsMap.delete(i.tag),e({data:null===(t=i.payload)||void 0===t?void 0:t.data,error:_.processErrorCases(null===(n=i.payload)||void 0===n?void 0:n.error)})}}static toJSON(e){try{return JSON.stringify(e)}catch(e){throw new u((null==e?void 0:e.message)||"unknown",s.EVENT_JSON_STRINGIFY_FAILURE)}}static fromJSON(e){try{return JSON.parse(e)}catch(e){throw new u((null==e?void 0:e.message)||"unknown",s.EVENT_JSON_PARSE_FAILURE)}}static shouldProcessEvent(e){return(null==e?void 0:e.source)===a.NATIVE}cancel(e,t){if(!this.eventsMap.has(e))return!1;const n=this.eventsMap.get(e);return this.eventsMap.delete(e),n({data:null,error:new u("cancelled",t||s.EVENT_CANCELLED)}),!0}static processErrorCases(e){if(!e)return null;switch(e){case s.UNKNOWN_EVENT_TYPE:return new u("the unrecognized event type",s.UNKNOWN_EVENT_TYPE);case s.EVENT_INVALID_PAYLOAD:return new u("invalid payload",s.EVENT_INVALID_PAYLOAD);default:return new u(e,s.EVENT_PROCESSING_FAILURE)}}}const E=new _,m=()=>"undefined"!=typeof window&&void 0!==(null===window||void 0===window?void 0:window.crypto.getRandomValues)?window.crypto.getRandomValues(new Uint32Array(1))[0]:Number(String(Math.random()).split(".")[1]);function I(e){return t=>{const n={tag:m(),payload:t,source:a.WEBVIEW,type:e,origin:t.origin||"*"};return E.call(n)}}new class{constructor(){this.listenersMap=new Map,this.listenNativeMessages=this.listenNativeMessages.bind(this),l&&window.addEventListener("message",this.listenNativeMessages)}listen(e,t){var n;const i=m();if(this.listenersMap.has(e))null===(n=this.listenersMap.get(e))||void 0===n||n.set(i,t);else{const n=new Map;this.listenersMap.set(e,n),n.set(i,t)}return i}unListen(e,t){var n;this.listenersMap.has(e)&&(null===(n=this.listenersMap.get(e))||void 0===n||n.delete(t))}invoke(e){const{type:t,payload:n}=e;if(t!==i.INVOKE_FROM_NATIVE)return;if(!this.listenersMap.has(n.listenerType))return;const o=this.listenersMap.get(n.listenerType);if(o)for(const e of Array.from(o.values()))e({data:n.data,error:n.error})}listenNativeMessages(e){let t;try{t=_.fromJSON(e.data)}catch(e){return}_.shouldProcessEvent(t)&&this.invoke({payload:t.payload,type:t.type})}};let y=3;const O=()=>{const e="DEBUG"===c.logLevel;if(E.isReady)return void(e&&console.log("init: already ready"));e&&console.log("init: start");const[t]=((e,t,n=1e6)=>{const i=m(),o=()=>E.cancel(i,s.EVENT_TIMEOUT_EXCEEDED),r=setTimeout((()=>{1e6!==n&&o()}),n);return[new Promise((n=>{E.call({type:e,tag:i,payload:t,source:a.WEBVIEW}).then((e=>{clearTimeout(r),n(e)}))})),o]})(o.PING,{},c.initTimeout);t.then((t=>{var n;const i=!!(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.success);if(!i&&y>0)return y--,O(),void(e&&console.log("init: retrying %s",3-y));E.setIsReady(i),E.flush(),e&&console.log("init: got result",JSON.stringify(t))}))},N=I(o.PING),T=I(o.LOGIN),P=I(o.SHARE),A=I(o.SET_PROGRESS_VISIBILITY),L=I(o.SET_TOOLBAR_CONFIG),b=I(o.JWT_AUTH),S=I(o.GEOLOCATION),C=I(o.CLIPBOARD_COPY),R=I(o.CALL_PHONE),D=I(o.TOKEN_PAY_CHECK),k=I(o.TOKEN_PAY),V=I(o.APP_INFO),x=I(o.OPEN_URL),U=I(o.DISMISS),j=I(o.SEND_MIXER_EVENT),M=I(o.SELECT_PICK_UP_POINT),B=I(o.UPDATE_PASSPORT_DATA),F=I(o.UT_TRACK_EVENT),W=I(o.SET_PAGE_VIEW_EVENT_PARAMETERS),G=I(o.ON_BACK_PRESSED),z=I(o.GET_APP_LOCAL_ANALYTICS_STATE),K=I(o.LOCAL_ANALYTICS_WEB_PAGE_VIEW),Y=I(o.SESSION_VERIFY);var J=Object.freeze({__proto__:null,ping:N,login:T,share:P,setProgressVisibility:A,setToolbarConfig:L,getJwtAuthToken:b,geolocation:S,copy:C,phoneCall:R,checkTokenPay:D,tokenPay:k,appInfo:V,openUrl:x,dismiss:U,sendMixer:j,selectPickUpPoint:M,updatePassportData:B,sendUtTrack:F,setPVParams:W,onBackPressed:G,getAppLocalAnalyticsState:z,saveTrackerData:K,sendSessionVerifyResult:Y});const $="a_t_info",H="a_r_t_info",X="aer_console_host",Q="aerConsoleButtonId",q="Network initialize error",Z="product",ee="page",te="page_view";const ne=new class{constructor(){this.internalIsWebView=!1,this.internalIsGCP=!1,this.internalPageData={},this.internalExcludeFieldsConfig=null,this.internalPlatform="empty",this.internalIsIosWv=!1,this.internalAerConsoleUrl="",this.internalTrackerLogData={},this.internalIsInitialized=!1}set pageData(e){this.internalPageData=e}get pageData(){return this.internalPageData}set excludeFieldsConfig(e){this.internalExcludeFieldsConfig=e}get excludeFieldsConfig(){return this.internalExcludeFieldsConfig}set isWebView(e){this.internalIsWebView=e}get isWebView(){return this.internalIsWebView}set isGCP(e){this.internalIsGCP=e}get isGCP(){return this.internalIsGCP}set platform(e){this.internalPlatform=e}get platform(){return this.internalIsWebView?"webview":this.internalPlatform}set isIosWv(e){this.internalIsIosWv=e}get isIosWv(){return this.internalIsIosWv}get aerConsoleUrl(){return this.internalAerConsoleUrl}set aerConsoleUrl(e){this.internalAerConsoleUrl=e}set trackerLogData(e){this.internalTrackerLogData=Object.assign({},e)}get trackerLogData(){return this.internalTrackerLogData}set isInitialized(e){this.internalIsInitialized=e}get isInitialized(){return this.internalIsInitialized}},ie=e=>{var t,n,i;const o=null===(i=null===(n=null===(t=null===document||void 0===document?void 0:document.cookie)||void 0===t?void 0:t.split("; "))||void 0===n?void 0:n.map((e=>e.replace("=",":=").split(":="))))||void 0===i?void 0:i.reduce(((e,[t,n])=>Object.assign(Object.assign({},e),{[decodeURIComponent(t)]:decodeURIComponent(n)})),{});return null==o?void 0:o[e]},oe=(e,t)=>{document.cookie=`${e}=${t}; SameSite=None; Secure; domain=.ru.laliexpress.com; path=/`},re=()=>{if("undefined"!=typeof window)return window.location||void 0},ae=({userParams:e})=>{var t,n,i,o,r;return{retryCount:0,domainName:(null===(t=null==e?void 0:e.rp)||void 0===t?void 0:t.domain)||"",chinaDeviceId:(null===(n=null==e?void 0:e.rp)||void 0===n?void 0:n["cookie:cna"])||(null===(i=null===window||void 0===window?void 0:window.goldlog)||void 0===i?void 0:i.Etag)||"",deviceId:e.abid||"",googleId:ie("_ga")||"",namespace:(null==e?void 0:e.namespace)||"external",platform:(null===(o=null==e?void 0:e.rp)||void 0===o?void 0:o.platform)||"",screenResolutionX:null===window||void 0===window?void 0:window.screen.width,screenResolutionY:null===window||void 0===window?void 0:window.screen.height,appsflyerId:"",isIframe:(null===window||void 0===window?void 0:window.self)!==(null===window||void 0===window?void 0:window.top)||!1,randomToken:(null===(r=null==e?void 0:e.rp)||void 0===r?void 0:r.foreverRandomToken)||void 0}},se=({userParams:e})=>{var t,n;if(!ne.isGCP)return{};return{chinaDeviceId:ie("cna")||"",platform:ne.platform||(()=>{if("undefined"!=typeof window)return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"msite":"pc"})(),domainName:(null===(t=null==e?void 0:e.rp)||void 0===t?void 0:t.domain)||(null===(n=re())||void 0===n?void 0:n.host)}};function le(){return new Promise(((e,t)=>{const n=document.body.getAttribute("data-spm")||null;n?e(n):t(n)}))}const de=(e,t,n)=>new Promise(((i,o)=>e().then(i).catch((r=>{return n>0?(a=t,new Promise((e=>setTimeout(e,a)))).then(de.bind(null,e,2*t,n-1)).then(i).catch(o):o(r);var a})))),ce=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),ue=e=>{try{if(!e)throw Error;const{origin:t,pathname:n}=new URL(e);return new URL(n,t).toString()}catch(e){return""}},ve=({userParams:e,trackerLogData:t})=>{var n,i,o,r,a,s,l,d;const[c,u]=(null===(o=null===(i=null===(n=null==e?void 0:e.rp)||void 0===n?void 0:n["request.Path"])||void 0===i?void 0:i.split("/"))||void 0===o?void 0:o.filter((e=>e)))||[],v="item"===c?null===(r=u.split("."))||void 0===r?void 0:r[0]:void 0,p=(null===document||void 0===document?void 0:document.referrer)||t.referralUrl||void 0,g=(null==e?void 0:e.alias)||"",h=(null==e?void 0:e.smpB)||"",f=t.prevPageName||"",w=ue(null===(a=null==e?void 0:e.rp)||void 0===a?void 0:a["request.URL"]),_=ue(p),E=(null===(s=null==e?void 0:e.layout)||void 0===s?void 0:s.id)||0,m=(null===(l=null==e?void 0:e.layout)||void 0===l?void 0:l.name)||"",I=t.currentId||"",y=t.prevPageId||"",O=t.prevChinaName||"",N=(null==e?void 0:e.traceId)||void 0,T=(null===window||void 0===window?void 0:window.dmtrack_pageid)||"",P=!v||+v?v:null===(d=v.split("_"))||void 0===d?void 0:d[1],A=(null==e?void 0:e.eagleeyeTraceId)||"";return Object.assign(Object.assign(Object.assign({},null==e?void 0:e.analyticsPageData),{name:g,chinaName:h,previousName:f,currentUrl:w,referralUrl:_,layoutId:E,layoutName:m,pageViewId:I,previousPageViewId:y,previousChinaName:O,traceId:N,utPageId:T,eagleeyeTraceId:A}),P&&{itemId:P})},pe=({trackerLogData:e,userParams:t})=>n(void 0,void 0,void 0,(function*(){var i,o;if(!ne.isGCP)return{};const{page:r}=e,a=(()=>{var e,t,n;if(void 0!==window){const[,i]=(null===(n=null===(t=new URLSearchParams(null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.search))||void 0===t?void 0:t.get("spm"))||void 0===n?void 0:n.split("."))||[];return i}})(),s=yield n(void 0,void 0,void 0,(function*(){try{return de(le,1e3,10)}catch(e){return"time_out_initialize_gcp"}}));return{previousChinaName:a,utPageId:(null===window||void 0===window?void 0:window.dmtrack_pageid)||(null==r?void 0:r.utPageId),chinaName:s,currentUrl:ue((null===(i=null==t?void 0:t.rp)||void 0===i?void 0:i["request.URL"])||(null===(o=re())||void 0===o?void 0:o.href))}})),ge=({userParams:e})=>{var t,n,i,o,r,a,s,l,d;const c=(null==e?void 0:e.clientID)||ie("aer_fe_userid")||"",u=ie("aer_auth_track_info")||void 0,v=ie("aer_lang")||void 0,p=!!c,g=(null===(t=null==e?void 0:e.rp)||void 0===t?void 0:t["user.settings.region"])||void 0,h=(null===(n=null==e?void 0:e.rp)||void 0===n?void 0:n["user.settings.currency"])||void 0,f=(null===(i=null==e?void 0:e.rp)||void 0===i?void 0:i["user.settings.city"])||void 0,w=(null===(o=null==e?void 0:e.rp)||void 0===o?void 0:o["user.settings.province"])||void 0,_=(null===(r=null==e?void 0:e.rp)||void 0===r?void 0:r["user.settings.region"])||void 0,E=(null==e?void 0:e.aerAbTestIds)||"",m=Boolean((null===(a=null==e?void 0:e.rp)||void 0===a?void 0:a.isBot)||!1);return{clientId:c,encryptedData:u,lang:v,login:p,aerAbTest:"",region:g,currency:h,cityId:f,provinceId:w,country:_,clientIdChina:null===(d=null===(l=(null===(s=null==e?void 0:e.rp)||void 0===s?void 0:s["cookie:xman_us_t"])||ie("xman_us_t"))||void 0===l?void 0:l.split("&").pop())||void 0===d?void 0:d.split("=").pop(),aerAbTestIds:E,isBot:m}},he=({userParams:e,trackerLogData:t})=>n(void 0,void 0,void 0,(function*(){const i=(({userParams:e,trackerLogData:t})=>Object.assign({},ge({userParams:e,trackerLogData:t})))({userParams:e,trackerLogData:t}),o=(({userParams:e,trackerLogData:t})=>{const n=ae({userParams:e,trackerLogData:t}),i=se({userParams:e,trackerLogData:t});return Object.assign(Object.assign({},n),i)})({userParams:e,trackerLogData:t}),r=yield(({userParams:e,trackerLogData:t})=>n(void 0,void 0,void 0,(function*(){const n=ve({userParams:e,trackerLogData:t}),i=yield pe({userParams:e,trackerLogData:t});return Object.assign(Object.assign({},n),i)})))({userParams:e,trackerLogData:t});ne.pageData={user:Object.assign({},i),page:Object.assign({},r),attributes:Object.assign({},o)},ne.isInitialized=!0})),fe=({userParams:e,trackerLogData:t})=>{const n=ae({userParams:e,trackerLogData:t}),i=(({trackerLogData:e})=>{if(!ne.isWebView)return{};const{attributes:t}=e;return{platform:null==t?void 0:t.platform,deviceId:null==t?void 0:t.deviceId,chinaDeviceId:null==t?void 0:t.chinaDeviceId,idfa:null==t?void 0:t.idfa,adId:null==t?void 0:t.adId,appVersion:null==t?void 0:t.appVersion,apiVersion:null==t?void 0:t.apiVersion}})({userParams:e,trackerLogData:t});return Object.assign(Object.assign({},n),i)},we=({userParams:e,trackerLogData:t})=>{const n=ve({userParams:e,trackerLogData:t}),i=(({trackerLogData:e})=>{if(!ne.isWebView)return{};const{page:t}=e,n=ce(),i=(null==t?void 0:t.name)||void 0,o=(null==t?void 0:t.pageId)||void 0,r=(null==t?void 0:t.pageViewId)||void 0,a=ue(null==t?void 0:t.currentUrl);return{pageId:n,previousName:i,previousPageId:o,previousPageViewId:r,previousChinaName:(null==t?void 0:t.chinaName)||void 0,referralUrl:a}})({userParams:e,trackerLogData:t});return Object.assign(Object.assign({},n),i)},_e=({userParams:e,trackerLogData:t})=>Object.assign(Object.assign({},ge({userParams:e,trackerLogData:t})),(({trackerLogData:e})=>{if(!ne.isWebView)return{};const{user:t}=e,n=(null==t?void 0:t.clientId)||"";return{clientId:n,login:!!n,encryptedData:null==t?void 0:t.encryptedData}})({userParams:e,trackerLogData:t})),Ee=({userParams:e,trackerLogData:t})=>{try{ne.isGCP?he({userParams:e,trackerLogData:t}):(({userParams:e,trackerLogData:t})=>{const n=_e({userParams:e,trackerLogData:t}),i=fe({userParams:e,trackerLogData:t}),o=we({userParams:e,trackerLogData:t});ne.pageData={user:Object.assign({},n),page:Object.assign({},o),attributes:Object.assign({},i)},ne.isInitialized=!0})({userParams:e,trackerLogData:t})}catch(e){ne.isInitialized=!0,console.error(e)}},me=()=>ne.pageData,Ie=e=>{const t=me();return(n,i,o,r)=>{var a;const s=((e,t)=>{var n,i;const o=null===(i=null===(n=Object.keys(t||{}))||void 0===n?void 0:n.map((e=>`${e}=${null==t?void 0:t[e]}`)))||void 0===i?void 0:i.join("&");return o?`${e}&${o}`:e})(o,{AerABID:(null===(a=t.attributes)||void 0===a?void 0:a.deviceId)||""});return e(n,i,s,r)}};const ye=new class{constructor(){this.internalMessage=new Map,this.internalInitializedQueue=new Set}get message(){return this.internalMessage}get initializedQueue(){return this.internalInitializedQueue}getMessagesForRequest(){var e,t;const n=[...this.message.values()].slice(0,9),i=Array.from(n,(e=>(null==e?void 0:e.uuid)||""));for(const n of i)(null===(e=this.internalMessage)||void 0===e?void 0:e.has(n))&&(null===(t=this.internalMessage)||void 0===t||t.delete(n));return n}},Oe=e=>{var t,n;if("undefined"!=typeof window)try{null===(n=null===(t=window.reasons)||void 0===t?void 0:t.sendReason)||void 0===n||n.call(t,e)}catch(e){console.error(e)}},Ne=(e,t,n)=>{var i;return null===(i=[...null==e?void 0:e.entries()])||void 0===i?void 0:i.map((([e,i])=>({code:"WEB_LOCAL_ANALYTICS",message:t,payload:{[n]:e,value:i,platform:ne.platform}})))};const Te=new class{constructor(){this.internalFetchResult=new Map,this.internalFetchRetry=new Map}increaseFetchResult(e){const t=this.internalFetchResult.get(e)||0;this.internalFetchResult.set(e,t+1)}increaseFetchRetry(e){const t=this.internalFetchRetry.get(e)||0;this.internalFetchRetry.set(e,t+1)}sendCollectReasonMessages(){((e,t)=>{var n,i;try{"undefined"!=typeof window&&(null===(i=null===(n=window.reasons)||void 0===n?void 0:n.sendReasonList)||void 0===i||i.call(n,e,t))}catch(e){console.log(e)}})([...Ne(this.internalFetchResult,"FETCH_RESULT","status"),...Ne(this.internalFetchRetry,"FETCH_RETRY","group")],!0)}},Pe={},Ae=e=>{try{return!(!e||!Boolean(new URL(e)))}catch(e){return!1}},Le=e=>e.map((e=>({uuid:e.uuid||"",timestamp:e.timestamp||"",actionType:e.actionType||""})));class be{constructor(){this.retryCount=0,this.collectReason=e=>{"reject"===e&&(Te.increaseFetchResult("retry"),this.retryCount+=1),"success"===e&&(Te.increaseFetchRetry(((e=0)=>{switch(!0){case e>0&&e<=5:return"oneToFive";case e>5&&e<=10:return"sixToTen";case e>10:return"moreTen";default:return"none"}})(this.retryCount)),this.retryCount=0),Te.increaseFetchResult(e)},this.retryFetch=({path:e,options:t,sendMessages:n})=>{const i=this.retryCount?((e,t)=>{const n=(null==e?void 0:e.map((e=>Object.assign(Object.assign({},e),{attributes:Object.assign(Object.assign({},e.attributes),{retryCount:t})}))))||[];return JSON.stringify({events:n})})(n,this.retryCount):(null==t?void 0:t.body)||"";((e="",t)=>{var n,i;return ne.isWebView||ne.isGCP?(null===window||void 0===window?void 0:window.originalFetch)?null===(n=null===window||void 0===window?void 0:window.originalFetch)||void 0===n?void 0:n.call(window,e,t):null===(i=window.fetch)||void 0===i?void 0:i.call(window,e,t):new Promise(((n,i)=>{var o,r;const a=new XMLHttpRequest;a.open("POST",e),(null==t?void 0:t.headers)instanceof Headers&&(null===(r=null===(o=t.headers)||void 0===o?void 0:o.forEach)||void 0===r||r.call(o,((e,t)=>{a.setRequestHeader(t,e)}))),a.onload=()=>{a.status>=200&&a.status<300?n(a.response):i(new Error(`Request failed with status: ${a.status}`))};try{a.onerror=()=>{i(new Error(q))},ne.isWebView||(a.onabort=()=>{i(new Error(q))},a.ontimeout=()=>{i(new Error(q))})}catch(e){i(e)}a.send(null==t?void 0:t.body)}))})(e,Object.assign(Object.assign({},t),{body:i})).then((()=>{this.collectReason("success")})).catch((i=>{this.collectReason("reject"),Oe({code:"LOCAL_TRACKER",message:"Couldn't send analytics to local tracker",stack:i.stack,payload:Object.assign({},Le(n))}),i.message===q&&setTimeout((()=>this.retryFetch({path:e,options:t,sendMessages:n})),3e3)}))}}}var Se="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ce="__lodash_hash_undefined__",Re="[object Function]",De="[object GeneratorFunction]",ke=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ve=/^\w*$/,xe=/^\./,Ue=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,je=/\\(\\)?/g,Me=/^\[object .+?Constructor\]$/,Be=/^(?:0|[1-9]\d*)$/,Fe="object"==typeof Se&&Se&&Se.Object===Object&&Se,We="object"==typeof self&&self&&self.Object===Object&&self,Ge=Fe||We||Function("return this")();var ze,Ke=Array.prototype,Ye=Function.prototype,Je=Object.prototype,$e=Ge["__core-js_shared__"],He=(ze=/[^.]+$/.exec($e&&$e.keys&&$e.keys.IE_PROTO||""))?"Symbol(src)_1."+ze:"",Xe=Ye.toString,Qe=Je.hasOwnProperty,qe=Je.toString,Ze=RegExp("^"+Xe.call(Qe).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),et=Ge.Symbol,tt=Ke.splice,nt=gt(Ge,"Map"),it=gt(Object,"create"),ot=et?et.prototype:void 0,rt=ot?ot.toString:void 0;function at(e){var t=-1,n=e?e.length:0;for(this.clear();++t-1&&e%1==0&&e-1},st.prototype.set=function(e,t){var n=this.__data__,i=ct(n,e);return i<0?n.push([e,t]):n[i][1]=t,this},lt.prototype.clear=function(){this.__data__={hash:new at,map:new(nt||st),string:new at}},lt.prototype.delete=function(e){return pt(this,e).delete(e)},lt.prototype.get=function(e){return pt(this,e).get(e)},lt.prototype.has=function(e){return pt(this,e).has(e)},lt.prototype.set=function(e,t){return pt(this,e).set(e,t),this};var ft=_t((function(e){var t;e=null==(t=e)?"":function(e){if("string"==typeof e)return e;if(yt(e))return rt?rt.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(t);var n=[];return xe.test(e)&&n.push(""),e.replace(Ue,(function(e,t,i,o){n.push(i?o.replace(je,"$1"):t||e)})),n}));function wt(e){if("string"==typeof e||yt(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function _t(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var i=arguments,o=t?t.apply(this,i):i[0],r=n.cache;if(r.has(o))return r.get(o);var a=e.apply(this,i);return n.cache=r.set(o,a),a};return n.cache=new(_t.Cache||lt),n}function Et(e,t){return e===t||e!=e&&t!=t}_t.Cache=lt;var mt=Array.isArray;function It(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function yt(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==qe.call(e)}var Ot=function(e,t,n){return null==e?e:vt(e,t,n)};const Nt=({sendByBeacon:e})=>{if(!ye.message.size||!ne.isInitialized)return;const t=new be,n=ye.getMessagesForRequest(),i=JSON.stringify({events:n}),o=`${Pe.handler}/v1/collect/aer`;try{!ne.isIosWv&&e&&"undefined"!=typeof navigator&&navigator.sendBeacon?navigator.sendBeacon(o,i):t.retryFetch({path:o,options:Object.assign({method:"POST",body:i,credentials:"omit",mode:"cors"},e&&{keepalive:!0}),sendMessages:n})}catch(e){Oe({code:"LOCAL_TRACKER",message:e.message,stack:e.stack,payload:Object.assign({},Le(n))})}},Tt=(e,t,n)=>{var i,o;if(ne.isInitialized){const r=ne.excludeFieldsConfig,a=(new Date).toISOString(),s=ce(),l=me(),d=(({config:e,event:t})=>{e&&(null==t?void 0:t.actionType)&&(null==e?void 0:e[null==t?void 0:t.actionType])&&(null==e?void 0:e[t.actionType]).forEach((e=>{Ot(t,e,"")}));return Object.assign({},t)})({config:r,event:Object.assign(Object.assign(Object.assign({},e),l),{attributes:Object.assign(Object.assign({},null==l?void 0:l.attributes),{yandexClientAdvId:(null===(i=null==e?void 0:e.attributes)||void 0===i?void 0:i.yandexClientAdvId)||(null===(o=null==l?void 0:l.attributes)||void 0===o?void 0:o.yandexClientAdvId)}),page:Object.assign(Object.assign({},null==e?void 0:e.page),null==l?void 0:l.page),timestamp:a,uuid:s})});((e,t=!1)=>{try{const n=JSON.stringify(e||"");Ae(ne.aerConsoleUrl)&&(!ne.isIosWv&&"undefined"!=typeof navigator&&navigator.sendBeacon?navigator.sendBeacon(ne.aerConsoleUrl,n):fetch(ne.aerConsoleUrl,Object.assign(Object.assign({method:"POST",mode:"cors"},t&&{keepalive:!0}),{body:n})).catch((()=>{})))}catch(e){}})(d,null==n?void 0:n.sendByBeacon),ye.message.set((null==d?void 0:d.uuid)||"",d),(null===window||void 0===window?void 0:window.onAerTrackerEvent)&&window.onAerTrackerEvent(d),(t||ye.message.size>=9)&&Nt(Object.assign({},n))}else ye.initializedQueue.add(e)},Pt=e=>{try{return e?JSON.parse(e):null}catch(e){return null}},At=e=>e.productID||e.exp_product||e.x_object_id||e.prod||e.product_id,Lt=({parsedInfo:e,actionType:t,type:n,itemId:i})=>({actionType:t,trackingInfo:{spm:(null==e?void 0:e.spm)||(null==e?void 0:e["spm-cnt"])||"",spm_url:(null==e?void 0:e["spm-url"])||"",type:n,itemId:i,title:(null==e?void 0:e.title)||""}}),bt=(()=>{const e=new Set;return n=>{var{itemId:i}=n,o=t(n,["itemId"]);i&&!e.has(i)&&(Tt(Lt(Object.assign(Object.assign({},o),{itemId:i}))),e.add(i))}})(),St=e=>(t,n,i)=>{var o,r;const a=Object.assign({},n);e(t,n,i);try{const e=!(null===(o=null==a?void 0:a.gokey)||void 0===o?void 0:o.startsWith("msg=url="))||(null===(r=null==a?void 0:a.gokey)||void 0===r?void 0:r.startsWith("expdata="));if(a.gokey&&e){const e=(e=>{var t;return null===(t=null==e?void 0:e.split("&"))||void 0===t?void 0:t.reduce(((e,t)=>{const n=null==t?void 0:t.indexOf("="),[i,o]=[null==t?void 0:t.slice(0,n),null==t?void 0:t.slice(n+1)];return Object.assign(Object.assign({},e),{[i]:"expdata"===i?JSON.parse(o):o})}),{})})(a.gokey);if("CLK"===a.gmkey){const t=At(e),n=Object.fromEntries(new URLSearchParams(a.gokey).entries());if(Object.keys(n).length)if(n.clkdata||e.clkdata||!t){const t=`${e.clkdata}__${e.category_id}`,[n]=Pt(t)||[],i=(e=>{var t,n;const i=Pt((null===(t=null==e?void 0:e.exargs)||void 0===t?void 0:t["data-clk-s"])||{});return(null===(n=null==i?void 0:i.ae_object_value)||void 0===n?void 0:n.split("__")[1])||null})(n);i&&Tt(Lt({actionType:"click_product",itemId:i,parsedInfo:n,type:Z}))}else Tt(Lt({actionType:"click_product",type:Z,itemId:t,parsedInfo:e}))}if("EXP"===a.gmkey){const t=(e=>{var t;return Array.isArray(e.expdata)?(null===(t=e.expdata)||void 0===t?void 0:t.map((e=>{var t;return{itemId:At(Pt(null===(t=null==e?void 0:e.exargs)||void 0===t?void 0:t["data-exp-s"]))||"",parsedInfo:e}})))||[]:[{itemId:At(e)||"",parsedInfo:e}]})(e);null==t||t.forEach((e=>{bt(Object.assign({actionType:"view_product",type:Z},e))}))}}}catch(e){console.error(e)}},Ct={record:e=>Ie(e),send:e=>St(e)},Rt=e=>{var t;(null===window||void 0===window?void 0:window.goldlog)&&(null===(t=window.goldlog)||void 0===t?void 0:t[e])?window.goldlog[e]=Ct[e](window.goldlog[e]):(window.goldlog={},Object.defineProperty(window.goldlog,e,{configurable:!0,get(){return this[`override_${e}`]},set(t){this[`override_${e}`]=Ct[e](t)}}))},Dt=()=>(null===localStorage||void 0===localStorage?void 0:localStorage.getItem(X))||"",kt=e=>{try{const[t,n]=(null==e?void 0:e.split("&"))||[];return new URL(`${t}/event?consoleId=${n}`).toString()}catch(e){return"error"}},Vt=(e,t)=>{if("undefined"!=typeof window){const n=new StorageEvent("storage",{key:X,oldValue:t,newValue:e});null===window||void 0===window||window.dispatchEvent(n)}},xt=e=>{if(e){const t=Dt();null===localStorage||void 0===localStorage||localStorage.setItem(X,e),Vt(e,t)}},Ut=e=>{Tt({actionType:"cookie_filing_yandex",attributes:{yandexClientAdvId:e},trackingInfo:{type:"cookie"}},!1,{})},jt=e=>new Promise(((t,n)=>{if(e)try{null==e||e("29739640","getClientID",(e=>{t(e)}))}catch(e){console.error(e),n(e)}else n()})),Mt=e=>{var t;if(e&&"undefined"!=typeof window){return new URLSearchParams(null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.search).get(e)}return null},Bt=e=>{var t,n;const i=!(!Mt("spm")||(null===document||void 0===document?void 0:document.referrer)),o={name:e.currentName||"",id:e.currentId||"",chinaName:e.currentChinaName||"",referralUrl:i?e.referralUrl:ue(null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.href)},r={name:e.prevPageName||"",id:e.prevPageId||"",chinaName:e.prevChinaName||"",referralUrl:i?e.referralUrl:ue(null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.href)};oe(H,encodeURIComponent(JSON.stringify(r))),oe($,encodeURIComponent(JSON.stringify(o)))},Ft=(e=!1)=>{e||(Bt(ne.trackerLogData),Tt({trackingInfo:{type:ee},actionType:"page_close"},!0,{sendByBeacon:!0}),Te.sendCollectReasonMessages())},Wt=()=>{const e=Dt();localStorage.removeItem(X),Vt("",e)},Gt=()=>{try{if("undefined"!=typeof window&&(null===window||void 0===window?void 0:window.document)){if(!document.getElementById(Q)){const e=document.createElement("div");e.id=Q,e.style.cssText="position: fixed; top: 10px; right: 10px; z-index: 1000; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center;";const t=document.createElement("div");t.style.cssText="position: absolute; width: 100%; height: 100%; background: rgb(255, 255, 255); opacity: 0.65; z-index: -1;";const n=document.createElement("div");n.style.cssText='background: url("https://st.ru.laliexpress.com/mixer-storage/aerconsole/aerconsole.png") no-repeat; background-size: cover; width: 52px; height: 52px;';const i=document.createElement("span");i.style.cssText="text-align: center; font-size: 12px;",i.innerHTML="Выключить",e.appendChild(t),e.appendChild(n),e.appendChild(i),e.addEventListener("click",Wt),document.body.appendChild(e)}}}catch(e){}},zt=()=>{setInterval((()=>{if(Nt({}),ne.isInitialized&&ye.initializedQueue.size){for(const e of ye.initializedQueue)Tt(e);ye.initializedQueue.clear()}}),3e3),!ne.isWebView&&Ae(ne.aerConsoleUrl)&&Gt()},Kt=({key:e,newValue:t})=>{e===X&&(t&&(ne.aerConsoleUrl=t||"empty"),Ae(t)?Gt():((()=>{var e;try{if("undefined"!=typeof window&&(null===window||void 0===window?void 0:window.document)){const t=document.getElementById(Q);t&&(null===(e=t.remove)||void 0===e||e.call(t))}}catch(e){}})(),ne.aerConsoleUrl=""))};var Yt;!function(e){e.NAVIGATE="navigate",e.RELOAD="reload"}(Yt||(Yt={}));const Jt=e=>((e="{}")=>Pt(decodeURIComponent(e)))(ie(e)||"{}"),$t=(e,t=!1)=>{let n=null,i=null;const o=function(){var e,t;let n=Yt.NAVIGATE;const i="undefined"!=typeof window,o=void 0!==window.performance;if(i&&o){const[i]=(null===(t=null===(e=null===window||void 0===window?void 0:window.performance)||void 0===e?void 0:e.getEntriesByType)||void 0===t?void 0:t.call(e,"navigation"))||[];n=(null==i?void 0:i.type)===Yt.RELOAD?Yt.RELOAD:Yt.NAVIGATE}return n}(),r=Mt("spm"),a=(null===document||void 0===document?void 0:document.referrer)||r;a&&(i=$),a&&o===Yt.RELOAD&&(i=H),i&&(n=Jt(i));return{currentId:t?ce():null==e?void 0:e.pageViewId,currentName:null==e?void 0:e.alias,currentChinaName:null==e?void 0:e.smpB,prevPageId:null==n?void 0:n.id,prevPageName:null==n?void 0:n.name,prevChinaName:null==n?void 0:n.chinaName,referralUrl:null==n?void 0:n.referralUrl}};O();e.clearUrlAerConsole=Wt,e.getPageData=me,e.getPageDataServerPixel=e=>{var t,n,i,o;const r=(null===(t=null==e?void 0:e.rp)||void 0===t?void 0:t["cookie:cna"])||"";return{actionType:"server_pixel",page:{name:(null==e?void 0:e.alias)||"",chinaName:(null==e?void 0:e.smpB)||"",layoutId:(null===(n=null==e?void 0:e.layout)||void 0===n?void 0:n.id)||0,layoutName:(null===(i=null==e?void 0:e.layout)||void 0===i?void 0:i.name)||"",pageViewId:(null==e?void 0:e.pageViewId)||ce()},attributes:{chinaDeviceId:r,deviceId:e.abid||"",namespace:(null==e?void 0:e.namespace)||"external",platform:(null===(o=null==e?void 0:e.rp)||void 0===o?void 0:o.platform)||""}}},e.sendEvent=Tt,e.setUrlAerConsole=xt,e.trackerInit=e=>n(void 0,void 0,void 0,(function*(){var n,i,o,r,a;const s=(null===(i=null===(n=null==e?void 0:e.rp)||void 0===n?void 0:n.useragent)||void 0===i?void 0:i.toLowerCase())||(null===(r=null===(o=null===window||void 0===window?void 0:window.navigator)||void 0===o?void 0:o.userAgent)||void 0===r?void 0:r.toLowerCase())||"";var l;l=(null==e?void 0:e.handler)||"",Pe.handler=l,ne.isWebView=s.endsWith("-wv"),ne.isIosWv=s.endsWith("-wv")&&s.includes("ios"),ne.platform=(null===(a=null==e?void 0:e.rp)||void 0===a?void 0:a.platform)||"",ne.isGCP=window.location.host.includes("promotion"),ne.excludeFieldsConfig=Pt(null==e?void 0:e.excludeFieldsConfig),ne.trackerLogData=$t(e,ne.isGCP),window.addEventListener("DOMContentLoaded",zt),window.addEventListener("storage",Kt),window.addEventListener("focus",(()=>Bt(ne.trackerLogData))),window.addEventListener("blur",(()=>Bt(ne.trackerLogData))),ne.isWebView?window.addEventListener("unload",(()=>Ft(!!e.turnOffBaseEvents))):window.addEventListener("beforeunload",(()=>Ft(!!e.turnOffBaseEvents))),Bt(ne.trackerLogData),ne.isGCP?Rt("send"):Rt("record");let d=ne.trackerLogData;if(ne.isWebView){const e=yield J.getAppLocalAnalyticsState({}),n=e.data||{},{consoleInfo:i=""}=n,o=t(n,["consoleInfo"]);ne.aerConsoleUrl=kt(i),e&&(d=Object.assign(Object.assign({},ne.trackerLogData),o))}else{const e=(()=>{var e;try{if("undefined"!=typeof window){const t=new URLSearchParams(null===(e=null===window||void 0===window?void 0:window.location)||void 0===e?void 0:e.search),n=t.get("host"),i=t.get("consoleId");if(n&&i)return kt([n,i].join("&"))}return""}catch(e){return"error"}})(),t=Dt();e&&xt(e),ne.aerConsoleUrl=e||t}Ee({userParams:e,trackerLogData:d}),J.saveTrackerData(Object.assign({actionType:te},me())),(null===window||void 0===window?void 0:window.ym)?jt(null===window||void 0===window?void 0:window.ym).then((e=>{Ut(e)})):Object.defineProperty(window,"ym",{configurable:!0,set(e){Object.defineProperty(window,"ym",{configurable:!0,value:e}),jt(e).then((e=>{Ut(e)}))}}),e.skipPageViewAnalytics||e.turnOffBaseEvents||Tt({trackingInfo:{type:ee},actionType:te})}))}(this.iife=this.iife||{}); //# sourceMappingURL=index.js.map