!function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var r={};e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=10)}([function(t,e,r){"use strict";function n(){return i}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(){}return t.prototype.cookie=function(){return document.cookie},t.prototype.setCookie=function(t){document.cookie=t},t.prototype.body=function(){return document.body},t.prototype.referrer=function(){return document.referrer},t.prototype.title=function(){return document.title},t.prototype.createElement=function(t){return document.createElement(t)},t.prototype.dispatchEvent=function(t){return document.dispatchEvent(t)},t.prototype.querySelector=function(t){return document.querySelector(t)},t.prototype.querySelectorAll=function(t){return document.querySelectorAll(t)},t.prototype.documentElement=function(){return document.documentElement},t.prototype.getElementsByTagName=function(t){return document.getElementsByTagName(t)},t.prototype.createCustomEvent=function(t,e){try{return new CustomEvent(t,e)}catch(n){var r=document.createEvent("CustomEvent");return r.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),r}},t}(),i=new o;e.virtualDocument=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(e,r){this.options={},this.options=t.merge(e,r)}return t.merge=function(t,e){var r={};for(var n in t)r[n]=t[n];for(var n in e)r[n]=e[n];return r},t.flatten=function(e){var r=t.merge(e,{});return r.properties={},t.merge(r,e.properties)},t.isEqual=function(t,e){for(var r in t)if(t[r]!==e[r])return!1;for(var r in e)if(e[r]!==t[r])return!1;return!0},t}();e.Integration=n},function(t,e,r){"use strict";function n(){return m.virtualWindow().location().hash}function o(){return m.virtualWindow().location().host}function i(){return m.virtualWindow().location().hostname}function a(){return m.virtualWindow().location().href}function c(t){m.virtualWindow().location().href=t}function u(){var t=m.virtualWindow().location();return t.origin?t.origin:t.protocol+"//"+t.hostname+(t.port?":"+t.port:"")}function s(){return m.virtualWindow().location().pathname}function p(){return m.virtualWindow().location().port}function d(){return m.virtualWindow().location().protocol}function f(){return m.virtualWindow().location().search}function l(t){return t=t||i(),null!==t.match(/(^|\.)shopify\.com$/)}Object.defineProperty(e,"__esModule",{value:!0});var m=r(3);e.hash=n,e.host=o,e.hostname=i,e.href=a,e.setHref=c,e.origin=u,e.pathname=s,e.port=p,e.protocol=d,e.search=f,e.isShopifyDotCom=l},function(t,e,r){"use strict";function n(){return i}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t){this.nativeWindow=t}return t.prototype.location=function(){return this.nativeWindow.location},t.prototype.userAgent=function(){return this.nativeWindow.navigator.userAgent},t.prototype.crypto=function(){return this.nativeWindow.crypto||this.nativeWindow.msCrypto},t.prototype.top=function(){return this.nativeWindow.top?new t(this.nativeWindow.top):void 0},t.prototype.parent=function(){return this.nativeWindow.parent?new t(this.nativeWindow.parent):void 0},t.prototype.postMessage=function(t,e,r){this.nativeWindow.postMessage(t,e,r)},t.prototype.addEventListener=function(t,e,r){this.nativeWindow.addEventListener(t,e,r)},t.prototype.performance=function(){return this.nativeWindow.performance},t}(),i=new o(window);e.virtualWindow=n},function(t,e,r){"use strict";function n(t,r,n,o){return o=o||e.requestImpl.base(),"/"!==o[o.length-1]&&(o+="/"),e.requestImpl.img(o+t+"/"+r+"?"+e.requestImpl.queryString(n))}function o(t){c=t}function i(t,e){return n("internal_errors","page",{name:t.name,line:t.lineNumber||t.line,script:t.fileName||t.sourceURL||t.script,stack:t.stackTrace||t.stack||t.description,message:t.message,url:a.href(),context:void 0!==e?e:null,appConfig:c||null})}Object.defineProperty(e,"__esModule",{value:!0});var a=r(2);e.requestImpl={base:function(){return"https://v.shopify.com/"},img:function(t){var e=new Image(1,1);return e.src=t,e.style.display="none",e},queryString:function(t){var e=[];for(var r in t)("number"==typeof t[r]||t[r])&&("object"==typeof t[r]&&0===Object.keys(t[r]).length||e.push(encodeURIComponent(r)+"="+encodeURIComponent(t[r])));if(function(t){for(var e=t.length;e>0;--e){var r=Math.floor(Math.random()*e),n=t[r];t[r]=t[e-1],t[e-1]=n}}(e),e.length>1&&0===e[0].indexOf("event=")){var n=e[0];e[0]=e[1],e[1]=n}return e.join("&")}},e.load=n;var c=void 0;e.setGlobalSerializedAppConfig=o,e.internalError=i},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i={viewedProduct:/^[ _]?viewed[ _]?product[ _]?$/i,viewedProductCategory:/^[ _]?viewed[ _]?product[ _]?category[ _]?$/i,viewedProductVariant:/^[ _]?viewed[ _]?product[ _]?variant[ _]?$/i,addedProduct:/^[ _]?added[ _]?product[ _]?$/i,completedOrder:/^[ _]?completed[ _]?order[ _]?$/i,startedOrder:/^[ _]?started[ _]?order[ _]?$/i,performedSearch:/^[ _]?performed[ _]?search[ _]?$/i,addedPayment:/^[ _]?added[ _]?payment[ _]?$/i},a=function(t){function e(e,r){var n=t.call(this,e,r)||this;return n.wrapTrack(),n}return n(e,t),e.prototype.wrapTrack=function(){var t=this.track;this.track=function(e){var r=e.event,n=!1;for(var o in i){var a=i[o];if(this[o]&&a.test(r)){this[o].apply(this,[e]),n=!0;break}}n||t.apply(this,Array.prototype.slice.call(arguments))}},e}(o.Integration);e.EcommerceIntegration=a},function(t,e,r){"use strict";function n(){return e.cookieImpl.enabled()}function o(t){return e.cookieImpl.read(t)}function i(t,r,n){void 0===n&&(n={}),a(t,r,n.permanent,e.shopifyCookie.domain(u.hostname())),a(t,r,n.permanent,d),a(t,r,n.permanent,n.domain),a(t,r,n.permanent,"")}function a(t,r,n,o){var i={maxage:n?p:s,domain:o,path:"/"};e.cookieImpl.write(t,r,i)}Object.defineProperty(e,"__esModule",{value:!0});var c=r(0),u=r(2),s=18e5,p=62208e6,d=".myshopify.com";e.cookieImpl={parse:function(t){for(var e={},r=0,n=t.split(/ *; */);r0?t.slice(e-1):".shopify.com"}}},function(t,e,r){"use strict";function n(){return!1}Object.defineProperty(e,"__esModule",{value:!0}),e.exportVar="trekkie",e.shouldPerformXtldExchange=n,e.enabledIntegrations=[];var o=r(14);e.enabledIntegrations.push(["Performance",o.Performance]);var i=r(15);e.enabledIntegrations.push(["Facebook Pixel",i.FacebookPixel]);var a=r(16);e.enabledIntegrations.push(["Google Analytics",a.GoogleAnalytics]);var c=r(17);e.enabledIntegrations.push(["Clickstream",c.Clickstream]);var u=r(21);e.enabledIntegrations.push(["Pinterest Pixel",u.Pinterest]);var s=r(22);e.enabledIntegrations.push(["Session Attribution",s.SessionAttribution]);var p=r(23);e.enabledIntegrations.push(["Google Gtag Pixel",p.GoogleGtag])},function(t,e,r){"use strict";function n(){return!!p.read(e.shortTermKey)||!!p.read(e.deprecatedShortTermKey)}function o(){return!!p.read(e.longTermKey)||!!p.read(e.deprecatedLongTermKey)}function i(){return m.fetchOrSet(!1,e.deprecatedShortTermKey,e.shortTermKey)[0]}function a(){return m.fetchOrSet(!0,e.deprecatedLongTermKey,e.longTermKey)}function c(){return m.build()}function u(){return h.fetchOrSet(e.firstSeenKey)}function s(){return m.hexTime()}Object.defineProperty(e,"__esModule",{value:!0});var p=r(6),d=r(3);e.deprecatedShortTermKey="_s",e.shortTermKey="_shopify_s",e.deprecatedLongTermKey="_y",e.longTermKey="_shopify_y",e.firstSeenKey="_shopify_fs";var f="00000000",l="xxxx-4xxx-xxxx-xxxxxxxxxxxx",m={fetch:function(t){return p.read(t)},fetchOrSet:function(t,e,r){if(!p.enabled())return["00000000-0000-0000-4000-000000000000",!1];var n=m.fetch(r)||m.fetch(e),o=!1;n||(n=m.build(),o=!0);var i={permanent:t};return p.write(e,n,i),p.write(r,n,i),[n,o]},build:function(){var t="";try{var e=d.virtualWindow().crypto(),r=new Uint16Array(31);e.getRandomValues(r);var n=0;t=l.replace(/[x]/g,function(t){for(var e=[],o=1;o>>0}catch(e){t=(new Date).getTime()>>>0}try{e=performance.now()>>>0}catch(t){e=0}var r=Math.abs(t+e).toString(16).toLowerCase();return f.substr(0,8-r.length)+r}},h={fetch:function(t){return p.read(t)},fetchOrSet:function(t){var e=h.fetch(t)||(new Date).toJSON(),r={permanent:!0};return p.write(t,e,r),e}};e.hasShortTerm=n,e.hasLongTerm=o,e.shortTerm=i,e.longTerm=a,e.buildToken=c,e.firstSeen=u,e.hexTime=s},function(t,e,r){"use strict";function n(t){var e=a.virtualDocument().createElement("script");return e.src=t.src,e.async=!0,i(e,t),a.virtualDocument().body().appendChild(e),e}function o(t){var e=a.virtualDocument().createElement("iframe");return e.src=t.src,e.style.display="none",i(e,t),a.virtualDocument().body().appendChild(e),e}function i(t,e){if(e.onLoad&&t.addEventListener("load",e.onLoad,!1),e.className){if(/^\d/.test(e.className))throw new Error("Invalid className: "+e.className+" starts with a digit");t.className=e.className}}Object.defineProperty(e,"__esModule",{value:!0});var a=r(0);e.script=n,e.iframe=o},function(t,e,r){"use strict";function n(t,e){for(var r=0,n=e;r0?t:t+u.search();var e=u.href(),r=e.indexOf("#");return-1===r?e:e.slice(0,r)},t}();e.Tricorder=p},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),i=r(4),a=r(8),c=r(13),u=r(3),s=r(0),p=r(7),d=r(2),f=r(24),l=r(6),m=function(t){function e(e,r){var n=t.call(this,{},e)||this;return n.shouldPerformXtldExchange()?f.performXtldExchange(f.xtldImpl.frameSource(),function(t,o){t?(l.write(a.deprecatedLongTermKey,t,{permanent:!0}),l.write(a.longTermKey,t,{permanent:!0}),n.init(e,r)):i.internalError(o||"Cannot load xtld token")}):n.init(e,r),n}return n(e,t),e.prototype.shouldPerformXtldExchange=function(){return p.shouldPerformXtldExchange()&&!a.hasLongTerm()&&!d.isShopifyDotCom()},e.prototype.init=function(t,e){this.injectEmitFunc(t),this.initInstanceVars(t),"parent"===t.embedMode&&this.installFrameListener(),e()},e.prototype.injectEmitFunc=function(t){var e=t.development?"testing":t.appName;c.isBot()&&(e="bot-traffic"),this.emitEvent=function(r,n){t.endpointBase?i.load(e,r,n,t.endpointBase):i.load(e,r,n)}},e.prototype.initInstanceVars=function(t){var e="",r="",n="",i=!1;"iframe"!==t.embedMode&&(c=a.longTerm(),e=c[0],i=c[1],r=a.shortTerm(),n=a.firstSeen()),this.defaultAttributes={appName:t.appName,uniqToken:e,visitToken:r,microSessionId:a.buildToken(),microSessionCount:0,firstSeen:n},t.enableNewUserAttribute&&(this.defaultAttributes.newUser=i),t.defaultAttributes&&(this.defaultAttributes=o.Integration.merge(t.defaultAttributes,this.defaultAttributes));var c},e.prototype.identify=function(t){this.emit("identify",t)},e.prototype.page=function(t){e.isEqualPage(this.lastPage,t)||(this.lastPage=t,this.emit("page",t))},e.prototype.track=function(t){this.emit("track",t)},e.prototype.emit=function(t,e,r){void 0===r&&(r={});var n=this.options;r.microSessionCount||++this.defaultAttributes.microSessionCount,e=o.Integration.flatten(e);var a=o.Integration.merge(e,this.defaultAttributes);if(a.eventType=t,a=o.Integration.merge(a,r),"iframe"===n.embedMode&&n.embedParentOrigin)try{this.getEmbedParent().postMessage(JSON.stringify({event:"trekkie:emit:v1",payload:{requestType:t,args:a,overrideAttributes:{microSessionId:a.microSessionId,microSessionCount:a.microSessionCount}}}),n.embedParentOrigin)}catch(t){i.internalError(t)}else this.emitEvent(t,a)},e.prototype.installFrameListener=function(){var t=this;u.virtualWindow().addEventListener("message",function(e){t.handleEmbedEvent(e)})},e.prototype.handleEmbedEvent=function(t){function e(t){return null!==t.match(/(shopify.com|shopifyapps.com|myshopify.io|shopifycloud.com|oberlo.com)$/)}function r(t){return window.Shopify&&window.Shopify.EmbeddedApp&&window.Shopify.EmbeddedApp.instance()&&window.Shopify.EmbeddedApp.instance().origin===t}try{if(!t||!t.data)return;if(!e(t.origin)&&!r(t.origin))return;var n=JSON.parse(t.data);if(!n.event||!n.event.match(/^trekkie:/))return;if(!e(t.origin)&&r(t.origin)&&"trekkie:emit:v1"!==n.event)return;switch(n.event){case"trekkie:emit:v1":var o=n.payload;o&&o.requestType&&o.args&&this.emit(o.requestType,o.args,o.overrideAttributes);break;case"trekkie:customEvent:v1":var o=n.payload;o&&o.eventType&&s.virtualDocument().dispatchEvent(s.virtualDocument().createCustomEvent(o.eventType,o.data));break;case"trekkie:xtldToken:v1":case"trekkie:xtldLastShop:v1":break;default:!function(t,e){i.internalError(new Error,JSON.stringify(e))}(n.event,n)}}catch(e){"SyntaxError"!==e.name&&i.internalError(e,JSON.stringify(t))}},e.prototype.getEmbedParent=function(){return u.virtualWindow().top()||u.virtualWindow().parent()},e.isEqualPage=function(t,e){return t&&e&&t.path===e.path&&t.referrer===e.referrer&&t.search===e.search&&t.title===e.title&&t.url===e.url&&t.name===e.name&&o.Integration.isEqual(t.properties,e.properties)},e}(o.Integration);e.Trekkie=m},function(t,e,r){"use strict";function n(){for(var t=0,e=i;t=Math.random()&&(e.properties=o.Integration.merge(this.pagePerformance(),e.properties),this.trekkie.track(e))},e.prototype.track=function(t){},e.prototype.pagePerformance=function(){return(new c).collect()},e.defaultOptions={navigationTimingApiMeasurementsEnabled:!0,navigationTimingApiMeasurementsSampleRate:.001},e}(o.Integration);e.Performance=a;var c=function(){function t(){}return t.prototype.timing=function(){return!(!i.virtualWindow().performance()||!i.virtualWindow().performance().timing)&&i.virtualWindow().performance().timing},t.prototype.collect=function(){var e={},r=function(){for(var r=0,n=t.perfAttrs;r0&&setInterval(function(){t.flushClickEvents()},1e3*this.config.flushInterval)},e.prototype.flushClickEvents=function(){for(var t=0,e=this.clickQueue.all();t0?JSON.stringify(t.data):null,target_url:e.getAttribute("href"),target_form_input_type:this.isHTMLFormInputSubType(e)?e.type:null,target_form_action:this.isHTMLFormInputSubType(e)?this.getHTMLFormAction(e):null,target_form_relative_position:this.isHTMLFormInputSubType(e)?this.getFormRelativePosition(e):null}},e.prototype.resolveRawClickEvent=function(t){for(var e=t.target,r={clicked:e,resolved:void 0,data:{}};e;){!r.resolved&&this.shouldTrack(e)&&(r.resolved=e);for(var n=0,o=Array.prototype.slice.call(e.attributes);n=0;for(var r=0;r=0},e.prototype.getClassName=function(t){return"object"==typeof t.className?t.parentElement.getAttribute("class"):t.className},e.prototype.getTextLabelFromHTMLElement=function(t){switch(t.tagName.toLowerCase()){case"input":return this.config.safeInputSubTypes.indexOf(t.type)>-1?t.value:t.name;case"select":var e=t.options.selectedIndex;return e>-1?t.options[e].text:"No value chosen";case"textarea":return t.name||"";default:return this.getTargetText(t)||this.getTextLabelFromParentHTMLElement(t)}},e.prototype.getTextLabelFromParentHTMLElement=function(t){for(;t.parentNode;)if(t=t.parentNode,t.tagName&&-1!==this.config.validTargets.indexOf(t.tagName.toLowerCase()))return this.getTargetText(t)},e.prototype.getTargetText=function(t){var e=t.innerText||t.textContent;if(e)return this.dedupTargetText(e.replace(/\s+/g," ").trim())},e.prototype.dedupTargetText=function(t){if(-1===t.indexOf(" "))return t;var e={};return t.split(" ").filter(function(t){return!e.hasOwnProperty(t)&&(e[t]=!0)}).join(" ")},e.prototype.getHTMLFormAction=function(t){for(;t.parentNode;)if((t=t.parentNode)&&t.tagName&&"form"===t.tagName.toLowerCase()){var e=t.attributes.getNamedItem("action");if(e&&e.value)return e.value}return""},e.prototype.isHTMLFormInputSubType=function(t){return-1!==["input","select","textarea"].indexOf(t.tagName.toLowerCase())},e.prototype.getFormRelativePosition=function(t){switch(t.tagName.toLowerCase()){case"select":return t.options.selectedIndex;default:return null}},e}(o.Integration);e.Clickstream=p},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r(19),o=function(){function t(t){this.queue=[],this.storage=new n.LocalStorage(t);var e=this.storage.get();null!==e&&(this.queue=JSON.parse(e))}return t.prototype.push=function(t){this.queue.push(t),this.persist()},t.prototype.all=function(){return this.queue},t.prototype.clear=function(){this.queue=[],this.persist()},t.prototype.persist=function(){this.storage.set(JSON.stringify(this.queue))},t}();e.PersistedQueue=o},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t){this.storageName=t,this.storage=localStorage,this.storageEnabled=this.checkLocalStorageAvailability()}return t.prototype.get=function(){return this.storageEnabled?this.storage.getItem(this.storageName):null},t.prototype.set=function(t){this.storageEnabled&&this.storage.setItem(this.storageName,t)},t.prototype.checkLocalStorageAvailability=function(){try{return this.storage.setItem("test","ok"),this.storage.removeItem("test"),!0}catch(t){return(22===t.code||1014===t.code)&&(this.storage.clear(),!0)}},t}();e.LocalStorage=n},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e,r){this.trekkie=t,this.requestType=e,this.eventName=r}return t.prototype.push=function(t){this.trekkie.emit(this.requestType,{event:this.eventName,properties:t})},t.prototype.all=function(){return[]},t.prototype.clear=function(){},t}();e.PostingQueue=n},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=r(5),i=r(4),a=function(t){function e(r,n,o){var i=t.call(this,e.defaultOptions,r)||this;return o(),i}return n(e,t),e.prototype.identify=function(t){},e.prototype.page=function(t){},e.prototype.track=function(t){},e.prototype.completedOrder=function(t){var e=this.options;i.requestImpl.img("https://ct.pinterest.com/v2.5/?tid="+e.pixelId+"&event=checkout&value=0.00&quantity=1")},e.defaultOptions={pixelId:""},e}(o.EcommerceIntegration);e.Pinterest=a},function(t,e,r){"use strict";var n=this&&this.__extends||function(){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=r(6),i=r(8),a=r(1),c=r(2),u=r(0);e.sessionAttributionEventKey="session-attribution",e.sessionAttributionParamsKey="_shopify_sa_p",e.sessionAttributionTimestampKey="_shopify_sa_t";var s=function(t){function r(e,r,n){var o=t.call(this,{},e)||this;return o.trekkie=r,o.timestampManager=new p,o.campaignManager=new d,setTimeout(function(){o.attributeSession()},0),n(),o}return n(r,t),r.prototype.identify=function(t){},r.prototype.page=function(t){},r.prototype.track=function(t){var r=this;t.event===e.sessionAttributionEventKey&&setTimeout(function(){r.trekkie.emit(e.sessionAttributionEventKey,t)},0)},r.prototype.attributeSession=function(){var t=new Date,r=c.search(),n=this.campaignManager.constructCanonicalUtmString(r);if(this.timestampManager.isValid(t)&&this.campaignManager.isValid(n));else{var o="";try{o=t.toJSON()}catch(t){}this.track({event:e.sessionAttributionEventKey,properties:{sa_url:c.href(),sa_referrer:u.virtualDocument().referrer(),sa_utm_string:n,sa_token:i.buildToken(),over_30_minutes:!this.timestampManager.isWithin30MinuteCutOff(t),cross_utc_midnight:this.timestampManager.isWithin30MinuteCutOff(t)&&!this.timestampManager.isSameDayAs(t),new_campaign:!this.campaignManager.isValid(n),prev_campaign_params:this.campaignManager.fetch(),last_extended:this.timestampManager.fetch(),local_now:o}})}this.timestampManager.extend(t.toJSON()),this.campaignManager.extend(n)},r}(a.Integration);e.SessionAttribution=s;var p=function(){function t(){}return t.prototype.fetch=function(){return o.read(e.sessionAttributionTimestampKey)},t.prototype.extend=function(t){o.write(e.sessionAttributionTimestampKey,t,{permanent:!1})},t.prototype.isValid=function(t){return this.isWithin30MinuteCutOff(t)&&this.isSameDayAs(t)},t.prototype.isWithin30MinuteCutOff=function(t){return this.testStoredTimestamp(function(t,e){return e.getTime()-t.getTime()<=18e5},t)},t.prototype.isSameDayAs=function(t){return this.testStoredTimestamp(function(t,e){return t.getUTCDate()===e.getUTCDate()},t)},t.prototype.testStoredTimestamp=function(t,e){var r=this.fetch();if(!r)return!1;try{return t(new Date(r),e)}catch(t){return!1}},t}();e.TimestampManager=p;var d=function(){function t(){}return t.prototype.fetch=function(){return o.read(e.sessionAttributionParamsKey)},t.prototype.extend=function(t){""===t&&(t=this.fetch()||""),o.write(e.sessionAttributionParamsKey,t,{permanent:!1})},t.prototype.isValid=function(t){return""===t||this.fetch()===t},t.prototype.constructCanonicalUtmString=function(e){if(""===e||void 0===e||null===e||"?"===e)return"";e="?"===e[0]?e.slice(1):e;for(var r={},n=0,o=e.split("&");n0&&(r=e.xtldImpl.handlerWithTimeout(r,n));var i="xtld-"+Math.random().toString(16).substring(2),a=function(){try{var n=e.xtldImpl.findFrame(i,t);n?e.xtldImpl.requestToken(n,"getLongTermCookie",r):r(void 0,new Error("Failed to load iFrame"))}catch(t){r(void 0,t)}};o.iframe({src:t,onLoad:a,className:i})}Object.defineProperty(e,"__esModule",{value:!0});var o=r(9),i=r(0),a=r(3);e.performXtldExchange=n,e.xtldImpl={requestToken:function(t,e,r){a.virtualWindow().addEventListener("message",function(e){try{e&&0===t.src.indexOf(e.origin)&&r(e.data)}catch(e){r(void 0,e)}}),t.contentWindow.postMessage(e,t.src)},handlerWithTimeout:function(t,e){var r=setTimeout(function(){t(void 0,new Error("Timed out, after "+e/1e3+" second(s)"))},e);return function(e,n){clearTimeout(r),t(e,n)}},frameSource:function(){return"https://cdn.shopify.com/s/javascripts/tricorder/xtld-frame.html"},findFrame:function(t,e){return i.virtualDocument().querySelector("iframe."+t+'[src="'+e+'"]')}}}]);