Number.prototype.isNan||(Number.isNaN=Number.isNaN||function(e){return e!=e}),Number.prototype.isInteger||(Number.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),(e=>{e.melidata_namespace={utils:{},session:{},config:{melidata_internal_admin_public_url:"https://api.mercadolibre.com/tracks/internal_admin",melidata_internal_admin_url:"https://melidata.adminml.com/tracks",melidata_internal_admin_url_test_url:"https://melidata-test.adminml.com/tracks",melidata_api_url:"https://api.mercadolibre.com/tracks",melidata_pixel_url:"https://api.mercadolibre.com/pixel.gif",retry_on_error_time:1e3,retry_on_error_limit:5,log_level:"enabled",enable_to_send:!0,http_retry_status_codes:[500,420,429]},test_env:!1},e.melidata_namespace.configure=function(e,t){e&&void 0!==t&&(this.config[e]=t)}})(window.inDapIF?window.parent:window.top),(r=>{r.melidata_namespace.utils={isWebkitContext:function(){var e=r.MobileWebKit;return void 0!==e&&!(void 0===e)},getUserAgent:function(){return navigator.userAgent},getCookieValue:function(e){for(var t,i,o=r.document.cookie.split(";"),s=0;s{var o={browser:{},device:{}};if(t.fullVersionList&&0!==t.fullVersionList.length){var s=t.fullVersionList.filter(e=>e.brand&&!e.brand.includes("Not")&&!e.brand.includes("Brand"));let i=["Google Chrome","Safari","Firefox","Microsoft Edge","Opera","Brave","Vivaldi","Chromium"],e=null;for(let t=0;te.brand===i[t]);if(a){o.browser.browser_name=a.brand,e=a.version;break}}!o.browser.browser_name&&t.brands[0]&&(o.browser.browser_name=t.brands[0].brand,e=t.brands[0].version),null!==e&&(e=e.split(".").slice(0,3).join("."),o.browser.browser_version=e),t.model&&""!==t.model&&(o.device.device_name=t.model),t.platform&&""!==t.platform&&(o.device.os_name=t.platform),t.platformVersion&&""!==t.platformVersion&&(o.device.os_version=t.platformVersion)}return o}):new Promise(e=>e({}))},postErrorToNewRelic:function(e){console.error("Error caught in safeExecute:",e);try{parent.newrelic&&parent.newrelic.noticeError(e,{errorSource:"melidata-js-sdk"})}catch(e){console.error("Error posting to newRelic from Melidata:",e)}}}})(window.inDapIF?window.parent:window.top),(n=>{var t,i,o,s,a,r,c=n.melidata_namespace.utils,u=n.melidata_namespace.test_env,d=c.getCookieValue("_d2id"),e=c.getCookieValue("backup_d2id"),l=c.getBusiness(n.location.hostname,n.location.pathname),m=c.getBusinesses(),p="com"===n.location.hostname.substr(-3)&&(l===m.mercadolibre||l===m.mercadopago);function h(e,t,i,o,s){t="https://melidata."+e+"/pixel.gif?name="+t+"&value="+i+"&max_age="+24*o*60*60+"&domain=."+e;return s&&(t+="&path="+s),t}function f(t,i,o,s,a){n.document.requestStorageAccessFor("https://melidata."+t).then(function(){var e;e=h(e=t,i,o,s,a),n.fetch(e,{keepalive:!0,credentials:"include"}),u&&console.log("setting cookie through fetch first-party-sets cookies",e)},function(e){console.log("requestStorageAccessFor error:"+e)})}function _(){s("mercadolibre.com","_d2id",d,a,"/");var e="/jms/"+i.toLowerCase()+"/";s("mercadoli"+("MLB"===i?"v":"b")+"re.com","_d2id",d,a,e),-1{var t=e.melidata_namespace.utils,i=e.melidata_namespace.test_env,o=/.*(\.?mercado[^\/]+)\/?.*/.exec(e.location.hostname),s=t.getBusiness(e.location.hostname,e.location.pathname),s="com"===e.location.hostname.substr(-3)&&("mercadolibre"===s||"mercadopago"===s),a=e.document.location.search,e=e.melidata_namespace.utils.parseQueryStrings(a),a="/",n=t.getCookieValue("_d2id");(e=e.forced_d2id)&&e.endsWith("-f")&&o?(o=o[1],s&&(s=t.getCurrentSite(t.getSites(),s),o.startsWith("mercadoli"+("MLB"===s?"v":"b")+"re")&&(a="/jms/"+s.toLowerCase()+"/"),o.startsWith("mercadopago"))&&(a="/"+s.toLowerCase()+"/"),n&&!n.endsWith("-f")&&t.setCookie("backup_d2id",n,7,"."+o,a,"d"),t.setCookie("_d2id",e,1,"."+o,a,"d")):i&&console.log("forced_d2id not valid")})(window.inDapIF?window.parent:window.top),(e=>{var t=e.melidata_namespace.utils,i=e.melidata_namespace.test_env,o=/.*(\.?mercado[^\/]+)\/?.*/.exec(e.location.hostname),s=t.getBusiness(e.location.hostname,e.location.pathname),s="com"===e.location.hostname.substr(-3)&&("mercadolibre"===s||"mercadopago"===s),a=e.document.location.search,e=e.melidata_namespace.utils.parseQueryStrings(a),a="/",n=t.getCookieValue("_d2id");(e=e.mshops_d2id)&&e.endsWith("-s")&&o?(o=o[1],s&&(s=t.getCurrentSite(t.getSites(),s),o.startsWith("mercadoli"+("MLB"===s?"v":"b")+"re")&&(a="/jms/"+s.toLowerCase()+"/"),o.startsWith("mercadopago"))&&(a="/"+s.toLowerCase()+"/"),n&&!n.endsWith("-s")&&t.setCookie("backup_d2id",n,7,"."+o,a,"d"),t.setCookie("_d2id",e,10,"."+o,a,"m")):i&&console.log("mshops_d2id not valid")})(window.inDapIF?window.parent:window.top),(e=>{var t,i=e.melidata_namespace.utils,o=e.melidata_namespace.test_env,s=e.document.location.search;(s=e.melidata_namespace.utils.parseQueryStrings(s).mshops_mldataSessionId)?(t=/.*(\.?mercado[^s\/]+)\/?.*/.exec(e.location.hostname),e=e.location.hostname.replace("www",""),t&&(e=t[1]),i.setCookie("_mldataSessionId_mshops",s,30,"."+e,"/","m")):o&&console.log("mshops_mldataSessionId not valid")})(window.inDapIF?window.parent:window.top);let SESSION_ID_MAX_AGE=30,COOKIE_MAX_AGE_MINUTES="m";class SessionManagerService{constructor(e,t){this.cookieName="_mldataSessionId",this.sessionId=null,this.mldata=e.melidata_namespace.utils,this.uuid=t,this.isTestEnv="localhost"===e.location.hostname,this.currentBusiness=this.getCurrentBusiness(e),this.isLogin=this.checkIfLogin(e,this.currentBusiness),this.isMlDotCom="mercadolibre.com"===e.location.hostname&&"/"===e.location.pathname,this.d2id=this.mldata.getCookieValue("_d2id"),this.isTestEnv||(this.setCookieDomain(e),this.setCookieName(e))}getCurrentBusiness(e){return this.mldata.getBusiness(e.location.hostname,e.location.pathname)}checkIfLogin(e,t){return"com"===e.location.hostname.substr(-3)&&("mercadolibre"===t||"mercadopago"===t)&&"/jms/"===e.location.pathname.substring(0,5)}isUidCrossSitePropagated(){return!("-n"===this.d2id.substring(this.d2id.length-2))}getSessionId(){return null===this.sessionId&&(this.sessionId=this.mldata.getCookieValue(this.cookieName)),this.setOrRenewSessionId(),this.sessionId}setOrRenewSessionId(){this.isLogin&&this.isUidCrossSitePropagated()||this.isMlDotCom||(null==this.sessionId&&(this.sessionId=this.uuid()),this.isTestEnv?this.mldata.setCookie(this.cookieName,this.sessionId,SESSION_ID_MAX_AGE,"","/",COOKIE_MAX_AGE_MINUTES):this.mldata.setCookie(this.cookieName,this.sessionId,SESSION_ID_MAX_AGE,"."+this.cookieDomain,"/",COOKIE_MAX_AGE_MINUTES))}setCookieDomain(e){this.cookieDomain=this.mldata.getDomain(e.location.hostname)}setCookieName(e){"mercadoshops"===this.mldata.getBusiness(e.location.hostname,e.location.pathname)&&(this.cookieName="_mldataSessionId_mshops")}}(window.inDapIF?window.parent:window.top).melidata_namespace.session={newSessionManager:function(e,t){return new SessionManagerService(e,t)}},(r=>{void 0!==r.document.addEventListener&&r.document.addEventListener("webkitvisibilitychange",function(){document.webkitHidden||r.melidata_namespace.sender.send_hidden()},!1);var e,o,c=r.melidata_namespace,u=(o=e=!1,window.XMLHttpRequest&&("withCredentials"in new window.XMLHttpRequest?(e=!0,new window.XMLHttpRequest):window.XDomainRequest&&(o=!(e=!1),new window.XDomainRequest)),e&&function(e){var t=new window.XMLHttpRequest,i=(o?(t.open(e.method,e.url),t.ontimeout=e.error,t.onerror=e.error,t.onload=function(){t&&(c.config.http_retry_status_codes.includes(t.status)||400===t.status||406===t.status)?e.error(t,t.responseText):e.success(t,t.responseText)}):(t.open(e.method,e.url,!0),t.onreadystatechange=function(){4===t.readyState&&(!t.response||c.config.http_retry_status_codes.includes(t.status)||400===t.status||406===t.status?e.error(t,t.responseText):e.success(t,t.responseText))}),e.headers);i&&Object.keys(i).forEach(function(e){t.setRequestHeader(e,i[e])}),t.send(e.data)});c.sender={user_agent_whitelist_app_track:["MercadoLibre-Android","MercadoLibre-iOS","MercadoPago-Android","MercadoPago-iOS"],shouldTrackSentFromWebViewInApp:function(e,t,i){for(var o=0;o{var a=s.melidata_namespace;function t(){var e=new Date;return{path:"",user:{},type:void 0,user_local_timestamp:a.utils.dateISOFormat(e),server_id:a.utils.uuid(),id:a.utils.uuid(),event_data:{},platform:{http:{}},application:{sdk_version:{}},device:{},experiments:{},created_hidden:!1}}function o(e,t,i){return u(i[e])?u(t)?i[e]=i[e].concat(t):i[e].push(t):"object"==typeof t?n(i[e],t):i[e]=t,this}function n(t,i){"object"==typeof i&&Object.keys(i).forEach(function(e){t[e]=i[e]})}function r(e){var t={},i=a.session.newSessionManager(s,a.utils.uuid),t=(0{null!==e&&(w(e.browser,t),x(e.device,t))}),this.actual_track.application.secured&&(e={secured:this.actual_track.application.secured,sdk_version:this.actual_track.application.sdk_version},b(e,t),i={platform:this.actual_track.device.platform},x(i,t)),this.actual_track.user.user_id&&(o={user_id:this.actual_track.user.user_id},p(o,t))}catch(e){a.utils.postErrorToNewRelic(e)}},a.withData=function(e,t){try{d(e,t)}catch(e){a.utils.postErrorToNewRelic(e)}},a.withUserData=function(e,t){try{p(e,t)}catch(e){a.utils.postErrorToNewRelic(e)}},a.withApplicationData=function(e,t){try{b(e,t)}catch(e){a.utils.postErrorToNewRelic(e)}},a.withPath=function(e,t){try{l(e,t)}catch(e){a.utils.postErrorToNewRelic(e)}},a.withStream=function(e,t){try{i(e,t)}catch(e){a.utils.postErrorToNewRelic(e)}},a.withExperiments=function(e,t){try{m(e,t)}catch(e){a.utils.postErrorToNewRelic(e)}},a.withExperiment=function(e,t,i){try{var o;null!==e&&null!==t&&((o={})[e]=t,m(o,i))}catch(e){a.utils.postErrorToNewRelic(e)}},a.withSdkVersion=function(e,t){try{withSdkVersion(e,t)}catch(e){a.utils.postErrorToNewRelic(e)}},a.complete=r;var d=function(e,t){return n(t.event_data,e),this},l=function(e,t){return e&&(t.path=e),this},m=function(e,t){return n(t.experiments,e),this},i=function(e,t){return e&&(t.stream_name=e),this},p=function(e,t){return n(t.user,e),this},h=function(e,t){return n(t.platform.http,e),this},f=function(e,t){return n(t.platform,e),this},_=function(e,t){return t.platform.http.cookies?n(t.platform.http.cookies,e):t.platform.http.cookies=e,this},g=function(e,t){return n(t.platform.http,e),this},v=function(e,t){return n(t.platform.http,e),this},w=function(e,t){return n(t.platform.http,e),this},k=function(e,t){return n(t.platform.http,e),this},b=function(e,t){return n(t.application,e),this},y=function(e,t){return n(t.application.sdk_version,e),this},x=function(e,t){n(t.device,e)},S=function(e,t){return p({melidata_session_id:e},t),this},M=function(){var e=window.top||window.parent||window;try{return e.location?decodeURIComponent(e.location.hash.substr(1)):""}catch(e){return""}},T=function(e){e.event_data||(E(t(),e,C),e.event_data={},a.fillTrack(e))},C=["user_local_timestamp","id","type","event_data"];function E(e,t,i){for(var o in e)e.hasOwnProperty(o)&&i.indexOf(o)<0&&(t[o]=s.JSON.parse(s.JSON.stringify(e[o])))}})(window.inDapIF?window.parent:window.top),((e,t)=>{var i=e.melidata_namespace,o=[];for(null!=e[t]&&null!=e[t].q&&(o=e[t].q),e[t]=function(){var e=Array.prototype.shift.apply(arguments),t=Array.prototype.slice.call(arguments);i.actual_track||(i.actual_track={},i.createViewTrack(i.actual_track)),i[e].apply(i,t)};0