!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()}))}))},p=function(e){var t=function(t){"pagehide"!==t.type&&"hidden"!==document.visibilityState||e(t)};addEventListener("visibilitychange",t,!0),addEventListener("pagehide",t,!0)},m=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)},_=function(){return g<0&&(g=h(),y(),s((function(){setTimeout((function(){g=h(),y()}),0)}))),{get firstHiddenTime(){return g}}},T=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},w=[1800,3e3],E=function(e,t){t=t||{},T((function(){var n,r=_(),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]}))}},A=[2500,4e3],D={};const q=10;const F=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 j;function H({monorailRegion:e,schema:t,rawData:n}){const r=Date.now(),o={schema_id:t,payload:t===j.OnUnload?U(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=F[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 U(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,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.0"}(j||(j={}));const J="https://cdn.shopify.com/shopifycloud/privacy-banner/storefront-banner.js",K="https://cdn.shopify.com/shopifycloud/consent-tracking-api/v0.1/consent-tracking-api.js";async function $(){try{return Array.from(document.scripts).some((e=>e.src===J||e.src===K))?Promise.resolve(!0):await new Promise(((e,t)=>{const n=document.createElement("script");n.type="text/javascript",n.src=K,n.onload=()=>{e(!0)},n.onerror=()=>{t(new Error("Could not load consent script"))},document.head.appendChild(n)}))}catch(e){}return Promise.resolve(!1)}const V="xxxx-4xxx-xxxx-xxxxxxxxxxxx";function X(){let e="";try{const t=window.crypto,n=new Uint16Array(31);t.getRandomValues(n);let r=0;e=V.replace(/[x]/g,(e=>{const t=n[r]%16;return r++,("x"===e?t:3&t|8).toString(16)})).toUpperCase()}catch(t){e=V.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 Z=!0,G=!1,Q=null,W=!1;class Y{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:"0.0.1-alpha.0",url:window.location.href,referrer:document.referrer||void 0,microSessionId:X(),microSessionCount:0,sessionToken:n,uniqueToken:o},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 $()}()}}const ee=new Set;function te(){if(null!==Q){if(oe()&&ee.size>0){let e={};for(const t of ee)e={...e,...t};ee.clear(),Q.info.microSessionCount+=1;const t=function(e){if(!(100*Math.random()>(e||q)))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))}))}(Q.config.resourceTimingSamplingRate);H({monorailRegion:Q.config.monorailRegion,schema:j.OnUnload,rawData:{...Q.info,...Q.config.storefrontData,...Q.performanceMetrics,...e,resourceTiming:t,paintTimingHidden:W}})}}else console.debug("⛔️ Shopify/perf-kit is not initialized")}var ne,re;function oe(){return window?.Shopify?.customerPrivacy?.analyticsProcessingAllowed()}ne=function(e){const{attribution:t,value:n}=e;ee.add({cumulativeLayoutShift:n,cumulativeLayoutShiftTarget:t.largestShiftTarget})},function(e,t){t=t||{},E(m((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),p((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),ne(e)}),re),function(e,n){!function(e,t){t=t||{},T((function(){var n,r=_(),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=[],R=M(),o=u("INP"),r=f(e,o,k,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!==Q?oe()&&(Q.info.microSessionCount+=1,H({monorailRegion:Q.config.monorailRegion,schema:j.OnInteraction,rawData:{...Q.info,...Q.config.storefrontData,...Q.performanceMetrics,interactionToNextPaint:Math.round(n),interactionToNextPaintTarget:t.eventTarget}})):console.debug("⛔️ Shopify/perf-kit is not initialized")}),{reportAllChanges:!0}),addEventListener("DOMContentLoaded",(()=>{W="hidden"===document.visibilityState})),addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&te()})),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),Q=new Y(t),t.spaMode&&(window.PerfKit={navigate:()=>{Z?Z=!1:G||(te(),Q=new Y(t),G=!0)},setPageType:e=>{t.storefrontData.pageType=e}})}catch(e){console.error("🚫 Error initializing PerfKit:",e.message)}var t}()}();