import{u as ge,O as Ne,N as Se,aV as Pe,L as Te,H as E,Q as xe,M as He,Y as Re,aZ as ze,ak as ye,a_ as Oe,a7 as Ve,a$ as je,b0 as Ge,n as he,R as Qe,a8 as De,t as We,q as pe,v as ce,a3 as Ue,b1 as Ze,z as ie,ai as Je,B as Ye,p as Be}from"./C-p8iwFB.js";import{d as Xe,g as Ke,f as et}from"./BS7h1Lqf.js";import{u as we,s as be}from"./DkctvIZ5.js";import{A as tt}from"./0q1_Mwst.js";import"./BosuxZz1.js";import"./CeX-HMq3.js";import"./ha1fAqgW.js";const lt=`
`,ot=`
`,nt=`
`,it=`
`,rt=' ',st=B=>{const h="form",v="q",d="search-ui",w="lb-search-element",_="luigi-box-mobile-filters-show-filter-btn",S="luigi-box-search-title",a="luigi-box-search-subtitle",u="luigi-box-search-input",x="luigi-box-search-submit-btn",q="luigi-box-filters-count",I="luigi-box-filters-clear-all",L="luigi-box-mobile-filters-close-btn",C="luigi-box-mobile-filters-show-results-btn",c={formId:h,searchInputName:v,searchElementId:d,lbSearchElement:w,luigiBoxMobileFilterShowFilterBtnId:_,luigiBoxSearchTitleId:S,luigiBoxSearchSubtitleId:a,luigiBoxSearchInputId:u,luigiBoxSearchSubmitBtnId:x,luigiBoxFiltersCountId:q,luigiBoxFiltersClearAllId:I,luigiBoxMobileFilterCloseBtnId:L,luigiBoxMobileFilterShowResultsBtnId:C,luigiBoxResultsPaginationInfoId:"luigi-box-results-pagination-info"},V=`#${c.formId}`,p=`[name="${c.searchInputName}"]`,b=`#${c.searchElementId}`,k=`#${c.lbSearchElement}`,Y=`#${c.luigiBoxSearchTitleId}`,X=`#${c.luigiBoxSearchSubtitleId}`,K=`#${c.luigiBoxSearchInputId}`,ee=`#${c.luigiBoxSearchSubmitBtnId}`,te=`#${c.luigiBoxFiltersCountId}`,le=`#${c.luigiBoxFiltersClearAllId}`,oe=`#${c.luigiBoxMobileFilterCloseBtnId}`,j=`#${c.luigiBoxMobileFilterShowResultsBtnId}`,G=`#${c.luigiBoxMobileFilterShowFilterBtnId}`,Q=`#${c.luigiBoxResultsPaginationInfoId}`,P={formSelector:V,searchInputSelector:p,searchElementSelector:b,lbSearchElementSelector:k,luigiBoxSearchTitleSelector:Y,luigiBoxSearchSubtitleSelector:X,luigiBoxSearchInputSelector:K,luigiBoxSearchSubmitBtnSelector:ee,luigiBoxFiltersCountSelector:te,luigiBoxFiltersClearAllSelector:le,luigiBoxMobileFilterCloseBtnSelector:oe,luigiBoxMobileFilterShowResultsBtnSelector:j,luigiBoxMobileFilterShowFilterBtnSelector:G,luigiBoxResultsPaginationInfoSelector:Q},{locale:T,t:s}=ge(),f=Ne(),ne=Se().$pages,D=f(Pe(ne.customerService),T.value),F={templateSearch:"template-search",templateFacets:"template-facets",templateFacetMultichoice:"template-facet-multichoice",templateLoading:"template-loading",templateNoResults:"template-no-results",templateResultDefault:"template-result-default",templateResults:"template-results"},ae={[Te.EN]:{activeFilters:{cancelAllFilters:s("customerServiceSearch.clearFilters")},pagination:{nextPage:s("customerServiceSearch.paginationShowMore")},topItems:{results:{title:s("customerServiceSearch.frequentlySearchedTitle")}}}},M=(de,me)=>{const W=document.createElement("script");W.type="text/x-template",W.id=de,W.innerHTML=me,document.body.appendChild(W)};return{defineCustomTemplates:()=>{M(F.templateSearch,`
${nt}
${s("customerServiceSearch.mobileShowResultsBtn")}
`),M(F.templateFacets,' '),M(F.templateFacetMultichoice,`
${s("customerServiceSearch.filterTitle")}
${s("customerServiceSearch.filterEmptyText")}
`),M(F.templateLoading,`
`),M(F.templateNoResults,`
${rt}
${s("customerServiceSearch.noResultsTip1")}
${s("customerServiceSearch.noResultsTip2")}
${s("customerServiceSearch.noResultsTip3")}
`),M(F.templateResultDefault,`
{
const id = url
const element = document.getElementById(url)
if (element.classList.contains('active')) {
element.classList.remove('active')
} else {
const results = document.querySelectorAll('.lb-result-default')
results.forEach((r) => r.classList.remove('active'))
element.classList.add('active')
}
}">
{{ attributes.title }}
${it}
{{attributes.answer}}
`),M(F.templateResults,`
`)},defineTranslations:ae,elementIds:c,elementSelectors:P,templateIds:F}},ct=B=>{const{luigiBoxSearchInputSelector:h,luigiBoxSearchSubmitBtnSelector:v,luigiBoxMobileFilterCloseBtnSelector:d,luigiBoxMobileFilterShowResultsBtnSelector:w,luigiBoxMobileFilterShowFilterBtnSelector:_}=B,S=E(null),a=E(null),u=E(null),x=()=>{const p=document.querySelector(h),b=document.querySelector(v);!p||!b||(S.value&&p.removeEventListener("input",S.value),a.value&&p.removeEventListener("keyup",a.value),u.value&&b.removeEventListener("click",u.value))},q=E(null),I=E(null),L=()=>{const p=document.querySelector(d),b=document.querySelector(w);q.value&&p&&p.removeEventListener("click",q.value),I.value&&b&&b.removeEventListener("click",I.value)},C=E(null),O=()=>{const p=document.querySelector(".luigi-box-results");if(!p)return;const b=p.querySelector(".luigi-box-mobile-active-filters");if(!b)return;const k=b.querySelector(_);k&&C.value&&k.removeEventListener("click",C.value)};return{handlers:{enterHandler:a,inputHandler:S,submitBtnHandler:u,closeBtnHandler:q,showResultsBtnHandler:I,openFilterBtnHandler:C},removeListeners:()=>{x(),L(),O()}}},at=`
`,ut=(B,h,v)=>{const{t:d,locale:w,availableLocales:_}=ge(),S=Se(),a=xe(),u=He(),x=Re(),q=x.public.i18n.defaultLocale,I=we(),L=E(null),{luigiBoxMobileFilterShowFilterBtnId:C,luigiBoxResultsPaginationInfoId:O}=h,{luigiBoxSearchTitleSelector:c,luigiBoxSearchSubtitleSelector:V,searchInputSelector:p,luigiBoxSearchInputSelector:b,luigiBoxSearchSubmitBtnSelector:k,formSelector:Y,luigiBoxFiltersCountSelector:X,luigiBoxFiltersClearAllSelector:K,luigiBoxMobileFilterCloseBtnSelector:ee,luigiBoxMobileFilterShowResultsBtnSelector:te,luigiBoxMobileFilterShowFilterBtnSelector:le,luigiBoxResultsPaginationInfoSelector:oe}=v,{inputHandler:j,enterHandler:G,submitBtnHandler:Q,closeBtnHandler:P,showResultsBtnHandler:T,openFilterBtnHandler:s}=B,f=()=>{var R,U,re,$,Z,J,N,se;const e=document.querySelector(".lb-search__headline");(R=e==null?void 0:e.parentNode)==null||R.removeChild(e);const l=document.querySelector(".lb-pagination_page--button-first");(U=l==null?void 0:l.parentNode)==null||U.removeChild(l);const t=document.querySelector(".lb-pagination_page--button-prev");t&&(t.textContent="");const o=document.querySelector(".lb-pagination_page--button-last");(re=o==null?void 0:o.parentNode)==null||re.removeChild(o);const n=document.querySelector(".lb-pagination_page--button-next");n&&(n.textContent="");const r=document.querySelector(".lb-aside-heading");($=r==null?void 0:r.parentNode)==null||$.removeChild(r);const i=document.querySelector(".lb-aside-heading__hits-count");(Z=i==null?void 0:i.parentNode)==null||Z.removeChild(i),document.querySelectorAll(".lb-facet__title").forEach(z=>{var ve;(ve=z.parentNode)==null||ve.removeChild(z)});const m=document.querySelector(".lb-facet__search");(J=m==null?void 0:m.parentNode)==null||J.removeChild(m);const g=document.querySelector(".luigi-box-mobile-active-filters");if(g){const z=g.querySelector(".lb-facet__header");(N=z==null?void 0:z.parentNode)==null||N.removeChild(z)}const H=document.querySelector(".lb-top-items__title");(se=H==null?void 0:H.parentNode)==null||se.removeChild(H)},A=e=>{const l=document.querySelectorAll(".lb-result-default"),t=document.querySelector(c);t&&(e?t.textContent=l.length?d("customerServiceSearch.headerFoundAnswer"):d("customerServiceSearch.headerNoAnswer"):t.textContent=d("customerServiceSearch.headerDefault"));const o=document.querySelector(V);if(o)if(e){const n=fe();o.style.display="block",o.innerHTML=n&&n.total&&n.total!=="0"?d("customerServiceSearch.subHeaderFoundAnswer",{query:e,results:n.total}):d("customerServiceSearch.subHeaderNoAnswer",{query:e})}else o.style.display="none"},ne=()=>{const e=document.querySelector(p),l=document.querySelector(b),t=document.querySelector(k),o=document.querySelector(Y);!l||!e||!t||(j.value=()=>{e.value=l.value,e.dispatchEvent(new Event("input",{bubbles:!0}))},G.value=n=>{n.key==="Enter"&&(o==null||o.requestSubmit())},Q.value=n=>{n.preventDefault(),o==null||o.requestSubmit()},l.addEventListener("input",j.value),l.addEventListener("keyup",G.value),t.addEventListener("click",Q.value))},D=()=>{const e=document.querySelector(".lb-active-filters");if(!e)return;const l=e.querySelector(".luigi-box-filters");l&&(l.querySelectorAll(".lb-active-filter").forEach(r=>{e.appendChild(r)}),l.remove());const t=e.querySelectorAll(".lb-active-filter");if(t.length===0)return;const o=document.createElement("div");o.className="luigi-box-filters",t.forEach(n=>{o.appendChild(n)}),e.appendChild(o)},F=()=>{const e=document.querySelectorAll(".lb-active-filter");e.length!==0&&e.forEach(l=>{const t=document.createElement("span");l.querySelector("span")||l.appendChild(t)})},ae=()=>{const e=document.querySelector(".luigi-box-active-filters"),l=document.querySelector(X);if(!l||!e)return;const t=e.querySelectorAll(".lb-active-filter").length;t?(l.innerHTML=d("customerServiceSearch.filtersCount",{count:t}),e.style.display="block"):e.style.display="none"},M=()=>{const e=document.querySelector(".lb-facet__header"),l=document.querySelector(K);if(!l)return;const t=document.querySelectorAll(".lb-active-filter"),o=l.querySelector(".lb-facet__cancel");if(t.length===0){o&&o.remove();return}if(!e)return;const n=e.querySelector(".lb-facet__cancel");n&&(o&&o.remove(),l.appendChild(n))},ue=()=>{const e=document.querySelector(".luigi-box-mobile-facets");e&&(e.style.display="none")},de=()=>{const e=document.querySelector(".luigi-box-mobile-facets");e&&(e.style.display="flex")},me=()=>{const e=document.querySelector(ee),l=document.querySelector(te);P.value=()=>ue(),T.value=()=>ue(),e==null||e.addEventListener("click",P.value),l==null||l.addEventListener("click",T.value)},W=()=>{const e=document.querySelector(".luigi-box-results");if(!e)return;const l=e.querySelector(".luigi-box-mobile-active-filters");if(!l)return;const t=l.querySelector(le),o=t||document.createElement("button");o.id=C,o.className="luigi-box-mobile-filters-show-filter-btn",o.innerHTML=`
${at}
${d("customerServiceSearch.filterTitle")}
`,s.value=()=>de(),o.addEventListener("click",s.value),t||l.insertBefore(o,l.firstChild)},fe=()=>{var o;const e=document.querySelector(".lb-pagination__info");if(!e)return null;const l=/(\d+)\s*-\s*(\d+)\s+of\s+(\d+)\s+results/i,t=(o=e.textContent)==null?void 0:o.match(l);if(t){const[,n,r,i]=t;return{from:n,to:r,total:i,info:e}}return null},Ie=()=>{var y;const e=fe();if(!e)return;const{from:l,to:t,total:o,info:n}=e,r=d("customerServiceSearch.paginationResults",{from:l,to:t,total:o}),i=document.querySelector(oe);if(i)i.innerHTML=r,i.style.display=o==="0"?"none":"block";else{const m=document.createElement("div");m.id=O,m.className="luigi-box-results-pagination-info",m.innerHTML=r,m.style.display=o==="0"?"none":"block",(y=n.parentNode)==null||y.insertBefore(m,n.nextSibling)}},Le=e=>{document.title=d(`customerServiceSearch.meta.title${e?"Search":"NoSearch"}`,{query:e})},qe=async()=>{const e=await Xe(S),l=await Ke();if(!e||!l)return{};const t={...e.content,...l};let o=0;return Object.keys(t).forEach(n=>{n==="ownPickupPoint"&&Object.keys(t.ownPickupPoint).forEach(r=>{t[`countryPickupPoint${r}`]=t.ownPickupPoint[r]}),n==="partnerPickupPoint"&&Object.keys(t.partnerPickupPoint).forEach(r=>{const i=t.partnerPickupPoint[r];o+=i?Number.parseInt(i):0,t[`countryPickupPoint${r}`]=i})}),t.partnerPickUpPointsAll=o,delete t.ownPickUpPoints,delete t.partnerPickUpPoints,delete t.component,delete t.howToUse,delete t.ownPickupPoint,delete t.partnerPickupPoint,delete t._editable,delete t._uid,Object.keys(t).forEach(n=>{t[n]=et(`${t[n]}`,w.value)}),{...t}},Ce=()=>{const e=document.querySelectorAll(".lb-result-default-content"),l=L.value||{};e.forEach(t=>{Object.keys(L.value||{}).forEach(o=>{t.innerHTML=t.innerHTML.replaceAll(`_${o}_`,l[o])})})},Fe=async()=>{try{L.value||(L.value=await qe()),Ce()}catch(e){console.log("Error attaching global numbers:",e)}},_e=e=>{const t=new DOMParser().parseFromString(e,"text/html"),o=t.createTreeWalker(t.body,NodeFilter.SHOW_TEXT,null);for(;o.nextNode();){const n=o.currentNode,r=document.createElement("textarea");r.innerHTML=n.nodeValue||"",n.nodeValue=r.value}return t.body.innerHTML},Me=e=>{const l=t=>{const o=i=>{const y=x.public.webId;return Oe(`${i.href}`,x.public,y,w.value,!1)};(t.marks||[]).forEach(i=>{var y,m;i&&i.type==="link"&&((y=i.attrs)!=null&&y.href)&&((m=i.attrs)==null?void 0:m.linktype)==="story"&&(i.attrs.href=o(i.attrs))}),(t.content||[]).forEach(i=>{l(i)})};e.forEach(t=>{l(t)})},Ee=()=>{document.querySelectorAll(".lb-result-default-content").forEach(l=>{const t=l.querySelector(".lb-result-default-content-object");if(!t)return;const o=JSON.parse(t.innerHTML)[0];Me(o.content);const n=ze(o);n&&(l.innerHTML=_e(n||"")),l.querySelectorAll("span").forEach(i=>{i.removeAttribute("style")})})},ke=()=>{const e=a.hash;if(!e)return;const l=document.getElementById(e.replace("#",""));l&&(l.scrollIntoView({behavior:"smooth",block:"start"}),l.classList.add("active"))},Ae=()=>{const e=u.options.history.state.back;if(!e)return;const l=e.split("/").filter(Boolean)[0];let t;if(_.includes(l)?t=l:t=q,t!==w.value)return{query:{q:""}}},$e=async(e=20)=>{var l,t,o;try{if(a.query.q||a.query["lb.f[]"])return Ae();const n=a.hash.split("#");if(n.length<2)return;const r=200,i=n[1].toUpperCase(),y=(l=n[2])==null?void 0:l.toUpperCase(),m={tracker_id:`${ye}-${I.trackerId}`,size:r,"f[]":`faqGroups_id:${i}`,facets:"faqGroup_name,faqGroups_id"},g=await be(m),H=((t=g==null?void 0:g.results)==null?void 0:t.total_hits)??0;if(H===0)return null;let R=g==null?void 0:g.results.hits[0].attributes.faqGroups_id.indexOf(i);R=typeof R!="number"?-1:R;const U=(g==null?void 0:g.results.hits[0].attributes.faqGroup_name[R])||"",re=Math.ceil(H/r);for(let $=1;$<=re;$++){const Z=$===1?g:await be({...m,page:$}),J=((o=Z==null?void 0:Z.results)==null?void 0:o.hits)??[];for(let N=0;N{const e=await $e();e&&await u.replace({...e})},removeInputValueWhenNotSameAsQuery:()=>{const e=document.getElementById(h.luigiBoxSearchInputId),l=document.querySelector(v.searchInputSelector);!e||!l||a.query.q!==(e==null?void 0:e.value)&&(e.value="",l.value="")}}};function dt(){const B=xe(),h=B.query.q,v=E(0),d=E(h),w=we(),{defineCustomTemplates:_,defineTranslations:S,elementIds:a,elementSelectors:u,templateIds:x}=st(h);Ve(()=>B.hash,async()=>{T()});const{handlers:q,removeListeners:I}=ct(u),{removeDefaults:L,addHeadlines:C,addSearchInputActions:O,moveActiveFilters:c,addSpanToActiveFilter:V,updateFiltersCountText:p,moveClearFiltersBtn:b,bindMobileFilterCloseButtons:k,insertMobileFilterOpenButton:Y,localizePaginationInfo:X,changeHeadTitle:K,attachGlobalNumbers:ee,parseRichtextContentInResults:te,centerAndOpenTargetQuestion:le,changeSearchPageWhenOnlyQuestionIdHash:oe,removeInputValueWhenNotSameAsQuery:j}=ut(q,a,u),G=s=>{if(typeof window.Luigis<"u"){s();return}const f=document.createElement("script");f.src=Ge,f.async=!0,f.onload=()=>{_(),s()},f.onerror=()=>{console.error("Failed to load Luigi's Box script")},document.head.appendChild(f)},Q=()=>{const s={TrackerId:`${ye}-${w.trackerId}`,Locale:"en",Theme:"boo",Size:20,Facets:["faqGroup_name"],Sorts:[],DefaultFilters:{type:"item"},QuicksearchTypes:[],UrlParamName:{QUERY:"q"},Translations:{...S},OnDone:f=>{I(),L(),C(f),O(),c(),V(),p(),b(),k(),Y(),X(),K(f),te(),ee(),le(),j()}};window.Luigis.Search(s,u.searchInputSelector,u.searchElementSelector)},P=()=>{const s=document.querySelector(u.lbSearchElementSelector);s&&(s.id=a.searchElementId,s.innerHTML="");const f=document.querySelector(u.searchElementSelector);f&&(f.innerHTML=""),Object.values(x).forEach(ne=>{const D=document.getElementById(ne);D&&D.remove()});const A=document.querySelector(`script[src*="${je}"]`);A!=null&&A.parentNode&&A.parentNode.removeChild(A),"Luigis"in window&&delete window.Luigis},T=()=>{P(),oe().then(()=>{G(()=>{Q()})})};return{elementOpts:{formId:a.formId,searchInputName:a.searchInputName,searchElementId:a.searchElementId},searchComponentKey:v,searchQuery:d,destroyLuigi:P,removeListeners:I,handleDestroyAndReinitLuigisSearch:T}}const mt=["id"],ht=["name"],pt=["id"],ft={class:"container my-160 d-flex justify-content-center"},vt=he({__name:"LuigiBoxSearch",setup(B){const{elementOpts:h,searchQuery:v,searchComponentKey:d,destroyLuigi:w,removeListeners:_,handleDestroyAndReinitLuigisSearch:S}=dt();return Qe(()=>{S()}),De(()=>{w(),_()}),(a,u)=>(pe(),We("div",{key:ie(d),class:"luigi-box-search container pt-64"},[ce("form",{id:ie(h).formId,class:"d-none"},[Ue(ce("input",{"onUpdate:modelValue":u[0]||(u[0]=x=>Je(v)?v.value=x:null),name:ie(h).searchInputName,type:"search",tabindex:"-1"},null,8,ht),[[Ze,ie(v)]])],8,mt),ce("div",{id:ie(h).searchElementId},[ce("div",ft,[Ye(tt,{"on-page":""})])],8,pt)]))}}),bt=he({__name:"search",setup(B){return(h,v)=>(pe(),Be(vt))}}),gt=he({__name:"search",setup(B){return(h,v)=>(pe(),Be(bt))}}),Ft=gt;export{Ft as default};
//# sourceMappingURL=C8eriImU.js.map