1var ie=Object.defineProperty;var H=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,ae=Object.prototype.propertyIsEnumerable;var P=(n,e,t)=>e in n?ie(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,f=(n,e)=>{for(var t in e||(e={}))oe.call(e,t)&&P(n,t,e[t]);if(H)for(var t of H(e))ae.call(e,t)&&P(n,t,e[t]);return n};var k=(n,e,t)=>new Promise((s,r)=>{var o=u=>{try{c(t.next(u))}catch(l){r(l)}},i=u=>{try{c(t.throw(u))}catch(l){r(l)}},c=u=>u.done?s(u.value):Promise.resolve(u.value).then(o,i);c((t=t.apply(n,e)).next())});import{ae as ce,i as U,S as F,dd as le,x as V,by as j,R,de as _,df as K,dg as he}from"./index-8d7a54b5.js";import{g as W}from"./generateListRealEstateRoute-0b97b270.js";var y={};(function(n){(function(e,t){t(n)})(ce,function(e){function t(a){if(Array.isArray(a)){for(var h=0,E=Array(a.length);h<a.length;h++)E[h]=a[h];return E}return Array.from(a)}Object.defineProperty(e,"__esModule",{value:!0});var s=!1;if(typeof window!="undefined"){var r={get passive(){s=!0}};window.addEventListener("testPassive",null,r),window.removeEventListener("testPassive",null,r)}function o(a){return l.some(function(h){return!(!h.options.allowTouchMove||!h.options.allowTouchMove(a))})}function i(a){var h=a||window.event;return!!o(h.target)||1<h.touches.length||(h.preventDefault&&h.preventDefault(),!1)}function c(){setTimeout(function(){S!==void 0&&(document.body.style.paddingRight=S,S=void 0),v!==void 0&&(document.body.style.overflow=v,v=void 0)})}var u=typeof window!="undefined"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&1<window.navigator.maxTouchPoints),l=[],g=!1,A=-1,v=void 0,S=void 0;e.disableBodyScroll=function(a,h){if(u){if(!a)return void console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");if(a&&!l.some(function(d){return d.targetElement===a})){var E={targetElement:a,options:h||{}};l=[].concat(t(l),[E]),a.ontouchstart=function(d){d.targetTouches.length===1&&(A=d.targetTouches[0].clientY)},a.ontouchmove=function(d){var p,b,L,T;d.targetTouches.length===1&&(b=a,T=(p=d).targetTouches[0].clientY-A,o(p.target)||(b&&b.scrollTop===0&&0<T||(L=b)&&L.scrollHeight-L.scrollTop<=L.clientHeight&&T<0?i(p):p.stopPropagation()))},g||(document.addEventListener("touchmove",i,s?{passive:!1}:void 0),g=!0)}}else{x=h,setTimeout(function(){if(S===void 0){var d=!!x&&x.reserveScrollBarGap===!0,p=window.innerWidth-document.documentElement.clientWidth;d&&0<p&&(S=document.body.style.paddingRight,document.body.style.paddingRight=p+"px")}v===void 0&&(v=document.body.style.overflow,document.body.style.overflow="hidden")});var re={targetElement:a,options:h||{}};l=[].concat(t(l),[re])}var x},e.clearAllBodyScrollLocks=function(){u?(l.forEach(function(a){a.targetElement.ontouchstart=null,a.targetElement.ontouchmove=null}),g&&(document.removeEventListener("touchmove",i,s?{passive:!1}:void 0),g=!1),l=[],A=-1):(c(),l=[])},e.enableBodyScroll=function(a){if(u){if(!a)return void console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");a.ontouchstart=null,a.ontouchmove=null,l=l.filter(function(h){return h.targetElement!==a}),g&&l.length===0&&(document.removeEventListener("touchmove",i,s?{passive:!1}:void 0),g=!1)}else(l=l.filter(function(h){return h.targetElement!==a})).length||c()}})})(y);function ue(n,e){return typeof n=="string"&&typeof e=="string"&&n.trim().length!==0&&e.trim().length!==0}function de(n,e){if(!ue(n,e))return e;const t=q(n,e);if(e!==t||n.indexOf(" ")===-1)return t;for(const s of n.split(" "))/[/<>]/.test(s)||(e=q(s,e));return e}function q(n,e){try{const t=new RegExp(`(${n})`,"i");return e.replace(t,"<strong>$1</strong>")}catch(t){return e}}class pe{constructor(e,t,s){this.inputElement=null;const r={minimumInputLength:1,delay:0};this.opts=f(f({},r),s),this.inputElement=e,this.inputElement.addEventListener("keyup",this.keyupListener.bind(this)),this.inputElement.addEventListener("keydown",this.keydownListener.bind(this)),this.inputElement.addEventListener("blur",this.lostFocusListener.bind(this)),this.inputElement.addEventListener("focus",this.recievedFocusListener.bind(this)),this.hub=t}getInputValue(){return this.inputElement.value}publishEvent(e,t,s){this.hub!==void 0&&this.hub.publish(e,t,s)}hasReachedMinimumInputLength(){return this.getInputValue().length>=this.opts.minimumInputLength}lostFocusListener(){this.publishEvent("input-tracker.focus.out")}recievedFocusListener(){this.publishEvent("input-tracker.focus.in")}keydownListener(e){const t=e.keyCode||e.which;switch(this.publishEvent("input-tracker.keydown",t),t){case 38:this.publishEvent("input-tracker.keydown.upArrow",this.getInputValue()),e.preventDefault();break;case 40:this.publishEvent("input-tracker.keydown.downArrow",this.getInputValue()),e.preventDefault();break;case 13:this.publishEvent("input-tracker.keydown.enter",this.getInputValue()),e.preventDefault();break;case 27:this.publishEvent("input-tracker.keydown.escape",this.getInputValue()),e.preventDefault();break}}keyupListener(e){const t=e.keyCode||e.which;switch(this.publishEvent("input-tracker.keyup",t),t){case 38:this.publishEvent("input-tracker.key.upArrow",this.getInputValue());break;case 40:this.publishEvent("input-tracker.key.downArrow",this.getInputValue());break;case 13:this.publishEvent("input-tracker.key.enter",this.getInputValue());break;case 27:this.publishEvent("input-tracker.key.escape",this.getInputValue());break;default:if(this.hasReachedMinimumInputLength()){const s=this;setTimeout(()=>{s.publishEvent("input-tracker.minimumLengthReached",s.getInputValue())},s.opts.delay)}break}}}const ge={clearInputOnSubmit:!0,forceHideWhenNoMatches:!1,scrollToOnXsFocus:null,hideDropdownOnBlur:!1,appendDropdownTo:null};class fe extends pe{constructor(e,t,s){super(e,t,f(f({},ge),s)),this.dropdown=null,this.dropdownCursor=0,this.sectionCursor=0,this.sections=[],this.dropdown=this.createDropdownElement(),this.opts.appendDropdownTo&&this.opts.appendDropdownTo instanceof Element?this.opts.appendDropdownTo.appendChild(this.dropdown):this.inputElement.after(this.dropdown)}setupSubscribers(){const e=this;
1document.body.addEventListener("click",s=>{const r=s.target;!r.classList.contains("autocomplete-dropdown")&&!r.classList.contains("autocomplete-section")&&!r.classList.contains("autocomplete-item")&&r!==e.inputElement&&e.hideDropdown()}),this.dropdown.addEventListener("mousedown",s=>{s.preventDefault()}),this.subscribeEvent("input-tracker.minimumLengthReached",s=>{e.publishEvent("autocomplete.needUpdate",s)}),this.subscribeEvent("input-tracker.keyup",()=>{e.getInputValue().length===0&&e.hideDropdown()}),this.subscribeEvent("input-tracker.key.enter",()=>{e.hideDropdown(),e.publishSubmitEvent()}),this.subscribeEvent("input-tracker.key.escape",()=>{e.hideDropdown()}),this.subscribeEvent("input-tracker.keydown.upArrow",()=>{this.decrementDropdownCursor(),this.refreshDropdownCursor(),this.scrollDropdown()}),this.subscribeEvent("input-tracker.keydown.downArrow",()=>{this.sectionCursor===this.sections.length-1&&this.dropdownCursor===this.sections[this.sectionCursor].items.length-1||(this.incrementDropdownCursor(),this.refreshDropdownCursor(),this.scrollDropdown())});let t=!1;this.subscribeEvent("input-tracker.focus.in",()=>{U()&&(e.opts.scrollToOnXsFocus!==null&&!t&&!e.inputElement.textContent&&(e.opts.scrollToOnXsFocus.scrollIntoView(),t=!0),e.hasReachedMinimumInputLength()&&e.showDropdown())}),this.subscribeEvent("input-tracker.focus.out",()=>{e.opts.hideDropdownOnBlur&&e.hideDropdown()})}setSections(e){this.sections=e,this.populateDropdown(),this.dropdownCursor=0,this.sectionCursor=0,this.refreshDropdownCursor()}listIsEmpty(){return!this.sections||this.sections.length===0}createDropdownElement(){const e=document.createElement("ul");return e.setAttribute("hidden","hidden"),e.classList.add("autocomplete-dropdown"),e}incrementDropdownCursor(){if(this.sections.length!==0){if(this.dropdownCursor+1===this.sections[this.sectionCursor].items.length){this.incrementSectionCursor(),this.dropdownCursor=0;return}this.dropdownCursor++}}decrementDropdownCursor(){if(this.sections.length!==0){if(this.dropdownCursor===0){if(this.sectionCursor===0)return;this.decrementSectionCursor(),this.dropdownCursor=this.sections[this.sectionCursor].items.length-1;return}this.dropdownCursor--}}incrementSectionCursor(){this.sectionCursor+1!==this.sections.length&&this.sectionCursor++}decrementSectionCursor(){this.sectionCursor!==0&&this.sectionCursor--}scrollDropdown(){var e;(e=this.getActiveItemElement())==null||e.scrollIntoView({block:"nearest"})}setActiveItemElement(e){this.dropdown.querySelectorAll("li.active").forEach(t=>t.classList.remove("active")),e==null||e.classList.add("active")}getActiveItemElement(){return this.dropdown.querySelector("li.active")}refreshDropdownCursor(){const e=this.dropdown.querySelector(`.autocomplete-section[data-index="${this.sectionCursor}"]`),[t]=me(e).slice(this.dropdownCursor,this.dropdownCursor+1);this.setActiveItemElement(t)}publishSubmitEvent(){const e=this.getActiveItemElement();!e&&!this.opts.hideDropdownOnBlur||(this.publishEvent("autocomplete.submit",e),this.opts.clearInputOnSubmit&&(this.inputElement.value=""),this.setSections([]),this.inputElement.focus(),this.hideDropdown())}subscribeEvent(e,t){this.hub!==void 0&&this.hub.subscribe(e,t)}showDropdown(){this.opts.forceHideWhenNoMatches&&this.sections.length===0||(this.dropdown.removeAttribute("hidden"),this.dropdown.classList.add("autocomplete-open"),this.inputElement.classList.add("autocomplete-open"),this.publishEvent("autocomplete.show"))}hideDropdown(){this.dropdown.setAttribute("hidden","hidden"),this.dropdown.classList.remove("autocomplete-open"),this.inputElement.classList.remove("autocomplete-open"),this.publishEvent("autocomplete.hide")}populateDropdown(){const e=this,t=this.sections;if(!t||!this.hasReachedMinimumInputLength()){this.hideDropdown();return}for(;this.dropdown.firstChild;)this.dropdown.removeChild(this.dropdown.firstChild);for(const[s,r]of t.entries()){const o=document.createElement("li");o.classList.add("autocomplete-section"),o.dataset.index=String(s),o.innerHTML=r.title,e.dropdown.append(o);for(const i of r.items){const c=document.createElement("li");c.classList.add("autocomplete-item"),c.innerHTML=e.highlightMatches(i.title),c.addEventListener("click",this.publishSubmitEvent.bind(this)),c.addEventListener("mouseover",()=>{this.setActiveItemElement(c)});for(const[u,l]of Object.entries(i.attributes))typeof l=="object"?c.setAttribute(u,JSON.stringify(l)):c.setAttribute(u,l);e.dropdown.append(c)}}if(t.length===0)if(this.opts.forceHideWhenNoMatches)this.hideDropdown();else{const s=document.createElement("standard");s.classList.add("standard"),s.classList.add("autocomplete-item-not-found"),s.textContent="Inga träffar",e.dropdown.append(s)}this.showDropdown()}highlightMatches(e){const t=this.inputElement.value;return de(t,e)}}function me(n){if(!n)return[];const e=[];let t=n;for(;t.nextElementSibling;)e.push(t.nextElementSibling),t=t.nextElementSibling;return e}function ve(n){return Object.prototype.toString.call(n)==="[object Object]"}function Se(n){return Object.prototype.toString.call(n)==="[object Array]"}function we(n,e){if(ve(n))for(const t in n)n.hasOwnProperty(t)&&e.call(e,n[t],t,n);else for(let t=0,s=n.length;t<s;t++)e.call(e,n[t],t,n)}class ye{constructor(e){this.name=e,this.topics={}}publish(e,t,s){let r=[t],o;if(s!==void 0&&(r=[].concat(r,s)),!this.topics[e])return!1;for(let c=0,u=this.topics[e].length;c<u;c++)o=this.topics[e][c].callback,o.apply(o,r);const i=this.topics.__all__||[];for(let c=0,u=i.length;c<u;c++)o=i[c].callback,o.apply(o,r)}subscribe(e,t){this.topics[e]||(this.topics[e]=[]),this.topics[e].push({callback:t})}installTo(e){Se(e)||(e=[e]),we(e,function(t){t.hasOwnProperty("hub")&&console.warn("[Hub.installTo] Overriding module.hub property."),t.hub=this}.bind(this))}}function je(n){return"property"in n}function qe(n){return"index"in n}function J(n,e){return n.type===e.type&&String(n.id)===String(e.id)&&n.index===e.index}function Ue(n,e){if(n.duplicable==="0"){if(n.property===e.property)return!0}else if(n.id){if(n.property===e.property&&n.value===e.value&&n.id===e.id)return!0}else if(n.property===e.property&&n.value===e.value)return!0;return!1}function Ee(n,e){if(e===null||n===null||e.indexed.length!==n.indexed.length)return!1;for(const t of n.indexed){let s=!1;for(const r of e.indexed)if(J(t,r)){s=!0;continue}if(!s)return!1}return!0}function I(){try{if(typeof window.localStorage=="undefined")return!1;const n="test";return window.localStorage.setItem(n,n),window.localStorage.removeItem(n),!0}catch(n){return!1}}
1class be extends Error{constructor(){super("Localstorage api is not available.")}}function Le(n,e){return!e||typeof e!="object"||e.hasOwnProperty("id")&&n.setId(e.id),n}const $=class D{constructor(){if(!I())throw new be}getAll(){const e=window.localStorage.getItem(this.getStorageKey());if(e===null)return[];const t=this.parseJsonToArray(e);return this.parseObjectsToClassInstances(t)}insert(e){let t=this.getAll();e.getId()===void 0&&e.setId(t.length),t.push(e),t.length>D.MAX_STORED_ITEM_SIZE&&(t=t.slice(t.length-D.MAX_STORED_ITEM_SIZE,t.length)),this.insertItemsIntoStorage(t)}update(e){const t=this.getAll();for(const[s,r]of t.entries())if(e.getId()===r.getId()){t[s]=e,this.insertItemsIntoStorage(t);return}this.insert(e)}insertItemsIntoStorage(e){const t=JSON.stringify(e);window.localStorage.setItem(this.getStorageKey(),t)}getAsObject(e){const t=this.mapObject(e);return Le(t,e)}parseObjectsToClassInstances(e){const t=[];for(const s of e){const r=this.getAsObject(s);t.push(r)}return t}parseJsonToArray(e){let t;try{t=JSON.parse(e)}catch(s){return[]}return Array.isArray(t)?t:[]}};$.MAX_STORED_ITEM_SIZE=100;let Ie=$;class X{constructor(e,t=new Date){this.filter=e,this.date=t}getId(){return this.id}setId(e){return this.id=e,this}setFilter(e){return this.filter=e,this}getFilter(){return this.filter}setDate(e){return this.date=e,this}getDate(){return this.date}}function Ce(n){return Ae(n)?new X(n.filter,"date"in n?new Date(n.date):null):null}const Ae=n=>n&&typeof n=="object"&&n.hasOwnProperty("filter")&&xe(n.filter),xe=n=>n?n.hasOwnProperty("indexed")&&n.hasOwnProperty("static"):!1,z=class G extends Ie{constructor(){super(...arguments),this.mapObject=e=>Ce(e)}getStorageKey(){return G.storageKey}syncFilterSetToRecentSearches(e){if(e.indexed.length===0&&e.static.length===0)return;const t=this.getAll();for(const s of t)if(this.shouldUpdateRecentSearch(s,e)){s.setFilter(e),this.update(s);return}this.insert(new X(e))}getMostRecent(){const e=this.getAll();return e.length===0?null:e[e.length-1]}shouldUpdateRecentSearch(e,t){const r=e.getFilter(),o=new Date;return Ee(r,t)&&o.getTime()-e.getDate().getTime()<864e5}};z.storageKey="recent-searches";let Te=z;class ke{constructor(e,t){this.recentSearchStorageRepository=null,this.onBlurListeners=[],this.onShowListeners=[],this.onHideListeners=[],this.container=e,this.recentSearchRenderer=t,this.searchField=this.container.querySelector("input.search-field"),this.suggestionsContainer=this.container.querySelector(".js-suggestions-container");const s=this.container.querySelector(".js-autocomplete-dropdown-container");if(!s)throw new Error("Could not find dropdown container");this.autocompleteDropdownContainer=s;try{this.recentSearchStorageRepository=new Te}catch(r){this.recentSearchStorageRepository=null}}render(){this.attachFocusBlurListeners(),this.setUpAutocomplete(),this.renderRecentSearches()}show(){this.container.classList.add("active"),this.shouldShowSuggestions()&&this.showSuggestions(),this.searchField.focus(),U()&&(y.disableBodyScroll(this.autocompleteDropdownContainer),this.autocompleteDropdownContainer.addEventListener("touchmove",this.onAutocompleteResultsScrollListener.bind(this))),this.onShowListeners.forEach(e=>e())}hide(){this.container.classList.contains("active")&&(this.container.classList.remove("active"),this.hideSuggestions(),y.clearAllBodyScrollLocks(),this.autocompleteDropdownContainer.removeEventListener("touchmove",this.onAutocompleteResultsScrollListener),this.onHideListeners.forEach(e=>e()))}addBlurListener(e){this.onBlurListeners.push(e)}addShowListener(e){this.onShowListeners.push(e)}addHideListener(e){this.onHideListeners.push(e)}renderRecentSearches(){if(this.recentSearchStorageRepository){const e=this.recentSearchStorageRepository.getAll();this.recentSearchRenderer.render(e)}}isShown(){return this.container.classList.contains("active")}resetSearchBar(){this.container.classList.remove("has-query"),this.searchField.focus()}shouldShowSuggestions(){return!0}clearAutocompleteSuggestions(){this.autocomplete.setSections([])}updateAutocomplete(e){this.autocomplete.getInputValue()===e.query&&this.autocomplete.setSections(e.results)}showSuggestions(){this.suggestionsContainer.classList.add("open"),this.container.classList.add("has-attachments")}hideSuggestions(){this.suggestionsContainer.classList.remove("open"),this.container.classList.remove("has-attachments")}onAutocompleteResultsScrollListener(){this.searchField.blur()}attachFocusBlurListeners(){this.searchField.addEventListener("focus",()=>this.show()),this.searchField.addEventListener("blur",()=>
1{this.onBlurListeners.forEach(t=>t())}),this.container.addEventListener("mousedown",t=>{(t.target instanceof HTMLButtonElement||t.target instanceof HTMLAnchorElement||t.target instanceof HTMLElement&&t.target.parentNode instanceof HTMLButtonElement||t.target instanceof HTMLElement&&t.target.parentNode instanceof HTMLAnchorElement)&&t.preventDefault()}),this.container.querySelectorAll(".js-hide-search-bar-trigger").forEach(t=>{t.addEventListener("click",s=>{s.preventDefault(),this.hide()})})}setUpAutocomplete(){const e={appendDropdownTo:this.autocompleteDropdownContainer},t=new ye("autocomplete");this.autocomplete=new fe(this.searchField,t,e),this.autocomplete.setupSubscribers(),t.subscribe("autocomplete.needUpdate",r=>k(this,null,function*(){const o=yield this.loadAutocompleteResults(r);this.updateAutocomplete(o)})),t.subscribe("autocomplete.submit",this.onAutocompleteSubmit.bind(this)),t.subscribe("autocomplete.show",()=>{this.hideSuggestions(),this.container.classList.add("has-attachments")}),t.subscribe("autocomplete.hide",()=>{this.isSuggestionsContainerVisible()||this.container.classList.remove("has-attachments")}),this.searchField.addEventListener("keyup",()=>{this.searchField.value.length===0?this.container.classList.remove("has-query"):this.container.classList.add("has-query")}),Array.from(this.container.querySelectorAll('input[type="reset"]')).forEach(r=>{r.addEventListener("click",()=>this.resetSearchBar())})}isSuggestionsContainerVisible(){return this.suggestionsContainer.offsetParent!==null}}class N extends Error{constructor(){super(),Object.setPrototypeOf(this,N.prototype)}}const B=class m{constructor(){this.restoreLastUsedIndex()}setIndexByValue(e){if(le(e)){this.setIndex(e);return}throw new N}getIndex(){return m.activeSearchIndex}getListObjectRouteGenerator(){return this.getIndex()===F.RealEstate?W:V}setIndex(e){m.activeSearchIndex=e,I()&&window.localStorage.setItem(m.lastUsedIndexLocalStorageKey,e)}restoreLastUsedIndex(){let e=null;const t=document.getElementById("filters-container");if(t!==null&&typeof t.dataset.index=="string"){this.setIndex(j(t.dataset.index));return}if(I()&&(e=window.localStorage.getItem(m.lastUsedIndexLocalStorageKey)),!e){this.setIndex(m.defaultIndex);return}this.setIndex(j(e))}};B.lastUsedIndexLocalStorageKey="start-active-search-tab";B.defaultIndex=F.Premises;let Y=B;function Re(n,e={}){if(n.length===0||Object.keys(n).length===0)return e;Array.isArray(n)||(n=[n]);const t=[],s=[],r={},o=f({},e);for(const i of n)if(i.filter==="indexed")i.type==="type"?t.push(i.slug):i.index==="geo"&&s.push(i.slug);else if(i.duplicable==="0")r[i.property]=i.value;else{const c=i.value;i.id?(r[i.property]||(r[i.property]={}),r[i.property][i.id]=c):(r[i.property]||(r[i.property]=[]),r[i.property].push(c))}return t.length>0&&(o.typeSlugs=t.join()),s.length>0&&(o.geoSlugs=s.join()),Object.keys(r).length>0&&(o.f=r),o}function De(n,e){const t=Re(n),s=e(t.typeSlugs,t.geoSlugs);return decodeURI(R.generate(s,t))}var Oe=(n=>(n.Premises="premises",n.Type="type",n))(Oe||{}),Fe=(n=>(n.Country="country",n.Province="province",n.County="county",n.Municipality="municipality",n.City="city",n.Region="region",n))(Fe||{}),Z=(n=>(n.Premises="premises",n.RealEstate="real_estate",n.Geo="geo",n))(Z||{});const Q=class O extends Error{constructor(){super(O.message),Object.setPrototypeOf(this,O.prototype)}};Q.message="Cannot create component using falsy container.";let _e=Q;class ee{constructor(e){if(!e)throw new _e;this.container=e}render(e){for(;this.container.firstChild!==null;)this.container.firstChild.remove();if(e.length===0)return;const t=this.getAllGeoIndexedFilters(e);this.appendFilters(t),this.container.classList.remove("hidden")}getAllGeoIndexedFilters(e){const t=this.extractIndexedFiltersOrderedFromRecentSearches(e);return this.filterIndexedFilters(t).slice(0,this.getMaxRenderedRecentSearches())}extractIndexedFiltersOrderedFromRecentSearches(e){return e.map(t=>t.getFilter().indexed).reverse().reduce((t,s)=>[...t,...s.reverse()],[])}filterIndexedFilters(e){return e.filter(t=>t.index===Z.Geo).reduce((t,s)=>{for(const r of t)if(J(r,s))return t;return t.push(s),t},[])}appendFilters(e){e.map((t,s)=>
1this.filterToElement(t,s)).forEach(t=>this.container.appendChild(t))}}ee.RECENT_SEARCH_CLASS="recent-search";class M extends ee{constructor(e,t){super(t),this.getMaxRenderedRecentSearches=()=>4,this.router=e,this.activeSearchIndexStorage=new Y}filterToElement(e){const t=document.createElement("a"),s=e.text;t.textContent=s.trim(),t.classList.add(M.RECENT_SEARCH_CLASS);let r=V;this.activeSearchIndexStorage.getIndex()===F.RealEstate&&(r=W);const o=this.router.generate(r(null,e.index),{geoSlugs:e.slug});return t.href=o,t.addEventListener("click",()=>window.location.href=o),t}}const te=class ne extends ke{constructor(e){const t=document.getElementById("recent-searches"),s=new M(R,t);super(e,s),this.activeSearchIndexStorage=new Y}render(){super.render(),this.attachChangeIndexListeners(),this.displayTextsForIndex()}initialize(e,t){this.render(),e.querySelectorAll(".js-open-search-bar-trigger").forEach(r=>{r.addEventListener("click",o=>{o.preventDefault(),this.show()})}),this.addBlurListener(()=>{t()||this.hide()})}onAutocompleteSubmit(e){if(!e)return;const t=this.getFilterData(e);window.location.href=De(t,this.activeSearchIndexStorage.getListObjectRouteGenerator())}loadAutocompleteResults(e){return k(this,null,function*(){const t=R.generate("search_query",{query:e,index:this.activeSearchIndexStorage.getIndex()});return fetch(t).then(s=>s.json())})}getFilterData(e){return e.dataset.filter==="indexed"||e.dataset.filter==="static"?e.dataset:JSON.parse(e.dataset.filter)}displayTextsForIndex(){const e=this.activeSearchIndexStorage.getIndex();this.container.querySelectorAll("span[data-applies-to-index], section[data-applies-to-index]").forEach(s=>s.classList.add("hidden")),this.container.querySelectorAll(`span[data-applies-to-index="${e}"], section[data-applies-to-index="${e}"]`).forEach(s=>s.classList.remove("hidden")),this.container.querySelectorAll(".recent-search").length>=ne.HIDE_POPULAR_CITIES_AT_RECENT_SEARCH_COUNT&&this.container.querySelectorAll(".popular-cities").forEach(s=>s.classList.add("hidden"));const t=`${e}IndexPlaceholder`.replace("_","");t in this.searchField.dataset&&(this.searchField.placeholder=this.searchField.dataset[t])}attachChangeIndexListeners(){this.container.querySelectorAll(".search-index-switcher a").forEach(e=>{e.addEventListener("click",t=>{const s=t.target;if(!(s instanceof HTMLElement)||!("targetIndex"in s.dataset))return!0;t.preventDefault(),this.activeSearchIndexStorage.setIndexByValue(s.dataset.targetIndex),this.displayTextsForIndex(),this.renderRecentSearches()})})}};te.HIDE_POPULAR_CITIES_AT_RECENT_SEARCH_COUNT=2;let Ve=te;const Ne=1300,Be=()=>C()<_,Ke=()=>{const n=C();return _<=n&&K>n},We=()=>{const n=C();return _<=n&&he>n},Je=()=>C()>K;function C(){return typeof window=="undefined"?Ne:window.innerWidth}const se=class w{constructor(e){this.navigationContainer=e,this.navbarToggleElement=this.navigationContainer.querySelector(".js-navbar-toggle")}initialize(){this.setUpNavbarToggle(),this.attachPrimaryNavigationListeners(),this.addClearSearchFilterTriggerListener()}isCollapsed(){return window.getComputedStyle(this.navbarToggleElement).display!=="none"}attachPrimaryNavigationListeners(){Array.from(this.navigationContainer.querySelectorAll(".navbar-primary li a span")).forEach(t=>t.addEventListener("click",this.onPrimaryNavigationClick.bind(this)))}onPrimaryNavigationClick(e){if(!Be()||!this.isCollapsed())return;const t=e.target.parentElement;if(!(t instanceof HTMLAnchorElement)||!("targetBundle"in t.dataset))return;e.preventDefault();const s=Array.from(this.navigationContainer.querySelectorAll("nav.navbar-secondary section")),r=t.dataset.targetBundle;s.forEach(i=>this.replaceActiveSection(i,r));const o=t.parentNode;o instanceof HTMLElement&&(this.navigationContainer.querySelectorAll(".navbar-primary ul > li.open").forEach(i=>i.classList.remove(w.OPEN_SECTION_CLASS)),o.classList.add(w.OPEN_SECTION_CLASS))}replaceActiveSection(e,t){const s=e.querySelector(".bundle-link-group.open");if(s.dataset.bundle===t)return;const r=e.querySelector(`.bundle-link-group[data-bundle="${t}"]`),o=this.calculateHiddenSectionHeight(r),i=e.style.transition;e.style.transition="",requestAnimationFrame(()=>{e.style.height=e.clientHeight+"px",e.style.transition=i,s.classList.remove(w.OPEN_SECTION_CLASS),r.classList.add(w.OPEN_SECTION_CLASS),requestAnimationFrame(()=>{e.style.height=o+"px",e.addEventListener("transitionend",()=>{e.style.removeProperty("height")})})})}calculateHiddenSectionHeight(e){e.classList.add("allow-js-size-calculation");const t=e.clientHeight;return e.classList.remove("allow-js-size-calculation"),t}setUpNavbarToggle(){this.navbarToggleElement.addEventListener("click",()=>{this.navbarToggleElement.classList.toggle("is-active"),this.navigationContainer.classList.toggle("collapsed"),this.navigationContainer.classList.contains("collapsed")?y.disableBodyScroll(this.navigationContainer):y.enableBodyScroll(this.navigationContainer)})}
1addClearSearchFilterTriggerListener(){if(!I())return;const e=Array.from(this.navigationContainer.querySelectorAll(".navbar-header .logotype, li.js-clear-filters a"));for(const t of e)t.addEventListener("click",()=>{window.localStorage.removeItem("filter.indexed"),window.localStorage.removeItem("filter.static"),window.localStorage.removeItem("real_estate-filter.indexed"),window.localStorage.removeItem("real_estate-filter.static")})}};se.OPEN_SECTION_CLASS="open";let $e=se;export{ye as H,_e as I,Ve as N,$e as S,Z as a,Fe as b,je as c,J as d,Oe as e,Be as f,We as g,Ke as h,qe as i,y as j,ue as k,I as l,Je as m,ve as n,Ue as s};
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.