PageSourceSearch

https://www.maccosmetics.com/cdn/shop/t/182/assets/nosto-recommendations.DBHE27CT.min.js

js maccosmetics.com collected 2026-09-24 17:10:58 UTC 3,217 bytes, 1 lines download raw bytes

1import{d as e}from"./vendor.D2HIaoTS.min.js";const t=class t{constructor(){if(this._defferedPromise=null,this._loaded=!1,this._skippedPlacements=[],!window.nostojs)throw new Error("Nosto Not initialized");this.initializeNosto=this.initializeNosto.bind(this),this._renderNostoInjectCampaigns=this._renderNostoInjectCampaigns.bind(this),this._callback=this._callback.bind(this),this._errorCallback=this._errorCallback.bind(this),this._defferedPromise=e(),this._skippedPlacements=[],this._attachListeners()}_attachListeners(){window.addEventListener("DOMContentLoaded",()=>this.initializeNosto()),document.addEventListener("cart:items-added",e=>{var t;const o=e.detail.items||[],n=e.detail.target;for(let i=0;i<o.length;i++){const e=o[i].product_id,s=(null==n?void 0:n.getRootNode()).host,r=(null==(t=null==n?void 0:n.closest(".nosto_element"))?void 0:t.id)||(null==s?void 0:s.urlParams.get("nosto"));r&&""!==r&&this.trackAddToCart(String(e),r)}}),document.addEventListener("quickshop::open",e=>{var t,o;const n=e.target,i=null==(t=null==n?void 0:n.closest("[product-id]"))?void 0:t.getAttribute("product-id"),s=null==(o=null==n?void 0:n.closest(".nosto_element"))?void 0:o.id;i&&s&&""!==s&&this.trackProductView(i,s)})}async initializeNosto(e=[]){var o,n;if(t.initialized)return this._loaded||await(null==(o=this._defferedPromise)?void 0:o.promise),this._renderNostoInjectCampaigns(this._nostoResponse);null==(n=window.nostojs)||n.call(window,t=>{const o=t.createRecommendationRequest({includeTagging:!0});Array.isArray(e)&&e.length>0&&o.setElements(e),o.setResponseMode("JSON_ORIGINAL").load().then(e=>{this._renderNostoInjectCampaigns(e),this._callback(e),this._skippedPlacements.length&&t.createRecommendationRequest().setElements(this._skippedPlacements).loadRecommendations()}).catch(this._errorCallback)}),t.initialized=!0}_renderNostoInjectCampaigns(e){var t;const o={};Object.keys(e.recommendations).forEach(t=>{if(e.recommendations[t].html&&(o[t]=e.recommendations[t].html),e.recommendations[t].products){const n=this.renderMarkup(e.recommendations[t],t);n?o[t]=n:this._skippedPlacements.push(t)}}),null==(t=window.nostojs)||t.call(window,e=>{e.placements.injectCampaigns(o)})}get nostoTemplates(){return document.getElementById("nosto-templates")}renderMarkup(e,t){if(!this.nostoTemplates)return;const o=document.getElementById(t);if(!o)return"";const n=o.getAttribute("data-template-type")||"",i=this.nostoTemplates.content.cloneNode(!0).querySelector(`[data-template-type="${n}"]`);if(!i)return"";const s=e.title,r=e.products;return i.innerHTML=i.innerHTML.replaceAll("%%result_id%%",e.result_id).replaceAll("%%title%%",s).replaceAll("%%products%%",encodeURIComponent(JSON.stringify(r))),i.innerHTML}_callback(e){var t;this._nostoResponse=e,this._loaded=!0,null==(t=this._defferedPromise)||t.resolve(this._nostoResponse)}_errorCallback(e){var t;null==(t=this._defferedPromise)||t.reject(e)}trackAddToCart(e,t){var o;null==(o=window.nostojs)||o.call(window,o=>{o.recommendedProductAddedToCart(e,t)})}trackProductView(e,t){var o;null==(o=window.nostojs)||o.call(window,o=>{o.createRecommendationRequest().setProducts([{product_id:e}],t).load()})}};t.initialized=!1;let o=t;window.__NOSTO_RECOMMENDER__=new o;

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.