import{a as k}from"./chunk-EDISMNG3.js";import{a as F}from"./chunk-LGMFDKN4.js";import{f as I,p as x}from"./chunk-RTOZFW5D.js";import{f as L,h as b}from"./chunk-E56JCP42.js";import{C as c,D as O,F as f,G as p,b as l}from"./chunk-3T7NQNCJ.js";import{k as w}from"./chunk-SBF3UK4I.js";import{ka as h,va as d}from"./chunk-SGK554CS.js";import{e as o,j as s,z as C}from"./chunk-YR2ZOLW3.js";import{D as S,Y as v}from"./chunk-VI2VOVRS.js";import{a as m,b as E}from"./chunk-EQDQRRRY.js";var T=(()=>{class i{constructor(e,t,r,a,n){this.configService=e,this.userService=t,this.shippingService=r,this.translateService=a,this.localeService=n}hideSearchEngine(){}initializeSearchEngine(){this.loadEmpathyConfig()}reloadSearchEngine(){this.loadEmpathyConfig()}getEmpathyParams(){let e={lang:this.translateService.currentLang,searchLang:this.translateService.currentLang,scope:this.getScope(),consent:this.userService.getCustomRecomendations(),currency:this.localeService.getCurrentCurrencyCode(),store:this.shippingService.getZoneId()};return window.EmpathyX.empathyXInitialized||(e=m(E(m({},e),{instance:this.configService.getBrand()}),this.configService.getEnvironment()!=="pro"&&{env:"staging"})),e}getScope(){return window.matchMedia("only screen and (max-width: 768px)").matches?L.isRunningInCapacitor()?"empathize_app":"empathize_mobile":window.matchMedia("only screen and (max-width: 1199px)").matches?"empathize_tablet":"empathize_desktop"}initializeEmpathySearchEngine(){let e=this.getEmpathyParams();if(window.EmpathyX)window.EmpathyX.empathyXInitialized?window.EmpathyX.setConfig(e):window.EmpathyX.init(e);else throw new Error(`Error when initialize Empathy with params: ${JSON.stringify(e)}`)}isSearcherCreate(){return!!document.getElementById("txtSearch")||!!document.getElementById("txtSearch2")||!!document.getElementById("txtSearchMobile")}loadEmpathyConfig(){this.isSearcherCreate()&&this.initializeEmpathySearchEngine()}static{this.\u0275fac=function(t){return new(t||i)(s(c),s(I),s(f),s(l),s(p))}}static{this.\u0275prov=o({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();function _(i){return`
{{#total}}{{#results}}
<div class="df-card-tol" data-role="close" data-role="result" onclick="searchForProducto('{{codigo}}');">
<div class="df-card__offer">
<div class="df-card__offer-ico{{ofertaico_${i}}}"></div>
</div>
<div class="df-card-tol__image">
<img src="{{image_link}}" alt="{{title}}" width="110" onerror="this.parentElement.className = this.parentElement.className + ' noimage'" style="width: 110px; height: 110px;"/>
</div>
<div class="df-card__content">
<div class="df-card__title">{{title}}</div>
<div class="df-card__title df-card__title--large u-d-none">{{{description}}}</div>
</div>
<div class="df-card__pricing">
<span class="df-card__price {{#sale_price_${i}}}df-card__price--old{{/sale_price_${i}}}">
{{#format-currency}}{{price_${i}}}{{/format-currency}}{{unit_type}}
</span>
{{#sale_price_${i}}}
<span class="df-card__price df-card__price--new">{{#format-currency}}{{sale_price_${i}}}{{/format-currency}}{{unit_type}}</span>
{{/sale_price_${i}}}
</div>
</div>
{{/results}}{{/total}} {{^total}}
{{#noResultsHTML}}{{{noResultsHTML}}}{{/noResultsHTML}}
{{^noResultsHTML}}
<p class="df-no-results">{{#translate}}Sorry, no results found.{{/translate}}</p>
{{/noResultsHTML}}
{{/total}}
`}function D(i){return`
{{#is_first}} {{#banner}}
<div class="df-banner">
<a {{#blank}}target="_blank" rel="noopener noreferrer"{{/blank}} href="{{link}}" data-role="banner" data-banner="{{id}}"><img src="{{#remove-protocol}}{{image}}{{/remove-protocol}}"></a>
</div>
{{/banner}}{{/is_first}} {{#total}}{{#results}}
<div class="df-card" data-role="result">
<div class="ofertaico{{ofertaico_${i}}}"></div>
<a class="link dflink df-clearfix" data-dfid="{{dfid}}" data-df-hitcounter="/hit/{{hashid}}/{{dfid}}/" onclick="searchForProducto('{{codigo}}');">
{{#image_link}}
<figure class="df-card__image">
<img src="{{#remove-protocol}}{{image_link}}{{/remove-protocol}}" alt="{{title}}" width="110" style="width: 110px; height: 110px;"/>
</figure>
{{/image_link}}
<div class="df-card__content">
<div class="df-card__title">{{title}}</div>
<div class="df-card__description">{{{description}}}</div>
{{#price_${i}}}
<div class="df-card__pricing">
<span class="df-card__price {{#sale_price_${i}}}df-card__price--old{{/sale_price_${i}}}">
{{#format-currency}}{{price_${i}}}{{/format-currency}}{{unit_type}}
</span>
{{#sale_price_${i}}}
<span class="df-card__price df-card__price--new">{{#format-currency}}{{sale_price_${i}}}{{/format-currency}}{{unit_type}}</span>
{{/sale_price_${i}}}
</div>
{{/price_${i}}}
</div>
</a>
<a class="add_to_cart" href="{{add_to_cart}}" {{^add_to_cart}}style="display:none;" {{/add_to_cart}}><span>{{#df_translate}}Add to cart{{/df_translate}}</span></a>
</div>
{{/results}}{{/total}} {{^total}}
<p class="df-no-results">{{#translate}}Sorry, no results found.{{/translate}}</p>{{/total}}
`}var j=(()=>{class i{constructor(e,t,r,a,n,u,R,B){this.shippingService=e,this.configService=t,this.translateService=r,this.orderService=a,this.navigationService=n,this.ngZone=u,this.sortListService=R,this.localeService=B}getKey(){return this.keyCache}hideSearchEngine(){this.hideDoofinderLayer("df-fullscreen"),this.hideDoofinderLayer("df-mobile")}initializeSearchEngine(){this.loadDoofinderConfig()}reloadSearchEngine(){setTimeout(()=>{this.loadDoofinderConfig()},3e3)}addCallbackListeners(e){this.addEventListenerForDesktopEnter("df-searchbox__"+e),this.addEventListenerForMobileSearch("df-mobile__searchbox__"+e)}addEventListenerForDesktopEnter(e){let t=document.getElementById(e);t&&t.addEventListener("keydown",r=>{r.key==="Enter"&&t.value&&this.ngZone.run(()=>{this.hideSearchEngine(),this.navigationService.navigateToSearch(t.value)})})}addEventListenerForMobileSearch(e){let t=document.getElementById(e);if(t){t.addEventListener("keydown",a=>{if(a.key==="Enter"){a.preventDefault();let n=document.getElementsByClassName("df-mobile__searchbox__loupe");n&&n[0].dispatchEvent(new Event("click"))}});let r=document.getElementsByClassName("df-mobile__searchbox__loupe");for(let a of Object.values(r))a.addEventListener("click",()=>{t.value&&this.ngZone.run(()=>{this.hideSearchEngine(),this.navigationService.navigateToSearch(t.value)})})}}getCurrencyDisplay(){return{symbol:"",decimal:",",thousand:".",precision:2,format:"%v %s"}}getFacets(){return{width:"250px",attached:"left",custom:[{name:"categories",label:this.doofinderOptions.categories},{name:"brand",label:this.doofinderOptions.brands}]}}getHash(){let e=this.configService.getDooFinderData().hashes;if(Object.hasOwn(e,this.translateService.currentLang.toUpperCase()))return e[this.translateService.currentLang.toUpperCase()][this.localeService.getCurrentCurrencyCode()]}getLayer(e,t,r,a,n){return{mobile:{display:{results:{template:_(r)}}},mainContainerId:t,toggleInput:e,dtop:2,hashid:a,zone:"eu1",searchParams:this.getSearchParams(r),display:{closeIfEmpty:!0,closeOnClick:!0,closeOnEscKey:!0,closeOnHit:!0,header:{show:!0},lang:n,currency:this.getCurrencyDisplay(),facets:this.getFacets(),results:{template:_(r)},translations:{Results:this.doofinderOptions.results,"Search\u2026":this.doofinderOptions.search,"Sorry, no results found.":this.doofinderOptions.noResults,"View less\u2026":this.doofinderOptions.viewLess,"View more\u2026":this.doofinderOptions.viewMore,"Selected Filters":this.doofinderOptions.selectedFilters,CLOSE:this.doofinderOptions.close,CLEAR:this.doofinderOptions.clear,FILTER:this.doofinderOptions.filter,"Query Too Large":this.doofinderOptions.queryTooLarge,"Latest Searches":this.doofinderOptions.latestSearches,"Sort by":this.doofinderOptions.sortBy,Relevance:this.doofinderOptions.relevance,Delete:this.doofinderOptions.delete,"POPULAR SUGGESTIONS":this.doofinderOptions.popularSuggestions,"SEARCH RESULTS":this.doofinderOptions.searchResults,"View all {{total}} results":this.doofinderOptions.viewAll,Previous:this.doofinderOptions.previous,Next:this.doofinderOptions.next,"Clear all":this.doofinderOptions.clearAll,"Suggestions:":this.doofinderOptions.suggestions,"Did you mean:":this.doofinderOptions.didYouMean}},redirections:{captureForm:!0},urlHash:!1,historyPlugin:{min:1,max:5},callbacks:{loaded:()=>{setTimeout(()=>{this.addCallbackListeners(t)},2e3)}}}}getSearchParams(e){return{filter:{zonas:[e]},sort:[],transformer:null}}getSortTypeFormatted(e){let t=this.sortListService.getSortTypeSelected(),r=this.orderService.getOrderTypes();return t?r.find(a=>a.orderId===t.id)?.value.replace("{idZona}",e).replace("{asc-desc}",t.label.split(".").pop()):"orden_1&desc"}hideDoofinderLayer(e){let t=document.getElementsByClassName(e);for(let r of Object.values(t))r.removeAttribute("visible"),r.setAttribute("hidden","true")}isHashIdChangedClassic(e){let t;return window.dfClassicLayers&&window.dfClassicLayers[0].layerOptions&&(t=window.dfClassicLayers[0].layerOptions.hashid),e!==t}isSearcherCreate(){return!!document.getElementById("txtSearch")||!!document.getElementById("txtSearch2")||!!document.getElementById("txtSearchMobile")}loadDoofinderConfig(){this.isSearcherCreate()&&(this.configService.getDooFinderData().url.indexOf("classic")!==-1?this.loadDoofinderConfigClassic():this.loadDoofinderConfigFullscreen())}loadDoofinderConfigClassic(){let e=this.getHash()+"-"+this.translateService.currentLang+"-"+this.localeService.getCurrentCurrencyCode()+"-"+String(this.shippingService.getZoneId())+"-"+this.getSortTypeFormatted(String(this.shippingService.getZoneId()));this.keyCache!==e&&!window.matchMedia("only screen and (max-width: 768px)").matches?S([this.translateService.get("headerStandard.searcher.doofinder.categories"),this.translateService.get("headerStandard.searcher.doofinder.brands")]).pipe(v()).subscribe(t=>{this.doofinderOptions={hashId:this.getHash(),lang:this.translateService.currentLang,currency:this.localeService.getCurrentCurrencyCode(),zone:String(this.shippingService.getZoneId()),order:this.getSortTypeFormatted(String(this.shippingService.getZoneId())),categories:t[0],brands:t[1],allergens:""},this.keyCache=e,this.isHashIdChangedClassic(this.doofinderOptions.hashId)?(this.setupClassicLayer(this.doofinderOptions.hashId,this.doofinderOptions.zone,this.doofinderOptions.lang),setTimeout(()=>{this.setOptionsDooFinderClassic()},2e3)):this.setOptionsDooFinderClassic()}):this.setOptionsDooFinderClassic()}loadDoofinderConfigFullscreen(){let e=this.getHash()+"-"+this.translateService.currentLang+"-"+this.localeService.getCurrentCurrencyCode()+"-"+String(this.shippingService.getZoneId())+"-"+this.getSortTypeFormatted(String(this.shippingService.getZoneId()));this.keyCache!==e?S([this.translateService.get("headerStandard.searcher.doofinder.categories"),this.translateService.get("headerStandard.searcher.doofinder.brands"),this.translateService.get("headerStandard.searcher.doofinder.results"),this.translateService.get("headerStandard.searcher.doofinder.search"),this.translateService.get("headerStandard.searcher.doofinder.noResults"),this.translateService.get("headerStandard.searcher.doofinder.viewLess"),this.translateService.get("headerStandard.searcher.doofinder.viewMore"),this.translateService.get("headerStandard.searcher.doofinder.selectedFilters"),this.translateService.get("headerStandard.searcher.doofinder.close"),this.translateService.get("headerStandard.searcher.doofinder.clear"),this.translateService.get("headerStandard.searcher.doofinder.filter"),this.translateService.get("headerStandard.searcher.doofinder.queryTooLarge"),this.translateService.get("headerStandard.searcher.doofinder.latestSearches"),this.translateService.get("headerStandard.searcher.doofinder.sortBy"),this.translateService.get("headerStandard.searcher.doofinder.relevance"),this.translateService.get("headerStandard.searcher.doofinder.delete"),this.translateService.get("headerStandard.searcher.doofinder.popularSuggestions"),this.translateService.get("headerStandard.searcher.doofinder.searchResults"),this.translateService.get("headerStandard.searcher.doofinder.viewAll"),this.translateService.get("headerStandard.searcher.doofinder.previous"),this.translateService.get("headerStandard.searcher.doofinder.next"),this.translateService.get("headerStandard.searcher.doofinder.clearAll"),this.translateService.get("headerStandard.searcher.doofinder.suggestions"),this.translateService.get("headerStandard.searcher.doofinder.didYouMean")]).pipe(v()).subscribe(t=>{this.doofinderOptions={hashId:this.getHash(),lang:this.translateService.currentLang,currency:this.localeService.getCurrentCurrencyCode(),zone:String(this.shippingService.getZoneId()),order:this.getSortTypeFormatted(String(this.shippingService.getZoneId())),categories:t[0],brands:t[1],allergens:"",results:t[2],search:t[3],noResults:t[4],viewLess:t[5],viewMore:t[6],selectedFilters:t[7],close:t[8],clear:t[9],filter:t[10],queryTooLarge:t[11],latestSearches:t[12],sortBy:t[13],relevance:t[14],delete:t[15],popularSuggestions:t[16],searchResults:t[17],viewAll:t[18],previous:t[19],next:t[20],clearAll:t[21],suggestions:t[22],didYouMean:t[23]},this.keyCache=e,this.setupFullscreenLayer(this.doofinderOptions.hashId,this.doofinderOptions.zone,this.doofinderOptions.lang),setTimeout(()=>{this.setOptionsDooFinder()},2e3)}):(this.setOptionsDooFinder(),this.addCallbackListeners("doofinder"))}setOptionsDooFinder(){window.dfFullscreenLayers&&window.dfFullscreenLayers.forEach(e=>{e&&e.layerOptions&&(e.layerOptions.display.lang=this.doofinderOptions.lang,e.layerOptions.display.facets.custom[0].label=this.doofinderOptions.categories,e.layerOptions.display.facets.custom[1].label=this.doofinderOptions.brands,e.layerOptions.searchParams.filter.zonas[0]=this.doofinderOptions.zone,e.configure())})}setOptionsDooFinderClassic(){window.dfClassicLayers&&window.dfClassicLayers.forEach(e=>{e&&e.layerOptions&&(e.layerOptions.display.lang=this.doofinderOptions.lang,e.layerOptions.display.facets.custom[0].label=this.doofinderOptions.categories,e.layerOptions.display.facets.custom[1].label=this.doofinderOptions.brands,e.layerOptions.searchParams.filter.zonas[0]=this.doofinderOptions.zone,e.configure())})}setupClassicLayer(e,t,r){let a={mainContainerId:"doofinder",queryInput:"#txtSearch",dtop:2,hashid:e,zone:"eu1",searchParams:this.getSearchParams(t),display:{closeIfEmpty:!0,closeOnClick:!0,closeOnEscKey:!0,closeOnHit:!0,header:{show:!0},lang:r,currency:this.getCurrencyDisplay(),facets:this.getFacets(),results:{width:"960px",template:D(this.doofinderOptions.zone)}},redirections:!0,urlHash:!1},n=w(a);n.mainContainerId="doofinder2",n.queryInput="#txtSearch2",window.doofinder.classic.setLayers([a,n])}setupFullscreenLayer(e,t,r){let a=this.getLayer("#txtSearch","doofinder",t,e,r),n=this.getLayer("#txtSearch2","doofinder2",t,e,r),u=this.getLayer("#txtSearchMobile","doofinderMobile",t,e,r);setTimeout(()=>{window.doofinder.fullscreen.setLayers([a,n,u])},2200)}static{this.\u0275fac=function(t){return new(t||i)(s(f),s(c),s(l),s(F),s(x),s(C),s(k),s(p))}}static{this.\u0275prov=o({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var M=(()=>{class i{constructor(e,t,r){this.configService=e,this.empathy=t,this.dooFinder=r}createSearchEngineObject(){switch(this.configService.getSearchEngineType()){case d.Empathy:return this.empathy;case d.DooFinder:return this.dooFinder;default:break}}getUrl(){switch(this.configService.getSearchEngineType()){case d.Empathy:{let t=this.configService.getBrand();return this.configService.getEmpathyBrokerData().url.replace("{brand}",t)}case d.DooFinder:return this.configService.getDooFinderData().url;default:break}}static{this.\u0275fac=function(t){return new(t||i)(s(c),s(T),s(j))}}static{this.\u0275prov=o({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var se=(()=>{class i{constructor(e,t,r,a){this.configService=e,this.searchEngineFactory=t,this.externalSystemsService=r,this.loggingService=a}reloadSearchEngine(){this.searchEngine&&this.searchEngine.reloadSearchEngine()}setupSearchEngine(){this.configService.getSearchEngineType()!==h.Default&&this.configService.getSearchEngineType()!==h.SmartSearcher&&this.externalSystemsService.loadScript(this.configService.getSearchEngineType(),this.searchEngineFactory.getUrl(),h.SearcherEngine,[],!1).then(()=>{this.searchEngine=this.searchEngineFactory.createSearchEngineObject(),this.searchEngine&&this.searchEngine.initializeSearchEngine()}).catch(e=>{this.loggingService.error(e)})}static{this.\u0275fac=function(t){return new(t||i)(s(c),s(M),s(b),s(O))}}static{this.\u0275prov=o({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var ne=(()=>{class i{constructor(){window.monitor={isLoaded:!1,isLogged:!1}}setIsLoaded(){window.monitor.isLoaded=!0}setIsLogged(e){window.monitor.isLogged=e}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=o({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();export{se as a,ne as b};