1import{a as q}from"./chunk-ANTWCXYX.js";import{a as Ee}from"./chunk-FOZKSOKQ.js";import"./chunk-QMUYHL4Q.js";import{a as Te}from"./chunk-AIFC7VMD.js";import"./chunk-RKYIHD27.js";import"./chunk-2NUHZIE4.js";import{a as ye}from"./chunk-ZRZ5BRAO.js";import{h as $e}from"./chunk-OUQUGTPA.js";import{a as we}from"./chunk-BPP3E2TO.js";import{a as Be}from"./chunk-VTK5J2DS.js";import"./chunk-3SDC52M5.js";import"./chunk-4KNFSRE5.js";import"./chunk-PMDFIPZC.js";import"./chunk-EHPRDZBY.js";import"./chunk-56A6QMAO.js";import"./chunk-ZH6IOVTT.js";import"./chunk-NUJSW3VU.js";import"./chunk-KJKIPU3Z.js";import"./chunk-6NEIA7KQ.js";import"./chunk-CNBMOLNM.js";import"./chunk-YMDDGZ5U.js";import"./chunk-3OL3GXBR.js";import"./chunk-4DAUCYCB.js";import"./chunk-XUPYV42H.js";import"./chunk-TYQB6DAR.js";import"./chunk-GW6I55VC.js";import"./chunk-4ZJHJNLB.js";import"./chunk-3IRW6MAO.js";import"./chunk-FVZKEHFL.js";import"./chunk-CABTRMED.js";import"./chunk-7EDV3FYO.js";import"./chunk-OBUWOHWX.js";import"./chunk-AWTSZHSK.js";import"./chunk-KUHFH43V.js";import"./chunk-JC5PZU5R.js";import"./chunk-UNHUUWFF.js";import"./chunk-N4SAKXVX.js";import"./chunk-GJK2E2S6.js";import"./chunk-QIWZL5RQ.js";import"./chunk-MOINSKK7.js";import"./chunk-SU7S3GV3.js";import"./chunk-7OWGJP2F.js";import"./chunk-OT5BIL5I.js";import"./chunk-3KYWNODB.js";import"./chunk-NOYQY4IF.js";import"./chunk-ME6REO5O.js";import"./chunk-RPX352E4.js";import{a as xe}from"./chunk-CIDLE6M4.js";import"./chunk-XFNOPY4D.js";import"./chunk-SD2GF6LN.js";import"./chunk-VCI6DQU6.js";import"./chunk-ELFTTI6P.js";import"./chunk-DFKOY57W.js";import{g as me}from"./chunk-3OSB33KW.js";import"./chunk-DL3JVWPO.js";import"./chunk-XERX3YYW.js";import"./chunk-AUTQTPL7.js";import"./chunk-4Z5MUJO3.js";import"./chunk-A3QLZGQA.js";import{$ as ve,U as _e,V as Ce,X as fe,Z as ge,da as be,rb as Se}from"./chunk-LJH5OBMW.js";import{Eb as f,Ec as ae,F as K,Fb as te,Fc as $,Gb as g,Ge as le,Hb as O,J as Y,Jb as I,Jc as o,Kb as D,Kc as a,Lb as u,Lc as k,Mb as l,Mh as H,Nb as s,Nh as F,Ob as x,Qa as N,S as J,Ub as ne,Uc as U,Ue as de,V as C,Vb as j,Xb as E,Z as V,Zb as c,a as P,cb as r,d as G,fc as ie,ga as z,gc as oe,jc as re,kc as L,mc as B,nd as A,o as R,ob as M,oc as y,oe as se,pb as Z,ph as ue,ra as X,rh as he,sg as pe,tb as ee,u as m,ua as h,v as Q,vc as v,wc as T,we as ce,xc as w,ya as b,za as S}from"./chunk-PMSJWPYZ.js";import"./chunk-NIF3MU5U.js";var Me=(()=>{class t{productAlgoliaService=h(Be);query$=this.productAlgoliaService.queryParamsSearchQuery$.pipe(K(e=>e!==null),J(1));sub=new P;ngOnDestroy(){this.sub.unsubscribe()}search(e){this.productAlgoliaService.setSearchQueryParam(e)}clearQuery(){this.productAlgoliaService.setSearchQueryParam()}submit(e){this.productAlgoliaService.setSearchQueryParam(e)}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=M({type:t,selectors:[["trn-algolia-search-box"]],decls:3,vars:7,consts:[[3,"onChange","onClear","onSubmit","placeholder","barcode","value"]],template:function(n,i){n&1&&(l(0,"trn-search-box",0),o(1,"cxTranslate"),o(2,"async"),E("onChange",function(_){return i.search(_)})("onClear",function(){return i.clearQuery()})("onSubmit",function(_){return i.submit(_)}),s()),n&2&&u("placeholder",a(1,3,"common.search_placeholder"))("barcode",!0)("value",a(2,5,i.query$))},dependencies:[q,F,A,H],encapsulation:2})}return t})();var Le=["searchBox"],ke=["dropdown"],Ae=()=>({flexType:"AssistantChatFloatComponent",typeCode:"AssistantChatFloatComponent"}),He=t=>({search:t,searchBoxActive:!0,maxRecentSearches:5}),W=t=>({count:t}),Fe=t=>({query:t});function qe(t,d){t&1&&x(0,"trn-algolia-search-box")}function Re(t,d){}function Qe(t,d){t&1&&(l(0,"div",7),x(1,"trn-icon",9),l(2,"div",10),B(3),o(4,"cxTranslate"),s()()),t&2&&(r(3),y(" ",a(4,1,"refinement.no_results_found")," "))}function Ve(t,d){if(t&1&&(l(0,"li",14),x(1,"trn-product-card",16),o(2,"async"),o(3,"async"),s()),t&2){let e=d.$implicit,n=d.$index;c(3);let i=w(9),p=c();r(),u("product",e)("isSearchBox",!0)("index",a(2,6,p.productsIndex$))("position",n+1)("queryID",a(3,8,p.productsQueryID$))("searchQuery",i)}}function ze(t,d){if(t&1&&(l(0,"div")(1,"div",11),B(2),o(3,"async"),s(),l(4,"h4",12),B(5),o(6,"async"),o(7,"cxTranslate"),s(),l(8,"ul",13),I(9,Ve,4,10,"li",14,O),s(),x(11,"trn-button",15),o(12,"cxTranslate"),s()),t&2){c();let e=w(0);c();let n=w(9),i=c();r(2),y(" ",a(3,14,i.srMessage$)," "),r(3),y(" ",k(7,18,"refinement.products",$(23,W,a(6,16,i.productC
1ount$)))," "),r(4),D(e),r(2),L("outlined"),u("size","medium")("appearance","link")("url","produkter")("fill",!0)("label",a(12,21,"refinement.see_all_products"))("queryParams",$(25,Fe,n))("color","primary")("icon","arrow_forward")("iconPlacement","icon-right")("size","medium")}}function Ne(t,d){if(t&1&&(l(0,"li",14),x(1,"trn-brand-thumbnail",19),o(2,"async"),o(3,"async"),s()),t&2){let e=d.$implicit,n=d.$index,i=c(4);r(),u("brand",e)("borderless",!0)("index",a(2,5,i.brandsIndex$))("position",n+1)("queryID",a(3,7,i.brandsQueryID$))}}function je(t,d){if(t&1&&(l(0,"div")(1,"h4",17),B(2),o(3,"async"),o(4,"cxTranslate"),s(),l(5,"ul",13),I(6,Ne,4,9,"li",14,O),s(),x(8,"trn-button",18),o(9,"cxTranslate"),s()),t&2){c();let e=w(3),n=c(2);r(2),y(" ",k(4,13,"refinement.brands",$(18,W,a(3,11,n.brandCount$)))," "),r(4),D(e),r(2),L("outlined"),u("size","medium")("appearance","link")("url","/merker")("color","primary")("iconPlacement","icon-right")("icon","arrow_forward")("label",a(9,16,"refinement.see_all_brands"))("fill",!0)}}function Ue(t,d){if(t&1&&(l(0,"li",14),x(1,"trn-article",21),o(2,"async"),o(3,"async"),s()),t&2){let e=d.$implicit,n=d.$index,i=c(4);r(),u("article",e)("displayCategory",!1)("search",!0)("index",a(2,6,i.articlesIndex$))("position",n+1)("queryID",a(3,8,i.articlesQueryID$))}}function We(t,d){if(t&1&&(l(0,"div")(1,"h4",17),B(2),o(3,"async"),o(4,"cxTranslate"),s(),l(5,"ul",20),I(6,Ue,4,10,"li",14,O),s(),x(8,"trn-button",18),o(9,"cxTranslate"),s()),t&2){c();let e=w(6),n=c(2);r(2),y(" ",k(4,13,"refinement.articles",$(18,W,a(3,11,n.articleCount$)))," "),r(4),D(e),r(2),L("outlined"),u("size","medium")("appearance","link")("url","/tips-og-trender")("color","primary")("iconPlacement","icon-right")("icon","arrow_forward")("label",a(9,16,"refinement.see_all_articles"))("fill",!0)}}function Ge(t,d){if(t&1&&(v(0),o(1,"async"),f(2,ze,13,27,"div"),v(3),o(4,"async"),f(5,je,10,20,"div"),v(6),o(7,"async"),f(8,We,10,20,"div")),t&2){let e=c(2),n=T(a(1,3,e.productHits$));r(2),g(n!=null&&n.length?2:-1),r();let i=T(a(4,6,e.brandHits$));r(2),g(i!=null&&i.length?5:-1),r();let p=T(a(7,9,e.articleHits$));r(2),g(p!=null&&p.length?8:-1)}}function Ke(t,d){if(t&1){let e=j();v(0),o(1,"async"),l(2,"div",8)(3,"trn-button",22),o(4,"cxTranslate"),E("onClick",function(){b(e);let i=c(2);return S(i.seeResultsClick())}),s()()}if(t&2){let e=a(1,6,c(2).isUpLgBreakpoint$);r(3),u("fill",!0)("label",a(4,8,"refinement.see_all_results"))("color","primary")("icon","arrow_forward")("iconPlacement","icon-right")("size",e?"large":"medium")}}function Ye(t,d){if(t&1){let e=j();v(0),o(1,"async"),l(2,"trn-search-box",3,0),o(4,"cxTranslate"),E("onChange",function(i){b(e);let p=c();return S(p.search(i))})("onClear",function(){b(e);let i=c();return S(i.clear())})("onFocus",function(i){b(e);let p=c();return S(p.onFocus(i))})("onSubmit",function(i){b(e);let p=c();return S(p.onEnter(i))}),s(),l(5,"div",4,1),o(7,"async"),l(8,"div",5),v(9),o(10,"async"),ee(11,Re,0,0,"ng-template",6),f(12,Qe,5,3,"div",7)(13,Ge,9,12),s(),f(14,Ke,5,10,"div",8),s()}if(t&2){let e=c(),n=a(1,8,e.noResults$);r(2),u("barcode",!0)("placeholder",a(4,10,"common.search_placeholder")),r(3),re("hidden",a(7,12,e.dropdownOpened$)!==!0),r(4);let i=T(a(10,14,e.query$));r(2),u("cxOutlet",e.searchBoxOutlets.RECENT_SEARCHES)("cxOutletContext",$(17,He,i)),r(),g(n?12:13),r(2),g(n!==!0?14:-1)}}var Je=2,Oe=(()=>{class t{breakPointService=h(be);cmsService=h(ue);routerService=h(pe);router=h(ce);searchBoxService=h(ye);windowRef=h(de);searchInsightService=h(we);translationService=h(he);withOutDropdown$=this.cmsService.getCurrentPage().pipe(m(e=>e?.template==="SearchResultsListPageTemplate"));results$=this.searchBoxService.results$;noResults$=this.searchBoxService.noResults$;query$=this.searchBoxService.query$;isUpLgBreakpoint$=this.breakPointService.isUp(_e.lg);productHits$=this.searchBoxService.hits$(this.searchBoxService.index.products);brandHits$=this.searchBoxService.hits$(this.searchBoxService.index.brands);articleHits$=this.searchBoxService.hits$(this.searchBoxService.index.articles);productCount$=this.searchBoxService.resultCount$(this.searchBoxService.index.products);articleCount$=this.searchBoxService.resultCount$(this.searchBoxService.index.articles);brandCount$=this.searchBoxService.resultCount$(this.searchBoxService.index.brands);
1srMessage$=Q({productCount:this.productCount$,articleCount:this.articleCount$,brandCount:this.brandCount$}).pipe(m(e=>{let n={productCount:"refinement.product",articleCount:"refinement.article",brandCount:"refinement.brand"};return Object.entries(e).reduce((i,[p,_])=>_===0?i:i.concat([this.translationService.translate(n[p],{count:_})]),[])}),z(e=>e.length?Q(e):R([])),m(e=>e.join(", ")),z(e=>e?this.translationService.translate("common.sr_search_results",{query:e}):R("")),C(),Y(500));dropdownOpened$=new G(!1);productsIndex$=this.searchBoxService.result$(this.searchBoxService.index.products).pipe(m(e=>e?.index),C());brandsIndex$=this.searchBoxService.result$(this.searchBoxService.index.brands).pipe(m(e=>e?.index),C());articlesIndex$=this.searchBoxService.result$(this.searchBoxService.index.articles).pipe(m(e=>e?.index),C());productsQueryID$=this.searchBoxService.result$(this.searchBoxService.index.products).pipe(m(e=>e?.queryID),C());brandsQueryID$=this.searchBoxService.result$(this.searchBoxService.index.brands).pipe(m(e=>e?.queryID),C());articlesQueryID$=this.searchBoxService.result$(this.searchBoxService.index.articles).pipe(m(e=>e?.queryID),C());searchBoxOutlets=Se;hasAppliedEventListeners=!1;routerEventsSub;sub=new P;searchBox=U("searchBox",{read:N});dropdown=U("dropdown");constructor(){this.sub.add(this.router.events.subscribe(e=>{e instanceof se&&this.dropdownOpened$.getValue()&&this.closeDropdown()})),this.sub.add(this.results$.subscribe(e=>e.filter(n=>Object.values(this.searchBoxService.index).includes(n.index)).forEach(n=>{let i=n.hits.map(Ie=>Ie.objectID);if(i.length===0)return;let _={[this.searchBoxService.index.products]:"Viewed products",[this.searchBoxService.index.brands]:"Viewed brands",[this.searchBoxService.index.articles]:"Viewed articles"}[n.index]||"View objects";this.searchInsightService.viewedObjectIDs({eventName:_,index:n.index,queryID:n.queryID,objectIDs:i})})))}ngOnDestroy(){this.sub.unsubscribe()}search(e){if(!e||e.length<Je)return this.closeDropdown();this.searchBoxService.search(e),this.results$.pipe(V()).subscribe(()=>this.openDropdown())}clear(){this.searchBoxService.clear(),this.closeDropdown()}onFocus(e){let n=e.target.value;this.search(n)}onEnter(e){this.closeDropdown();let n=e.length?{query:e}:{};this.routerService.go("/produkter",{queryParams:n})}seeResultsClick(){this.query$.pipe(V()).subscribe(e=>this.onEnter(e))}openDropdown(){this.dropdownOpened$.next(!0),this.applyBodyClass(),!this.hasAppliedEventListeners&&this.windowRef.isBrowser()&&(this.hasAppliedEventListeners=!0,this.searchFocusEventHandler=this.searchFocusEventHandler.bind(this),this.searchEscapeHandler=this.searchEscapeHandler.bind(this),this.windowRef.document.addEventListener("focusin",this.searchFocusEventHandler),this.searchBox()?.nativeElement?.addEventListener("keydown",this.searchEscapeHandler),this.dropdown()?.nativeElement?.addEventListener("keydown",this.searchEscapeHandler))}closeDropdown(){this.dropdownOpened$.next(!1),this.applyBodyClass(!1),this.windowRef.isBrowser()&&(this.hasAppliedEventListeners=!1,this.windowRef.document.removeEventListener("focusin",this.searchFocusEventHandler),this.searchBox()?.nativeElement?.removeEventListener("keydown",this.searchEscapeHandler),this.dropdown()?.nativeElement?.removeEventListener("keydown",this.searchEscapeHandler))}applyBodyClass(e=!0){this.windowRef.isBrowser()&&(e?this.windowRef.document.body.classList.add("search-box-opened"):this.windowRef.document.body.classList.remove("search-box-opened"))}searchEscapeHandler(e){e.key==="Escape"&&(e.stopPropagation(),this.getFocusableSearchElements()[0].focus(),this.closeDropdown())}searchFocusEventHandler(e){this.windowRef.isBrowser()&&(this.dropdown()?.nativeElement?.contains(e.target)||this.searchBox()?.nativeElement?.contains(e.target)||e.target.localName!=="header"&&this.closeDropdown())}getFocusableSearchElements(){let e=this.searchBox()?.nativeElement?.querySelectorAll("a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled])"),n=this.dropdown()?.nativeElement?.querySelectorAll("a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled])");return[...e,...n].filter(i=>i.tabIndex>=0)}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=M({type:t,selectors:[["trn-cms-search-box"]],viewQuery:function(n,i){n&1&&ie(i.searchBox,Le,5,N)(i.dropdown,ke,5),n&2&&oe(2)},decls:4,vars:5,consts:[["searchBox",""],["dropdown",""],[3,"cxComponentWrapper"],[3,"onChange","onClear","onF
1ocus","onSubmit","barcode","placeholder"],[1,"search-dropdown"],["tabindex","-1",1,"search-results"],[3,"cxOutlet","cxOutletContext"],[1,"no-results"],[1,"all-results-button"],["icon","search_off",1,"icon"],["aria-live","assertive","role","alert",1,"heading"],["aria-live","assertive","role","alert",1,"sr-only"],[1,"list-header"],[1,"list"],[1,"list-item"],[3,"size","appearance","url","fill","label","queryParams","color","icon","iconPlacement"],[3,"product","isSearchBox","index","position","queryID","searchQuery"],[1,"sr-only"],[3,"size","appearance","url","color","iconPlacement","icon","label","fill"],[1,"for-search-dropdown",3,"brand","borderless","index","position","queryID"],[1,"list","articles"],["type","compact","linkLabelSize","small",3,"article","displayCategory","search","index","position","queryID"],[3,"onClick","fill","label","color","icon","iconPlacement","size"]],template:function(n,i){n&1&&(ne(0,2),f(1,qe,1,0,"trn-algolia-search-box"),o(2,"async"),te(3,Ye,15,19)),n&2&&(u("cxComponentWrapper",ae(4,Ae)),r(),g(a(2,2,i.withOutDropdown$)?1:3))},dependencies:[xe,F,me,q,Me,Ee,Te,$e,fe,Ce,ve,ge,A,H],styles:["[_nghost-%COMP%]{display:block}@media all and (min-width:992px){[_nghost-%COMP%]{position:relative}}.search-results[_ngcontent-%COMP%]{display:grid;grid-gap:32px;grid-template-columns:1fr;padding:24px 16px;overflow-x:hidden;flex:1}@media all and (min-width:992px){.search-results[_ngcontent-%COMP%]{padding:24px;max-height:calc(100vh - 208px);overflow-y:auto}}.search-results[_ngcontent-%COMP%]:empty{padding:0}.list-header[_ngcontent-%COMP%]{font-family:Ubuntu,sans-serif;font-weight:400;-webkit-font-smoothing:antialiased;font-size:16px;line-height:20px;letter-spacing:normal;padding-top:2px;padding-bottom:2px}@media all and (min-width:576px){.list-header[_ngcontent-%COMP%]{font-size:18px;line-height:24px;letter-spacing:normal;padding-top:0;padding-bottom:0}}@media all and (min-width:992px){.list-header[_ngcontent-%COMP%]{font-size:22px;line-height:28px;letter-spacing:normal;padding-top:2px;padding-bottom:2px}}.list-header[_ngcontent-%COMP%]{margin-bottom:8px}.list[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,1fr);grid-gap:8px;margin-bottom:8px}@media all and (min-width:992px){.list[_ngcontent-%COMP%]{grid-template-columns:repeat(3,1fr);grid-gap:16px;margin-bottom:24px}}.list.articles[_ngcontent-%COMP%]{grid-template-columns:1fr}@media all and (min-width:992px){.list.articles[_ngcontent-%COMP%]{grid-template-columns:repeat(2,1fr)}}.no-results[_ngcontent-%COMP%]{text-align:center}.no-results[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{height:32px;width:auto;font-size:32px}.no-results[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%] img{height:32px;width:auto}.no-results[_ngcontent-%COMP%] .icon[_ngcontent-%COMP%]{color:#0000008c}.no-results[_ngcontent-%COMP%] .heading[_ngcontent-%COMP%]{font-family:Ubuntu,sans-serif;font-weight:400;-webkit-font-smoothing:antialiased;font-size:18px;line-height:24px;letter-spacing:normal;padding-top:0;padding-bottom:0}@media all and (min-width:576px){.no-results[_ngcontent-%COMP%] .heading[_ngcontent-%COMP%]{font-size:24px;line-height:32px;letter-spacing:normal;padding-top:0;padding-bottom:0}}@media all and (min-width:992px){.no-results[_ngcontent-%COMP%] .heading[_ngcontent-%COMP%]{font-size:28px;line-height:34px;letter-spacing:normal;padding-top:3px;padding-bottom:3px}}.all-results-button[_ngcontent-%COMP%]{border-top:1px solid rgba(0,0,0,.1);padding:15px 24px 16px;background-color:#fff}@media all and (max-width:991px){.all-results-button[_ngcontent-%COMP%]{padding:11px 16px 12px}}.search-dropdown[_ngcontent-%COMP%]{width:100%;position:absolute;left:0;background:#fff;overflow:hidden;display:flex;flex-direction:column}.search-dropdown.hidden[_ngcontent-%COMP%]{display:none}@media all and (min-width:992px){.search-dropdown[_ngcontent-%COMP%]{box-shadow:0 35px 90px #0000001f}.search-dropdown[_ngcontent-%COMP%]{margin-top:4px;border-radius:12px;border:1px solid #e7e5e5;min-width:440px;left:50%;transform:translate(-50%)}}@media all and (max-width:991px){.search-dropdown[_ngcontent-%COMP%]{top:64px;
1height:calc(100vh - 117px);border-top:1px solid rgba(0,0,0,.1)}}"]})}return t})();var Tt=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=Z({type:t});static \u0275inj=X({providers:[le({cmsComponents:{SearchBoxComponent:{component:Oe}}})]})}return t})();export{Tt as TrnSearchBoxModule};
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.