PageSourceSearch

https://www.granngarden.se/dist/Component.ProductList.a88bfbf7.js

js granngarden.se collected 2026-09-24 18:17:51 UTC 17,422 bytes, 1 lines download raw bytes

1"use strict";(self.fkaWebpackJsonp=self.fkaWebpackJsonp||[]).push([[8063],{9371:(e,t,a)=>{a.r(t),a.d(t,{default:()=>be});var r=a(641),s=a(33),l=a(3751);const i={class:"product-list"},n={class:"product-list__wrapper"},o={class:"product-list__heading-tags"},c={key:0,class:"product-list__last-visited tags tags--latest"},u=["href"],d={key:1,class:"product-list__text-image"},g={key:0,class:"product-list__text-wrapper"},p=["innerHTML"],v=["src"],y={class:"product-list__inner-wrapper"},h={key:0,class:"product-list__date"},_={class:"product-list__published"},f={key:0,class:"product-list__modified"},k={class:"product-list__published-by"},C={class:"product-list__published-by-short"},m=["aria-expanded"],b=["aria-label"],x={key:0,class:"product-list__links"},E=["href"],R=["href"],T={key:2,class:"product-list__facets"},L={class:"product-list__sort-wrapper"},X={class:"sr-only",for:"product-list-sort"},w=["value"],M={class:"product-list__items-count","aria-live":"assertive","aria-atomic":"true"},F={key:3,class:"product-list__empty"},S={class:"h3"},K={key:4,class:"product-list__products"},H={key:1,class:"product-list__article-teaser"},Q=["href","aria-label"],A=["alt","src"],I={class:"article-teaser__content"},W={key:0,class:"article-teaser__types"},P={class:"article-teaser__heading h2"},B=["href"],j={class:"product-list__load-more"},O={class:"search-results__page"},U=["alt"];var $=a(6663),D=a(5094),V=a(7985),N=a(4324),G=a(463),z=a(5052),Y=a(7258),q=a(1724);const J={class:"product-list__categories"},Z={class:"product-list__category-title"},ee=["href"],te=["innerHTML"];const ae={class:"product-list__categories-item"},re={class:"product-list__category-wrapper"},se=["href"],le={key:0},ie=["aria-controls","aria-expanded"],ne={class:"sr-only"},oe=["aria-hidden","id"];const ce=(0,r.pM)({name:"ProductListCategory",mixins:[(0,N.m)()],components:{Icon:z.A},props:{active:String,category:Object},data(){return{isMounted:!1,isExpanded:this.category?.selected}},computed:{hasActiveChild(){const e=[],t=this.category?.subCategories||[];for(const a of t)a.selected&&e.push(a.id);return e.length>0}},mounted(){this.$nextTick((()=>{this.isMounted=!0}))}});var ue=a(6262);const de=(0,ue.A)(ce,[["render",function(e,t,a,i,n,o){const c=(0,r.g2)("icon"),u=(0,r.g2)("product-list-category",!0);return(0,r.uX)(),(0,r.CE)("div",ae,[(0,r.Lk)("div",re,[e.category&&e.category.url?((0,r.uX)(),(0,r.CE)("a",{key:0,href:e.category.url,class:(0,s.C4)(["product-list__category link",{"has-active":e.active?e.active===e.category.id:e.category.selected,"has-active--child":e.hasActiveChild}])},[(0,r.eW)((0,s.v_)(e.category.name)+" ",1),"number"==typeof e.category.count?((0,r.uX)(),(0,r.CE)("span",le,"("+(0,s.v_)(e.category.count)+")",1)):(0,r.Q3)("",!0)],10,se)):(0,r.Q3)("",!0),e.category&&e.category.subCategories&&e.category.subCategories.length&&e.isMounted?((0,r.uX)(),(0,r.CE)("button",{key:1,class:"product-list__expand-category",onClick:t[0]||(t[0]=(0,l.D$)((t=>e.isExpanded=!e.isExpanded),["prevent"])),type:"button","data-aria-ignore":"","aria-controls":e.category.id,"aria-expanded":e.isExpanded?"true":"false"},[(0,r.Lk)("span",ne,(0,s.v_)(e.translate(e.isExpanded?"collapse":"expand")),1),(0,r.bF)(c,{class:(0,s.C4)([{"is-open":e.isExpanded},"product-list__expand-category-icon"]),icon:"caret-up",height:"18px",width:"18px"},null,8,["class"])],8,ie)):(0,r.Q3)("",!0)]),e.category&&e.category.subCategories&&e.category.subCategories.length?(0,r.bo)(((0,r.uX)(),(0,r.CE)("ul",{key:0,"aria-hidden":!e.isExpanded,id:e.category.id,class:"product-list__subcategories"},[((0,r.uX)(!0),(0,r.CE)(r.FK,null,(0,r.pI)(e.category.subCategories,(t=>((0,r.uX)(),(0,r.Wv)(u,{category:t,lang:e.lang,active:e.active,key:t.id},null,8,["category","lang","active"])))),128))],8,oe)),[[l.aG,!e.isMounted||e.isExpanded]]):(0,r.Q3)("",!0)])}]]),ge=(0,r.pM)({name:"ProductListCategoryTree",mixins:[(0,N.m)()],emits:["maincategory"],components:{ProductListCategory:de},props:{category:String||Object,categoryTree:Object,filterHeading:String},data:()=>({isMounted:!1}),methods:{setFilterHeading(){return this.filterHeading??"kategori"}}
1,mounted(){this.$nextTick((()=>{this.isMounted=!0}))}}),pe=(0,ue.A)(ge,[["render",function(e,t,a,l,i,n){const o=(0,r.g2)("product-list-category");return(0,r.uX)(),(0,r.CE)("ul",J,[(0,r.Lk)("li",Z,[(0,r.Lk)("a",{href:e.categoryTree?.url||"?",class:(0,s.C4)(["product-list__category link",{"has-active":""===e.category||e.category===e.categoryTree?.id}])},[(0,r.Lk)("p",{innerHTML:e.translateFormat([`<i>${e.setFilterHeading()}</i>`],"showAllIn")},null,8,te)],10,ee)]),((0,r.uX)(!0),(0,r.CE)(r.FK,null,(0,r.pI)(e.categoryTree?.subCategories||[],(t=>((0,r.uX)(),(0,r.CE)("li",{class:"product-list__categorytree",key:t.id},[(0,r.bF)(o,{category:t,lang:e.lang,active:e.category},null,8,["category","lang","active"])])))),128))])}]]);var ve=a(1626),ye=a(9901),he=a(8857),_e=a(953),fe=a(2124),ke=a(6327);const Ce=(0,r.pM)({mixins:[(0,N.m)()],name:"ProductList",components:{Alert:Y.default,Facets:G.A,Icon:z.A,ProductCard:q.default,ProductListCategoryTree:pe},props:{apiUrl:String,initialResponse:Object,heading:String,filterHeading:String,text:String,image:String,lastVisited:Array,links:Array,sort:Array,hideFilterHeading:Boolean,updateHistory:{type:Boolean,default:!0},toggle:Boolean,hideHeading:Boolean,created:String,changed:String,banner:{type:Object,default:{showCampaign:!1,campaignLink:null,campaignColor:null,campaignText:null}},articleTeaser:{type:Object,default:{text:null,link:null,image:"",alt:"",label:"",tags:null}}},setup(e){const t=(e,t)=>t?.link?.length&&e?.length,a=(e,a,r)=>{if(!t(e,a))return e;let s=Math.max(Math.min(e.length,r),0);const l={isTeaser:!0,link:a.link,name:a.text,image:a.image,bannerMessageText:a.alt,mainIntro:a.label,colorGroups:a.tags};return[...e.slice(0,s),l,...e.slice(s)]},s=(0,fe.Pj)(),l=(0,_e.KR)(!1),i=(0,_e.KR)(!1),n=(0,r.rk)("textRef"),o=(0,r.rk)("loadMoreRef"),c=(0,_e.KR)(""),u=(0,_e.KR)(e.sort?.find((e=>e.isDefault))?.id??e.initialResponse?.selectedSort),d=(0,_e.KR)(null),g=(0,_e.KR)(!1),p=(0,_e.KR)(a(e.initialResponse?.products,e.articleTeaser,4)),v=(0,_e.KR)(e.initialResponse?.facets),y=(0,_e.KR)(e.initialResponse?.productCount),h=(0,_e.KR)(e.initialResponse?.page??1),_=(0,_e.KR)(e.initialResponse?.pages??1),f=(0,_e.KR)(e.initialResponse?.category??""),k=(0,_e.KR)(e.initialResponse?.categoryTree),C=(0,_e.KR)("undefined"!=typeof AbortController?new AbortController:null),m=(0,_e.KR)(null),b=(0,_e.KR)(!1),x=(0,_e.KR)([]),E=(0,_e.KR)(!0),R=(0,r.EW)((()=>{let t="editorial-color-picker";return e.banner?.campaignColor&&e.banner?.campaignColor.length&&(t+=" editorial-color-picker--"+e.banner?.campaignColor),t})),T=(0,r.EW)((()=>!!e.sort?.find((e=>e.id!==u.value))?.isDefault)),L=(0,r.EW)((()=>{const e=n.value;return!!l.value&&(e?.childElementCount??0)>2})),X=(0,r.EW)((()=>{if(g.value)return!1;let a=p.value?.length??0;return t(e.initialResponse?.products,e.articleTeaser)&&(a-=1),(y.value??0)>a&&h.value<_.value})),w=(0,r.EW)((()=>e.filterHeading||e.initialResponse?.categoryTree?.name||e.heading||"")),M=(0,r.EW)((()=>e.text&&e.text.split("&nbsp;").join(" ").trim())),F=(0,r.EW)((()=>e.sort?.find((e=>!0===e.isDefault))?.id)),S=(0,r.EW)((()=>{if(e.initialResponse?.brandUrl)return e.initialResponse.brandUrl.replace(/\//g," > ");if(!k.value)return;const t=e=>{let a=e.selected?e:null;return e.subCategories?.forEach((e=>{const r=t(e);r&&(a=r)})),a},a=t(k.value);return a?.id})),K=(0,r.EW)((()=>!g.value&&0===(y.value??0)));(0,r.wB)([c,u,f],(()=>{W()})),(0,r.wB)((()=>X.value),(()=>{A()}));const H=()=>{const e=n.value;(e?.childElementCount??0)<2&&(i.value=!0)},Q=e=>{c.value=e},A=async()=>{!E.value||!X.value||h.value>=3||(await(0,r.dY)(),o.value&&d.value?.observe(o.value))},I=()=>{W(h.value+1)},W=async t=>{if(e.apiUrl){g.value=!0;try{const r=$.parseUrl(e.apiUrl);let l=0;p.value&&(l=p.value.length);const i={...r.query};let n=new Array;const o=(e,t=null)=>{e?.forEach((e=>{e.selected?(n.push(e.id),t&&(n=n.filter((e=>e!==t.id))),e.subCategories&&e.subCategories.length>0&&o(e.subCategories,e)):e.subCategories&&e.subCategories.length>0&&o(e.subCategories,null)}))};o(k.value?.subCategories??[]);const d=window.location.href.split("?")[0];t&&t>1&&(i.p=t),c.value&&(i.f=c.value),u.value!==F.value&&(i.s=u.value);const f=""===$.stringify(i)?`${r.url}`:`${r.url}?${$.stringify(i)}`;C.value=new AbortController;const b=await V.A.get(f,{signal:C.value?.signal}),x=await b.json();if(t&&!x.products.length)return y.value=p.value?.length??0,g.value=!1,void(C.value=null);t?p.value=(p.value??[]).concat(x.products):(p.value=a(x.products,e.articleTeaser,4),v.value=x.facets,y.value=x.productC
1ount,""===c.value&&e.initialResponse?.categoryTree&&void 0===x.categoryTree&&(k.value=e.initialResponse?.categoryTree)),s&&(0,ye.aK)(s,{listName:w.value||e.heading||"",products:x.products,indexOffset:Math.max(0,l)}),h.value=x.page,(0,ke.V)({products:x.products,offset:t?Math.max(0,l):0,filter:c.value||"",orderBy:u.value||"",pageCategories:[S.value||"unknow_category"],attributionToken:x.attributionToken||e.initialResponse?.attributionToken||""}),"number"==typeof x.pages&&(_.value=x.pages),m.value=null,e.updateHistory?window.history?.replaceState({},"",""===$.stringify(i)?d:d+"?"+$.stringify(i)):window.location.hash=$.stringify(i)}catch(e){E.value=!1,m.value={message:"Ett feil oppstod ved henting av ny side, vennligst prøv igjen",type:"scroll"},D.z(e)}C.value=null,g.value=!1}else D.z("ApiUrl property is missing")};return(0,r.sV)((async()=>{l.value=!0,e.toggle&&(b.value=!0),c.value=(0,he.gR)(v.value),u.value=e.initialResponse?.selectedSort??F.value,await(0,r.dY)(),H(),"IntersectionObserver"in window&&(d.value||(d.value=new IntersectionObserver((e=>{for(let t=0;t<e.length;t++){const a=e[t];a.intersectionRatio>0&&(d.value?.unobserve(a.target),I())}}),{rootMargin:"200px 0px",threshold:.01})),A()),!p.value||c.value||T.value||((0,ye.aK)(s,{listName:w.value||e.heading||"",products:p.value.filter((e=>!e.isTeaser))}),await(0,r.dY)(),(0,ke.V)({products:p.value,filter:c.value||"",orderBy:u.value||"",pageCategories:[S.value||"unknow_category"],offset:0,attributionToken:e.initialResponse?.attributionToken||""}))})),(0,r.hi)((()=>{d.value?.disconnect(),d.value=null})),{expanded:i,activeFacets:c,activeSort:u,observer:d,fetching:g,products:p,facets:v,page:h,pages:_,category:f,categoryTree:k,abortController:C,error:m,isToggled:b,checkedFacets:x,hasSortChanged:T,expandable:L,showLoadMore:X,filterHeading:w,filteredText:M,initialSort:F,handleResetSort:()=>{u.value=e.sort?.find((e=>e.isDefault))?.id},updateSort:e=>{u.value=e},handleResetFilter:()=>{if(!v.value)return;const e=v.value.map((e=>(e.values=e.values.map((e=>({...e,selected:!1}))),e)));Q((0,he.gR)(e))},viewName:e=>ve.S[e],expandTextIfLessThanTwoElements:H,handleFacetsChange:Q,loadMore:I,mainCategoryClickHandler:e=>{k.value?.url||(e.preventDefault(),f.value="")}
1,productCount:y,currentPageCategory:S,isEmpty:K,campaignBannerColor:R}}}),me=(0,ue.A)(Ce,[["render",function(e,t,a,$,D,V){const N=(0,r.g2)("icon"),G=(0,r.g2)("product-list-category-tree"),z=(0,r.g2)("facets"),Y=(0,r.g2)("alert"),q=(0,r.g2)("product-card");return(0,r.uX)(),(0,r.CE)("section",i,[(0,r.Lk)("div",n,[(0,r.Lk)("div",o,[(0,r.Lk)("h1",{class:(0,s.C4)(["product-list__heading",{"sr-only":e.hideHeading}]),"data-epi-edit":"Heading"},(0,s.v_)(e.heading),3),e.lastVisited&&e.lastVisited.length?((0,r.uX)(),(0,r.CE)("nav",c,[((0,r.uX)(!0),(0,r.CE)(r.FK,null,(0,r.pI)(e.lastVisited,(e=>((0,r.uX)(),(0,r.CE)("a",{key:e.link,href:e.link},(0,s.v_)(e.link),9,u)))),128))])):(0,r.Q3)("",!0),e.filteredText||e.image?((0,r.uX)(),(0,r.CE)("div",d,[e.filteredText?((0,r.uX)(),(0,r.CE)("div",g,[""!==e.filteredText?((0,r.uX)(),(0,r.CE)("div",{key:0,id:"read-more",class:(0,s.C4)(["product-list__text editorial",{expanded:e.expanded}]),"data-epi-edit":"text",innerHTML:e.filteredText,ref:"textRef"},null,10,p)):(0,r.Q3)("",!0),e.image?((0,r.uX)(),(0,r.CE)("img",{key:1,class:(0,s.C4)(["product-list__image",{"has-text":!!e.filteredText,"product-list__image--expanded":e.expanded}]),src:e.image,alt:""},null,10,v)):(0,r.Q3)("",!0),(0,r.Lk)("div",y,[e.created?((0,r.uX)(),(0,r.CE)("div",h,[(0,r.Lk)("p",_,[(0,r.eW)((0,s.v_)(e.translate("datePublished")),1),(0,r.Lk)("time",null,(0,s.v_)(e.created),1)]),e.changed?((0,r.uX)(),(0,r.CE)("p",f,[(0,r.eW)((0,s.v_)(e.translate("dateModified")),1),(0,r.Lk)("time",null,(0,s.v_)(e.changed),1)])):(0,r.Q3)("",!0),(0,r.Lk)("span",k,(0,s.v_)(e.translate("publishedBy")),1),(0,r.Lk)("span",C,(0,s.v_)(e.translate("publishedByShort")),1)])):(0,r.Q3)("",!0),e.expandable?((0,r.uX)(),(0,r.CE)("button",{key:1,class:"product-list__read-more",onClick:t[0]||(t[0]=(0,l.D$)((t=>e.expanded=!e.expanded),["prevent"])),"aria-expanded":e.expanded,"aria-controls":"read-more",type:"button"},[(0,r.Lk)("span",null,(0,s.v_)(e.translate(e.expanded?"close":"readMore")),1),(0,r.bF)(N,{icon:"chevron-down",height:"16",width:"16"})],8,m)):(0,r.Q3)("",!0)])])):(0,r.Q3)("",!0)])):(0,r.Q3)("",!0)]),e.categoryTree&&e.categoryTree.subCategories&&e.categoryTree.subCategories.length>0?((0,r.uX)(),(0,r.CE)("nav",{key:0,"aria-label":e.translate("categories"),id:"navigation-categories",class:"product-list__category-section"},[e.links&&e.links.length>0?((0,r.uX)(),(0,r.CE)("ul",x,[((0,r.uX)(!0),(0,r.CE)(r.FK,null,(0,r.pI)(e.links,(e=>((0,r.uX)(),(0,r.CE)("li",{key:e.link,class:"product-list__link"},[(0,r.Lk)("a",{href:e.link,class:(0,s.C4)(["product-list__link-button",{"is-active":e.selected}])},(0,s.v_)(e.title),11,E)])))),128))])):(0,r.Q3)("",!0),(0,r.bF)(G,{categoryTree:e.categoryTree,category:e.category,links:e.links,onMaincategory:e.mainCategoryClickHandler,lang:e.lang,filterHeading:e.filterHeading},null,8,["categoryTree","category","links","onMaincategory","lang","filterHeading"])],8,b)):(0,r.Q3)("",!0),e.banner?.showCampaign&&e.banner?.campaignLink?((0,r.uX)(),(0,r.CE)("a",{key:1,href:e.banner?.campaignLink,class:(0,s.C4)(["product-list__campaign-banner","button--arrow-right",e.campaignBannerColor])},(0,s.v_)(e.banner.campaignText),11,R)):(0,r.Q3)("",!0),e.facets&&e.facets.length?((0,r.uX)(),(0,r.CE)("div",T,[(0,r.bF)(z,{sort:e.sort,itemsLabel:e.productCount+" "+e.translate("products")?.toLowerCase(),facets:e.facets,lang:e.translate("facets"),onChange:e.handleFacetsChange,heading:e.heading,onActiveSort:e.updateSort,onHandleResetFilter:e.handleResetFilter,onResetSort:e.handleResetSort,"has-sort-changed":e.hasSortChanged,"active-sort":e.initialResponse?.selectedSort??e.initialSort,"active-sort-text":e.sort?.find((t=>t.id===e.activeSort))?.text},null,8,["sort","itemsLabel","facets","lang","onChange","heading","onActiveSort","onHandleResetFilter","onResetSort","has-sort-changed","active-sort","active-sort-text"]),(0,r.Lk)("div",L,[e.sort&&e.sort.length?((0,r.uX)(),(0,r.CE)("div",{key:0,class:(0,s.C4)(["sort",{"product-list__sort--visible":e.isToggled}])},[(0,r.Lk)("label",X,(0,s.v_)(e.translate("sort")),1),(0,r.bo)((0,r.Lk)("select",{name:"sort","onUpdate:modelValue":t[1]||(t[1]=t=>e.activeSort=t),id:"product-list-sort"},[((0,r.uX)(!0),(0,r.CE)(r.FK,null,(0,r.pI)(e.sort,(e=>((0,r.uX)(),(0,r.CE)("option",{key:e.id,value:e.id},(0,s.v_)(e.text),9,w)))),128))],512),[[l.u1,e.activeSort]]),(0,r.bF)(N,{icon:"sort"}
1)],2)):(0,r.Q3)("",!0),(0,r.Lk)("span",M,(0,s.v_)(e.productCount+" "+e.translate("products")?.toLowerCase()),1)])])):(0,r.Q3)("",!0),e.isEmpty?((0,r.uX)(),(0,r.CE)("div",F,[(0,r.Lk)("h2",S,[(0,r.bF)(Y,{type:2,message:e.translate("noProductsFound")},{default:(0,r.k6)((()=>[(0,r.eW)((0,s.v_)(e.translate("noProductsFound")),1)])),_:1},8,["message"])])])):(0,r.Q3)("",!0),e.products?((0,r.uX)(),(0,r.CE)("ul",K,[((0,r.uX)(!0),(0,r.CE)(r.FK,null,(0,r.pI)(e.products,((t,a)=>((0,r.uX)(),(0,r.CE)("li",{key:t.productNumber},[t.isTeaser?(0,r.Q3)("",!0):((0,r.uX)(),(0,r.Wv)(q,(0,r.v6)({key:0,hasFetchedPriority:a<2,lang:e.translate("productCard"),"heading-level":"h2",listName:e.filterHeading,listIndex:a,ref_for:!0},t),null,16,["hasFetchedPriority","lang","listName","listIndex"])),t.isTeaser?((0,r.uX)(),(0,r.CE)("article",H,[(0,r.Lk)("a",{class:"article-teaser__image",href:t.link,"aria-label":t.mainIntro},[(0,r.Lk)("picture",null,[(0,r.Lk)("img",{alt:t.bannerMessageText,class:"ls-is-cached lazyloaded",loading:"lazy",src:t.image},null,8,A)])],8,Q),(0,r.Lk)("article",I,[t.colorGroups&&t.colorGroups.length>0?((0,r.uX)(),(0,r.CE)("div",W,[((0,r.uX)(!0),(0,r.CE)(r.FK,null,(0,r.pI)(t.colorGroups,(e=>((0,r.uX)(),(0,r.CE)("span",{class:"tags tags--square",key:e},(0,s.v_)(e),1)))),128))])):(0,r.Q3)("",!0),(0,r.Lk)("h3",P,[(0,r.Lk)("a",{class:"link",href:t.link},(0,s.v_)(t.name),9,B)])])])):(0,r.Q3)("",!0)])))),128))])):(0,r.Q3)("",!0),(0,r.Lk)("div",j,[e.error&&"scroll"===e.error.type?((0,r.uX)(),(0,r.Wv)(Y,{key:0,class:"product-list__alert",message:e.error.message},null,8,["message"])):(0,r.Q3)("",!0),(0,r.Lk)("p",O,(0,s.v_)(e.translateFormat([e.page,e.pages],"showingPageXofY")),1),e.showLoadMore?((0,r.uX)(),(0,r.CE)("button",{key:1,class:"button button--secondary button--small",onClick:t[2]||(t[2]=(0,l.D$)(((...t)=>e.loadMore&&e.loadMore(...t)),["prevent"])),type:"button",ref:"loadMoreRef"},(0,s.v_)(e.translate("getMoreProducts")),513)):(0,r.Q3)("",!0),e.fetching?((0,r.uX)(),(0,r.CE)("img",{key:2,height:"30",width:"120px",class:"product-list__loading",src:"/UI/Icons/loading.svg",alt:e.translate("fetchingMoreProducts")},null,8,U)):(0,r.Q3)("",!0)])])])}]]),be=me}}]);

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.