PageSourceSearch

https://www.brochuwalker.com/cdn/shop/t/1176/assets/lib-elements.js?v=124212710403623209001790355649

js brochuwalker.com collected 2026-09-25 19:55:33 UTC 11,189 bytes, 2 lines download raw bytes

1import{camelToKebab,kebabToCamel,parseAttribute,getSectionId,reduceObject,deepMerge}from"utils/gw";import{debounce}from"utils/general";import{RESIZE_DEBOUNCE_TIMER}from"constants";const HTMLParsedElement=((reverse=!1)=>{const DCL="DOMContentLoaded",init=new WeakMap,queue=[],isParsed=el=>{do if(el.nextSibling)return!0;while(el=el.parentNode);return!1},upgrade=()=>{reverse&&queue.reverse(),queue.splice(0).forEach(info=>{init.get(info[0])!==!0&&(init.set(info[0],!0),info[0][info[1]]())})};document.addEventListener(DCL,upgrade);class HTMLParsedElement2 extends HTMLElement{static withParsedCallback(Class,name="parsed"){const{prototype}=Class,{connectedCallback}=prototype,method=name+"Callback",cleanUp=(el,observer,ownerDocument,onDCL)=>{observer.disconnect(),ownerDocument.removeEventListener(DCL,onDCL),parsedCallback(el)},parsedCallback=el=>{queue.length||requestAnimationFrame(upgrade),queue.push([el,method])};return Object.defineProperties(prototype,{connectedCallback:{configurable:!0,writable:!0,value(){if(connectedCallback&&connectedCallback.apply(this,arguments),method in this&&!init.has(this)){const self=this,{ownerDocument}=self;if(init.set(self,!1),ownerDocument.readyState==="complete"||isParsed(self))parsedCallback(self);else{const onDCL=()=>cleanUp(self,observer,ownerDocument,onDCL);ownerDocument.addEventListener(DCL,onDCL);const observer=new MutationObserver(()=>{isParsed(self)&&cleanUp(self,observer,ownerDocument,onDCL)});observer.observe(self.parentNode,{childList:!0,subtree:!0})}}}},[name]:{configurable:!0,get(){return init.get(this)===!0}}}),Class}}return HTMLParsedElement2.withParsedCallback(HTMLParsedElement2)})();export class GWElement extends HTMLParsedElement{constructor(){super(),this.initialized=!1,console.debug("GWEL: constructing element",this,this.initialized),this.options={},this.listeners=new Map,this.attributeChangedCallbacks=new Map,this.hooks={beforeListeners:[]},this.sectionId=getSectionId(this),this.optionObjectSeparator=".",this.parsedOptionObjects=[]}parsedCallback(){this.log("Connecting"),console.debug("GWEL: CONNECTING element",this,this.initialized),this.init()}disconnectedCallback(){this.log("Disconnecting"),this.destroy()}static get observedAttributes(){return[]}attributeChangedCallback(attr,oldValue,newValue){if(oldValue===newValue)return;newValue=parseAttribute(newValue);const attrKey=kebabToCamel(attr);Object.keys(this.options).includes(attrKey)&&(this.options[attrKey]=newValue);const attrCallback=this.attributeChangedCallbacks.get(attr);attrCallback&&attrCallback(newValue,oldValue,attr)}addAttributeListener(attr,callback){this.attributeChangedCallbacks.set(attr,callback.bind(this))}addEventListeners(){this.log("Adding event listeners",this.listeners);for(const[target,events]of this.listeners)for(const[event,callback]of Object.entries(events))console.debug("adding event listener!",event,callback,target),target.addEventListener(event,callback)}removeEventListeners(){this.log("Removing event listeners");for(const[target,events]of this.listeners)for(const[event,callback]of Object.entries(events))target.removeEventListener(event,callback)}addListener(target,event,callback,bound=!1){if(!target||!event)return this.error("Failed to add listener, invalid target or event specified");const listeners={...this.listeners.get(target),[event]:bound?callback:callback.bind(this)};this.listeners.set(target,listeners)}addDelegatedListener(container,targets,event,callback,bound=!1){targets=Array.from(typeof targets=="string"?container.querySelectorAll(targets):targets),bound||(callback=callback.bind(this));const eventCallback=e=>targets.includes(e.target)&&callback(e);this.addListener(container,event,eventCallback)}addResizeListener(target,callback){callback=debounce(callback.bind(this),RESIZE_DEBOUNCE_TIMER),this.addListener(target,"resize",callback,!0)}addHook(hook,callback,bound=!1){if(!Object.keys(this.hooks).includes(hook))return this.error("Failed to add hook, invalid hook specified");if(!callback)return this.error("Failed to add hook, no callback specified");this.hooks[hook].push(bound?callback:callback.bind(this))}
1registerEditorCallback(event,callback,bound=!1){if(!callback||typeof callback!="function"||callback.toString().endsWith("{}"))return;callback=bound?callback:callback.bind(this);const eventCallback=event2=>{event2.detail.sectionId===this.sectionId&&callback(event2.target,{...event2.detail,event:event2})};this.addListener(document,event,eventCallback)}onBlockSelect(element,{load,event}){}onBlockDeselect(element,{event}){}onSectionLoad(element,{event}){}onSectionUnload(element,{event}){}onSectionSelect(element,{load,event}){}onSectionDeselect(element,{event}){}onSectionReorder(element,{event}){}configureThemeEditor(){const editorEventCallbacks={"shopify:block:select":this.onBlockSelect,"shopify:block:deselect":this.onBlockDeselect,"shopify:section:load":this.onSectionLoad,"shopify:section:unload":this.onSectionUnload,"shopify:section:select":this.onSectionSelect,"shopify:section:deselect":this.onSectionDeselect,"shopify:section:reorder":this.onSectionReorder};Object.entries(editorEventCallbacks).forEach(([e,c])=>
1this.registerEditorCallback(e,c))}init(){console.debug("GWEL: INITIALIZING element",this,this.initialized,this.listeners),!this.initialized&&(this.log("Initializing"),this.options=this.getOptions(),this.configureThemeEditor(),this.hooks.beforeListeners.forEach(hook=>hook()),this.addEventListeners(),!this.manualInit&&(this.initialized=!0))}destroy(){this.removeEventListeners(),this.initialized=!1}reset(){this.destroy(),this.init()}resetOnResize(){this.addResizeListener(window,this.reset)}get optionDefaults(){return{}}derivedOptions(options){return{}}optionDefault(option){if(option.includes(this.optionObjectSeparator)){const keys=option.split(this.optionObjectSeparator);let value=this.optionDefaults;for(const key of keys)value=value[key];return value}return this.optionDefaults[option]??null}parseOption(option){if(option=camelToKebab(option),!this.hasAttribute(option))return null;const value=this.getAttribute(option);return parseAttribute(value)}parseOptionObject(group,defaults={}){const baseObject=this.parseOption(group)??{};if(this.parseOption(group)===!1)return!1;this.parsedOptionObjects.push(group);const objectPrefix=`${group}${this.optionObjectSeparator}`,optionAttributes=[baseObject];for(const attribute of this.attributes){if(!attribute.name.startsWith(objectPrefix))continue;const parts=attribute.name.slice(objectPrefix.length).split(this.optionObjectSeparator);let attributeObject=this.parseOption(attribute.name);for(;parts.length;)attributeObject={[kebabToCamel(parts.pop())]:attributeObject};optionAttributes.push(attributeObject)}return deepMerge(defaults,...optionAttributes)}getOptions(){const defaults=this.optionDefaults,options={};for(const[prop,defaultValue]of Object.entries(defaults))if(defaultValue&&typeof defaultValue=="object"&&!Array.isArray(defaultValue)){if(this.parsedOptionObjects.includes(prop))continue;options[prop]=this.parseOptionObject(prop,defaultValue)??defaultValue}else options[prop]=this.parseOption(prop)??defaultValue;return deepMerge(options,this.derivedOptions(options))}log(){console.debug(`${this.constructor.name}:`,...arguments)}error(){return console.error(`${this.constructor.name} Error:`,...arguments),!1}}export class GWObservedElement extends GWElement{constructor(){super(),this.observerList=new Map,this.observers=new Map}init(){super.init(),this.initObservers()}destroy(disconnectObservers=!0){super.destroy(),disconnectObservers&&this.disconnectObservers()}reset(){this.destroy(!0),this.init()}getObserver(type,target){const observers=this.observers.get(type);if(!observers)return this.error(`Failed to get observer, no observer of type ${type} found`);const observer=observers.get(target);return observer||this.error(`Failed to get ${type} observer, no observer found for target`,target)}addObserver(target,type,data){if(!data.callback)return this.error(`Failed to add ${type} observer, no callback provided`);data.callback=data.callback.bind(this);const observers=[...this.observerList.get(type)||new Map,[target,data]];this.observerList.set(type,observers)}initObservers(){this.log("Initializing observers");for(const[type,observers]of this.observerList)for(const[target,data]of observers)this.initObserver(type,target,data)}initObserver(type,target,data){let observer=null;switch(type){case"mutation":observer=this.initMutationObserver(target,data);break;case"intersection":observer=this.initIntersectionObserver(target,data);break;case"resize":observer=this.initResizeObserver(target,data);break}if(!observer)return this.error(`Failed to initialize observer, the provided type "${type}" is not supported`);const observers=[...this.observers.get(type)||new Map,[target,observer]];this.observers.set(type,observers)}processObserverOptions(options={}){const processed={};for(const key of Object.keys(options))processed[key]=typeof options[key]=="function"?options[key]():options[key];return processed}addMutationObserver(target,callback,{mutationType="childList",options={}}={}){this.addObserver(target,"mutation",{callback,mutationType,options:{...options,[mutationType]:!0}})}initMutationObserver(target,{mutationType,callback,options}={}){const observer=new MutationObserver((mutations,observer2)=>{for(const mutation of mutations)mutation.type===mutationType&&callback(mutation,observer2)});return this.observe(observer,target,this.processObserverOptions(options)),observer}addIntersectionObserver(target,callback,{onIntersect=!0,root=null,rootMargin="0px 0px 0px 0px",threshold=0}={}){this.addObserver(target,"intersection",{callback,onIntersect,options:{root,rootMargin,threshold}})}initIntersectionObserver(target,{callback,onIntersect,options}={}){const observer=new IntersectionObserver((entries,observer2)=>
1{for(const entry of entries)(entry.isIntersecting||!onIntersect)&&callback(entry,observer2)},this.processObserverOptions(options));return this.observe(observer,target),observer}addResizeObserver(target,callback,{debounced=!0,options}={}){this.addObserver(target,"resize",{callback,debounced,options})}initResizeObserver(target,{callback,debounced,options}={}){const resize=(entries,observer2)=>{for(const entry of entries)callback(entry,observer2)},observer=new ResizeObserver(debounced?debounce(resize,RESIZE_DEBOUNCE_TIMER):resize);return this.observe(observer,target,this.processObserverOptions(options)),observer}disconnectObservers(){for(const[,observers]of this.observers)for(const[,observer]of observers)observer.disconnect();this.observers.clear()}normalizeTargets(target){return isIterable(target)?[...target]:[target]}observe(observer,targets,options=!1){targets=this.normalizeTargets(targets);for(const target of targets)options!==!1?observer.observe(target,options):observer.observe(target)}}const flattenEditorEventData=(data,[key,value],parentKey=null)=>(parentKey&&(key=`${parentKey}:${key}`),typeof value=="object"?reduceObject(value,flattenEditorEventData,data,key):(key.includes("shopify")||(key=`shopify:${key}`),{...data,[key]:value}));
2//# sourceMappingURL=/cdn/shop/t/1176/assets/lib-elements.js.map?v=124212710403623209001790355649

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.