PageSourceSearch

https://www.allbirds.co.uk/cdn/shop/t/3608/assets/base-section.js

js allbirds.co.uk collected 2026-10-02 06:17:19 UTC 7,087 bytes, 3 lines download raw bytes

1import{i as E,e as C,g as P,a as R,w as I,S as g}from"./ScrollTrigger.js";const A=new Map,M=300*1e3,v=20;function L(o,e=[]){try{const t=new URL(o),i=new URLSearchParams,n=new Set;return t.searchParams.forEach((r,a)=>{const s=a.toLowerCase();e.map(p=>p.toLowerCase()).includes(s)||n.has(s)||(t.searchParams.getAll(a).map(l=>l.toLowerCase()).sort().forEach(l=>{i.append(s,l)}),n.add(s))}),t.search=i.toString(),t.toString()}catch{return o}}function $(o){const e=A.get(o);return e&&Date.now()-e.timestamp<M?e.html:(e&&A.delete(o),null)}function N(o,e){if(A.size>=v){const t=A.keys().next().value;A.delete(t)}A.set(o,{html:e,timestamp:Date.now()})}const _=new Map;let w=0,u=null;function H(o,e){_.set(o,e)}async function T(o,e,t,i){let n=null;try{const r=++w;if(u){E("[Allbirds utils] - Section Rerenderer - Request cancelled",{newRequestId:r,oldRequestId:w-1,reason:"newer-request"});try{u.abort()}catch{}}n=new AbortController,u=n;const a=Array.isArray(o),s=a?o:[o.getAttribute("data-section-id")];if(!s.every(c=>c))throw new Error("Invalid section ID(s) provided");const p=s.join(","),S=new URL(window.location.href);S.searchParams.set("sections",p);const l=L(S.toString(),["tab"]),m=$(l);let d;if(m)E("[Allbirds utils] - Section Rerenderer - Cache hit",{cacheKey:l,sectionIds:s}),d=m;else{const c=await fetch(S.toString(),{signal:n.signal});if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);if(r!==w){u===n&&(u=null);return}d=await c.json(),N(l,d),E("[Allbirds utils] - Section Rerenderer - Cache miss",{cacheKey:l,sectionIds:s})}const f=s.map(async c=>{if(r!==w)return;const b=d[c];if(!b)throw new Error(`Section HTML not found in response for section: ${c}`);const y=document.querySelector(`[data-section-id="${c}"]`);if(!y)throw new Error(`Section container not found for section: ${c}`);await k(y,b,c),r===w&&a&&e[c]?.onComplete&&e[c].onComplete(y)});if(await Promise.all(f),r!==w){u===n&&(u=null);return}t&&t(),u===n&&(u=null)}catch(r){if(r&&(r.name==="AbortError"||r.code===20)){u===n&&(u=null);return}C("[Allbirds utils] - Section Rerenderer - Error rerendering sections",{},r),i&&i(r),u===n&&(u=null)}}async function q(o,e={},t,i){try{const n={preserveScroll:!0,...e},r=n.preserveScroll?window.scrollY:null,a=[],s={};if(o.forEach(l=>{document.querySelectorAll(`[data-section-type="${l}"]`).forEach(d=>{const f=d.getAttribute("data-section-id");f&&(a.push(f),n[l]&&(s[f]=n[l]))})}),a.length===0)throw new Error(`No sections found for types: ${o.join(", ")}`);const p=()=>{n.preserveScroll&&r!==null&&window.scrollTo(0,r),t&&t()};await T(a,s,()=>{a.forEach(l=>{const m=_.get(l);m&&m()}),o.forEach(l=>{document.querySelectorAll(`[data-section-type="${l}"]`).forEach(d=>{const f=d.getAttribute("data-section-id");if(f&&window.BaseSection&&typeof window.BaseSection.getInstance=="function"){const c=window.BaseSection.getInstance(f);c&&c.section&&(c.initialized=!1,c.section._initInstance(c))}})}),p&&p()},l=>{n.preserveScroll&&r!==null&&window.scrollTo(0,r),i&&i(l)})}catch(n){if(i)i(n);else throw n}}function O(o){_.delete(o)}async function k(o,e,t){const i=document.createElement("div");i.innerHTML=e;const n=i.querySelector(`[data-section-id="${t}"]`);if(!n)throw new Error(`New section not found in response HTML for section: ${t}`);const r=o.__vue_app__;if(r){const a=o.getAttribute("data-section-id");if(window.BaseSection&&typeof window.BaseSection.getInstance=="function"){const s=window.BaseSection.getInstance(a);s&&s.section&&typeof s.section.onUnload=="function"&&s.section.onUnload(s)}r.unmount(),delete o.__vue_app__}o.innerHTML=n.innerHTML,n.getAttributeNames().filter(a=>a.startsWith("data-")).forEach(a=>{o.setAttribute(a,n.getAttribute(a))})}const V=(o,e,t)=>{var i=`Error in component: <${e.$options.name} />
2`;t&&(i+=`Error occurred during lifecycle hook: ${t}
3`),e.$options.propsData&&(i+=`Props passed to component: ${e.$options.propsData}`),console.warn(i),window?.TrackJS?.track(o)};P.registerPlugin(R);class h{static instances=new Map;constructor(e){const t=document.querySelectorAll(e);t.length&&(t.forEach(i=>{const n=i.getAttribute("data-section-id");if(!n)return;this.templateName=this.templateName?this.templateName:i.getAttribute("data-section-template-name");const r={animation:null,container:i,hasLoaded:!1,initialized:!1,scrollTrigger:null,section:this};h.instances.has(this.constructor.name)||h.instances.set(this.constructor.name,new Map),h.instances.get(this.constructor.name).set(n,r),this._initInstance(r)}),Shopify.designMode&&(document.addEventListener("shopify:section:load",i=>{const n=i.target.querySelector(e);
3if(!n)return;const r=n.getAttribute("data-section-id"),a=h.instances.get(this.constructor.name);if(a&&r){const s={animation:null,container:n,hasLoaded:!1,initialized:!1,scrollTrigger:null,section:this};a.set(r,s),this._initInstance(s)}}),document.addEventListener("shopify:section:unload",i=>{const n=i.target.querySelector(e);if(!n)return;const r=n.getAttribute("data-section-id"),a=h.instances.get(this.constructor.name);if(a&&r){const s=a.get(r);s&&(this.onUnload(s),a.delete(r))}})))}static getInstance(e){for(const[,t]of h.instances)if(t.has(e))return t.get(e);return null}_configureErrorMonitoring(e){const t=e.container.__vue_app__;t?t.config.errorHandler=V:C(`[Allbirds section] - BaseSection - _configureErrorMonitoring for ${e.container.id}`,{},new Error("Vue app not found"))}_initInstance(e){const t=e.container.getAttribute("data-section-id");e.initialized?I(`[Allbirds section] - BaseSection - _initInstance skipped for ${t} (already initialized)`):(this.init(e),typeof this.setupInViewAnimationTimeline=="function"&&this.setupInViewAnimation(e),this._configureErrorMonitoring(e),t&&H(t,()=>this.onRerenderComplete(e)),e.initialized=!0,e.hasLoaded=!0)}getInViewAnimationOptions(){return{end:"bottom 20%",once:!0,start:"top 85%"}}init(e){}isAncillaryPageTemplate(){return this.templateName===g.PAGE}isCollectionPageTemplate(){return this.templateName===g.COLLECTION}isErrorPageTemplate(){return this.templateName===g.NOT_FOUND_ERROR}isHomePageTemplate(){return this.templateName===g.INDEX}isProductPageTemplate(){return this.templateName===g.PRODUCT}isSearchPageTemplate(){return this.templateName===g.SEARCH}onRerenderComplete(e){e.initialized=!1,this._initInstance(e)}onUnload(e){const t=e.container.__vue_app__,i=e.container.getAttribute("data-section-id");i&&O(i),e.animation?.scrollTrigger?.kill(),e.animation&&(e.animation.kill(),e.animation=null),t?.unmount()}registerRerendering(e,t,i,n){if(Array.isArray(e))return()=>T(e,t,i,n);const r=e;return()=>T(r.container,t,i,n)}registerRerenderingByType(e,t={},i,n){return()=>q(e,t,i,n)}setupAnimation(e,t){return e.animation=t(),e.animation&&e.animation.pause(0),e.animation}setupInViewAnimation(e){if(e.animation?.scrollTrigger){e.scrollTrigger&&R.refresh();return}try{const t=this.setupAnimation(e,()=>this.setupInViewAnimationTimeline(e));t?.scrollTrigger&&(e.scrollTrigger=t.scrollTrigger)}catch(t){I("[Allbirds section] - BaseSection - Error setting up animation timeline:",{},t)}}setupInViewAnimationTimeline(e){return null}}export{h as B,q as r};

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.