PageSourceSearch

http://reviewdekha.com/js/bc-datalayer.js

js reviewdekha.com collected 2026-10-04 01:49:05 UTC 81,363 bytes, 498 lines download raw bytes

1(()=>{"use strict"
2var t=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i])
3return t.concat(r||Array.prototype.slice.call(e))}
4const e=function(){function e(){}return e.getInstance=function(){return e.instance||(e.instance=new e),e.instance},e.prototype.shouldDebug=function(){var t,e
5return!0===(null===(e=null===(t=window._BCDataLayer)||void 0===t?void 0:t.config)||void 0===e?void 0:e.debug)},e.prototype.shouldLog=function(){var t,e
6return!0===(null===(e=null===(t=window._BCDataLayer)||void 0===t?void 0:t.config)||void 0===e?void 0:e.debug)},e.prototype.log=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e]
7this.shouldLog()&&console.log.apply(console,t)},e.prototype.warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
8this.shouldLog()&&console.warn.apply(console,t(["%c"+e[0],"color: #FFA500; font-weight: bold;"],e.slice(1),!1))},e.prototype.error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
9this.shouldLog()&&console.error.apply(console,t(["%c"+e[0],"color: #FF0000; font-weight: bold;"],e.slice(1),!1))},e.prototype.debug=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n]
10this.shouldLog()&&console.debug.apply(console,t(["%c"+e[0],"color:rgb(123, 123, 223); font-weight: bold;"],e.slice(1),!1))},e}()
11var n,r=function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])
12return t},r.apply(this,arguments)},i=function(){function t(){this.default_config={listing:{item_id:"ss_sku",item_name:"name",item_brand:"brand",item_category:"product_type",compare_at_price:"msrp",price:"price",product_id:"uid"},product:{item_id:"uid",item_brand:"brand",item_category:"product_type"},api:"",skuseperator:"_",gtm:""},this.config={}}return t.getInstance=function(){var n,i,o,a,s,c,u,l,d,p,h,f
13return t.instance||(t.instance=new t,(null===(n=window._BCDataLayer)||void 0===n?void 0:n.config)||e.getInstance().warn("DL Config: config is missing. Using default config."),t.instance.config=r(r(r({},t.instance.default_config),null===(i=window._BCDataLayer)||void 0===i?void 0:i.config),{product:r(r({},t.instance.default_config.product),null===(a=null===(o=window._BCDataLayer)||void 0===o?void 0:o.config)||void 0===a?void 0:a.product),listing:r(r({},t.instance.default_config.listing),null===(c=null===(s=window._BCDataLayer)||void 0===s?void 0:s.config)||void 0===c?void 0:c.listing),api:null===(l=null===(u=window._BCDataLayer)||void 0===u?void 0:u.config)||void 0===l?void 0:l.api,skuseperator:null===(p=null===(d=window._BCDataLayer)||void 0===d?void 0:d.config)||void 0===p?void 0:p.skuseperator,gtm:null===(f=null===(h=window._BCDataLayer)||void 0===h?void 0:h.config)||void 0===f?void 0:f.gtm})),t.instance},t.prototype.getConfig=function(){return this.config},t.prototype.getSkuSeparator=function(){return this.config.skuseperator||"_"},t.prototype.setConfig=function(t){this.config=t},t.prototype.getMappedListingField=function(t){return this.config.listing[t]||this.default_config.listing[t]||null},t.prototype.getMappedField=function(t){return this.config[t]||this.default_config[t]||null},t.prototype.getDebug=function(){return this.config.debug||this.default_config.debug||!1},t}(),o=function(){return o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])
14return t},o.apply(this,arguments)},a=function(){function t(t,e,n){this.manager=t,this.sectionName=e,this.data=n,this.dlConfig=i.getInstance()}return t.prototype.getData=function(){return this.data},t.prototype.getDLConfig=function(){return this.dlConfig},t.prototype.update=function(t){this.data=o(o({},this.data),t),this.manager.notifySectionUpdated(this.sectionName,this.data)},t}(),s=function(){return s=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])
15return t},s.apply(this,arguments)},c=function(){function t(t){void 0===t&&(t={items:[],cart_count:0,cart_total:0,currency:"AUD"}),this.newCartItemArray=[],this.newCartItemMap=new Map,this.state=t,this.initCartItemQtyMap()}return t.prototype.getState=function(){return this.state},t.prototype.updateCartItemQtyMapAndGetChangeQuantity=function(t,e){var n=this.cartItemQtyMap.get(t)||0
16return n&&this.registerQtyChangeMap.set(t,e-n),this.cartItemQtyMap.set(t,e),{changedQty:e-n}},t.prototype.registerQtyChange=function(t,e){this.registerQtyChangeMap.set(t,e)},t.prototype.registryRemovedItem=function(t){this.cartItemQtyMap.delete(t),this.cartItemMap.delete(t)},t.prototype.getChangedQtyFromRegistry=function(t){var e=this.registerQtyChangeMap.get(t)
17return this.registerQtyChangeMap.delete(t),e},t.prototype.getCartItem=function(t){return this.cartItemMap.get(t)},t.prototype.getCartItems=function(){return Array.from(this.cartItemMap.values())},t.prototype.setCartItem=function(t,e){this.cartItemMap.set(t,e),this.cartItemQtyMap.set(t,e.quantity)},t.prototype.setNewCartItemArray=function(t){this.newCartItemArray.push(t),this.newCartItemMap.set(t.id,t)},t.prototype.reduceCartQtyById=function(t){var e=new Map
18return t.forEach((function(t){var n=t.id,r=t.quantity||0,i=e.get(n)||0
19e.set(n,i+r)})),e},t.prototype.detectChangesFromNewCartItems=function(){var t=this,e=[],n=[],r=[]
20if(this.newCartItemArray.length>0){var i=this.reduceCartQtyById(this.newCartItemArray)
21i.forEach((function(i,o){var a=i,c=t.cartItemQtyMap.has(o)?t.cartItemQtyMap.get(o):0,u=t.newCartItemMap.get(o)
22a==c?r.push(s(s({},u),{quantity:a})):a>c?e.push(s(s({},u),{quantity:a-c})):n.push(s(s({},u),{quantity:c-a}))})),this.cartItemMap.forEach((function(t,e){i.has(e)||n.push(t)}))
23var o=new Map(this.newCartItemMap)
24this.cartItemMap.clear(),o.forEach((function(e,n){t.cartItemMap.set(n,s({},e))})),this.cartItemQtyMap.clear(),i.forEach((function(e,n){t.cartItemQtyMap.set(n,e)})),this.newCartItemArray=[],this.newCartItemMap.clear()}return{added:e,removed:n,nochange:r}},t.prototype.noItemsInCartChanges=function(){var t=[]
25return this.cartItemMap.forEach((function(e,n){t.push(e)})),t},t.prototype.setEmptyCartState=function(){this.state.items=[],this.cartItemMap.clear(),this.cartItemQtyMap.clear(),this.registerQtyChangeMap.clear(),this.newCartItemArray=[],this.newCartItemMap.clear()},t.prototype.uniqueCartItems=function(t){var e=new Map
26return t.forEach((function(t){e.set(t.id,t)})),e},t.prototype.removeCartItem=function(t){this.cartItemMap.delete(t),this.cartItemQtyMap.delete(t)},t.prototype.initCartItemQtyMap=function(){this.cartItemQtyMap=this.reduceCartQtyById(this.state.items),this.cartItemMap=this.uniqueCartItems(this.state.items),this.registerQtyChangeMap=new Map},t}(),u=function(){function t(){this.cache=new Map,this.isValid=!0,this.isLocalStorageAvailable=this.getIsLocalStorageAvailable(),this.loadFromLocalStorage()}return t.prototype.getIsLocalStorageAvailable=function(){try{return"undefined"!=typeof window&&"localStorage"in window&&null!==window.localStorage}catch(t){return!1}},t.prototype.hydrateCache=function(t){var e=JSON.parse(t)
27this.cache=new Map(e.map((function(t){return[t.id,t]})))},t.prototype.loadFromLocalStorage=function(){if(this.isLocalStorageAvailable)try{var e=localStorage.getItem(t.CACHE_KEY)
28if(e){var n=JSON.parse(e)
29this.cache=new Map(n.map((function(t){return[t.id,t]})))}}catch(t){console.error("Error loading product cache:",t),this.cache.clear()}},t.prototype.getCacheAttributes=function(t){var e,n,r,i,o,a,s,c,u,l,d=this.cache.get(t)
30if(d){var p=(n=(e=d.data).item_brand,r=e.item_category,i=e.item_category2,o=e.item_category3,a=e.item_category4,s=e.item_category5,c=e.item_size,u=e.item_width,l=e.compare_at_price,{item_id:e.item_id,item_brand:n,item_category:r,item_category2:i,item_category3:o,item_category4:a,item_category5:s,item_size:c,item_width:u,compare_at_price:parseFloat(l)})
31return Object.fromEntries(Object.entries(p).filter((function(t){return t[0],null!==t[1]})))}return null},t.prototype.getCartAttributesAndIfValid=function(t){var e=this.getCacheAttributes(t)
32return(!e||0!==Object.keys(e).length)&&e},t.prototype.saveToLocalStorage=function(){if(this.isLocalStorageAvailable)try{var e=Array.from(this.cache.values())
33localStorage.setItem(t.CACHE_KEY,JSON.stringify(e))}catch(t){console.error("Error saving product cache:",t)}},t.prototype.setCache=function(e,n,r){if(void 0===r&&(r=!1),this.cache.has(e)){var i=this.cache.get(e)
34return n&&(i.data=n),i.timestamp=Date.now(),void(i.isCartItem=r||i.isCartItem)}for(var o=Array.from(this.cache.entries()).filter((function(t){return t[0],!t[1].isCartItem})).sort((function(t,e){return t[1].timestamp-e[1].timestamp}));this.cache.size>=t.MAX_CACHE_SIZE+Array.from(this.cache.values()).filter((function(t){return t.isCartItem})).length&&o.length>0;){var a=o.shift()[0]
35this.cache.delete(a)}this.cache.set(e,{id:e,data:n,timestamp:Date.now(),isCartItem:r}),this.saveToLocalStorage()},t.prototype.getCache=function(t){var e=this.cache.get(t)
36return e?(e.timestamp=Date.now(),e.data):null},t.prototype.clearCache=function(){this.cache.clear(),this.saveToLocalStorage()},t.prototype.removeCacheByProductId=function(t){this.setCache(t,!1,!1)},t.MAX_CACHE_SIZE=20,t.CACHE_KEY="cartProductCache",t}(),l=function(){function t(t,e){this.accessToken=t,this.shopDomain=e}return t.prototype.isCartEndpoint=function(e){if(!e)return!1
37var n=e.startsWith("/")?e.substring(1):e,r={cart:t.ENDPOINT_REGEX.cart.test(n)},i=Object.keys(r).find((function(t){return r[t]}))||null
38return null!==i&&{matches:null!==i,endpoint:i}},t.prototype.getEndpointType=function(e){var n
39return(null===(n=Object.entries(t.ENDPOINT_REGEX).find((function(t){return t[0],t[1].test(e)})))||void 0===n?void 0:n[0])||null},t.prototype.isEndPoint=function(t){return this.isCartEndpoint(t)},t.prototype.shouldQueueRequestCallBack=function(e){return!!e&&t.TRIGGER_AFTER_URLS.some((function(t){return e.includes(t)}))},t.prototype.queueRequestCallBack=function(){e.getInstance().debug("Queue Request Callback"),setTimeout((function(){fetch("/cart.js?dl=".concat(Math.random()))}),50)},t.prototype.shouldInterceptRequest=function(t){return this.isCartEndpoint(t)||this.shouldQueueRequestCallBack(t)},t.ENDPOINT_REGEX={cart:/^cart\.js(?:\?.*)?$/},t.TRIGGER_AFTER_URLS=["/cart/change","/cart/update","/cart/add"],t}(),d=function(){function t(t,e){var n=this
40this.handleWorkerMessage=function(t){var e=t.data,r=e.type,i=e.products,o=e.error,a=e.cartResponse
41switch(r){case"PRODUCT_FETCH_COMPLETE":n.handleProductFetchComplete(a,i,!1)
42break
43case"PRODUCT_FETCH_ERROR":console.error("Product fetch error:",o),n.handleProductFetchComplete(a,[],!0)}},this.initWorker(),this.accessToken=window._BCDataLayer.config.accessToken,this.shopDomain=window._BCDataLayer.config.shopDomain,this.metaFieldConfig=window._BCDataLayer.config,this.cartSection=t,this.cartWorkerCallback=e}return t.prototype.initWorker=function(){return t=this,n=function(){var t,e,n,r
44return function(t,e){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1]
45return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype)
46return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a
47function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.")
48for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i
49switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s
50break
51case 4:return o.label++,{value:s[1],done:!1}
52case 5:o.label++,r=s[1],s=[0]
53continue
54case 7:s=o.ops.pop(),o.trys.pop()
55continue
56default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0
57continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1]
58break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s
59break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s)
60break}i[2]&&o.ops.pop(),o.trys.pop()
61continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1]
62return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,fetch("".concat(window._BCDataLayer.worker))]
63case 1:return[4,i.sent().text()]
64case 2:return t=i.sent(),e=new Blob([t]),n=URL.createObjectURL(e),this.worker=new Worker(n),this.worker.addEventListener("message",this.handleWorkerMessage),[3,4]
65case 3:return r=i.sent(),console.error("Failed to load worker:",r),[3,4]
66case 4:return[2]}}))},new((e=void 0)||(e=Promise))((function(r,i){function o(t){try{s(n.next(t))}catch(t){i(t)}}function a(t){try{s(n.throw(t))}catch(t){i(t)}}function s(t){var n
67t.done?r(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(o,a)}s((n=n.apply(t,[])).next())}))
68var t,e,n},t.prototype.fetchCartProducts=function(t){var e=this,n=t.items?t.items:[t],r=Array.from(new Set(n.map((function(t){return t.variant_id})))),i=new Map,o=r.filter((function(t){var n=e.cartSection.cache.getCache(t)
69return!n||(i.set(t.toString(),n),!1)}))
700!==o.length?this.worker.postMessage({type:"FETCH_PRODUCT",variantIds:o,accessToken:this.accessToken,shopDomain:this.shopDomain,metaFieldConfig:this.metaFieldConfig,cartResponse:t,marketHandle:this.cartSection.getMarketHandle()}):this.handleProductFetchComplete(t,r.map((function(t){return{variantId:t,variant:e.cartSection.cache.getCache(t),fromCache:!0}})),!1)},t.prototype.handleProductFetchComplete=function(t,e,n){var r=this
71return n||e&&e.forEach((function(t){var e=t.variantId,n=t.variant
72!t.fromCache&&n&&r.cartSection.cache.setCache(e,n,!0)})),this.cartWorkerCallback(t,e)},t.prototype.terminate=function(){this.worker.terminate()},t}(),p=function(){function t(t,e){this.config=t,this.originalFetch=window.fetch,this.originalXHR=window.XMLHttpRequest,this.callBack=e,this.interceptXHR(),this.interceptFetch(),this.queueRequestCallback()}return t.prototype.queueRequestCallback=function(){},t.prototype.interceptXHR=function(){var t=this.originalXHR,e=this
73window.XMLHttpRequest=function(){var n=new t,r=n.open,i=n.send
74return n.open=function(t,e,n,i,o){return this._url=e,r.call(this,t,e,n,i,o)},n.send=function(t){var n=this
75if(e.config.shouldInterceptRequest(this._url)){this.addEventListener("loadend",(function(){e.config.shouldQueueRequestCallBack(n._url)&&e.config.queueRequestCallBack()}))
76var r=e.config.isEndPoint(this._url)
77if(r){var o=this.onload
78this.onload=function(){if(200===this.status)try{var t=JSON.parse(this.responseText)
79e.callBack(t,r)}catch(t){console.error("Error parsing interceptXHR response:",t)}"function"==typeof o&&o.call(this)}}}return i.call(this,t)},n},window.XMLHttpRequest.prototype=t.prototype},t.prototype.interceptFetch=function(){var t=this,e=this.originalFetch||window.fetch
80try{window.fetch=function(n,r){var i=this,o=e(n,r),a="",s=""
81try{a="string"==typeof n?n:n instanceof URL||"object"==typeof n&&null!==n&&"pathname"in n?n.pathname:"",n instanceof URL&&(s=n.search,a+=s)}catch(t){console.error("Error parsing interceptFetch input:",t)}return a&&t.config.shouldInterceptRequest(a)&&o.then((function(e){return n=i,o=function(){var n,r,i
82return function(t,e){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1]
83return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype)
84return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a
85function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.")
86for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i
87switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s
88break
89case 4:return o.label++,{value:s[1],done:!1}
90case 5:o.label++,r=s[1],s=[0]
91continue
92case 7:s=o.ops.pop(),o.trys.pop()
93continue
94default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0
95continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1]
96break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s
97break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s)
98break}i[2]&&o.ops.pop(),o.trys.pop()
99continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1]
100return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,(function(o){switch(o.label){case 0:if(t.config.shouldQueueRequestCallBack(a)&&t.config.queueRequestCallBack(),!(n=t.config.isEndPoint(a)))return[3,6]
101o.label=1
102case 1:return o.trys.push([1,4,,5]),200!==e.status?[3,3]:[4,e.clone().json()]
103case 2:r=o.sent(),t.callBack(r,n),o.label=3
104case 3:return[3,5]
105case 4:return i=o.sent(),console.error("Error parsing interceptFetch response:",i),[3,5]
106case 5:return[2,e]
107case 6:return[2]}}
107))},new((r=void 0)||(r=Promise))((function(t,e){function i(t){try{s(o.next(t))}catch(t){e(t)}}function a(t){try{s(o.throw(t))}catch(t){e(t)}}function s(e){var n
108e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(i,a)}s((o=o.apply(n,[])).next())}))
109var n,r,o})).catch((function(t){throw console.error("Fetch error:",t),t})),o}}catch(t){console.error("Error intercepting fetch:",t)}window.fetch.prototype=e.prototype},t}(),h=function(){function t(t,e){var n=this
110this.cartUpdateCallback=function(t,e){n.cartSection.handleCartResponse(t,e)},this.config=t,this.cartSection=e,this.init()}return t.prototype.init=function(){var t=new d(this.cartSection,this.cartUpdateCallback.bind(this))
111this.networkInterceptor=new p(this.config,t.fetchCartProducts.bind(t))},t}(),f=function(){function t(t){this.config=new l(t.accessToken,t.shopDomain),this.cartSection=t,this.initialize()}return t.prototype.getCartState=function(){return this.cartSection.getData()},t.prototype.initialize=function(){new h(this.config,this.cartSection)},t}
111(),v=(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null")
112function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),g=function(){return g=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])
113return t},g.apply(this,arguments)},y=function(t){function n(e,n){void 0===n&&(n={items:[],cart_count:0,cart_total:0,currency:"AUD"})
114var r,i=this,o=null===(r=e.site.getData())||void 0===r?void 0:r.currency
115return(i=t.call(this,e,"cart",g(g({},n),{currency:o}))||this)._eventName="cart_details",i.cache=new u,i.cartState=new c(g(g({},n),{currency:o})),new f(i),i}return v(n,t),n.prototype.onLoad=function(){},n.prototype.getMarketHandle=function(){var t
116return(null===(t=this.manager.site.getData())||void 0===t?void 0:t.marketHandle)||""},n.prototype.removeCache=function(){var t=this
117return function(n){var r,i,o,a;(null===(i=null===(r=null==n?void 0:n.ecommerce)||void 0===r?void 0:r.remove)||void 0===i?void 0:i.items)&&(null===(a=null===(o=null==n?void 0:n.ecommerce)||void 0===o?void 0:o.remove)||void 0===a||a.items.forEach((function(n){n.is_last_item&&(e.getInstance().debug("CartSection: removeCache",n.variant_id),t.cache.removeCacheByProductId(n.variant_id))})))}},n.prototype.handleCartResponse=function(t,n){try{var r=this.detectChanges(t),i=r.added,o=r.removed;(i.length>0||o.length>0)&&this.updateCart(i,o)}catch(t){e.getInstance().error("CartSection: handleCartResponse",t)}},n.prototype.detectChanges=function(t){var e,n=this,r=[],i=[]
118if((null===(e=t.items)||void 0===e?void 0:e.length)>0){t.items.forEach((function(t){n.cartState.setNewCartItemArray(t)}))
119var o=this.cartState.detectChangesFromNewCartItems(),a=o.added,s=o.removed
120return o.nochange,a.length>0&&a.forEach((function(t){r.push(n._cartResponseItemToCartItem(t))})),s.length>0&&s.forEach((function(t){i.push(n._cartResponseItemToCartItem(t))})),{added:r,removed:i}}return(s=this.cartState.noItemsInCartChanges()).length>0&&s.forEach((function(t){i.push(n._cartResponseItemToCartItem(t))})),this.cartState.setEmptyCartState(),{added:[],removed:i}},n.prototype._cartResponseItemToCartItem=function(t){var e={item_id:t.sku.split(this.dlConfig.getSkuSeparator()).slice(0,2).join(this.dlConfig.getSkuSeparator()),item_name:t.product_title,item_variant:t.title,quantity:t.quantity,price:"string"==typeof t.price?parseFloat(t.price):t.price/100,product_id:t.product_id,variant_id:t.variant_id}
121return g(g({},e),this.cache.getCacheAttributes(t.variant_id))},n.prototype.updateCart=function(t,e){var n=this
122t.length>0&&this.manager.pushEcommerceEvent("add_to_cart",{currency:this.cartState.getState().currency,add:{value:this.reduceCartTotal(t),items:t.map((function(t){return n.formatProductForGTM(t)}))}}),e.length>0&&this.manager.pushEcommerceEvent("remove_from_cart",{currency:this.cartState.getState().currency,remove:{value:this.reduceCartTotal(e),items:e.map((function(t){return n.formatProductForGTM(t)}))}})},n.prototype.formatProductForGTM=function(t){var e={item_id:t.item_id,item_name:t.item_name,price:t.price||0,item_brand:t.item_brand||null,product_id:t.product_id,item_size:t.item_size||null,item_width:t.item_width||null,item_category:t.item_category||null,item_category2:t.item_category2||null,item_category3:t.item_category3||null,item_category4:t.item_category4||null,item_category5:t.item_category5||null,item_variant:t.item_variant||null,compare_at_price:t.compare_at_price||null,quantity:t.quantity||1,variant_id:t.variant_id||null,is_last_item:t.is_last_item||null,id:null}
123return Object.fromEntries(Object.entries(e).filter((function(t){return t[0],null!==t[1]})))},n.prototype.reduceCartTotal=function(t){return t.reduce((function(t,e){return t+(parseFloat(e.price)||0)*(parseInt(e.quantity)||1)}),0)},n.prototype.clear=function(){this.updateCart([],[])},n}(a),m=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)}
124return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null")
125function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_=function(){return _=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])
126return t},_.apply(this,arguments)},b=function(t){function e(e,n){void 0===n&&(n={})
127var r=t.call(this,e,"state",n)||this
128return r._eventName="state_details",r}return m(e,t),e.prototype.onLoad=function(){var t,e,n,r=this.manager.cart.getData(),i=_(_({},this.data),{page_type:this.manager.page.getPageType()||"",cart_total:(null==r?void 0:r.cart_total)||0,cart_
128count:(null==r?void 0:r.cart_count)||0,cart_contents:(null==r?void 0:r.items)||[],cart_currency:(null===(t=this.manager.site.getData())||void 0===t?void 0:t.currency)||"AUD",visitor_type:(null===(n=null===(e=this.manager.customer)||void 0===e?void 0:e.getData())||void 0===n?void 0:n.customer_id)?"logged_in":"logged_out",customer_data:this.manager.customer.getData()})
129this.update(i),this.manager.push(this._eventName,i)},e.prototype.clear=function(){this.update({})},e}(a),w=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)}
130return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null")
131function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),T=function(t){function e(e,n){void 0===n&&(n={})
132var r=t.call(this,e,"page",n)||this
133return r._eventName="page_view",r}return w(e,t),e.prototype.getPageType=function(){var t
134return void 0!==(null===(t=this.data)||void 0===t?void 0:t.type)?this.data.type:""},e.prototype.getSiteData=function(){return this.manager.site.getData()},e.prototype.getCartData=function(){return this.manager.cart.getData()},e.prototype.getHandle=function(){var t
135return void 0!==(null===(t=this.data)||void 0===t?void 0:t.handle)?this.data.handle:""},e.prototype.onLoad=function(){},e.prototype.clear=function(){this.update({})},e}(a),E=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)}
136return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null")
137function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),C=function(t){function e(e,n){void 0===n&&(n={})
138var r=t.call(this,e,"product",n)||this
139return r._eventName="view_item",r}return E(e,t),e.prototype.onLoad=function(){var t=this
140this.data.length>0&&this.manager.push(this._eventName,{ecommerce:{currency:this.manager.site.getData().currency,detail:{value:this.data.reduce((function(t,e){return t+(e.price||0)}),0),items:this.data.map((function(e,n){return t.formatProductForGTM(e,n,"",!1)}))}}})},e.prototype.formatProductForGTM=function(t,e,n,r){void 0===e&&(e=!1),void 0===n&&(n=""),void 0===r&&(r=1)
141var i={item_id:t.item_id,item_name:t.item_name,price:t.price||0,item_brand:t.item_brand||"",product_id:t.product_id,compare_at_price:t.compare_at_price||null,item_category:t.item_category||"",item_category2:t.item_category_2||null,item_category3:t.item_category_3||null,item_category4:t.item_category_4||null,item_category5:t.item_category_5||null}
142return r&&(i.quantity=parseInt(r)),e&&(i.index=e),n&&(i.item_list_name=n),Object.keys(i).forEac
142h((function(t){null===i[t]&&delete i[t]})),i},e.prototype.push=function(){this.manager.push(this._eventName,this.data)},e.prototype.clear=function(){this.update([])},e}(a),A=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)}
143return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null")
144function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),S=function(t){function e(e,n){return void 0===n&&(n={}),t.call(this,e,"site",n)||this}return A(e,t),e.prototype.onLoad=function(){},e.prototype.clear=function(){this.update({})},e}(a),I=function(){return I=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])
145return t},I.apply(this,arguments)},D=function(){function t(t){var e
146void 0===t&&(t=""),this.subscribers=new Map,this.eventPrefix="",this.eventPrefix=t||(null===(e=window._BCDataLayer.config)||void 0===e?void 0:e.eventPrefix)||""}return t.prototype.push=function(t,e){void 0===e&&(e={})
147var n=I(I({},e),{event:this._preFixEventName(t),event_id:Date.now().toString()+"-"+Math.random().toString().substring(2),event_timestamp:Date.now()})
148return window.dataLayer.push(n),this.publish(t,n),this},t.prototype.pushEcommerceEvent=function(t,e){void 0===e&&(e={}),window.dataLayer.push({ecommerce:null})
149var n={event:this._preFixEventName(t),ecommerce:e,event_id:Date.now().toString()+"-"+Math.random().toString().substring(2),event_timestamp:Date.now()}
150return window.dataLayer.push(n),this.publish(t,n),this},t.prototype.subscribe=function(t,e){var n=this._generateId()
151this.subscribers.has(t)||this.subscribers.set(t,[])
152var r=this.subscribers.get(t)
153return null==r||r.push({id:n,callback:e}),n},t.prototype.unsubscribe=function(t,e){var n=this.subscribers.get(t)
154if(!n)return!1
155var r=n.length,i=n.filter((function(t){return t.id!==e}))
156return this.subscribers.set(t,i),i.length<r},t.prototype.publish=function(t,e){(this.subscribers.get("*")||[]).forEach((function(n){try{n.callback({event:t,data:e})}catch(t){console.error("Error in wildcard subscriber callback: ".concat(t))}})),(this.subscribers.get(t)||[]).forEach((function(t){try{t.callback(e)}catch(t){console.error("Error in event subscriber callback: ".concat(t))}}))},t.prototype._generateId=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2)},t.prototype._preFixEventName=function(t){return this.eventPrefix&&""!==this.eventPrefix?("".concat(this.eventPrefix).concat(t),"".concat(this.eventPrefix).concat(t)):t},t.prototype.getDataLayer=function(){return window.dataLayer||[]},t}(),O=function(){function t(){}return t.prototype.isEndPoint=function(e){if(!e)return!1
157var n=e.startsWith("/")?e.substring(1):e,r={search:t.ENDPOINT_REGEX.search.test(n),recommender:t.ENDPOINT_REGEX.recommender.test(n),autocomplete:t.ENDPOINT_REGEX.autocomplete.test(n)},i=Object.keys(r).find((function(t){return r[t]}))||null
158return null!==i&&{matches:null!==i,endpoint:i,wildcardValue:"recommender"===i?n.match(t.ENDPOINT_REGEX.recommender)[1]:null,ssParams:this.parseUrlToKeyValue(e)}},t.prototype.shouldQueueRequestCallBack=function(t){return!1},t.prototype.queueRequestCallBack=function(){},t.prototype.shouldInterceptRequest=function(t){return this.isEndPoint(t)||this.shouldQueueRequestCallBack(t)},t.prototype.parseUrlToKeyValue=function(t){var e={}
159return t.includes("?")?(t.split("?")[1].split("&").forEach((function(t){var n=t.split("="),r=n[0],i=n[1]
160if(r&&void 0!==i){var o=decodeURIComponent(r),a=decodeURIComponent(i)
161e[o]?Array.isArray(e[o])?e[o].push(a):e[o]=[e[o],a]:e[o]=a}})),e):e},t.prototype.getSearchSpringBGFilter=function(t){var e=Object.keys(t).filter((function(t){return t.includes("bgfilter")}))
162if(e){var n=e.map((function(e){var n
163return(n={})[e.split(".")[1]]=t[e],n}))
164return n.length>0?n:void 0}},t.ENDPOINT_REGEX={search:/.*api\/search\/search\.json(\?.*)?$/,recommender:/.*boost\/(.+)\/recommend(\?.*)?$/,autocomplete:/.*api\/search\/autocomplete\.json(\?.*)?$/},t}
164(),L=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e
165t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},R=function(t,e){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1]
166return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype)
167return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a
168function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.")
169for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i
170switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s
171break
172case 4:return o.label++,{value:s[1],done:!1}
173case 5:o.label++,r=s[1],s=[0]
174continue
175case 7:s=o.ops.pop(),o.trys.pop()
176continue
177default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0
178continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1]
179break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s
180break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s)
181break}i[2]&&o.ops.pop(),o.trys.pop()
182continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1]
183return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}
184const k=function(){function t(){this.shopDomain=window._BCDataLayer.config.shopDomain,this.accessToken=window._BCDataLayer.config.accessToken}return t.prototype.request=function(t,e){return L(this,void 0,void 0,(function(){return R(this,(function(n){switch(n.label){case 0:return[4,fetch("https://".concat(this.shopDomain,"/api/2024-01/graphql.json"),{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":this.accessToken},body:JSON.stringify({query:t,variables:e})})]
185case 1:return[4,n.sent().json()]
186case 2:return[2,n.sent()]}}))}))},t.prototype.getProductPrice=function(t,e,n){return L(this,void 0,void 0,(function(){var r
187return R(this,(function(i){switch(i.label){case 0:return r={country:t,query:e,count:n},[4,this.request("\n    query GetProductPrice($country: CountryCode, $query: String, $count: Int) @inContext(country: $country) {\n      products(first: $count, query: $query) {\n        edges {\n          node {\n            id\n            title\n            variants(first: 1) {\n              edges {\n                node {\n                  id\n                  title\n                  price {\n                    amount\n                    currencyCode\n                  }\n                  compareAtPrice {\n                    amount\n                    currencyCode\n                  }\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n    ",r)]
188case 1:return[2,i.sent()]}}))}))},t}()
189function M(t){return e=this,r=function(){var e,n,r,i,o,a,s,c,u,l,d,p,h
190return function(t,e){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1]
191return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype)
192return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a
193function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.")
194for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i
195switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s
196break
197case 4:return o.label++,{value:s[1],done:!1}
198case 5:o.label++,r=s[1],s=[0]
199continue
200case 7:s=o.ops.pop(),o.trys.pop()
201continue
202default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0
203continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1]
204break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s
205break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s)
206break}i[2]&&o.ops.pop(),o.trys.pop()
207continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1]
208return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,(function(f){switch(f.label){case 0:if(!Array.isArray(t)||0===t.length)return console.error("Invalid or empty results array"),[2,null]
209if((null===(s=null===(a=window._BCDataLayer)||void 0===a?void 0:a.site)||void 0===s?void 0:s.storeCurrency)==(null===(u=null===(c=window._BCDataLayer)||void 0===c?void 0:c.site)||void 0===u?void 0:u.currency))return[2,N(t)]
210f.label=1
211case 1:return f.trys.push([1,3,,4]),e=null===(d=null===(l=window._BCDataLayer)||void 0===l?void 0:l.site)||void 0===d?void 0:d.marketHandle,n=t.length,r=P(t),[4,(new k).getProductPrice(e,r,n)]
212case 2:if((i=f.sent()).errors)throw new Error(JSON.stringify(i.errors))
213if(!(null===(h=null===(p=i.data)||void 0===p?void 0:p.products)||void 0===h?void 0:h.edges)
213)throw new Error("Unexpected response structure")
214return[2,N(i)]
215case 3:return o=f.sent(),console.error("Error fetching product prices:",o),[2,null]
216case 4:return[2]}}))},new((n=void 0)||(n=Promise))((function(t,i){function o(t){try{s(r.next(t))}catch(t){i(t)}}function a(t){try{s(r.throw(t))}catch(t){i(t)}}function s(e){var r
217e.done?t(e.value):(r=e.value,r instanceof n?r:new n((function(t){t(r)}))).then(o,a)}s((r=r.apply(e,[])).next())}))
218var e,n,r}var P=function(t){return Array.isArray(t)?t.map((function(t){return t.uid})).filter(Boolean).map((function(t){return'(id:"'.concat(t.split("/").pop(),'")')})).join(" OR "):""},N=function(t){var e,n
219return((null===(n=null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.products)||void 0===n?void 0:n.edges)||[]).map((function(t){var e,n,r,i,o=(null==t?void 0:t.node)||{},a=(null===(n=null===(e=null==o?void 0:o.variants)||void 0===e?void 0:e.edges)||void 0===n?void 0:n[0])||{},s=(null==a?void 0:a.node)||{}
220return{title:o.title||"",handle:o.handle||"",id:o.id||"",price:(null===(r=null==s?void 0:s.price)||void 0===r?void 0:r.amount)||"0",compareAtPrice:(null===(i=null==s?void 0:s.compareAtPrice)||void 0===i?void 0:i.amount)||null}}))},j=function(){return j=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])
221return t},j.apply(this,arguments)},F=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{c(r.next(t))}catch(t){o(t)}}function s(t){try{c(r.throw(t))}catch(t){o(t)}}function c(t){var e
222t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((r=r.apply(t,e||[])).next())}))},x=function(t,e){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1]
223return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype)
224return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a
225function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.")
226for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i
227switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s
228break
229case 4:return o.label++,{value:s[1],done:!1}
230case 5:o.label++,r=s[1],s=[0]
231continue
232case 7:s=o.ops.pop(),o.trys.pop()
233continue
234default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0
235continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1]
236break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s
237break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s)
238break}i[2]&&o.ops.pop(),o.trys.pop()
239continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1]
240return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}
241function B(t,e){if(void 0===e&&(e="object"),"object"==typeof t)return t
242if(!t)return"object"===e?{}:[]
243try{return JSON.parse(t.replace(/(&quot;)/g,'"'))}catch(t){return console.error("Could not parse input in parseJSON.",B,t),"object"===e?{}:[]}}function q(t){return F(this,void 0,void 0,(function(){var e
244return x(this,(function(n){switch(n.label){case 0:return e=null==t?void 0:t.map((function(t){var e
245return{tag:null===(e=t.profile)||void 0===e?void 0:e.tag,items:t.results.map((function(t){return j(j({},t.attributes),t.mappings.core)}))}})),e&&e.length?[4,H(e)]:[2,[]]
246case 1:return[2,n.sent()]}}))}))}function U(t){return F(this,void 0,void 0,(function(){var e
247return x(this,(function(n){switch(n.label){case 0:return t&&(e=null==t?void 0:t.map((function(t){var e=B(t,"array")
248return j(j({},t),{variants:e})})))&&e.length?[4,V(e)]:[2,[]]
249case 1:return[2,n.sent()]}}))}))}function V(t){return F(this,void 0,void 0,(function(){var e,n
250return x(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,M(t)]
251case 1:return e=r.sent(),[2,t.map((function(t){var n=null==e?void 0:e.find((function(e){return e.id.split("/").pop()===t.uid}))
252return n?j(j({},t),{price:n.price,msrp:n.compareAtPrice,compareAtPrice:n.compareAtPrice}):t}))]
253case 2:return n=r.sent(),console.error("Error localising results:",n),[2,t]
254case 3:return[2]}}
254))}))}function H(t){return F(this,void 0,void 0,(function(){var e,n,r
255return x(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,M(null===(r=t[0])||void 0===r?void 0:r.items)]
256case 1:return e=i.sent(),[2,t.map((function(t){return j(j({},t),{items:t.items.map((function(t){var n=null==e?void 0:e.find((function(e){return e.id.split("/").pop()===t.uid}))
257return n?j(j({},t),{price:n.price,msrp:n.compareAtPrice,compareAtPrice:n.compareAtPrice}):t}))})}))]
258case 2:return n=i.sent(),console.error("Error localising results:",n),[2,t]
259case 3:return[2]}}))}))}var G=function(){function t(t,e){this.config=new O,new p(this.config,this.handleProductListingUpdate.bind(this)),this.productListingSection=t,this.mapper=e}return t.prototype.handleProductListingUpdate=function(t,e){return n=this,i=function(){var n,r,i,o,a,s,c,u,l,d,p,h,f=this
260return function(t,e){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1]
261return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype)
262return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a
263function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.")
264for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i
265switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s
266break
267case 4:return o.label++,{value:s[1],done:!1}
268case 5:o.label++,r=s[1],s=[0]
269continue
270case 7:s=o.ops.pop(),o.trys.pop()
271continue
272default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0
273continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1]
274break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s
275break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s)
276break}i[2]&&o.ops.pop(),o.trys.pop()
277continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1]
278return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,(function(v){switch(v.label){case 0:return n=[],r=this.productListingSection.getPageTypeAndHandle(),i=r.pageType,o=r.handle,a=r.title,s=a||"".concat(i,"-").concat(o),"search"!=e.endpoint?[3,4]:"search"!=i&&"collection"!=i?[3,2]:[4,U(t.results)]
279case 1:return n=v.sent(),c=(null===(h=t.pagination)||void 0===h?void 0:h.begin)-1||0,this.productListingSection.publishProductListingEvent(this.mapper.mapProductListingData(n,c),"".concat(i,"-").concat(o),"".concat(s)),[3,4]
280case 2:return u=e.ssParams?this.config.getSearchSpringBGFilter(e.ssParams):void 0,l=[],u?u.forEach((function(t){Object.keys(t).forEach((function(e){l.push("".concat(e)),l.push("".concat(t[e]))}))})):l=[i,o],d=l.join("-"),[4,U(t.results)]
281case 3:n=v.sent(),(p=window._BCDataLayerProductListing||[]).push({item_list_id:"".concat(d),item_list_name:"Search Spring Search",items:this.mapper.mapProductListingData(n)}),window._BCDataLayerProductListing=p,v.label=4
282case 4:return"recommender"!=e.endpoint?[3,6]:[4,q(t)]
283case 5:v.sent().forEach((function(t){var e=f.mapper.mapProductListingData(t.items),n=window._BCDataLayerProductListing||[]
284n.push({item_list_id:"".concat(t.tag),item_list_name:"SearchSpring Recommendations",items:e}),window._BCDataLayerProductListing=n})),v.label=6
285case 6:return[2]}}
285))},new((r=void 0)||(r=Promise))((function(t,e){function o(t){try{s(i.next(t))}catch(t){e(t)}}function a(t){try{s(i.throw(t))}catch(t){e(t)}}function s(e){var n
286e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(o,a)}s((i=i.apply(n,[])).next())}))
287var n,r,i},t}(),Q=function(){function t(){this.dlConfig=i.getInstance()}return t.prototype.mapProductListingData=function(t,n){var r=this
288return t&&0!==t.length?t.map((function(t,e){return r.mapProductData(t,e+(n||0))})):(e.getInstance().error("SearchSpringMapper: mapProductListingData","searchSpringData is undefined or empty"),[])},t.prototype._getMappedFieldValueFromData=function(t,e){var n=this.dlConfig.getMappedListingField(e)
289if(!n)return null
290var r=t[n]
291return r?String(r):null},t.prototype.mapProductData=function(t,e){var n,r={item_id:null===(n=this._getMappedFieldValueFromData(t,"item_id"))||void 0===n?void 0:n.toString().split(this.dlConfig.getSkuSeparator()).slice(0,2).join(this.dlConfig.getSkuSeparator()),item_name:this._getMappedFieldValueFromData(t,"item_name"),item_brand:this._getMappedFieldValueFromData(t,"item_brand"),item_category:this._getMappedFieldValueFromData(t,"item_category"),price:parseFloat(t.price),product_id:parseInt(this._getMappedFieldValueFromData(t,"product_id")),item_category2:this._getMappedFieldValueFromData(t,"item_category2"),item_category3:this._getMappedFieldValueFromData(t,"item_category3"),item_category4:this._getMappedFieldValueFromData(t,"item_category4"),item_category5:this._getMappedFieldValueFromData(t,"item_category5"),compare_at_price:parseFloat(this._getMappedFieldValueFromData(t,"compare_at_price"))>0?parseFloat(this._getMappedFieldValueFromData(t,"compare_at_price")):null,index:e}
292return Object.keys(r).forEach((function(t){null===r[t]&&delete r[t]})),r},t}(),K=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)}
293return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null")
294function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),z=function(){return z=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])
295return t},z.apply(this,arguments)},J=function(t){function n(e,n){void 0===n&&(n={items:[],item_list_id:"",item_list_name:""})
296var r=t.call(this,e,"listing",n)||this
297return r._mapper=new Q,new G(r,r._mapper),r}return K(n,t),n.prototype.onLoad=function(){},n.prototype.getPageTypeAndHandle=function(){var t,e
298return{pageType:this.manager.page.getPageType(),handle:null===(t=this.manager.page.getData())||void 0===t?void 0:t.handle,title:null===(e=this.manager.page.getData())||void 0===e?void 0:e.page_title}},n.prototype.publishProductListingEvent=function(t,n,r){if(n&&r||e.getInstance().error("Product Listing DataLayer: item_list_id or item_list_name is missing"),0!==t.length)if(t.every((function(t){return!!t.item_id}))){e.getInstance().debug("Product Listing DataLayer: productListingData",t)
299var i={ecommerce:{impression:{item_list_id:n,item_list_name:r,items:t.map((function(t){return z(z({},t),{item_list_id:n,item_list_name:r})}))}}}
300this.manager.push("view_item_list",i)}else e.getInstance().error("Product Listing DataLayer: item_id is missing")
301else e.getInstance().error("Product Listing DataLayer: items array is empty")},n}(a),X=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)}
302return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null")
303function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),W=function(t){function e(e,n){return void 0===n&&(n={customer_id:"",customer_email:"",customer_first_name:null,customer_last_name:null,customer_phone:null,customer_city:null,customer_zip:null,customer_address_1:null,customer_address_2:null,customer_country:null,customer_province:null,customer_order_count:"",customer_total_spent:"",customer_tags:null,customer_loyalty_program:null,customer_loyalty_tier:null,customer_loyalty_balance:null}),t.call(this,e,"customer",n)||this}return X(e,t),e.prototype._trackAccountOrLogin=function(){var t
304if(null===(t=this.getData())||void 0===t?void 0:t.customer_id){var n=sessionStorage.getItem(e.CUSTOMER_JOURNEY_KEY)
305if(!n)return
306var r=null
307try{r=JSON.parse(n)}catch(t){console.error("Invalid customerJourney JSON",t)}r&&("login"===r.checkpoint?this._fireGTMForLogin():"register"===r.checkpoint&&this._fireGTMForRegister())}else{var i=new URL(window.location.href),o=i.pathname.includes("/account/login")?"login":i.pathname.includes("/account/register")?"register":null
308o&&this.saveCustomerTrackingOnSessionStorage({checkpoint:o})}},e.prototype.saveCustomerTrackingOnSessionStorage=function(t){var n=sessionStorage.getItem(e.CUSTOMER_JOURNEY_KEY)
309n&&JSON.parse(n).checkpoint===t.checkpoint||sessionStorage.setItem(e.CUSTOMER_JOURNEY_KEY,JSON.stringify(t))},e.prototype.onLoad=function(){this._trackAccountOrLogin()},e.prototype._clearCustomerJourney=function(){sessionStorage.removeItem(e.CUSTOMER_JOURNEY_KEY)},e.prototype._fireGTMForLogin=function(){var t,e=null===(t=this.manager.state.getData())||void 0===t?void 0:t.customer_data,n=Object.fromEntries(Object.entries(e).filter((function(t){return t[0],null!==t[1]})))
310this.manager.push("log_in",{visitor_type:"logged-in",customer_data:n}),this._clearCustomerJourney()},e.prototype._fireGTMForRegister=function(){var t,e=null===(t=this.manager.state.getData())||void 0===t?void 0:t.customer_data,n=Object.fromEntries(Object.entries(e).filter((function(t){return t[0],null!==t[1]})))
311this.manager.push("create_account",{visitor_type:"logged-in",customer_data:n}),this._clearCustomerJourney()},e.CUSTOMER_JOURNEY_KEY="_BC_CUSTOMER_JOURNEY",e}(a),Y=function(){return Y=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])
312return t},Y.apply(this,arguments)},$=(function(){function t(t,e,n){this.manager=t,this.sectionName=e,this.data=n,this.dlConfig=i.getInstance()}t.prototype.getData=function(){return this.data},t.prototype.update=function(t){this.data=Y(Y({},this.data),t),this.manager.notifySectionUpdated(this.sectionName,this.data)}}(),function(){function t(t){void 0===t&&(t={}),this.dataLayer=[],this._BCDataLayer={},this.eventNotification=new D,this.site=new S(this,t.site||{}),this.page=new T(this,t.page||{}),this.cart=new y(this,t.cart||{}),this.customer=new W(this,t.customer||{}),this.products=new C(this,t.products||{}),this.state=new b(this,t.state||{}),this.listing=new J(this,t.listing||{})}return t.prototype.onLoad=function(){this.state.onLoad(),this.site.onLoad(),this.page.onLoad(),this.cart.onLoad(),this.customer.onLoad(),this.products.onLoad(),this.listing.onLoad(),this.eventNotification.subscribe("remove_from_cart",this.cart.removeCache())},t.prototype.notifySectionUpdated=function(t,e){this._BCDataLayer[t]=e,this.eventNotification.publish("".concat(t,"_updated"),e)},t.prototype.push=function(t,e){return void 0===e&&(e={}),this.eventNotification.push(t,e),this},t.prototype.pushEcommerceEvent=function(t,e){return void 0===e&&(e={}),this.eventNotification.pushEcommerceEvent(t,e),this},t.prototype.subscribe=function(t,e){return this.eventNotification.subscribe(t,e)},t.prototype.unsubscribe=function(t,e){return this.eventNotification.unsubscribe(t,e)},t.prototype.getState=function(){return{GTM:this.dataLayer,BC:this._BCDataLayer}},t.prototype.clear=function(){return this.cart=new y(this),this.customer=new W(this),this.products=new C(this),this.page=new T(this),this.site=new S(this),this.listing=new J(this),this._BCDataLayer={cart:this.cart.getData(),customer:this.customer.getData(),products:this.products.getData(),page:this.page.getData(),site:this.site.getData(),listing:this.listing.getData()},this},t}()),Z=function(){function t(){}return t.create=function(e){return void 0===e&&(e={}),t.instance||(t.instance=new $(e)),t.instance},t.reset=function(){t.instance=null},t.instance=null,t}(),tt=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i])
313return t.concat(r||Array.prototype.slice.call(e))},et=function(){function t(t){var e=void 0===t?{}:t,n=e.modalSelector,r=void 0===n?".modal":n,i=e.openClass,o=void 0===i?"open":i,a=e.closeClass,s=void 0===a?"closed":a,c=e.openAttribute,u=void 0===c?"open":c,l=e.closeAttribute,d=void 0===l?"close":l,p=e.onModalOpen,h=void 0===p?function(){}:p,f=e.onModalClose,v=void 0===f?function(){}:f,g=e.debug,y=void 0!==g&&g,m=this
314this.modalSelector=r,this.openClass=o,this.openAttribute=u,this.closeClass=s,this.closeAttribute=d,this.onModalOpen=h,this.onModalClose=v,this.debug=y,this.modals=[],this.mutationObserver=null,this.modalStates=new Map,this.modalObservers=new Map,this.initialized=!1
315var _=function(){return m.init()}
316"loading"===document.readyState?window.document.addEventListener("DOMContentLoaded",_):_()}return t.prototype.init=function(){var t=this
317try{if(this.initialized)return
318this.initialized=!0,this.modals=Array.from(document.querySelectorAll(this.modalSelector)),this.debug&&e.getInstance().debug("ModalObserver: Found ".concat(this.modals.length," modals"),this.modals),this.modals.forEac
318h((function(e){try{t.modalStates.set(e,t.isModalVisible(e))}catch(t){console.error("Error setting modal state:",t)}})),this.setupMutationObserver(),this.setupResizeObserver()}catch(t){console.error("Error initializing ModalObserver:",t)}},t.prototype.isModalVisible=function(t){if(!t)return!1
319try{var e=window.getComputedStyle(t)
320if(!e)return!1
321if("none"===e.display)return!1
322if("hidden"===e.visibility)return!1
323var n=e.opacity
324if(0===(n?parseFloat(n):1))return!1
325var r=t.getBoundingClientRect()
326if(0===r.width||0===r.height)return!1
327if(t.classList&&t.classList.contains(this.closeClass)||t.hasAttribute&&t.hasAttribute(this.closeAttribute))return!1
328var i=t.classList&&t.classList.contains(this.openClass),o=t.hasAttribute&&t.hasAttribute(this.openAttribute)
329return!((this.openClass||this.openAttribute)&&!i&&!o)}catch(t){return console.error("Error checking modal visibility:",t),!1}},t.prototype.setupResizeObserver=function(){var t=this
330if("undefined"!=typeof ResizeObserver)try{var e=new ResizeObserver((function(e){for(var n=0,r=e;n<r.length;n++){var i=r[n].target
331t.checkModalVisibilityChange(i)}}))
332this.modals.forEach((function(t){try{e.observe(t)}catch(t){console.error("Error observing resize on modal:",t)}}))}catch(t){console.error("Error setting up ResizeObserver:",t)}},t.prototype.setupMutationObserver=function(){var t=this
333try{this.modals.forEach((function(e){if(!t.modalObservers.has(e))try{var n=new MutationObserver((function(n){var r=!1
334n.forEach((function(e){"attributes"!==e.type||"style"!==e.attributeName&&"class"!==e.attributeName&&e.attributeName!==t.openAttribute&&e.attributeName!==t.closeAttribute||(r=!0)})),r&&setTimeout((function(){try{var n=t.isModalVisible(e),r=t.modalStates.get(e)||!1
335t.modalStates.set(e,n),n!==r&&(n?(t.debug,t.onModalOpen(e)):(t.debug,t.onModalClose(e)))}catch(t){console.error("Error handling mutation:",t)}}),50)}))
336n.observe(e,{attributes:!0,attributeFilter:["class","style",t.openAttribute,t.closeAttribute,"hidden","visibility","display"],attributeOldValue:!0,subtree:!0}),t.modalObservers.set(e,n)}catch(t){console.error("Error setting up observer for modal:",t,e)}}))}catch(t){console.error("Error in setupMutationObserver:",t)}},t.prototype.cleanup=function(){try{this.modalObservers.forEach((function(t){try{t.disconnect()}catch(t){console.error("Error disconnecting observer:",t)}})),this.modalObservers.clear(),this.debug&&e.getInstance().debug("ModalObserver: Cleaned up all observers")}catch(t){console.error("Error cleaning up ModalObserver:",t)}},t.prototype.checkModalVisibilityChange=function(t){try{var e=this.modalStates.get(t)||!1,n=this.isModalVisible(t)
337e!==n&&(this.modalStates.set(t,n),n?this.handleModalOpen(t):this.handleModalClose(t))}catch(t){console.error("Error checking modal visibility change:",t)}},t.prototype.handleModalOpen=function(t){try{this.debug&&e.getInstance().debug("Modal opened: ".concat(t.id||"unknown")),this.onModalOpen(t)}catch(t){console.error("Error handling modal open:",t)}},t.prototype.handleModalClose=function(t){try{this.debug&&e.getInstance().debug("Modal closed: ".concat(t.id||"unknown")),this.onModalClose(t)}catch(t){console.error("Error handling modal close:",t)}},t.prototype.disconnect=function(){try{this.modalObservers.forEach((function(t){try{t.disconnect()}catch(t){console.error("Error disconnecting observer:",t)}})),this.modalObservers.clear(),this.debug&&e.getInstance().debug("ModalObserver: Disconnected all observers")}catch(t){console.error("Error disconnecting ModalObserver:",t)}},t.prototype.refresh=function(){var t=this
338try{var n=Array.from(document.querySelectorAll(this.modalSelector)).filter((function(e){return!t.modals.includes(e)}))
339n.length>0&&(this.debug&&e.getInstance().debug("ModalObserver: Found ".concat(n.length," new modals"),n),this.modals=tt(tt([],this.modals,!0),n,!0),n.forEac
339h((function(e){t.modalStates.set(e,t.isModalVisible(e))})),this.setupMutationObserver())}catch(t){console.error("Error refreshing ModalObserver:",t)}},t}(),nt=function(){return nt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])
340return t},nt.apply(this,arguments)},rt=function(){function t(t){this.publishedListings=new Map,this.manager=t}return t.prototype.addToProductListing=function(t){var e=window._BCDataLayerProductListing||[],n=e.findIndex((function(e){return e.item_list_id===t.item_list_id}))
341n>=0?(e[n].items||(e[n].items=[]),e[n].items.push(t.item)):e.push({item_list_name:t.item_list_name,item_list_id:t.item_list_id,items:[t.item]}),window._BCDataLayerProductListing=e},t.prototype.findMatchingListing=function(t){var e
342if(!window._BCDataLayerProductListing||0===window._BCDataLayerProductListing.length)return null
343for(var n=0;n<window._BCDataLayerProductListing.length;n++){var r=window._BCDataLayerProductListing[n]
344if(null===(e=r.items)||void 0===e?void 0:e.length){var i="".concat(n,"-").concat(r.item_list_id,"-").concat(r.item_list_name)
345if(!this.publishedListings.has(i)&&t&&r.item_list_id===t)return{productListing:r,index:n}}}return null},t.prototype.publishProductListingForSection=function(t,e,n){var r,i,o=this.findMatchingListing(e)
346if(!o)return!1
347var a=o.productListing,s=o.index,c="".concat(s,"-").concat(a.item_list_id,"-").concat(a.item_list_name);(null===(i=null===(r=window._BCDataLayer)||void 0===r?void 0:r.config)||void 0===i?void 0:i.debug)&&this.addDebugOverlay(t,a)
348var u=a.items.map((function(t,e){return nt(nt({},t),{index:e})}))
349return this.publishProductListingEvent(u,a.item_list_id,n||a.item_list_name),this.publishedListings.set(c,!0),!0},t.prototype.publishProductListingEvent=function(t,e,n){this.manager.listing.publishProductListingEvent(t,e,n)},t.prototype.addDebugOverlay=function(t,e){t.style.border="1px solid red"
350var n=document.createElement("div")
351n.style.cssText="\n      position: absolute;\n      top: 0;\n      right: 0;\n      background-color: red;\n      color: white;\n      padding: 5px;\n      font-size: 12px;\n      z-index: 1000;\n      border-radius: 0 0 0 5px;\n    ",n.innerHTML="\n      ID: ".concat(e.item_list_id||"N/A","<br>\n      Name: ").concat(e.item_list_name||"N/A","\n    "),"static"===window.getComputedStyle(t).position&&(t.style.position="relative"),t.appendChild(n)},t}(),it=function(){function t(t,e){this.manager=t,this.DATA_ATTRS=e,this.productListingManager=new rt(t)}return t.prototype.isElementVisible=function(t,e){try{var n=e.isIntersecting||e.intersectionRatio>0,r=void 0
352try{r=window.getComputedStyle(t)}catch(e){return console.error("Error getting computed style:",e),n&&!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)}var i=!!(t.offsetWidth&&t.offsetHeight||t.getBoundingClientRect().width&&t.getBoundingClientRect().height||t.getClientRects().length),o=parseFloat(r.opacity)
353return n&&i&&"none"!==r.display&&"hidden"!==r.visibility&&0!==o}catch(t){return console.error("Error in isElementVisible:",t),!!e.isIntersecting}},t.prototype.initialize=function(){var t=this
354if("IntersectionObserver"in window){var n=new IntersectionObserver((function(r){r.forEach((function(r){var i=r.target,o=t.isElementVisible(i,r)
355if(e.getInstance().debug("isElementVisible: ".concat(o),i,r),o){var a=i.getAttribute(t.DATA_ATTRS.SECTION_ID),s=i.getAttribute(t.DATA_ATTRS.SECTION_NAME)
356if(!a)for(var c=i;c&&!a;)if((c=c.parentElement)&&c.hasAttribute(t.DATA_ATTRS.SECTION_ID)){a=c.getAttribute(t.DATA_ATTRS.SECTION_ID),s=c.getAttribute(t.DATA_ATTRS.SECTION_NAME)
357break}if(t.productListingManager.publishProductListingForSection(i,a||null,s||null))try{n.unobserve(i)}catch(t){console.error("Error unobserving element:",t)}}}))}),{threshold:0,rootMargin:"50px"}),r=function(e){var r=e,i=r.getBoundingClientRect()
358if(i.top<window.innerHeight&&i.bottom>0&&i.width>0&&i.height>0){var o=r.getAttribute(t.DATA_ATTRS.SECTION_ID),a=r.getAttribute(t.DATA_ATTRS.SECTION_NAME)
359if(!o)for(var s=r;s&&!o;)if((s=s.parentElement)&&s.hasAttribute(t.DATA_ATTRS.SECTION_ID)){o=s.getAttribute(t.DATA_ATTRS.SECTION_ID),a=s.getAttribute(t.DATA_ATTRS.SECTION_NAME)
360break}if(t.productListingManager.publishProductListingForSection(r,o||null,a||null))try{n.unobserve(r)}catch(t){console.error("Error unobserving element:",t)}}},i=function(){!function(){try{document.querySelectorAll("[".concat(t.DATA_ATTRS.SECTION_ID,"]")).forEac
360h((function(t){try{r(t),n.observe(t)}catch(t){console.error("Error observing element:",t)}}))}catch(t){console.error("Error in observeMatchingElements:",t)}}()
361var e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes&&e.addedNodes.forEach((function(e){if(1===e.nodeType){var i=e
362if(i.hasAttribute&&i.hasAttribute(t.DATA_ATTRS.SECTION_ID))try{r(i),n.observe(i)}catch(t){console.error("Error observing element in mutation:",t)}if(i.querySelectorAll)try{var o=i.querySelectorAll("[".concat(t.DATA_ATTRS.SECTION_ID,"]"))
363o&&o.length&&o.forEach((function(t){try{r(t),n.observe(t)}catch(t){console.error("Error observing child element:",t)}}))}catch(t){console.error("Error in querySelectorAll:",t)}}}))}))}))
364e.observe(document.body,{childList:!0,subtree:!0}),window.BCDataLayerVisibilityObserver=n,window.BCDataLayerMutationObserver=e}
365"loading"===document.readyState?window.document.addEventListener("DOMContentLoaded",i):i()}else this.fallbackForIntersectionObserver()},t.prototype.fallbackForIntersectionObserver=function(){var t,e,n=this,r=function(){document.querySelectorAll("[".concat(n.DATA_ATTRS.SECTION_ID,"]")).forEach((function(t){var e=t.getBoundingClientRect()
366if(e.top<window.innerHeight&&e.bottom>0){var r=t.getAttribute(n.DATA_ATTRS.SECTION_ID)
367n.productListingManager.publishProductListingForSection(t,r)}}))},i=(t=r,e=!1,function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r]
368e||(t.apply(this,n),e=!0,setTimeout((function(){e=!1}),100))})
369window.addEventListener("scroll",i),window.addEventListener("resize",i),r()},t}(),ot=function(){return ot=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])
370return t},ot.apply(this,arguments)},at=function(){function t(t){var e
371this._delegates={},this.pdpSelectMap=new Map,this.WISHLIST_SELECTED_CLASS="wk-selected",this.SELECTORS={PRODUCT_CLICK:'[data-dl-track="select_item"]',VARIANT_CLICK:'[data-dl-track="toggle_variant"]',VARIANT_CLICK_PDP:'[data-dl-track="toggle_variant_pdp"]',SECTION_ID:"[data-dl-section-id]",SECTION_NAME:"[data-dl-section-name]",WISHLIST_CLICK:(null===(e=window._BCDataLayer.config)||void 0===e?void 0:e.wishlistButtonSelector)||".wkh-button",PRODUCT_ID:"[data-dl-product-id]"},this.DATA_ATTRS={PRODUCT_ID:"data-dl-product-id",VARIANT_ID:"data-dl-variant-id",LIST_ID:"data-dl-list-id",LIST_NAME:"data-dl-list-name",INDEX:"data-dl-index",ATTRIBUTE:"data-dl-attribute",VALUE:"data-dl-value",SECTION_ID:"data-dl-section-id",SECTION_NAME:"data-dl-section-name",TRACK_ATTR:"data-dl-track",TRACK_TOGGLE_VARIANT:"toggle_variant",TRACK_TOGGLE_VARIANT_PDP:"toggle_variant_pdp",TRACK_SELECT_ITEM:"select_item",TRACK_SAVE_PRODUCT:"save_product"},this.manager=t}return t.prototype.trackWishlistClick=function(t){var e=this
372setTimeout((function(){var n,r=t.classList.contains(e.WISHLIST_SELECTED_CLASS)?"SELECTED":"UNSELECTED"
373if("SELECTED"===r){var i=e.manager.listing.getPageTypeAndHandle(),o={current_state:r,product_id:null}
374o=e.appendClosestSectionData(o,t),o=e.appendClosestProductData(o,t)
375var a=e.findInDataLayer(o.product_id,null)
376if(a||"product"!==i.pageType||(a=e.findInDataLayer(null,null,"view_item"),o.list_id="".concat(i.pageType,"-").concat(i.handle),o.list_name=i.handle),a){"collection"!==i.pageType&&"search"!==i.pageType||(o.list_id=null==a?void 0:a.item_list_id,o.list_name=null==a?void 0:a.item_list_name)
377var s={ecommerce:{currency:(null===(n=e.manager.site.getData())||void 0===n?void 0:n.currency)||"AUD",save:{value:a.price,items:[ot(ot({},a),{item_list_id:o.list_id,item_list_name:o.list_name})]}}}
378e.manager.push("save_product",s)}}}),100)},t.prototype.trackVariantClick=function(t){var e,n=this.extractTrackingData(t,[this.DATA_ATTRS.PRODUCT_ID,this.DATA_ATTRS.VARIANT_ID,this.DATA_ATTRS.LIST_ID,this.DATA_ATTRS.LIST_NAME,this.DATA_ATTRS.ATTRIBUTE,this.DATA_ATTRS.VALUE])
379n=this.appendClosestSectionData(n,t)
380var r=this.findInDataLayer(n.product_id,n.variant_id)
381if(r){var i=ot(ot(((e={page_type:n.page_type,clicked_attribute:n.attribute})[n.attribute]=n.value,e),r),{item_list_id:n.list_id,item_list_name:n.list_name}),o=Object.fromEntries(Object.entries(i).filter((function(t){return t[0],null!==t[1]})))
382this.manager.push("toggle_variant",o)}}
382,t.prototype.publishToggleVariantEvent=function(t){var e,n=((e={page_type:null==t?void 0:t.page_type,product_id:null==t?void 0:t.product_id,variant_id:null==t?void 0:t.variant_id,clicked_attribute:null==t?void 0:t.attribute})[null==t?void 0:t.attribute]=null==t?void 0:t.value,e.item_list_id=null==t?void 0:t.item_list_id,e.item_list_name=null==t?void 0:t.item_list_name,e)
383this.manager.push("toggle_variant",n)},t.prototype.trackVariantClickPDP=function(t){var e=this.extractTrackingData(t,[this.DATA_ATTRS.PRODUCT_ID,this.DATA_ATTRS.VARIANT_ID,this.DATA_ATTRS.ATTRIBUTE,this.DATA_ATTRS.VALUE])
384this.pdpSelectMap.set(e.attribute,e.value)
385var n=this.findInDataLayer(e.productId,e.variantId,"view_item")
386if(n){var r=ot(ot(ot({page_type:"product"},Object.fromEntries(this.pdpSelectMap)),{clicked_attribute:e.attribute}),n),i=Object.fromEntries(Object.entries(r).filter((function(t){return t[0],null!==t[1]})))
387this.manager.push("toggle_variant",i)}},t.prototype.trackProductClick=function(t){var e=this.extractTrackingData(t,[this.DATA_ATTRS.PRODUCT_ID,this.DATA_ATTRS.VARIANT_ID,this.DATA_ATTRS.LIST_ID,this.DATA_ATTRS.LIST_NAME,this.DATA_ATTRS.INDEX]),n=this.manager.listing.getPageTypeAndHandle()
388e=this.appendClosestSectionData(e,t)
389var r=this.findInDataLayer(e.product_id,e.variant_id)
390r&&("collection"===n.pageType&&(e.list_id=null==r?void 0:r.item_list_id,e.list_name=null==r?void 0:r.item_list_name),e.index||(e.index=r.index),this.publishSelectItemEvent(ot(ot({},r),{product_id:parseInt(e.product_id,10),index:parseInt(e.index,10),item_list_id:e.list_id,item_list_name:e.list_name})))},t.prototype.publishSelectItemEvent=function(t){var e={ecommerce:{click:{item_list_id:t.item_list_id,item_list_name:t.item_list_name,items:[ot({},t)]}}}
391this.manager.push("select_item",e)},t.prototype.publishEventWithDataLayerItemLookup=function(t,e,n){void 0===n&&(n={})
392var r=this.findInDataLayer(t,null,"toggle_variant_pdp"==e?"view_item":"view_item_list")
393if(r)switch(e){case"select_item":this.publishSelectItemEvent(ot(ot(ot({},r),{product_id:parseInt(t,10),index:r.index,item_list_id:r.item_list_id,item_list_name:r.item_list_name}),n))
394break
395case"toggle_variant":case"toggle_variant_pdp":this.publishToggleVariantEvent(ot(ot(ot({},r),{product_id:parseInt(t,10)}),n))}},t.prototype.extractTrackingData=function(t,e){return e.reduce((function(e,n){var r=t.getAttribute(n)
396return e[n.replace("data-dl-","").replace(/-/g,"_")]=r||null,e}),{})},t.prototype.findInDataLayer=function(t,e,n){var r,i,o,a,s
397void 0===n&&(n="view_item_list")
398for(var c=[],u=0,l=window.dataLayer;u<l.length;u++){var d=l[u]
399if(d.event==="".concat(null===(r=window._BCDataLayer.config)||void 0===r?void 0:r.eventPrefix).concat(n)){var p="view_item"===n?null===(o=null===(i=d.ecommerce)||void 0===i?void 0:i.detail)||void 0===o?void 0:o.items:null===(s=null===(a=d.ecommerce)||void 0===a?void 0:a.impression)||void 0===s?void 0:s.items
400Array.isArray(p)&&(c=c.concat(p))}}if(0===c.length)return null
401if("view_item"===n)return c[0]
402if(e){var h=c.find((function(t){return parseInt(t.variant_id,10)===parseInt(e,10)}))
403if(h)return h}if(t){var f=c.find((function(e){return parseInt(e.product_id,10)===parseInt(t,10)}))
404if(f)return f}return null},t.prototype.hasRequiredAttributes=function(t,e){return e.every((function(e){return t.hasAttribute(e)}))},t.prototype.appendClosestSectionData=function(t,e){var n=this.manager.listing.getPageTypeAndHandle()
405if(!t.list_id||!t.list_name){var r=e.closest("".concat(this.SELECTORS.SECTION_ID))
406r?(t.list_id=null==(null==r?void 0:r.getAttribute(this.DATA_ATTRS.SECTION_ID))?"".concat(n.pageType,"-").concat(n.handle):r.getAttribute(this.DATA_ATTRS.SECTION_ID),t.list_name=null==(null==r?void 0:r.getAttribute(this.DATA_ATTRS.SECTION_NAME))?n.handle:r.getAttribute(this.DATA_ATTRS.SECTION_NAME)):(t.list_id="".concat(n.pageType,"-").concat(n.handle),t.list_name=n.handle)}return t.page_type=n.pageType,t.page_handle=n.handle,t},t.prototype.appendClosestProductData=function(t,e){this.manager.listing.getPageTypeAndHandle()
407var n=e.closest("".concat(this.SELECTORS.PRODUCT_ID))
408if(n){var r=n.getAttribute(this.DATA_ATTRS.PRODUCT_ID)
409t.product_id=r}return t},t.prototype.delegateEvent=function(t,e,n,r,i){void 0===r&&(r=[]),void 0===i&&(i={}),this._delegates[t]||(this._delegates[t]=[],document.addEventListener(t,this._handleDelegates.bind(this,t),!1)),this._delegates[t].push({trackAttr:e,handler:n,requiredAttrs:r,exclusive:i.exclusive})},t.prototype._handleDelegates=function(t,e){for(var n=this._delegates[t],r=e.target,i=0,o=n;i<o.length;i++)for(var a=o[i],s=r;s&&s!==document.body;){if(a.trackAttr.includes(".")&&s.classList.contains(a.trackAttr.substring(1)))return void a.handler(s,e)
410if(s.getAttribute(this.DATA_ATTRS.TRACK_ATTR)===a.trackAttr&&this.hasRequiredAttributes(s,a.requiredAttrs)){if(a.handler(s,e),a.exclusive)return
411break}s=s.parentElement}},t.prototype.setupClickTracking=function(){this.delegateEvent("click",this.SELECTORS.WIS
411HLIST_CLICK,this.trackWishlistClick.bind(this),[],{exclusive:!0}),this.delegateEvent("click",this.DATA_ATTRS.TRACK_TOGGLE_VARIANT,this.trackVariantClick.bind(this),[this.DATA_ATTRS.PRODUCT_ID,this.DATA_ATTRS.ATTRIBUTE,this.DATA_ATTRS.VALUE],{exclusive:!0}),this.delegateEvent("click",this.DATA_ATTRS.TRACK_TOGGLE_VARIANT_PDP,this.trackVariantClickPDP.bind(this),[this.DATA_ATTRS.PRODUCT_ID,this.DATA_ATTRS.ATTRIBUTE,this.DATA_ATTRS.VALUE],{exclusive:!1}),this.delegateEvent("click",this.DATA_ATTRS.TRACK_SELECT_ITEM,this.trackProductClick.bind(this),[this.DATA_ATTRS.PRODUCT_ID,this.DATA_ATTRS.INDEX])},t}(),st=function(){function t(){}return t.hashEmail=function(t){return e=this,r=function(){var e,n,r,i,o
412return function(t,e){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1]
413return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype)
414return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a
415function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.")
416for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i
417switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s
418break
419case 4:return o.label++,{value:s[1],done:!1}
420case 5:o.label++,r=s[1],s=[0]
421continue
422case 7:s=o.ops.pop(),o.trys.pop()
423continue
424default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0
425continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1]
426break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s
427break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s)
428break}i[2]&&o.ops.pop(),o.trys.pop()
429continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1]
430return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),e=t.trim().toLowerCase(),n=new TextEncoder,r=n.encode(e),[4,crypto.subtle.digest("SHA-256",r)]
431case 1:return i=a.sent(),[2,Array.from(new Uint8Array(i)).map((function(t){return t.toString(16).padStart(2,"0")})).join("")]
432case 2:return o=a.sent(),console.error("Error hashing email:",o),[2,t]
433case 3:return[2]}}
433))},new((n=void 0)||(n=Promise))((function(t,i){function o(t){try{s(r.next(t))}catch(t){i(t)}}function a(t){try{s(r.throw(t))}catch(t){i(t)}}function s(e){var r
434e.done?t(e.value):(r=e.value,r instanceof n?r:new n((function(t){t(r)}))).then(o,a)}s((r=r.apply(e,[])).next())}))
435var e,n,r},t.findInDataLayer=function(t,e,n){var r,i,o,a,s
436void 0===n&&(n="view_item_list")
437for(var c=[],u=0,l=window.dataLayer;u<l.length;u++){var d=l[u]
438if(d.event==="".concat(null===(r=window._BCDataLayer.config)||void 0===r?void 0:r.eventPrefix).concat(n)){var p="view_item"===n?null===(o=null===(i=d.ecommerce)||void 0===i?void 0:i.detail)||void 0===o?void 0:o.items:null===(s=null===(a=d.ecommerce)||void 0===a?void 0:a.impression)||void 0===s?void 0:s.items
439Array.isArray(p)&&(c=c.concat(p))}}if(0===c.length)return null
440if("view_item"===n)return c[0]
441if(e){var h=c.find((function(t){return parseInt(t.variant_id,10)===parseInt(e,10)}))
442if(h)return h}if(t){var f=c.find((function(e){return parseInt(e.product_id,10)===parseInt(t,10)}))
443if(f)return f}return null},t}(),ct=function(){function t(t){var e=this
444this.emailsPushed=new Set,this.phonesPushed=new Set,this._handleKlaviyoFormSubmit=function(t){return n=e,i=function(){var e,n,r,i,o,a,s,c,u,l,d,p,h,f,v,g,y,m
445return function(t,e){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1]
446return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype)
447return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a
448function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.")
449for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i
450switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s
451break
452case 4:return o.label++,{value:s[1],done:!1}
453case 5:o.label++,r=s[1],s=[0]
454continue
455case 7:s=o.ops.pop(),o.trys.pop()
456continue
457default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0
458continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1]
459break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s
460break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s)
461break}i[2]&&o.ops.pop(),o.trys.pop()
462continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1]
463return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,(function(_){switch(_.label){case 0:return"submit"!==(e=t).detail.type&&"stepSubmit"!==e.detail.type?[3,4]:(n=null===(f=null===(h=e.detail)||void 0===h?void 0:h.metaData)||void 0===f?void 0:f.$email,r=(null===(g=null===(v=e.detail)||void 0===v?void 0:v.metaData)||void 0===g?void 0:g.$source)||"",i=(null===(m=null===(y=e.detail)||void 0===y?void 0:y.metaData)||void 0===m?void 0:m.$phone_number)||"",!n||this.emailsPushed.has(n)?[3,2]:(a=(o=this.eventNotification).push,s=["subscribe_email"],d={},[4,st.hashEmail(n)]))
464case 1:a.apply(o,s.concat([(d.customer_email=_.sent(),d.source=r,d)])),this.emailsPushed.add(n),_.label=2
465case 2:return!i||this.phonesPushed.has(i)?[3,4]:(u=(c=this.eventNotification).push,l=["subscribe_sms"],p={},[4,st.hashEmail(i)])
466case 3:u.apply(c,l.concat([(p.customer_phone=_.sent(),p.source=r,p)])),this.phonesPushed.add(i),_.label=4
467case 4:return[2]}}
467))},new((r=void 0)||(r=Promise))((function(t,e){function o(t){try{s(i.next(t))}catch(t){e(t)}}function a(t){try{s(i.throw(t))}catch(t){e(t)}}function s(e){var n
468e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(o,a)}s((i=i.apply(n,[])).next())}))
469var n,r,i},this.eventNotification=new D,"klaviyo"===t&&this._initKlaviyo()}return t.prototype._initKlaviyo=function(){window.removeEventListener("klaviyoForms",this._handleKlaviyoFormSubmit),window.addEventListener("klaviyoForms",this._handleKlaviyoFormSubmit)},t}(),ut=function(){function t(t){this._isInitalized=!1,this.manager=t,this.intersectionObserverManager=new it(t,{SECTION_ID:"data-dl-section-id",SECTION_NAME:"data-dl-section-name"}),this.clickEventHandlers=new at(t),this.productListingManager=new rt(t),this.newsletterSubscription=new ct("klaviyo"),this.init()}return t.prototype.init=function(){this.clickEventHandlers.setupClickTracking(),this.intersectionObserverManager.initialize(),this.setupModalObserver()},t.prototype.setupModalObserver=function(){var t=this
470new et({modalSelector:"modal-dialog",openClass:"",openAttribute:"open",closeClass:"",closeAttribute:"close",debug:this.manager.site.getDLConfig().getDebug(),onModalOpen:function(e){var n=e.getAttribute("data-dl-section-id")
471if(!n){var r=e.querySelector("[data-dl-section-id]")
472r&&(n=r.getAttribute("data-dl-section-id"))}n&&t.productListingManager.publishProductListingForSection(e,n)},onModalClose:function(t){}})},t.prototype.addToProductListing=function(t){this.productListingManager.addToProductListing(t)},t.prototype.publishProductListingEvent=function(t){if(0===t.items.length)throw new Error("Items array is empty")
473if(!t.item_list_id||!t.item_list_name)throw new Error("Item list ID and name are required")
474this.productListingManager.publishProductListingEvent(t.items,t.item_list_id,t.item_list_name)},t.prototype.publishToggleVariantEvent=function(t){if(t.page_type&&(t.page_type=this.manager.page.getPageType()),!(t.item_list_id&&t.item_list_name&&t.product_id&&t.attribute&&t.value))throw new Error("Missing required fields. Requires - item_list_id, item_list_name, product_id, attribute, value")
475this.clickEventHandlers.publishToggleVariantEvent(t)},t.prototype.publishSelectItemEvent=function(t){if(!(t.item_list_id&&t.item_list_name&&t.product_id&&t.index))throw new Error("Missing required fields. Requires - item_list_id, item_list_name, product_id, index")
476this.clickEventHandlers.publishSelectItemEvent(t)},t}(),lt=function(){function t(t){this.manager=t,this.init()}return t.prototype.init=function(){this.listenForStoreFinderMessages()},t.prototype.handleEventData=function(t){if(!t.type)return console.error("No event type provided. data should have type property.",t),null
477var e=null
478if(this.isSearchStoreEvent(t)){if(!this.isValidSearchStoreEvent(t))return console.error("Invalid search store event data:",t),console.error("Schema:","{ type: 'SEARCH_STORE', postcode: string }"),null
479e={postcode:t.postcode,type:"SEARCH_STORE"}}else if(this.isSelectedStoreEvent(t)){if(!this.isValidSelectedStoreEvent(t))return console.error("Invalid selected store event data:",t),console.error("Schema:","{ type: 'SELECTED_STORE', postcode: string, selected_store: string }"),null
480e={postcode:t.postcode,selected_store:t.selected_store,type:"SELECTED_STORE"}}else console.error("Invalid event data:",t),console.error("Available event types:",["SEARCH_STORE","SELECTED_STORE"])
481return e},t.prototype.listenForStoreFinderMessages=function(){var t=this,e=/^https?:\/\/.*brauz.*netlify\.app$/i
482window.addEventListener("message",(function(n){if(e.test(n.origin)){var r=t.handleEventData(n.data)
483r&&t._pushDataLayerEvent(r)}}))},t.prototype.publishStoreEvent=function(t){var e=this.handleEventData(t)
484e&&this._pushDataLayerEvent(e)},t.prototype._pushDataLayerEvent=function(t){switch(t.type){case"SEARCH_STORE":delete t.type,this.manager.push("search_postcode_find_in_store",t)
485break
486case"SELECTED_STORE":delete t.type,this.manager.push("select_store_find_in_store",t)
487break
488default:console.error("Invalid event type:",t.type)}},t.prototype.isSearchStoreEvent=function(t){return"SEARCH_STORE"===t.type},t.prototype.isSelectedStoreEvent=function(t){return"SELECTED_STORE"===t.type},t.prototype.isValidSearchStoreEvent=function(t){var e
489return(null===(e=t.postcode)||void 0===e?void 0:e.length)>0},t.prototype.isValidSelectedStoreEvent=function(t){var e,n
490return(null===(e=t.postcode)||void 0===e?void 0:e.length)>0&&(null===(n=t.selected_store)||void 0===n?void 0:n.length)>0},t}(),dt=function(){return dt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])
491return t},dt.apply(this,arguments)}
492window.dataLayer=window.dataLayer||[]
493var pt=window.BCDataLayerManager||{},ht=dt(dt({},pt),{version:"1.0.0",manager:null,interactive:null,storeFinder:null,utils:null,createManager:function(t){return void 0===t&&(t={}),Z.create(t)},getCart:function(){var t
494return null===(t=this.manager)||void 0===t?void 0:t.cart},getProducts:function(){var t
495return null===(t=this.manager)||void 0===t?void 0:t.products},getPage:function(){var t
496return null===(t=this.manager)||void 0===t?void 0:t.page},getState:function(){var t
497return null===(t=this.manager)||void 0===t?void 0:t.state}}),ft=ht.createManager({state:window._BCDataLayer.state,site:window._BCDataLayer.site,cart:window._BCDataLayer.cart,products:window._BCDataLayer.products,page:window._BCDataLayer.page,customer:window._BCDataLayer.customer,listing:{},utils:null})
498ft.onLoad(),ht.manager=ft,ht.interactive=new ut(ft),ht.storeFinder=new lt(ft),ht.utils=st,window.BCDataLayerManager=ht})()

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.