1(function(){"use strict";var processedDataEl=null;function stripCardForInjection(html,keepStyle){var doc=new DOMParser().parseFromString(html,"text/html");return keepStyle||doc.querySelectorAll("style").forEach(function(el){el.remove()}),doc.querySelectorAll("script").forEach(function(el){el.remove()}),doc.body?doc.body.innerHTML:""}function renderGrid(data){var handles=Array.isArray(data.handles)?data.handles:[],gridSelector=data.gridSelector||"#facets-results",grid=document.querySelector(gridSelector);if(!grid){console.warn("[arkiv-sort] grid container not found:",gridSelector);return}if(handles.length){grid.setAttribute("data-arkiv-loading","true");var fetches=handles.map(function(handle,index){return fetch("/products/"+encodeURIComponent(handle)+"?view=arkiv-card",{credentials:"same-origin",headers:{Accept:"text/html"}}).then(function(resp){if(!resp.ok)throw new Error("HTTP "+resp.status+" for handle="+handle);return resp.text()}).then(function(html){return{handle:handle,html:html,ok:!0,index:index}}).catch(function(err){return console.warn("[arkiv-sort] fetch failed for handle="+handle,err),{handle:handle,html:"",ok:!1,index:index}})});Promise.all(fetches).then(function(results){var keptStyleYet=!1,combined=results.filter(function(r){return r.ok}).map(function(r){var keepStyle=!keptStyleYet;return keepStyle&&(keptStyleYet=!0),stripCardForInjection(r.html,keepStyle)}).join("");if(grid.innerHTML=combined,grid.removeAttribute("data-arkiv-loading"),typeof window.__cardV3RefreshAllFromCart=="function")try{window.__cardV3RefreshAllFromCart()}catch(e){}})}}function isFilteredView(){var path=window.location.pathname||"",query=window.location.search||"";return path.indexOf("/a/search")!==-1?!0:/[?&](q|filter\.|filter_search)/.test(query)}function processCurrentDataEl(){var dataEl=document.getElementById("arkiv-sort-data");if(dataEl&&dataEl!==processedDataEl){processedDataEl=dataEl;var data;try{data=JSON.parse(dataEl.textContent||"{}")}catch(err){console.error("[arkiv-sort] could not parse #arkiv-sort-data JSON",err);return}renderGrid(data)}}var FOREIGN_PARAMS=["filter_search_collection"];function preserveForeignParams(){var current=new URLSearchParams(window.location.search),carry=FOREIGN_PARAMS.filter(function(name){return current.get(name)});if(carry.length){var selects=document.querySelectorAll('select[name="sort_by"]');Array.prototype.forEach.call(selects,function(sel){var form=sel.form;form&&carry.forEach(function(name){if(!form.querySelector('[name="'+name+'"]')){var input=document.createElement("input");input.type="hidden",input.name=name,input.value=current.get(name),form.appendChild(input)}})});var links=document.querySelectorAll('a[href*="sort_by="]');Array.prototype.forEach.call(links,function(a){var href;try{href=new URL(a.getAttribute("href"),window.location.origin)}catch(e){return}if(href.origin===window.location.origin){var changed=!1;carry.forEach(function(name){href.searchParams.get(name)||(href.searchParams.set(name,current.get(name)),changed=!0)}),changed&&a.setAttribute("href",href.pathname+href.search)}})}}function hideBakedSortOptions(){if(isFilteredView()){var selects=document.querySelectorAll('select[name="sort_by"]');Array.prototype.forEach.call(selects,function(sel){Array.prototype.slice.call(sel.options).forEach(function(opt){opt.value&&opt.value.indexOf("arkiv-")===0&&opt.remove()})})}}function init(){preserveForeignParams(),hideBakedSortOptions(),processCurrentDataEl();var observer=new MutationObserver(function(mutations){for(var i=0;i<mutations.length;i++)if(mutations[i].addedNodes&&mutations[i].addedNodes.length>0){preserveForeignParams(),hideBakedSortOptions(),processCurrentDataEl();return}});observer.observe(document.body,{childList:!0,subtree:!0})}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",init):init()})(); 2//# sourceMappingURL=/cdn/shop/t/41/assets/arkiv-sort.js.map?v=100712919136520868801788495703
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.