!function(){"use strict";var e,t=function(){return window.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0]},n=function(e){if("loading"===document.readyState)return"loading";var n=t();if(n){if(e(t||100)-1)return n||i;if(n=n?i+">"+n:i,o.id)break;e=o.parentNode}}catch(e){}return n},i=-1,a=function(){return i},s=function(e){addEventListener("pageshow",(function(t){t.persisted&&(i=t.timeStamp,e(t))}),!0)},c=function(){var e=t();return e&&e.activationStart||0},u=function(e,n){var r=t(),o="navigate";return a()>=0?o="back-forward-cache":r&&(document.prerendering||c()>0?o="prerender":document.wasDiscarded?o="restore":r.type&&(o=r.type.replace(/_/g,"-"))),{name:e,value:void 0===n?-1:n,rating:"good",delta:0,entries:[],id:"v3-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:o}},d=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver((function(e){Promise.resolve().then((function(){t(e.getEntries())}))}));return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch(e){}},f=function(e,t,n,r){var o,i;return function(a){t.value>=0&&(a||r)&&((i=t.value-(o||0))||void 0===o)&&(o=t.value,t.delta=i,t.rating=function(e,t){return e>t[1]?"poor":e>t[0]?"needs-improvement":"good"}(t.value,n),e(t))}},l=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},m=function(e){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||e(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},p=function(e){var t=!1;return function(n){t||(e(n),t=!0)}},g=-1,h=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},v=function(e){"hidden"===document.visibilityState&&g>-1&&(g="visibilitychange"===e.type?e.timeStamp:0,S())},y=function(){addEventListener("visibilitychange",v,!0),addEventListener("prerenderingchange",v,!0)},S=function(){removeEventListener("visibilitychange",v,!0),removeEventListener("prerenderingchange",v,!0)},T=function(){return g<0&&(g=h(),y(),s((function(){setTimeout((function(){g=h(),y()}),0)}))),{get firstHiddenTime(){return g}}},_=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},w=[1800,3e3],E=function(e,t){t=t||{},_((function(){var n,r=T(),o=u("FCP"),i=d("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(i.disconnect(),e.startTimet.latency){if(n)n.entries.push(e),n.latency=Math.max(n.latency,e.duration);else{var r={id:e.interactionId,latency:e.duration,entries:[e]};O[r.id]=r,N.push(r)}N.sort((function(e,t){return t.latency-e.latency})),N.splice(10).forEach((function(e){delete O[e.id]}))}},z=[2500,4e3],A={},F=[800,1800],D=function e(t){document.prerendering?_((function(){return e(t)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(t)}),!0):setTimeout(t,0)},j=function(e,n){n=n||{};var r=u("TTFB"),o=f(e,r,F,n.reportAllChanges);D((function(){var i=t();if(i){var a=i.responseStart;if(a<=0||a>performance.now())return;r.value=Math.max(a-c(),0),r.entries=[i],o(!0),s((function(){r=u("TTFB",0),(o=f(e,r,F,n.reportAllChanges))(!0)}))}}))};const H=10;const =Object.freeze({shop_domain:`{window.location.origin}/.well-known/shopify/monorail/v1/produce`,global:"https://monorail-edge.shopifysvc.com/v1/produce",canada:"https://monorail-edge-ca.shopifycloud.com/v1/produce",staging:"https://monorail-edge-staging.shopifycloud.com/v1/produce"});var U;function J({monorailRegion:e,schema:t,rawData:n}){const r=Date.now(),o={schema_id:t,payload:t===U.OnUnload?K(n):(i=n,{url:i.url,page_type:i.pageType,shop_id:i.shopId,application:i.application,storefront_id:i.storefrontId,theme_instance_id:i.themeInstanceId,session_token:i.sessionToken,unique_token:i.uniqueToken,micro_session_id:i.microSessionId,micro_session_count:i.microSessionCount,interaction_to_next_paint:i.interactionToNextPaint,interaction_to_next_paint_target:i.interactionToNextPaintTarget,seo_bot:i.seoBot,humanness_score:i.humannessScore,ja3_fingerprint:i.ja3Fingerprint,referrer:i.referrer,worker_start:i.workerStart,next_hop_protocol:i.nextHopProtocol,navigation_bad:i.navigationBad}),metadata:{event_created_at_ms:r,event_sent_at_ms:r}};var i;try{const t=[e||""];if(!t)return void console.debug("📡 Monorail: ",JSON.stringify(o,null,2));if("function"!=typeof window.navigator.sendBeacon||"function"!=typeof window.Blob||function(){const{userAgent:e}=window.navigator;return-1!==e.lastIndexOf("iPhone; CPU iPhone OS 12_")||-1!==e.lastIndexOf("iPad; CPU OS 12_")}()){const e=new XMLHttpRequest;e.open("POST",t),e.setRequestHeader("Content-type","text/plain"),e.send(JSON.stringify(o))}else{const e=new window.Blob([JSON.stringify(o)],{type:"text/plain"});window.navigator.sendBeacon(t,e)}}catch(e){}}function K(e){const t=["domInteractive","domContentLoadedEventStart","domContentLoadedEventEnd","domComplete","firstPaint","visuallyReady","initiatorType","redirectCount"].reduce(((t,n)=>{var r;return e[n]&&(t[(r=n,r.replace(/[A-Z]/g,(e=>`_{e.toLowerCase()}`)))]=e[n]||null),t}),{});return{perf_kit_init:e.perfKitInit,perf_kit_version:e.perfKitVersion,url:e.url,page_type:e.pageType,shop_id:e.shopId,application:e.application,storefront_id:e.storefrontId,theme_instance_id:e.themeInstanceId,session_token:e.sessionToken,unique_token:e.uniqueToken,micro_session_id:e.microSessionId,micro_session_count:e.microSessionCount,cumulative_layout_shift:e.cumulativeLayoutShift,cumulative_layout_shift_target:e.cumulativeLayoutShiftTarget,first_contentful_paint:e.firstContentfulPaint,largest_contentful_paint:e.largestContentfulPaint,largest_contentful_paint_target:e.largestContentfulPaintTarget,time_to_first_byte:e.timeToFirstByte,seo_bot:e.seoBot,humanness_score:e.humannessScore,ja3_fingerprint:e.ja3Fingerprint,navigation_start:e.navigationStart,navigation_type:e.navigationType,navigation_bad:e.navigationBad,encoded_body_size:e.encodedBodySize,decoded_body_size:e.decodedBodySize,transfer_size:e.transferSize,response_start:e.responseStart,response_end:e.responseEnd,worker_start:e.workerStart,connect_start:e.connectStart,connect_end:e.connectEnd,domain_lookup_start:e.domainLookupStart,domain_lookup_end:e.domainLookupEnd,fetch_start:e.fetchStart,redirect_start:e.redirectStart,redirect_end:e.redirectEnd,request_start:e.requestStart,secure_connection_start:e.secureConnectionStart,next_hop_protocol:e.nextHopProtocol,server_timing:e.serverTiming,paint_timing_hidden:e.paintTimingHidden,referrer:e.referrer,render_region:e.renderRegion,resource_timing:e.resourceTiming,other_metrics:JSON.stringify(t)}}!function(e){e.OnInteraction="perf_kit_on_interaction/3.0",e.OnUnload="perf_kit_on_unload/3.1"}(U||(U={}));const V="/shopifycloud/privacy-banner/storefront-banner.js",X="/shopifycloud/consent-tracking-api/v0.1/consent-tracking-api.js";async function Z(){const e=`https://{window?.Shopify?.cdnHost||"www.scopeapplications.com"}`;try{return function(e){return null!==document.querySelector(`script[src="{e}{V}"], script[src="{e}{X}"]`)}(e)?Promise.resolve(!0):await function(e){const t=new Promise(((t,n)=>{const r=document.createElement("script");r.type="text/javascript",r.src=`{e}{X}`,r.onload=()=>{t(!0)},r.onerror=()=>{n(new Error("Could not load consent script"))},document.head.appendChild(r)}));return t}(e)}catch(e){}return Promise.resolve(!1)}const G="xxxx-4xxx-xxxx-xxxxxxxxxxxx";function Q(){let e="";try{const t=window.crypto,n=new Uint16Array(31);t.getRandomValues(n);let r=0;e=G.replace(/[x]/g,(e=>{const t=n[r]%16;return r++,("x"===e?t:3&t|8).toString(16)})).toUpperCase()}catch(t){e=G.replace(/[x]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})).toUpperCase()}return`{function(){let e=0,t=0;e=(new Date).getTime()>>>0;try{t=performance.now()>>>0}catch(e){t=0}return Math.abs(e+t).toString(16).toLowerCase().padStart(8,"0")}()}-{e}`}let W=!0,Y=!1,ee=null,te=!1;class ne{info;config;performanceMetrics;constructor(e){const t=/_shopify_s=([^;]*)/.exec(document.cookie),n=t?t[1]:void 0,r=/_shopify_y=([^;]*)/.exec(document.cookie),o=r?r[1]:void 0;this.config=e,this.info={perfKitInit:Date.now(),perfKitVersion:"1.0.1",url:window.location.href,referrer:document.referrer||void 0,microSessionId:Q(),microSessionCount:0,sessionToken:n,uniqueToken:o},performance.setResourceTimingBufferSize(1e3),this.performanceMetrics=function(e){const t=performance.getEntriesByType("navigation");if(0===t.length)return{};const n=t[0];let r=!1;return(n.requestStart&&n.startTime&&n.requestStarte+864e5)&&(r=!0),{encodedBodySize:n.encodedBodySize,decodedBodySize:n.decodedBodySize,navigationStart:Math.round(n.startTime),navigationType:n.type,navigationBad:r,responseStart:Math.round(n.responseStart),responseEnd:Math.round(n.responseEnd),workerStart:Math.round(n.workerStart),connectStart:Math.round(n.connectStart),connectEnd:Math.round(n.connectEnd),domainLookupStart:Math.round(n.domainLookupStart),domainLookupEnd:Math.round(n.domainLookupEnd),fetchStart:Math.round(n.fetchStart),redirectStart:Math.round(n.redirectStart),redirectEnd:Math.round(n.redirectEnd),requestStart:Math.round(n.requestStart),secureConnectionStart:Math.round(n.secureConnectionStart),nextHopProtocol:n.nextHopProtocol,serverTiming:JSON.stringify(n.serverTiming),domInteractive:Math.round(n.domInteractive),domComplete:Math.round(n.domComplete),domContentLoadedEventStart:Math.round(n.domContentLoadedEventStart),domContentLoadedEventEnd:Math.round(n.domContentLoadedEventEnd),redirectCount:n.redirectCount,initiatorType:n.initiatorType,transferSize:n.transferSize}}(this.info.perfKitInit),async function(){const{Shopify:e}=window;e&&e.customerPrivacy||await Z()}()}}const re=new Set;function oe(){if(null!==ee){if(se()&&re.size>0){let e={};for(const t of re)e={...e,...t};re.clear(),ee.info.microSessionCount+=1;const t=function(e){if(!(100*Math.random()>(e||H)))return performance.getEntriesByType("resource").map((e=>{const t=Object.entries(e.toJSON()).map((([e,t])=>"number"==typeof t?[e,Math.round(t)]:[e,t]));return JSON.stringify(Object.fromEntries(t))}))}(ee.config.resourceTimingSamplingRate);J({monorailRegion:ee.config.monorailRegion,schema:U.OnUnload,rawData:{...ee.info,...ee.config.storefrontData,...ee.performanceMetrics,...e,resourceTiming:t,paintTimingHidden:te}})}}else console.debug("⛔️ Shopify/perf-kit is not initialized")}var ie,ae;function se(){return window?.Shopify?.customerPrivacy?.analyticsProcessingAllowed()}ie=function(e){const{attribution:t,value:n}=e;re.add({cumulativeLayoutShift:n,cumulativeLayoutShiftTarget:t.largestShiftTarget})},function(e,t){t=t||{},E(p((function(){var n,r=u("CLS",0),o=0,i=[],a=function(e){e.forEach((function(e){if(!e.hadRecentInput){var t=i[0],n=i[i.length-1];o&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(o+=e.value,i.push(e)):(o=e.value,i=[e])}})),o>r.value&&(r.value=o,r.entries=i,n())},c=d("layout-shift",a);c&&(n=f(e,r,C,t.reportAllChanges),m((function(){a(c.takeRecords()),n(!0)})),s((function(){o=0,r=u("CLS",0),n=f(e,r,C,t.reportAllChanges),l((function(){return n()}))})),setTimeout(n,0))})))}((function(e){!function(e){if(e.entries.length){var t=e.entries.reduce((function(e,t){return e&&e.value>t.value?e:t}));if(t&&t.sources&&t.sources.length){var r=(i=t.sources).find((function(e){return e.node&&1===e.node.nodeType}))||i[0];if(r)return void(e.attribution={largestShiftTarget:o(r.node),largestShiftTime:t.startTime,largestShiftValue:t.value,largestShiftSource:r,largestShiftEntry:t,loadState:n(t.startTime)})}}var i;e.attribution={}}(e),ie(e)}),ae),function(e,n){!function(e,t){t=t||{},_((function(){var n,r=T(),o=u("LCP"),i=function(e){var t=e[e.length-1];t&&t.startTime0&&(o.value=0,o.entries=[]),r(!0)})),s((function(){N=[],B=L(),o=u("INP"),r=f(e,o,P,t.reportAllChanges)})))}))}((function(t){!function(e){if(e.entries.length){var t=e.entries.sort((function(e,t){return t.duration-e.duration||t.processingEnd-t.processingStart-(e.processingEnd-e.processingStart)}))[0],r=e.entries.find((function(e){return e.target}));e.attribution={eventTarget:o(r&&r.target),eventType:t.name,eventTime:t.startTime,eventEntry:t,loadState:n(t.startTime)}}else e.attribution={}}(t),e(t)}),t)}((function(e){const{attribution:t,value:n}=e;null!==ee?se()&&(ee.info.microSessionCount+=1,J({monorailRegion:ee.config.monorailRegion,schema:U.OnInteraction,rawData:{...ee.info,...ee.config.storefrontData,...ee.performanceMetrics,interactionToNextPaint:Math.round(n),interactionToNextPaintTarget:t.eventTarget}})):console.debug("⛔️ Shopify/perf-kit is not initialized")}),{reportAllChanges:!0}),function(e,t){j((function(t){!function(e){if(e.entries.length){var t=e.entries[0],n=t.activationStart||0,r=Math.max(t.domainLookupStart-n,0),o=Math.max(t.connectStart-n,0),i=Math.max(t.requestStart-n,0);e.attribution={waitingTime:r,dnsTime:o-r,connectionTime:i-o,requestTime:e.value-i,navigationEntry:t}}else e.attribution={waitingTime:0,dnsTime:0,connectionTime:0,requestTime:0}}(t),e(t)}),t)}((function(e){const{value:t}=e;re.add({timeToFirstByte:Math.round(t)})})),addEventListener("DOMContentLoaded",(()=>{te="hidden"===document.visibilityState})),addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&oe()})),function(){const{dataset:e}=document.currentScript;try{t=function(e){if(!e.application)throw new Error("Application is missing");if(!["storefront-renderer","hydrogen"].includes(e.application.toLowerCase()))throw new Error("Invalid application type");if(!e.shopId)throw new Error("shopId is missing");if(!e.themeInstanceId&&!e.storefrontId)throw new Error("Either `themeInstanceId` or `storefrontId` must be defined");for(const t of["shopId","humannessScore","themeInstanceId","storefrontId"])if(e[t]&&isNaN(Number(e[t])))throw new Error(`Invalid {t}`);if(e.monorailRegion&&!["shop_domain","global","staging","canada"].includes(e.monorailRegion.toLowerCase()))throw new Error("Invalid monorail region");if(e.resourceTimingSamplingRate&&(isNaN(Number(e.resourceTimingSamplingRate))||Number(e.resourceTimingSamplingRate)100))throw new Error("Invalid resource timing sampling rate");return{storefrontData:{application:e.application.toLowerCase(),shopId:Number(e.shopId),renderRegion:e.renderRegion,pageType:e.pageType,seoBot:"true"===e.seoBot,humannessScore:Number(e.humannessScore)||void 0,ja3Fingerprint:e.ja3Fingerprint,themeInstanceId:Number(e.themeInstanceId)||void 0,storefrontId:Number(e.storefrontId)||void 0},monorailRegion:e.monorailRegion,resourceTimingSamplingRate:Number(e.resourceTimingSamplingRate)||void 0,spaMode:"true"===e.spaMode}}(e),ee=new ne(t),t.spaMode&&(window.PerfKit={navigate:()=>{W?W=!1:Y||(oe(),ee=new ne(t),Y=!0)},setPageType:e=>{t.storefrontData.pageType=e}})}catch(e){console.error("🚫 Error initializing PerfKit:",e.message)}var t}()}();