1 line
25 KiB
Plaintext
1 line
25 KiB
Plaintext
!function(){"use strict";var e,n="snaptr",t="PAD_SERVER_URL",i="https://tr.snapchat.com",r="".concat(i,"/p"),o="".concat(i,"/cm/si"),a="".concat(i,"/cm/s"),c="".concat(i,"/log/error"),s="".concat(i,"/init"),d="__scpt__",u="".concat(i,"/cm/i"),l="1d53c387",f="_sctr",p="cmdone",m=34186698e3,h="_scid",g="u_sclid",_="u_scsid";!function(e){e[e.UNSET=0]="UNSET",e[e.JS_BRIDGE=1]="JS_BRIDGE",e[e.CLICK_ID=2]="CLICK_ID"}(e||(e={}));var v={age:"u_age",gender:"u_gd",firstname:"u_fn",lastname:"u_ln",device_brand:"d_br",device_model:"d_md",device_type:"d_type",os_type:"d_ot",os_version:"d_os",locale_country:"d_lc",locale_language:"d_ll",user_agent:"d_ua",limited_ad_tracking:"d_lat",connection_type:"c_type",isp:"c_isp",integration:"intg",mobile_carrier:"c_mc",ip_address:"c_ip",lat:"l_lat",long:"l_lng",geo_country:"l_gc",geo_region:"l_gr",geo_metro:"l_gm",geo_city:"l_city",geo_postal_code:"l_gpc",geo_location_source:"l_ls",geo_address:"l_addr",price:"e_pr",item_category:"e_ic",item_ids:"e_iids",currency:"e_cur",number_items:"e_ni",transaction_id:"e_tid",description:"e_desc",level:"e_lv",search_string:"e_ss",payment_info_available:"e_pia",sign_up_method:"e_sm",success:"e_su",event_tag:"et",brand_id:"br_id",data_use:"du",client_dedup_id:"cdid",client_deduplication_id:"cdid"},w=function(){var e=4022871197,n=function(n){n=n.toString();for(var t=0;t<n.length;t++){var i=.02519603282416938*(e+=n.charCodeAt(t));i-=e=i>>>0,e=(i*=e)>>>0,e+=4294967296*(i-=e)}return 2.3283064365386963e-10*(e>>>0)};return n.version="Mash 0.9",n},S=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return function(e){var n=0,t=0,i=0,r=1;0===e.length&&(e=[+new Date]);var o=w();n=o(" "),t=o(" "),i=o(" ");for(var a=0;a<e.length;a++)(n-=o(e[a]))<0&&(n+=1),(t-=o(e[a]))<0&&(t+=1),(i-=o(e[a]))<0&&(i+=1);o=null;var c=function(){var e=2091639*n+2.3283064365386963e-10*r;return n=t,t=i,i=e-(r=0|e)};return c.uint32=function(){return 4294967296*c()},c.fract53=function(){return c()+11102230246251565e-32*(2097152*c()|0)},c.version="Alea 0.9",c.args=e,c}(e)}(""+function e(n,t){var i=[];if(t&&"object"==typeof n&&(3===t||!n.location))for(var r in n)try{i.push(r,e(n[r],t-1))}catch(e){}return i.length?i:""+n}([(new Date).getTime(),navigator.userAgent,navigator.plugins,navigator.language,Math.random()],3));function y(e){var n,t=e?36:32,i="0123456789abcdef".split(""),r=[];e&&(r[8]=r[13]=r[18]=r[23]="-",r[14]="4");for(var o=0;o<t;o++)r[o]||(n=0|16*S.fract53(),r[o]=i[19===o?3&n|8:n]);return r.join("")}function b(){return function(){try{localStorage.getItem(g)||localStorage.setItem(g,y(1))}catch(e){}}(),function(){try{return localStorage.getItem(g)||""}catch(e){return""}}()}function I(){return function(){try{sessionStorage.getItem(_)||sessionStorage.setItem(_,y(1))}catch(e){}}(),function(){try{return sessionStorage.getItem(_)||""}catch(e){return""}}()}function k(e){return!!e&&/^[A-Fa-f0-9]{64}$/.test(e)}function E(e){return e&&36===e.length&&/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function L(){try{return window.self!==window.top}catch(e){return!0}}var A=!("addEventListener"in document);function N(e,n,t){t&&(A?e.attachEvent(n,t):e.addEventListener(n,t,!1))}function x(){if(L())try{return window.top.location.href}catch(e){try{return window.document.referrer}catch(e){return window.location.href}}return window.location.href}function C(){var e=document.createElement("iframe"),n=function(){var e=O();for(;null!=document.getElementById(e);)e=O();return e}();return e.id=n,e.name=n,e}function O(){return"snap"+Math.random().toString().replace(".","")}var T=function(){var e=x().match(/[&|\?]ScCid=([0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[1-5][0-9A-Fa-f]{3}-[89ab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12})(&|$)/);if(e)return e[1].toLowerCase()}();function D(n){if("object"==typeof n&&n){var t=I();!n.u_scsid&&t&&(n.u_scsid=t);var i=b();!n.u_sclid&&i&&(n.u_sclid=b()),n.s_r_id?n.s_r_ids=e.JS_BRIDGE:T?(n.s_r_id=T,n.s_r_ids=e.CLICK_ID):n.s_r_ids=e.UNSET}}var P,B=new(function(){function e(){}return e.prototype.sendForm=function(e,n,t,i,r){var o=C(),a=document.createElement("form");a.method=e,a.action=n,a.target=o.id,a.acceptCharset="utf-8",a.style.cssText="display: none",a.appendChild(o);var c=function(){!function(e,n,t){t&&(A?e.detachEvent(n,t):e.removeEventListener(n,t,!1))}(o,"load",c),D(t),Object.keys(t).forEach((function(e){if(t[e]){var n=document.createElement("input");n.name=e,n.value=t[e],a.appendChild(n)}})),N(o,"load",(function(){null!=i&&i(),r||setTimeout((function(){a.parentNode&&a.parentNode.removeChild(a)}),0)})),a.submit()};return N(o,"load",c),document.body.appendChild(a),o},e.prototype.sendJSON=function(e,n,i,r){var o=new XMLHttpRequest;o.open(e,t+n),o.setRequestHeader("Content-Type","application/json;charset=UTF-8"),o.onload=function(){if(o.status>=200&&o.status<300){var e=void 0;try{e=JSON.parse(o.responseText)}catch(e){return void(r&&r(e))}r&&r(void 0,e)}},o.onerror=o.onabort=function(e){r&&r(e)},D(i),o.send(JSON.stringify(i))},e.prototype.sendBeacon=function(e,n){if(navigator.sendBeacon){D(n);var t=new FormData;Object.keys(n).forEach((function(e){n[e]&&t.append(e,n[e])}));try{navigator.sendBeacon(e,t)}catch(t){this.sendForm("POST",e,n)}}else this.sendForm("POST",e,n)},e}()),H=function(){return H=Object.assign||function(e){for(var n,t=1,i=arguments.length;t<i;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},H.apply(this,arguments)};!function(e){e[e.Loading=0]="Loading",e[e.NotNeeded=1]="NotNeeded",e[e.Ready=2]="Ready"}(P||(P={}));var R=function(){var e=this;this.getPixelIdConfigsByFilter=function(n){return e.initConfigFinished?e.initConfig.pixel_id_configs.filter(n).map((function(e){return e.pixel_id})):[]},this.setInitConfig=function(n){e.initConfig=n,e.initConfigFinished=!0},this.isInitCofigReady=function(){return e.initConfigFinished},this.getErrorLoggingPixelIds=function(){return e.getPixelIdConfigsByFilter((function(e){return e.error_log_enabled}))},this.shouldLogError=function(){return e.initConfigFinished&&100*Math.random()<e.initConfig.error_log_sample_rate&&e.getErrorLoggingPixelIds().length},this.extractInitInfo=function(n){Object.keys(n).forEach((function(t){var i=String(n[t]);i&&("u_em"===t||"user_email"===t?e.email=i.trim().toLowerCase():"u_hem"===t||"user_hashed_email"===t?e.hashedEmail=i.trim():"u_pn"===t||"user_phone_number"===t?e.phoneNumber=i.trim().replace(/[^\w]/gi,""):"u_hpn"===t||"user_hashed_phone_number"===t?e.hashedPhoneNumber=i.trim():"u_mai"===t||"user_mobile_ad_id"===t?e.mobileAdId=i.trim().toLowerCase():"u_hmai"===t||"user_hashed_mobile_ad_id"===t?e.hashedMobileAdId=i.trim():"u_pnid"===t||"partner_id"===t?e.partnerId=i.trim():"u_puid"===t||"user_partner_uid"===t?e.userPartnerUid=i.trim():t in v&&(e.additionalInfo[v[t]]=i))}))},this.toRequestParams=function(){var n={};return e.hashedEmail&&(n.u_hem=e.hashedEmail),e.hashedEmailDomain&&(n.u_hed=e.hashedEmailDomain),e.hashedPhoneNumber&&(n.u_hpn=e.hashedPhoneNumber),e.hashedMobileAdId&&(n.u_hmai=e.hashedMobileAdId),e.scut&&(n.u_scut=e.scut),e.userPartnerUid&&(n.u_puid=e.userPartnerUid),e.partnerId&&(n.u_pnid=e.partnerId),e.cookie1&&(n.u_c1=e.cookie1),e.srid&&(n.s_r_id=e.srid),H(H({},n),e.additionalInfo)},this.pixelIdList=[],this.hashState=P.NotNeeded,this.cookieSynced=!0,this.cookieSyncInProgress=!1,this.initConfigFinished=!1,this.additionalInfo={},this.initConfig={pixel_id_configs:[],error_log_sample_rate:0}};window.snaptrContext||(window.snaptrContext=new R);var j=window.snaptrContext,F=function(e,n,t,i){if(!(e<0))if(j.isInitCofigReady()){if(!j.shouldLogError())return;M(n,t,i)}else setTimeout((function(){F(e-10,n,t,i)}),10)},U=function(e,n,t){F(5e3,e,n,t)},M=function(e,n,t){var i={name:e,message:n,domain:window.location.hostname,userAgent:navigator.userAgent,pixelIds:j.getErrorLoggingPixelIds().join()||j.pixelIdList.join(),bt:l,stack:t};if(navigator.sendBeacon){var r=new FormData;for(var o in i)i[o]&&r.append(o,i[o]);navigator.sendBeacon(c,r)}else B.sendForm("POST",c,i)};function q(){function e(e){return e&&e.performance?e.performance:null}var n=!1,t=null;try{(t=e(window.top))||(t=e(window),n=!0)}catch(i){t=e(window),n=!0}return[t,n]}var J=q()[0],G=function(e){if(e){var n=e.getEntriesByType("navigation");if(n&&n.length>0)return n[0]}return null}(J),X=function(e){if(e){var n=e.getEntriesByType("paint").filter((function(e){return"first-contentful-paint"===e.name}));if(n&&n.length>0)return n[0]}return null}(J),z=q()[1],Y=!!(J&&J.mark&&J.getEntriesByName&&(J.timing||G)&&J.now);function Z(e){if(Y){var t=function(e){if(!Y)return null;var n=null==J?void 0:J.getEntriesByName(e);if(n&&n.length>0)return n[n.length-1];return null}(n);t&&(e.m_sl=Math.floor(t.startTime)),J&&(e.m_rd=Math.floor(J.now())),e.m_pi=G?G.domInteractive:(null==J?void 0:J.timing)?J.timing.domInteractive-J.timing.navigationStart:0,e.m_dcl=G?G.domContentLoadedEventEnd:0,e.m_fcps=X?X.startTime:0,e.m_pl=G?G.loadEventEnd:(null==J?void 0:J.timing)?J.timing.loadEventEnd-J.timing.navigationStart:0,e.m_ic=+z,e.m_pv=G?"v2":(null==J?void 0:J.timing)?"v1":"n/a";var i,r=(i=new URL(x()),new URLSearchParams(i.search).get("sc_wbt"));r&&(e.m_wbt=r)}}function $(){var e=W(h);if(null==e||!E(e)){e=y(1);var n=new Date;n.setTime(n.getTime()+m),K(h,e,n.toUTCString())}j.cookie1=e}function W(e){for(var n=e+"=",t=document.cookie.split(";"),i=t.length-1;i>=0;--i){for(var r=t[i];" "===r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(n))return r.substring(n.length,r.length)}return null}function K(e,n,t,i,r){var o=function(){for(var e="_schn=_"+(Math.random()+1).toString(36).substring(6),n=(document.domain||document.location.hostname).split("."),t="",i=n.length-1;i>=0;i--)if(t="."+n[i]+t,document.cookie=e+";domain="+t+";SameSite=Lax",document.cookie.indexOf(e)>-1)return document.cookie=e.split("=")[0]+"=;domain="+t+";expires=Thu, 01 Jan 1970 00:00:01 GMT;SameSite=Lax",t;return null}();document.cookie=e+"="+n+";"+(null==o?"":"domain="+o+";")+(null==t?"":"expires="+t+";")+(null==i?"path=/;":"path="+i+";")+"SameSite=Lax"+(r?"; Secure":"")}function Q(){try{$();var e={jsrid:y(1),c1:j.cookie1,siid:j.srid?j.srid:"",pids:j.pixelIdList?j.pixelIdList.join(","):"",u_scsid:I(),u_sclid:b()};B.sendForm("GET",o,e)}catch(e){U("cookie_sync_error","cookie sync error: ".concat(e.message),e.stack)}}function V(e){var n=[],t=null==e?void 0:e.sync_modes;if(t){for(var i=0;i<t.length;i++){var r={bt:l,pnid:t[i],cb:(new Date).valueOf()};n.push(B.sendForm("GET",a,r))}ee(n)}}function ee(e){for(var n=0;n<e.length;n++){var t=document.getElementById(e[n].id);if(null!=t&&"complete"!==t.readyState)return void setTimeout((function(){ee(e)}),10)}try{window.parent.postMessage(p,document.referrer)}catch(e){U("cookie_sync_error","postMessage ".concat(p," error: ").concat(e.message),e.stack)}}function ne(){var e=navigator.userAgent.toLowerCase(),n=-1!==e.indexOf("iphone"),t=-1!==e.indexOf("ipad"),i=-1!==e.indexOf("ipod"),r=n||t||i;return-1!==e.indexOf("snapchat")&&r}function te(){var e=navigator.userAgent.toLowerCase();return-1!==e.indexOf("snapchat")&&-1!==e.indexOf("android")}var ie,re={B:"1",F:"1",P:"1",V:"1",C:"2",G:"2",J:"2",K:"2",Q:"2",S:"2",X:"2",Z:"2",D:"3",T:"3",L:"4",M:"5",N:"5",R:"6",W:"7",H:"7",A:"8",E:"8",I:"8",O:"8",U:"8",Y:"8"},oe=/[^A-Z]/g,ae=function(e){var n,t,i,r;if(0===(e=e.toUpperCase().replace(oe,"")).length)return"";for(var o=e[0],a="",c=1;c<e.length;c++){var s=e[c],d=null!==(n=re[s])&&void 0!==n?n:"";if(d===a?d="":a=d,"7"!==d&&"8"!==d||(d=""),4===(o+=d).length)break}return o[0]+(null!==(t=o[1])&&void 0!==t?t:"0")+(null!==(i=o[2])&&void 0!==i?i:"0")+(null!==(r=o[3])&&void 0!==r?r:"0")};function ce(e){var n=window.crypto||window.msCrypto;n&&n.subtle&&window.TextEncoder?function(e){var n=[];if(j.email){n.push(ue(j.email).then((function(e){j.hashedEmail=e})));var t="string"==typeof j.email&&j.email.split("@")[1];t&&n.push(ue(t).then((function(e){j.hashedEmailDomain=e})))}j.phoneNumber&&n.push(ue(j.phoneNumber).then((function(e){j.hashedPhoneNumber=e})));j.mobileAdId&&n.push(ue(j.mobileAdId).then((function(e){j.hashedMobileAdId=e})));Promise.all(n).then((function(){le(e)})).catch((function(){se(e)}))}(e):se(e)}function se(e){var n=document.createElement("script");n.async=!0,n.src="https://sc-static.net/js-sha256-v1.min.js","integrity"in n&&"crossOrigin"in n&&(n.integrity="sha384-W4RqaNUbvBdTRc41QQAWDcd2aX9wGruak2WnlXwyjVAlhi56zatCk4e/RSqwrAg6",n.crossOrigin="anonymous");var t=document.getElementsByTagName("script")[0];t&&t.parentNode&&t.parentNode.insertBefore(n,t),"addEventListener"in document?n.addEventListener("load",(function(){return de(e)}),!1):n.attachEvent("load",(function(){return de(e)}))}function de(e){!function(){var e=(new window.scpixel.Hashes.SHA256).hex;if(j.email){j.hashedEmail=e(j.email);var n="string"==typeof j.email&&j.email.split("@")[1];n&&(j.hashedEmailDomain=e(n))}j.phoneNumber&&(j.hashedPhoneNumber=e(j.phoneNumber));j.mobileAdId&&(j.hashedMobileAdId=e(j.mobileAdId))}(),le(e)}function ue(e){var n=(new TextEncoder).encode(e);return crypto.subtle.digest("SHA-256",n).then((function(e){return function(e){for(var n=[],t=new DataView(e),i=0;i<t.byteLength;i+=4){var r="00000000",o=(r+t.getUint32(i).toString(16)).slice(-r.length);n.push(o)}return n.join("")}(e)}))}function le(e){var n;j.email&&k(j.email)&&(j.hashedEmail=j.email),!j.email||k(j.email)||(n=j.email,/^[^@]+@[^@]+$/.test(n))||(j.hashedEmail="FFF"+j.hashedEmail),j.mobileAdId&&!E(j.mobileAdId)&&(j.hashedMobileAdId="FFF"+j.hashedMobileAdId),e()}function fe(e,n){var t,r,o,a=e[0];if(a)if(E(a))if(-1===j.pixelIdList.indexOf(a)&&j.pixelIdList.push(a),function(){if(j.pixelIdList&&j.pixelIdList.length&&window.fetch){var e=j.pixelIdList.join();fetch("".concat(s,"?pids=").concat(e)).then((function(e){return e.text()})).then((function(n){try{var t=JSON.parse(n);"object"==typeof t&&j.setInitConfig(t)}catch(t){M("init_error","init config parsing error: ".concat(t.message,", ").concat(e,", ").concat(n),t.stack)}})).catch((function(e){M("init_error","init config networking error: ".concat(e.message),e.stack)}))}}(),function(){if(j.pixelIdList&&j.pixelIdList.length&&window.fetch){var e=location.hostname.split(".").pop(),n=j.pixelIdList.join();fetch("".concat(i,"/collector/is_enabled?pids=").concat(n,"&tld=").concat(e)).then((function(e){return e.text()})).then((function(e){try{var t=JSON.parse(e),r=t&&Object.keys(t).some((function(e){return!0===t[e]})),o=[];if(t&&t.ipg){var a=t.ipg;o.push.apply(o,a.split(","))}if(t&&t.t){var c=t.t;o.push.apply(o,c.split(","))}if(r){!function(e){function n(e){return"password"===e.type||"hidden"===e.type}document.addEventListener("submit",(function(t){if(t.target instanceof HTMLElement){var r=t.target.querySelectorAll("input"),o=[],a=[],c=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,s=/^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/im,d=/^0+|\D/g;if(r.forEach((function(t){var i=t.value&&t.value.trim();!n(t)&&i.match(c)&&o.push(i.toLowerCase()),!n(t)&&i.match(s)&&("+"!=i.trim()[0]?(e.forEach((function(e){return a.push(("+"+e+i).replace(d,""))})),a.push(("+1"+i).replace(d,""))):a.push(i.replace(d,"")))})),(o.length||a.length)&&window.crypto&&crypto.subtle&&window.TextEncoder){var u=o.map((function(e){return ue(e)})),l=Promise.all(u),f=a.map((function(e){return ue(e)})),p=Promise.all(f);Promise.all([l,p]).then((function(e){var n=e[0],t=e[1],r=new FormData;r.append("pids",j.pixelIdList.join()),n.length&&r.append("u_hems",n.join()),t.length&&r.append("u_hpns",t.join()),j.cookie1&&r.append("u_c1",j.cookie1),navigator.sendBeacon&&navigator.sendBeacon("".concat(i,"/collector/prep_mapping"),r)})).catch((function(e){U("signal_collector_error","Signal collector error: ".concat(e.message),e.stack)}))}}}))}(o);var s=t.asc_rules,d=void 0!==s&&s;d&&function(e){e.forEach((function(e){var n,t=e.ev,r=e.watch_el,o=e.val_el;(n=r,new Promise((function(e){if(document.querySelector(n))return e(document.querySelector(n));if(MutationObserver){var t=new MutationObserver((function(i){document.querySelector(n)&&(e(document.querySelector(n)),t.disconnect())}));t.observe(document.body,{childList:!0,subtree:!0})}}))).then((function(){document.querySelector(r).addEventListener(t,(function(){var e=o.reduce((function(e,n){var t=n[0],i=n[1],r=document.querySelector(t);if(!(r instanceof HTMLInputElement))return U("signal_collector_error","Unable to retreive value from ".concat(t," for ").concat(i)),e;var o=r.value;if(!o)return e;if(pe.has(i)){if(pe.get(i)===ie.SOUNDEX_AND_SHA){var a=i.replace("_","_s");e.push(Promise.resolve([a,ae(o)]))}var c=i.replace("_","_h");e.push(new Promise((function(e){ue(o).then((function(n){e([c,n])}))})))}else U("signal_collector_error","Unknown key:; ".concat(i)),e.push(new Promise((function(e){ue(o).then((function(n){e([i,n])}))})));return e}),[]);Promise.all(e).then((function(e){var n=new FormData,t=e.reduce((function(e,n){var t=n[0],i=n[1];return e.set(t,(e.has(t)?e.get(t)+",":"")+i),e}),new Map);Array.from(t.entries()).forEach((function(e){var t=e[0],i=e[1];n.append(t,i)})),navigator.sendBeacon&&navigator.sendBeacon("".concat(i,"/collector/prep_mapping"),n)}))}))}))}))}(d)}}catch(t){U("signal_collector_error","Signal collector config parsing error: ".concat(t.message,",, ").concat(n,", ").concat(e),t.stack)}})).catch((function(e){U("signal_collector_error","Signal collector config networking error: ".concat(e.message),e.stack)}))}}(),o=function(e){if(null===e)return null;var n=e.split("|");return n.length<2?null:n[1].split(",")}(W(f)),null===(r=null===o||o.length<1?null:+o[0])||(new Date).valueOf()-r>6048e5)if(j.cookieSyncInProgress)g(0,n);else{j.cookieSynced=!1,j.cookieSyncInProgress=!0;var c=null===(t=e[1])||void 0===t?void 0:t.sync_modes,d={pid:a,sync_modes:Array.isArray(c)?c.join(","):void 0},l=B.sendForm("GET",u,d,void 0,!0),h=function(e){var n,t,r;if((n=i+"/",t=e.origin+"/",null!=n&&null!=t&&n.substr(!r||r<0?0:+r,t.length)===t)&&e.data===p){try{var o=new Date;o.setHours(0,0,0,0);var a=new Date;a.setTime(a.getTime()+m);var c="1|"+o.valueOf();K(f,c,a.toUTCString(),void 0,!1)}catch(e){U("cookie_sync_error","possCookieSync error: ".concat(e.message),e.stack)}j.cookieSynced=!0,j.cookieSyncInProgress=!1;var s=l.parentNode;s&&s.parentNode&&s.parentNode.removeChild(s)}};window.addEventListener?window.addEventListener("message",h):window.attachEvent("message",h),g(0,n)}else ge(e,n);else U("invalid_params","Invalid pixel id in Init:".concat(a));function g(n,t){if(j.cookieSynced||n<0)return j.cookieSynced=!0,void ge(e,t);setTimeout((function(){g(n-10,t)}),10)}}!function(e){e[e.SHA_ONLY=0]="SHA_ONLY",e[e.SOUNDEX_AND_SHA=1]="SOUNDEX_AND_SHA"}(ie||(ie={}));var pe=new Map([["u_fn",ie.SOUNDEX_AND_SHA],["u_mn",ie.SOUNDEX_AND_SHA],["u_ln",ie.SOUNDEX_AND_SHA],["l_c",ie.SOUNDEX_AND_SHA],["l_s",ie.SOUNDEX_AND_SHA],["l_r",ie.SHA_ONLY],["l_z",ie.SHA_ONLY],["u_dobm",ie.SHA_ONLY],["u_dobd",ie.SHA_ONLY],["u_ems",ie.SHA_ONLY],["u_pns",ie.SHA_ONLY]]);function me(e,n){var t;!function(){$(),j.scut=he(d,window.location.search.substring(1)),j.scut&&K("snaptr-scut",j.scut);if(!j.scut){var e=document.referrer||"",n=e.indexOf("?");n>=0&&(j.scut=he(d,e.substring(n+1)),j.scut&&K("snaptr-scut",j.scut))}if(!j.scut){var t=W("snaptr-scut");t&&(j.scut=t)}}(),(null===(t=e[1])||void 0===t?void 0:t.constructor)===Object&&(j.extractInitInfo(e[1]),j.hashState=P.Loading,ce((function(){j.hashState=P.Ready,n()})))}function he(e,n){for(var t=n.split("&"),i=0;i<t.length;i++){var r=t[i].split("=");if(r[0]===e)return r[1]}}function ge(e,n){me(e,n),(te()||ne())&&Q(),n()}function _e(e,n,i){if(E(e)){var o={trackId:y(1),pid:e,ev:n,pl:x(),ts:(new Date).valueOf(),rf:document.referrer,v:"1.6.0",if:L(),bt:l};if(i){var a=i;Object.keys(a).forEach((function(e){v[e]&&(o[v[e]]=a[e])}))}!function(e){try{Z(e)}catch(e){U("perf_metric_error","populate perf metrics error: ".concat(e.message),e.stack)}}(o);var c=j.toRequestParams(),s=H(H({},o),c);window.snaptr.sendPixelByGTM?(D(s),window.snaptr.sendPixelByGTM(r+function(e){var n=e?Object.keys(e).map((function(n){return n+"="+encodeURIComponent(e[n])})).join("&"):"";n&&(n="?"+n);return n}(s),ve,ve)):t.indexOf("/")>-1?B.sendJSON("POST","/gateway/p",s):B.sendBeacon(r,s)}else U("invalid_params","Invalid pixel id in sendPixelRequest:".concat(e))}function ve(){}try{Y&&(null==J||J.mark(n)),window.triedToSendCookieToNative=!1,function(){var e=function(){try{return window.sessionStorage&&window.sessionStorage.getItem("srid")}catch(e){return null}}();if(e)j.srid=e;else{window.WebJSBridge={setSRID:function(e){j.srid=e;try{window.sessionStorage&&window.sessionStorage.setItem("srid",e)}catch(e){}Q()}};try{te()?window.JSBridge&&window.JSBridge.getSRID?window.JSBridge.getSRID():U("native_bridge_error","Snap android bridge missing. JSBridge defined: ".concat(void 0!==window.JSBridge)):ne()&&(window.webkit&&window.webkit.messageHandlers.getSRID?window.webkit.messageHandlers.getSRID.postMessage({placeholder:"placeholder"}):U("native_bridge_error","Snap ios bridge missing. window.webkit defined: ".concat(void 0!==window.webkit)))}catch(e){U("native_bridge_error","getSRIDFromNative error: ".concat(e.message),e.stack)}}}(),window.snaptr.handleRequest=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];window.snaptr.queue.push(e),Se()},window.snaptr.clean=Se,function(e){var n=!1;function t(){n||(n=!0,e())}if("complete"===document.readyState)return void t();if("interactive"===document.readyState)return void setTimeout(t,0);if(document.addEventListener)document.addEventListener("load",t,!1);else if(document.attachEvent){var i=null!=window.frameElement;if(document.documentElement.scroll&&!i){var r=function(){if(!n)try{document.documentElement.scroll({left:0}),t()}catch(e){setTimeout(r,10)}};r()}document.attachEvent("onreadystatechange",(function(){"complete"===document.readyState&&t()}))}window.addEventListener?window.addEventListener("load",t,!1):window.attachEvent&&window.attachEvent("onload",t)}(Se)}catch(e){M("boot_error","Initialization error: ".concat(e.message),e.stack)}function we(e){var n=Array.prototype.slice.call(e),t=n.shift();switch(t&&t.toLowerCase&&(t=t.toLowerCase()),t){case"init":fe(n,(function(){Se()}));break;case"track":!function(e){if(j.pixelIdList&&j.pixelIdList.length>0){if("string"==typeof e[0])switch(1===e.length&&(e=[e[0],{}]),e.length){case 2:if("string"==typeof e[1]){if(!E(o=e[0]))return;var n=e[1];-1!==j.pixelIdList.indexOf(o)?_e(o,n):U("invalid_params","Invalid pixel id: ".concat(o))}else for(var t=e[0],i=e[1],r=0;r<j.pixelIdList.length;r++)_e(j.pixelIdList[r],t,i);break;case 3:var o;if(!E(o=e[0]))return;var a=e[1];i=e[2],-1!==j.pixelIdList.indexOf(o)?_e(o,a,i):U("invalid_params","Invalid pixel id: ".concat(o));break;default:U("invalid_params","Invalid track parameters: ".concat(e))}}else U("invalid_params","Invalid pixel id in formatQueryForTrack: ".concat(j.pixelIdList))}(n);break;case"autofill":!function(e){!function(e){if(window.snaptr.responseUserInfo=function(n){null==e||e.onComplete(JSON.parse(n))},window.webkit&&window.webkit.messageHandlers.SnapchatUserInfoProvider){var n={request_fields:null==e?void 0:e.fields,js_callback:"snaptr.responseUserInfo"};window.webkit.messageHandlers.SnapchatUserInfoProvider.postMessage(JSON.stringify(n))}else if(null==e?void 0:e.fields){for(var t=0;t<(null==e?void 0:e.fields.length);t++)e.fields[t]=e.fields[t].concat("=");e.fields.push("js_callback=snaptr.responseUserInfo");var i=e.fields.join("&"),r=window.location.protocol+"//"+window.location.host+"/snapchat/userInfoRequest?"+i,o=new XMLHttpRequest;o.open("GET",r,!1),o.send(null)}}(e[0])}(n);break;case"immersive_mode":!function(e){!function(e){if(window.snaptr.responseDidLaunchNativeSharing=function(n){null==e||e.onComplete(n)},window.webkit&&window.webkit.messageHandlers.SnapchatUserInfoProvider)window.webkit.messageHandlers.SnapchatUserInfoProvider.postMessage(JSON.stringify({action:"request_native_sharing",js_callback:"snaptr.responseDidLaunchNativeSharing"}));else{var n=window.location.protocol+"//"+window.location.host+"/snapchat/nativeSharingRequest?action=request_native_sharing&js_callback=snaptr.responseDidLaunchNativeSharing",t=new XMLHttpRequest;t.open("GET",n,!1),t.send(null)}}(e[0])}(n);break;case"cm":!function(e){V(e[0])}(n);break;default:U("invalid_params","Request parsing failed")}}function Se(){window.triedToSendCookieToNative||(!function(){try{if(te()||ne()){$();var e=j.cookie1;e&&te()?window.JSBridge&&window.JSBridge.onCookieId?window.JSBridge.onCookieId(e):U("native_bridge_error","Snap android bridge missing. JSBridge defined: ".concat(void 0!==window.JSBridge)):e&&ne()&&(window.webkit&&window.webkit.messageHandlers.onCookieId?window.webkit.messageHandlers.onCookieId.postMessage({firstPartyCookie:e}):U("native_bridge_error","Snap ios bridge missing. window.webkit defined: ".concat(void 0!==window.webkit)))}}catch(e){U("native_bridge_error","passCookie1ToNative failed. error: ".concat(e.message),e.stack)}}(),window.triedToSendCookieToNative=!0),function e(n){if(window.snaptr.queue&&window.snaptr.queue.length)if(j.cookieSynced&&j.hashState!==P.Loading||n<0){var t=window.snaptr.queue.shift();try{we(t)}catch(e){U("queue_error","clean queue error: ".concat(e.message),e.stack)}window.snaptr.queue.length>0&&Se()}else setTimeout((function(){e(n-10)}),10)}(1e4)}}(); |