PageSourceSearch

https://www.mooseknucklescanada.com/cdn/shop/t/726/assets/-nosto-p…?v=36575985089249173411790702476

js mooseknucklescanada.com collected 2026-10-03 19:38:04 UTC 18,662 bytes, 103 lines download raw bytes

1import{r as R,n as f,t as O,B as q,u as N,v as H,y as P,z as B,N as F,A as $,C as m,D,E as U,F as z,G,H as v,I as W,J as Q,K as Y,M as K,Q as j,R as T,S as u,T as V,U as J,x as l,V as p,W as X,X as Z,Y as b,Z as ee,_ as w}from"./chunk-core-C-8Qoxie.js";var te=Object.defineProperty,ie=Object.getOwnPropertyDescriptor,h=(e,t,i,s)=>{for(var r=s>1?void 0:s?ie(t,i):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(r=(s?a(t,i,r):a(r))||r);return s&&r&&te(t,i,r),r};const se=["productId","name","url","imageUrl","price","listPrice","priceCurrencyCode","available","variantId"],re="grid grid-cols-2 gap-x-2xs gap-y-md sm:grid-cols-3 lg:grid-cols-4 lg:gap-x-xs items-stretch",L=8,S="is-loaded",y=4e3,oe="200% 0px 250% 0px",ae="(max-width: 1023px)",C=typeof window<"u"&&window.matchMedia?window.matchMedia(ae):null,ne=2,de=8,_="data-initial-load",k=4,le=2,I="leadImage",ce="data-nosto-seed";function x(e){var t;return g((t=e.querySelector("[data-is-product-card]"))==null?void 0:t.getAttribute("data-algolia-product-id"))}const M="cursor-pointer whitespace-nowrap text-center text-[13px] uppercase leading-none tracking-normal underline underline-offset-2";function g(e){return(e??"").replace(/\D/g,"")}function E(e){const t=new Set;return e.filter(i=>{const s=i.productId??i.url;return s?t.has(s)?!1:(t.add(s),!0):!0})}const he=l`<style>
2  /* The skeleton cover overlays the card via absolute fill (inset: 0) rather
3     than grid-stacking, so it hides the card's full box whatever the height of
4     the markup underneath, and nothing shows through until JS lifts it. */
5  nosto-product-grid [data-nosto-card] {
6    position: relative;
7    min-width: 0;
8    overflow: hidden;
9  }
10  /* Phones: a card's layout is its own business, so inserting a row or
11     revealing a card does not make the browser reconsider the rest of the
12     page. Layout only, not paint: paint containment would clip anything a
13     card lets out of its box, and it measured no better. Worth about a tenth
14     off the worst frame of a flick. */
15  @media (max-width: 1023px) {
16    nosto-product-grid [data-nosto-card] {
17      contain: layout;
18    }
19  }
20  nosto-product-grid [data-nosto-card] > * {
21    min-width: 0;
22  }
23  nosto-product-grid [data-nosto-card] > .nosto-card-cover {
24    position: absolute;
25    inset: 0;
26    z-index: 2;
27  }
28  /* The body's own skeleton sits under the opaque cover until the card fills,
29     so its pulse would only burn compositor time; one pulse per card, on the
30     cover. Phones keep a hard budget of animating layers. */
31  nosto-product-grid
32    [data-nosto-card]:not(.is-loaded)
33    > [data-nosto-card-body]
34    .animate-pulse {
35    animation: none;
36  }
37  nosto-product-grid [data-nosto-card].is-loaded {
38    overflow: visible;
39  }
40  /* Removed outright rather than faded: a hidden cover would keep its pulse
41     animation alive for every revealed card on the page. */
42  nosto-product-grid [data-nosto-card].is-loaded > .nosto-card-cover {
43    display: none;
44  }
45  /* Hold the img hidden until it has actually loaded so the browser doesn't
46     paint its alt-text / broken-image glyph over the pulsing image frame; fade
47     it in once loaded. The is-image-loaded class is applied by the global
48     product-card-image-loading script (layout/theme.liquid). Mirrors the theme's
49     existing hold-until-loaded treatment of .product-card-content. */
50  nosto-product-grid .product-card-image-frame img {
51    opacity: 0;
52    transition: opacity 0.2s ease;
53  }
54  nosto-product-grid .product-card-image-frame.is-image-loaded img {
55    opacity: 1;
56  }
57  /* Nothing animates while the page is still arriving; everything after the
58     first page (filter, sort, see more) does, since the shopper acted. */
59  nosto-product-grid[data-initial-load] .animate-pulse {
60    animation: none;
61  }
62  nosto-product-grid[data-initial-load] .product-card-image-frame img,
63  nosto-product-grid[data-initial-load] .product-card-content {
64    transition: none;
65  }
66</style>`;let c=class extends q{constructor(){super(...arguments),this.search=!1,this.pageSize=36,this.expectedCount=0,this._limit=0,this._redirecting=!1,this._cardBodies=new Map,this._pendingHtml=new Map,this._renderCount=0,this._growScheduled=!1,this._fillQueue=new Set,this._fillPumping=!1,this._observedBodies=new Set,this._revealScheduled=!1,this._inGridTiles=[],this._seedNodes=[],this._onCardHtml=(e,t)=>
66{let i=this._cardBodies.get(e);if(i!=null&&i.isConnected||(i=Array.from(this.querySelectorAll("[data-nosto-card-body]")).find(s=>s.dataset.handle===e)??void 0),!(!i||i.querySelector("[data-is-product-card]"))){if(this._observeBody(i),this._isNear(i)){this._queueFill(i,t);return}this._pendingHtml.set(e,t)}},this._unavailable=new Set,this._onCardUnavailable=e=>{this._unavailable.has(e)||(this._unavailable.add(e),this.requestUpdate())},this._loadingMore=!1,this._onUserFilterChanged=()=>{var t;this._seedNodes=[];const e=window.scrollY>0;this._scrollToSectionTop(),e&&((t=window.__syncDrawerTopOffset)==null||t.call(window)),this._onFilterChanged()},this._awaitingClient=!1,this._onRetry=()=>{this._searchTask.run()},this._onSeeMore=()=>{if(this._loadingMore)return;const e=N(this._requested,this.pageSize,this.total,L);e<=this._requested||(this._loadingMore=!0,this._limit=e)},this._searchTask=new H(this,{task:async(e,{signal:t})=>{const i=this.activeFilters,s={fields:se,facets:["*"],sort:P(this.sortBy),from:0,size:this._requested,...i.length?{filter:i}:{}},r=this.search?{query:this.searchTerm,products:s}:{products:{...s,...this._categoryTarget()}},o=this.search?"serp":"category";let a;try{a=await B(r,{track:o},{context:o})}catch(n){throw t.aborted||document.dispatchEvent(new CustomEvent(F,{bubbles:!0,composed:!0})),n}if(t.throwIfAborted(),this.hasAttribute(_)){const n=Math.max(0,k-this._seedNodes.length);$(m(a),Math.max(n,1))}return this.search&&D(U(a))?(this._redirecting=!0,a):(this._broadcastResults(a),a)},args:()=>[this.search,this.searchTerm,this.collectionId,this.collectionPath,this.sortBy,z(new URLSearchParams(location.search)),this._limit],onComplete:e=>{if(this._loadingMore=!1,this._kickHydration(e),this._limit>0)return;const t=G(this._requested,v(e),L);t>this._requested&&(this._loadingMore=!0,this._limit=t)},onError:e=>{this._loadingMore=!1,e instanceof W&&e.detail.stage==="ready"&&!this._awaitingClient&&(this._awaitingClient=!0,Q(()=>{this._awaitingClient=!1,this._searchTask.run()}))}})}get _phone(){return!!(C!=null&&C.matches)}_growRenderCount(e){this._growScheduled||this._renderCount>=e||(this._growScheduled=!0,requestAnimationFrame(()=>{this._growScheduled=!1,this._renderCount=Math.min(this._renderCount+de,e),this.requestUpdate()}))}_queueFill(e,t){if(!this._phone){this._fillBody(e,t);return}const i=e.dataset.handle;i&&(this._pendingHtml.set(i,t),this._fillQueue.add(e),this._pumpFills())}_pumpFills(){if(this._fillPumping)return;this._fillPumping=!0;const e=()=>{const t=window.innerHeight/2,i=Array.from(this._fillQueue).filter(s=>s.isConnected&&s.dataset.handle&&this._pendingHtml.has(s.dataset.handle));if(this._fillQueue.forEach(s=>{i.includes(s)||this._fillQueue.delete(s)}),!i.length){this._fillPumping=!1;return}i.sort((s,r)=>Math.abs(s.getBoundingClientRect().top-t)-Math.abs(r.getBoundingClientRect().top-t)),i.slice(0,ne).forEach(s=>{this._fillQueue.delete(s);const r=this._pendingHtml.get(s.dataset.handle??"");r&&this._fillBody(s,r)}),requestAnimationFrame(e)};requestAnimationFrame(e)}_pruneObservedBodies(){this._observedBodies.size&&this._observedBodies.forEach(e=>{var t;e.isConnected||((t=this._nearObserver)==null||t.unobserve(e),this._observedBodies.delete(e))})}_scheduleReveal(){this._revealScheduled||(this._revealScheduled=!0,requestAnimationFrame(()=>{this._revealScheduled=!1,this._revealLoadedCards()}))}get sortBy(){return new URLSearchParams(location.search).get("sort_by")}get searchTerm(){return new URLSearchParams(location.search).get("q")??""}get activeFilters(){return Y(new URLSearchParams(location.search))}connectedCallback(){var r,o;super.connectedCallback(),window.nostoStrings&&(window.nostoStrings=K(window.nostoStrings)),this.setAttribute(_,""),this._hydration=new j({ctx:{pathname:location.pathname,search:location.search,root:((o=(r=window.Shopify)==null?void 0:r.routes)==null?void 0:o.root)??"/"},onCard:this._onCardHtml,onUnavailable:this._onCardUnavailable}),this._hydration.prewarm();const e=this.querySelector("[data-nosto-initial-skeleton]"),t=e?Array.from(e.querySelectorAll(`[${ce}]`)):[];e&&t.length?(this._seedList=e,this._seedNodes=t.map(a=>({key:`seed:${x(a)}`,productId:x(a),node:a}))):e==null||e.remove(),this._onFilterChanged=this._onFilterChanged.bind(this),document.addEventListener(T,this._onUserFilterChanged),window.addEventListener("popstate",this._onFilterChanged);const i=this.querySelector("template[data-nosto-ingrid-tiles]");if(!i)return;
66const s=Array.from(i.content.querySelectorAll("[data-ingrid-position]")).map((a,n)=>({key:n,breakpoint:a.getAttribute("data-ingrid-breakpoint")??"desktop",configured:Number(a.getAttribute("data-ingrid-position")),position:0,html:a.outerHTML}));for(const a of["desktop","mobile"])s.filter(n=>n.breakpoint===a).sort((n,d)=>n.configured-d.configured).forEach((n,d)=>{n.position=Math.max(1,n.configured-d)});s.sort((a,n)=>a.position-n.position||a.configured-n.configured),this._inGridTiles=s.filter(a=>a.position>=1&&a.position<=this.pageSize)}disconnectedCallback(){var e,t,i;super.disconnectedCallback(),document.removeEventListener(T,this._onUserFilterChanged),window.removeEventListener("popstate",this._onFilterChanged),(e=this._cardObserver)==null||e.disconnect(),(t=this._nearObserver)==null||t.disconnect(),this._observedBodies.clear(),(i=this._hydration)==null||i.destroy()}willUpdate(){if(!this._seedList)return;const e=this._searchTask.status;(e===u.COMPLETE||e===u.ERROR||this._redirecting)&&(this._seedList.remove(),this._seedList=void 0)}_revealLoadedCards(){this._prioritiseLeadImages(),this.querySelectorAll(`[data-nosto-card]:not(.${S})`).forEach(t=>{if(!this._cardHasOwnMarkup(t))return;t.dataset.revealDeadline||(t.dataset.revealDeadline=String(performance.now()+y),setTimeout(()=>this._scheduleReveal(),y+50));let i=performance.now()>Number(t.dataset.revealDeadline);if(!(!t.querySelector("[data-is-product-card] product-card-slider")||!customElements.get("product-card-slider")||!!t.querySelector('[data-pcs-index="0"]'))&&!i)return;const o=t.querySelector('[data-is-product-card] [data-pcs-index="0"] img')??t.querySelector("[data-is-product-card] .product-card-image-frame img");if(i&&o&&!o.complete){const n=t.getBoundingClientRect();if(!(n.top<window.innerHeight*2.5&&n.bottom>-window.innerHeight)){t.dataset.revealDeadline=String(performance.now()+y),setTimeout(()=>this._scheduleReveal(),y+50),i=!1;return}}if(o&&!o.complete&&!i){if(t.dataset.revealWaiting)return;t.dataset.revealWaiting="1";const n=()=>{delete t.dataset.revealWaiting,this._scheduleReveal()};o.addEventListener("load",n,{once:!0}),o.addEventListener("error",n,{once:!0});return}const a=()=>{var n,d;o&&o.naturalWidth>0&&((n=o.closest(".product-card-image-frame"))==null||n.classList.add("is-image-loaded"),(d=o.closest(".product-card-shell"))==null||d.classList.add("is-image-loaded")),delete t.dataset.revealWaiting,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.classList.add(S),this._clearInitialLoadOnce()})})};if(o&&o.complete&&o.naturalWidth>0&&o.decode&&!i){if(t.dataset.revealDecoding)return;t.dataset.revealDecoding="1",o.decode().catch(()=>{}).then(()=>{delete t.dataset.revealDecoding,a()});return}a()}),this._clearInitialLoadOnce()}_placeholderCount(){return this.hasAttribute(_)?this.expectedCount<=0?this.pageSize:Math.min(this.pageSize,this.expectedCount):this.pageSize}_clearInitialLoadOnce(){!this.hasAttribute(_)||this._searchTask.status!==u.COMPLETE||Array.from(this.querySelectorAll(`[data-nosto-card]:not(.${S})`)).some(i=>{const s=i.getBoundingClientRect();return s.top<window.innerHeight*2&&s.bottom>0})||this.removeAttribute(_)}_prioritiseLeadImages(){this.hasAttribute(_)&&Array.from(this.querySelectorAll("[data-nosto-card]")).slice(0,k).forEach((e,t)=>{const i=e.querySelector(".product-card-image-frame img");!i||i.dataset[I]!==void 0||(i.dataset[I]="done",i.loading="eager",t<le&&i.setAttribute("fetchpriority","high"))})}_cardHasOwnMarkup(e){var i;const t=g((i=e.querySelector("[data-nosto-card-body]"))==null?void 0:i.getAttribute("data-product-id"));return t?Array.from(e.querySelectorAll("[data-is-product-card]")).some(s=>g(s.getAttribute("data-algolia-product-id"))===t):!1}_hitsToHydrate(e){const t=new Set(this._seedNodes.map(i=>i.productId));return E(m(e)).filter(i=>!t.has(g(i.productId)))}_kickHydration(e){!this._hydration||this._redirecting||this._hydration.update(this._hitsToHydrate(e))}_syncHydration(){const e=this._searchTask.value;!e||!this._hydration||this._redirecting||(this._pruneObservedBodies(),this._cardBodies.clear(),this._pendingHtml.clear(),this.querySelectorAll("[data-nosto-card-body]").forEach(t=>{const i=t.dataset.handle;i&&this._cardBodies.set(i,t),this._observeBody(t)}),this._hydration.update(this._hitsToHydrate(e)))}_fillBody(e,t){e.querySelector("[data-is-product-card]")||(e.innerHTML=t,e.dataset.handle&&this._pendingHtml.delete(e.dataset.handle),this._scheduleReveal())}_isNear(e){if(e.dataset.near)return!0;const t=e.getBoundingClientRect(),i=window.innerHeight;return t.bottom>-i&&t.top<i*2.5}
66_observeBody(e){if(!this._observedBodies.has(e)){if(this._observedBodies.add(e),!("IntersectionObserver"in window)){e.dataset.near="1";return}this._nearObserver??(this._nearObserver=new IntersectionObserver(t=>{for(const i of t){const s=i.target;if(!i.isIntersecting){delete s.dataset.near;continue}s.dataset.near="1";const r=s.dataset.handle?this._pendingHtml.get(s.dataset.handle):void 0;r&&this._queueFill(s,r)}},{rootMargin:oe})),this._nearObserver.observe(e)}}updated(){if(this._cardObserver||(this._cardObserver=new MutationObserver(()=>this._scheduleReveal()),this._cardObserver.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-pcs-index"]})),this._revealLoadedCards(),this._syncHydration(),!this._phone)return;const e=this._searchTask.value,t=e?E(m(e)).length:0;t&&(this._renderCount===0?this._renderCount=t:this._renderCount<t&&this._growRenderCount(t))}_onFilterChanged(){this._seedNodes=[],this._limit=0,this._renderCount=0,this._unavailable.clear(),this._loadingMore=!1,this.requestUpdate()}_scrollToSectionTop(){var s;const e=this.closest("#collection, #search-results");if(!e){window.scrollTo({top:0,left:0,behavior:"auto"});return}const t=((s=document.getElementById("main-header"))==null?void 0:s.offsetHeight)??0,i=Math.max(0,e.getBoundingClientRect().top+window.scrollY-t);window.scrollY>i&&window.scrollTo({top:i,left:0,behavior:"auto"})}get _requested(){return this._limit>0?this._limit:this.pageSize}_broadcastResults(e){document.dispatchEvent(new CustomEvent(V,{bubbles:!0,composed:!0,detail:{facets:J(e),total:v(e)}}))}_categoryTarget(){return this.collectionId?{categoryId:this.collectionId}:{categoryPath:this.collectionPath??""}}_gridItems(e){const t=[],i=new Set(this._seedNodes.map(r=>r.productId));this._seedNodes.forEach(r=>t.push({key:r.key,template:l`${r.node}`})),i.size&&(e=e.filter(r=>!i.has(g(r.productId))));const s=this._seedNodes.length;return e.forEach((r,o)=>{const a=o+1+s;this._inGridTiles.filter(d=>d.position===a).forEach(d=>t.push({key:`t:${d.key}`,template:l`${p(d.html)}`}));const n=X(r.url);!n||this._unavailable.has(n)||t.push({key:`p:${r.productId??r.url??o}`,template:l`<li class="w-full" data-nosto-card>
67          <div
68            class="block"
69            data-nosto-card-body
70            data-handle="${n}"
71            data-product-id="${Z(r.productId)}"
72          >
73            ${p(b())}
74          </div>
75          <div class="nosto-card-cover bg-t-background" aria-hidden="true">
76            ${p(b())}
77          </div>
78        </li>`})}),e.length>0&&this._inGridTiles.filter(o=>o.position>e.length).sort((o,a)=>o.position-a.position).forEach(o=>t.push({key:`t:${o.key}`,template:l`${p(o.html)}`})),l`${ee(t,r=>r.key,r=>r.template)}`}_skeletonLis(e){const t=Array.from({length:e},()=>`<li class="w-full flex flex-col">${b()}</li>`).join("");return l`${p(t)}`}_grid(e,t={}){return l`${he}
79      <ul class="${re}">
80        ${this._gridItems(e)}
81        ${t.extraSkeletons?this._skeletonLis(t.extraSkeletons):w}
82      </ul>
83      ${t.footer??w}`}_footer(e){var s,r;const t=v(e)-this._requested;let i=w;if(t>0){const o=this.search?((s=window.nostoStrings)==null?void 0:s.loadMore)||"Load more":((r=window.nostoStrings)==null?void 0:r.seeMore)||"See more";i=l`<button
84        type="button"
85        class=${M}
86        @click=${this._onSeeMore}
87        aria-label=${o}
88      >
89        ${o}
90      </button>`}return l`<div
91      class="main-collection-product-grid__load-more-area flex flex-col items-center justify-center gap-4 py-6"
92    >
93      ${i}
94    </div>`}render(){var o,a,n,d;if(this._redirecting)return this._grid([],{extraSkeletons:this.pageSize});const e=this._searchTask.status,t=this._searchTask.value,i=E(t?m(t):[]),s=this._phone&&this._renderCount>0&&this._renderCount<i.length?i.slice(0,this._renderCount):i;if((e===u.PENDING||e===u.INITIAL)&&!this._loadingMore)return this._seedList?l``:this._grid([],{extraSkeletons:this._placeholderCount()});if(e===u.ERROR&&!t){const A=((o=window.nostoStrings)==null?void 0:o.tryAgain)??"Try again";return this._message(((a=window.nostoStrings)==null?void 0:a.error)??"Unable to load products.",l`<button
95          type="button"
96          class=${M}
97          @click=${this._onRetry}
98        >
99          ${A}
100        </button>`)}return e===u.COMPLETE&&!s.length?((n=this.closest("#search-results, #collection"))==null?void 0:n.querySelector("[data-search-no-results]"))?l``:this._message(((d=window.nostoStrings)==null?void 0:d.noResults)??"No products found."):this._grid(s,{extraSkeletons:this._loadingMore?Math.max(0,this._requested-s.length):0,footer:this._loadingMore||!t?void 0:this._footer(t)})}_message(e,t){return l`<div class="flex flex-col items-start gap-3 py-md">
101      <h2>${e}</h2>
102      ${t??w}
103    </div>`}get total(){return this._searchTask.value?v(this._searchTask.value):0}};h([f({attribute:"collection-id"})],c.prototype,"collectionId",2);
103h([f({attribute:"collection-path"})],c.prototype,"collectionPath",2);h([f({type:Boolean})],c.prototype,"search",2);h([f({type:Number,attribute:"page-size"})],c.prototype,"pageSize",2);h([f({type:Number,attribute:"expected-count"})],c.prototype,"expectedCount",2);h([R()],c.prototype,"_limit",2);h([R()],c.prototype,"_redirecting",2);h([R()],c.prototype,"_loadingMore",2);c=h([O("nosto-product-grid")],c);

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.