1(function(){var ATTR_KEY="_section_source_log",state=null,hydrating=null,dirty=!1;function resolveCartUrlFallback(path){var root=typeof Shopify!="undefined"&&Shopify.routes&&Shopify.routes.root?String(Shopify.routes.root).replace(/\/?$/,"/"):"/";return root+path}function resolveCartUrl(path){return window.WonderfulCartLogShared?window.WonderfulCartLogShared.resolveCartUrl(path):resolveCartUrlFallback(path)}function fetchCart(){return window.WonderfulCartLogShared?window.WonderfulCartLogShared.fetchCart():fetch(resolveCartUrlFallback("cart.js"),{credentials:"same-origin",headers:{Accept:"application/json"}}).then(function(res){if(!res.ok)throw new Error("GET /cart.js failed: "+res.status);return res.json()})}function parseLog(cart){var raw=cart&&cart.attributes&&cart.attributes[ATTR_KEY];if(!raw)return{};try{var parsed=JSON.parse(raw);return parsed&&typeof parsed=="object"?parsed:{}}catch(e){return{}}}function persistPrunedLog(){fetch(resolveCartUrl("cart/update.js"),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"same-origin",body:JSON.stringify({attributes:buildAttributePatch()})}).catch(function(){})}function hydrate(){return state?Promise.resolve(state):hydrating||(hydrating=fetchCart().then(function(cart){var parsed=parseLog(cart),live=liveQuantitiesFromCart(cart),result=reconcileAgainstLive(parsed,live);state=result.reconciled;var changed=JSON.stringify(parsed)!==JSON.stringify(state);return changed&&persistPrunedLog(),state}).catch(function(){return state={},state}).finally(function(){hydrating=null}),hydrating)}function recordDelta(variantId,delta,sectionId,label){var vid=String(variantId||""),n=Math.trunc(Number(delta)||0);return!vid||n===0?Promise.resolve():(n>0&§ionId&&window.__WONDERFUL_CLASSIC_REQUESTED__&&(sectionId="CR_"+sectionId),hydrate().then(function(){var arr=(state[vid]||[]).slice();if(n>0)for(var i=0;i<n;i++)arr.push(sectionId);else arr=arr.slice(0,Math.max(0,arr.length+n));arr.length>0?state[vid]=arr:delete state[vid],dirty=!0}))}function reconcileAgainstLive(logState,liveQuantitiesByVariant){var totalsBySection={},untrackedTotal=0,reconciled={},perVariant={},seenVariants={};function tally(sectionId){if(sectionId){var canonical=sectionId.indexOf("CR_")===0?sectionId.slice(3):sectionId;totalsBySection[canonical]=(totalsBySection[canonical]||0)+1}}return Object.keys(logState||{}).forEach(function(vid){seenVariants[vid]=!0;var arr=(logState[vid]||[]).slice(),live=liveQuantitiesByVariant[vid]||0,trimmedStaleEntries=0;arr.length>live&&(trimmedStaleEntries=arr.length-live,arr=arr.slice(0,live));var untracked=Math.max(0,live-arr.length);arr.length>0&&(reconciled[vid]=arr),arr.forEach(tally),untrackedTotal+=untracked,perVariant[vid]={live:live,sections:arr.slice(),untracked:untracked,trimmedStaleEntries:trimmedStaleEntries}}),Object.keys(liveQuantitiesByVariant||{}).forEach(function(vid){if(!seenVariants[vid]){var live=liveQuantitiesByVariant[vid]||0;live<=0||(untrackedTotal+=live,perVariant[vid]={live:live,sections:[],untracked:live,trimmedStaleEntries:0})}}),{totalsBySection:totalsBySection,untrackedTotal:untrackedTotal,perVariant:perVariant,reconciled:reconciled}}function majoritySection(totalsBySection){var best=null,bestCount=0,tied=!1;return Object.keys(totalsBySection).forEach(function(sectionId){var count=totalsBySection[sectionId];count>bestCount?(best=sectionId,bestCount=count,tied=!1):count===bestCount&&(tied=!0)}),tied||!best?null:best}function liveQuantitiesFromCart(cart){if(window.WonderfulCartLogShared)return window.WonderfulCartLogShared.liveQuantitiesFromCart(cart);var map={};return(cart.items||[]).forEach(function(line){var vid=String(line.variant_id);map[vid]=(map[vid]||0)+(line.quantity||0)}),map}function buildAttributePatch(){var patch={};return patch[ATTR_KEY]=JSON.stringify(state),patch}function getPendingAttributesPatch(){return hydrate().then(function(){return dirty?buildAttributePatch():null})}function getPendingAttributesPatchSync(){return!state||!dirty?null:buildAttributePatch()}function markFlushed(){dirty=!1}function clearAll(){state={},dirty=!0}function computeCheckoutAttributes(){return hydrate().then(function(){return fetchCart()}).then(function(cart){var live=liveQuantitiesFromCart(cart),result=reconcileAgainstLive(state,live);state=result.reconciled,dirty=!1;var majority=majoritySection(result.totalsBySection),attributes=buildAttributePatch();return attributes.checkout_section=majority||"",{attributes:attributes,majority:majority}}).catch(function(e){return console.warn("[Wonderful Section Log] computeCheckoutAttributes failed",e),{attributes:{checkout_section:""},majority:null}})}window.WonderfulSectionLog={recordDelta:recordDelta,getPendingAttributesPatch:getPendingAttributesPatch,getPendingAttributesPatchSync:getPendingAttributesPatchSync,markFlushed:markFlushed,clearAll:clearAll,computeCheckoutAttributes:computeCheckoutAttributes}})(); 2//# sourceMappingURL=/cdn/shop/t/293/assets/wonderful-section-source-log.js.map?v=90929795409322657421787785408
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.