{"version":3,"sources":["components/autocomplete/autocompleteComponent.js","components/autocomplete/observer/searchFieldObservable.js","components/autocomplete/searchAutocompleteComponent.js","components/search-forms/searchFormComponent.js","pwa/component/loadCss.js","nhs/views/luxuryhomes/Show.js","../../../../../../../../../../module-insertRequire.js"],"names":["define","AutocompleteComponent","context","observable","engine","suggestionsComponent","this","_observable","_searchField","field","_engine","_suggestionsComponent","_context","suggestions","Object","defineProperty","get","getSelectedSuggestion","bind","add","_initEvents","prototype","_clickHandler","event","target","contains","close","document","body","addEventListener","passive","update","callback","value","getSuggestions","displaySuggestions","Function","clear","length","highlight","includeHighlightInSuggestion","RegExp","trim","index","htmlElement","parentElement","appendChild","open","selectSuggestion","hideSuggestions","name","SearchFieldObservable","inputElement","_observers","_debounceTimer","_lastValue","_initDomEvents","_fieldChangeHandler","key","code","toLowerCase","indexOf","notify","clearTimeout","setTimeout","observer","push","forEach","o","SearchAutocompleteComponent","call","querySelector","dependeciesRequested","includeCurrentLocation","hasAttribute","includeCurrentLocationIcon","_currentLocationSuggestion","onSelect","create","constructor","_loadDependencies","require","SuggestionsEngineConfig","SearchSuggestionsEngine","SearchSuggestionsComponent","SearchSuggestion","id","cssClass","dataAttributes","icon","_onSelect","removeCurrentLocation","currentLocationOption","remove","unshift","setAttribute","initAll","searchAutocompleteComponents","querySelectorAll","i","searchAutocompleteComponent","SearchFormComponent","settings","form","HTMLFormElement","TypeError","autocomplete","searchTextField","pageToHitFields","latitudeField","longitudeField","locationTypeField","itemIdField","marketIdField","submitButton","validationError","useAutocompleteForSubmit","shouldAlwaysSubmitForm","useBaseUrl","undefined","disabled","_formSubmitHandler","_setDataUserText","suggestionsContainer","relatedTarget","wrapper","closest","hasValue","classList","_getPageToHit","checked","_setPageToHitState","state","_redirectToCurrentLocationSearch","deviceHeight","window","innerHeight","deviceWidth","innerWidth","tilesAcrossWidth","maxLongitude","minLongitude","aspectRatio","maxLatitude","minLatitude","location","href","_setUpForLocationNameSearch","action","type","marketId","_getCurrentLocation","navigator","geolocation","getCurrentPosition","position","coords","latitude","longitude","err","_showSearchSubmitError","maximumAge","style","display","_clearSearchSubmitError","_getRecentSearchValues","clearSignsRegex","replace","_getParamsEvent","params","elements","element","dataset","ga4Param","preventDefault","inputText","textValue","userText","eventSegment","input_text","search_location","eventType","info","eventPandora","pandoraInfoEvent","pandoraCategory","pandoraInfoCategory","pandoraAction","pandoraInfoAction","pandoraLabel","infoGa4","paramsFromElements","eventGa4","eventName","ga4InfoEventName","search_value","click_target","ga4InfoEventClick_target","assign","dispatchEvent","CustomEvent","detail","data","isCurrentLocation","submit","searchTextInputs","oninput","filesName","filter","item","linksElements","fileName","str","nameWithResourceVersion","substring","lastIndexOf","getFileName","url","resourceDomain","fragment","createRange","createContextualFragment","links","onload","head","global","factory","amd","loadCss","lazyLoad","exports","module","LuxuryHomes","NHS","root","priceFormatter","number","Intl","NumberFormat","currency","minimumFractionDigits","format","priceLowValue","getElementById","priceNumber","parseInt","slice","priceHighValue","options","fieldsets","init"],"mappings":"AAAAA,OAAA,wBAAA,IAAA,WASA,SAAAC,sBAAAC,QAAAC,WAAAC,OAAAC,sBAIAC,KAAAC,YAAAJ,WAKAG,KAAAE,aAAAF,KAAAC,YAAAE,MAKAH,KAAAI,QAAAN,OAKAE,KAAAK,sBAAAN,qBAKAC,KAAAM,SAAAV,QAKAI,KAAAO,YAAA,GAKAC,OAAAC,eAAAT,KAAA,QAAA,CACAU,IAAA,WACA,OAAAV,KAAAK,sBAAAL,KAAAK,sBAAAM,wBAAA,MACAC,KAAAZ,QAGAA,KAAAC,YAAAY,IAAAb,MACAA,KAAAc,cA2EA,OAxEAnB,sBAAAoB,UAAAC,cAAA,SAAAC,OACAA,MAAAC,SAAAlB,KAAAM,UAAAN,KAAAM,SAAAa,SAAAF,MAAAC,SACAlB,KAAAK,uBACAL,KAAAK,sBAAAe,SAQAzB,sBAAAoB,UAAAD,YAAA,WACAO,SAAAC,KAAAC,iBAAA,QAAAvB,KAAAgB,cAAAJ,KA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AAnN,OAAA6D,IAAA,CACAsJ,UAAAtJ,GACA+D,MAAAC,QAAA,QAGAiE,QAAAzM,SAAA4C,cAAA,iBAAAtC,UAGAoM,SAAAqB,UAEA1P,OAAA,8BAAA,eCpFAiF,QAAA,CAAA","file":"../show-482cb9e224.js","sourceRoot":"..","sourcesContent":["define('AutocompleteComponent',[], function () {\r\n /**\r\n * @abstract\r\n * @class \r\n * @param {HTMLElement} context Element context\r\n * @param {Observable} observable Observable instance\r\n * @param {SuggestionsEngine} engine Suggestions Engine\r\n * @param {SuggestionsComponent} suggestionsComponent Suggestions Component\r\n */\r\n function AutocompleteComponent(context, observable, engine, suggestionsComponent) {\r\n /**\r\n * @property {Observable} _observable Observable \r\n */\r\n this._observable = observable;\r\n\r\n /**\r\n * @property {HTMLInputElement} _searchField Search field\r\n */\r\n this._searchField = this._observable.field;\r\n\r\n /**\r\n * @property {SuggestionsEngine} _engine Suggestions engine\r\n */\r\n this._engine = engine;\r\n\r\n /**\r\n * @property {SuggestionsComponent} _suggestionsComponent Suggestions component\r\n */\r\n this._suggestionsComponent = suggestionsComponent;\r\n\r\n /**\r\n * @property {HTMLElement} _context DOM Context\r\n */\r\n this._context = context;\r\n\r\n /**\r\n * @property {*[]}\r\n */\r\n this.suggestions = [];\r\n\r\n /**\r\n * @property {*} value Returns the selected suggestion of the suggestions conponent\r\n */\r\n Object.defineProperty(this, \"value\", {\r\n get: (function () {\r\n return this._suggestionsComponent ? this._suggestionsComponent.getSelectedSuggestion() : null;\r\n }).bind(this)\r\n });\r\n\r\n this._observable.add(this); // Add observer to observable \r\n this._initEvents(); // Init DOM events\r\n }\r\n\r\n AutocompleteComponent.prototype._clickHandler = function (event) {\r\n if (event.target === this._context || this._context.contains(event.target)) return;\r\n if (this._suggestionsComponent) {\r\n this._suggestionsComponent.close();\r\n }\r\n };\r\n\r\n /**\r\n * Initializes the DOM events\r\n * @method \r\n */\r\n AutocompleteComponent.prototype._initEvents = function () {\r\n document.body.addEventListener(\"click\", this._clickHandler.bind(this));\r\n document.body.addEventListener(\"touchstart\", this._clickHandler.bind(this), { passive: true });\r\n };\r\n\r\n /**\r\n * Updates the Autocomplete Suggestions\r\n * @method \r\n * @param {Function} callback Callback\r\n */\r\n AutocompleteComponent.prototype.update = function (callback) {\r\n if (this._searchField.value && this._suggestionsComponent.getSelectedSuggestion() === null) {\r\n this._engine.getSuggestions(this._searchField, (function (suggestions) {\r\n this.suggestions = suggestions;\r\n this.displaySuggestions();\r\n if (callback instanceof Function) {\r\n callback();\r\n }\r\n }).bind(this));\r\n } else if (!this._searchField.value) {\r\n this._suggestionsComponent.close();\r\n }\r\n };\r\n\r\n /**\r\n * Displays the suggestions\r\n * @method\r\n */\r\n AutocompleteComponent.prototype.displaySuggestions = function () {\r\n this._suggestionsComponent.close();\r\n this._suggestionsComponent.clear();\r\n if (!this.suggestions.length) {\r\n return;\r\n }\r\n var highlight = this.includeHighlightInSuggestion ? new RegExp(this._searchField.value.trim(), \"i\") : '';\r\n for (var index = 0; index < this.suggestions.length; index++) {\r\n this._suggestionsComponent.add(this.suggestions[index], highlight);\r\n }\r\n if (!this._suggestionsComponent.htmlElement.parentElement) {\r\n this._context.appendChild(this._suggestionsComponent.htmlElement);\r\n }\r\n this._suggestionsComponent.open();\r\n };\r\n\r\n /**\r\n * Selects a suggestion\r\n * @method\r\n * @param {Number} index Suggestion's index\r\n */\r\n AutocompleteComponent.prototype.selectSuggestion = function (index) {\r\n this.hideSuggestions();\r\n this._searchField.value = this.suggestions[index].name;\r\n };\r\n\r\n\r\n AutocompleteComponent.prototype.hideSuggestions = function () {\r\n if (this._suggestionsComponent) {\r\n this._suggestionsComponent.close();\r\n }\r\n };\r\n\r\n return AutocompleteComponent;\r\n});\r\n\r\n/**\r\n * Made with ♥ by NewHomeSource's team\r\n * Copyright (c) 2019-present, BuilderHomeSite Inc. All rights reserved.\r\n */;\n","define('SearchFieldObservable',[], function () {\r\n /**\r\n * @class \r\n * @param {HTMLInputElement} inputElement Input element to make observable\r\n */\r\n function SearchFieldObservable(inputElement) {\r\n /**\r\n * @property {Observer[]} _observers subscribed observers\r\n */\r\n this._observers = [];\r\n\r\n /**\r\n * @property {HTMLInputElement} field Field to observe\r\n */\r\n this.field = inputElement;\r\n\r\n /**\r\n * @property {Number} _debounceTimer Debounce Timeout\r\n */\r\n this._debounceTimer = null;\r\n\r\n this._lastValue = this.field.value;\r\n\r\n this._initDomEvents(); // Init DOM events\r\n }\r\n\r\n SearchFieldObservable.prototype._fieldChangeHandler = function (event) {\r\n if (event.key) {\r\n var code = event.key.toLowerCase();\r\n if (code.indexOf(\"down\") > -1 &&\r\n code.indexOf(\"up\") > -1 &&\r\n code.indexOf(\"enter\") > -1 &&\r\n code.indexOf(\"right\") > -1\r\n ) return;\r\n } \r\n if (this._lastValue !== this.field.value) {\r\n this._lastValue = this.field.value;\r\n this.notify();\r\n } \r\n };\r\n\r\n /**\r\n * Initializes the DOM events\r\n * @method\r\n */\r\n SearchFieldObservable.prototype._initDomEvents = function () {\r\n this.field.addEventListener(\"change\", this._fieldChangeHandler.bind(this));\r\n this.field.addEventListener(\"keyup\", this._fieldChangeHandler.bind(this));\r\n this.field.addEventListener(\"click\", this._fieldChangeHandler.bind(this));\r\n this.field.addEventListener(\"touchend\", this._fieldChangeHandler.bind(this)); \r\n this.field.addEventListener(\"search\", this._fieldChangeHandler.bind(this));\r\n };\r\n\r\n /**\r\n * Debounces the notify calls and notifies the observable observers\r\n * @method\r\n */\r\n SearchFieldObservable.prototype.notify = function () {\r\n clearTimeout(this._debounceTimer);\r\n this._debounceTimer = setTimeout((function () {\r\n this.notify();\r\n }).bind(this),\r\n 50);\r\n };\r\n\r\n SearchFieldObservable.prototype.add = function(observer) {\r\n this._observers.push(observer);\r\n };\r\n SearchFieldObservable.prototype.notify = function() {\r\n this._observers.forEach(function(o) {\r\n o.update();\r\n });\r\n };\r\n\r\n return SearchFieldObservable;\r\n});\r\n/**\r\n * Made with ♥ by NewHomeSource's team\r\n * Copyright (c) 2019-present, BuilderHomeSite Inc. All rights reserved.\r\n */;\n","define('SearchAutocompleteComponent',[\r\n \"AutocompleteComponent\",\r\n \"SearchFieldObservable\",\r\n], function (AutocompleteComponent, SearchFieldObservable) {\r\n /**\r\n * Creates a NewHomeSource search autocomplete component\r\n * @class\r\n * @extends AutocompleteComponent\r\n * @param {HTMLElement} context Element context\r\n */\r\n function SearchAutocompleteComponent(context) {\r\n AutocompleteComponent.call(this, context, new SearchFieldObservable(context.querySelector(\"[data-component-rol=target-input]\"))); // Call base class constructor\r\n /**\r\n * @property {Boolean} dependeciesRequested Flag to know if the dependencies were already requested\r\n */\r\n this.dependeciesRequested = false;\r\n this.includeCurrentLocation = context.hasAttribute(\"data-component-includeCurrentLocation\");\r\n this.includeCurrentLocationIcon = context.hasAttribute(\"data-component-include-current-location-icon\");\r\n this.includeHighlightInSuggestion = !context.hasAttribute(\"data-exclude-highlight\");\r\n Object.defineProperty(this, \"isCurrentLocation\", {\r\n get: (function () {\r\n return this._currentLocationSuggestion && this._currentLocationSuggestion === this.value;\r\n }).bind(this)\r\n });\r\n\r\n this.onSelect = null;\r\n }\r\n SearchAutocompleteComponent.prototype = Object.create(AutocompleteComponent.prototype, {\r\n constructor: {\r\n value: SearchAutocompleteComponent\r\n }\r\n });\r\n\r\n /**\r\n * Loads the dependencies\r\n * @method\r\n * @param {Function} callback Callback to execute when the dependencies are loaded\r\n */\r\n SearchAutocompleteComponent.prototype._loadDependencies = function (callback) {\r\n // If the dependencies hasn't been requested yet call them\r\n if (!this.dependeciesRequested) {\r\n require([\r\n \"SuggestionsEngineConfig\",\r\n \"SearchSuggestionsEngine\",\r\n \"SearchSuggestionsComponent\",\r\n \"SearchSuggestion\"\r\n ], (function (SuggestionsEngineConfig, SearchSuggestionsEngine, SearchSuggestionsComponent, SearchSuggestion) {\r\n this._engine = new SearchSuggestionsEngine(new SuggestionsEngineConfig());\r\n this._suggestionsComponent = new SearchSuggestionsComponent(this._searchField);\r\n if (this.includeCurrentLocation) {\r\n this._currentLocationSuggestion = new SearchSuggestion({ id: 0, name: \"Current Location\", cssClass: \"currentLocationSuggestion nhs-c-suggestion nhs-c-suggestion--icon\", dataAttributes: [\"data-current-location\"],\r\n icon: this.includeCurrentLocationIcon ? `
` : null\r\n });\r\n }\r\n this._suggestionsComponent.onSelect = this._onSelect.bind(this);\r\n callback();\r\n }).bind(this));\r\n this.dependeciesRequested = true; // Let me know that even when the dependencies are not loaded yet I've requested them to avoid doing it twice\r\n } else if (this._suggestionsComponent && this._engine) { // If the dependencies are there run the funcion\r\n callback();\r\n }\r\n };\r\n\r\n SearchAutocompleteComponent.prototype._onSelect = function () {\r\n if (this.onSelect instanceof Function) {\r\n this.onSelect();\r\n }\r\n };\r\n\r\n /**\r\n * removeCurrentLocation: removes the current location option from the component and sets the include current location flag to false\r\n * in order to avoid showing the current location option in further typeahead interactions.\r\n * @method\r\n */\r\n SearchAutocompleteComponent.prototype.removeCurrentLocation = function () {\r\n const currentLocationOption = this._suggestionsComponent.htmlElement.querySelector('[data-current-location]');\r\n\r\n if (!currentLocationOption) {\r\n return;\r\n }\r\n\r\n this.includeCurrentLocation = false;\r\n currentLocationOption.remove();\r\n };\r\n\r\n /**\r\n * Updates the Autocomplete Suggestions\r\n * @method\r\n * @param {Function} callback Callback\r\n */\r\n SearchAutocompleteComponent.prototype.update = function (callback) {\r\n this._loadDependencies((function () {\r\n AutocompleteComponent.prototype.update.call(this, callback); // Call the base implementation\r\n }).bind(this));\r\n };\r\n\r\n SearchAutocompleteComponent.prototype.displaySuggestions = function () {\r\n if (this.includeCurrentLocation) {\r\n this.suggestions.unshift(this._currentLocationSuggestion);\r\n }\r\n AutocompleteComponent.prototype.displaySuggestions.call(this);\r\n };\r\n\r\n SearchAutocompleteComponent.prototype.selectSuggestion = function (index) {\r\n AutocompleteComponent.prototype.selectSuggestion.call(this, index);\r\n this._searchField.setAttribute(\"data-suggestion-index\", index);\r\n };\r\n\r\n /**\r\n * Auto initializes all the components in the page\r\n * @method\r\n * @static\r\n */\r\n SearchAutocompleteComponent.initAll = function () {\r\n var searchAutocompleteComponents = document.querySelectorAll(\"[data-component=search-autocomplete]\");\r\n for (var i = 0; i < searchAutocompleteComponents.length; i++) {\r\n if (!searchAutocompleteComponents[i].searchAutocompleteComponent) {\r\n searchAutocompleteComponents[i].searchAutocompleteComponent = new SearchAutocompleteComponent(searchAutocompleteComponents[i]);\r\n }\r\n }\r\n };\r\n SearchAutocompleteComponent.initAll();\r\n return SearchAutocompleteComponent;\r\n});\r\n/**\r\n * Made with ♥ by NewHomeSource's team\r\n * Copyright (c) 2019-present, BuilderHomeSite Inc. All rights reserved.\r\n */;\n","define('SearchFormComponent',[\"SearchAutocompleteComponent\"], function (SearchAutocompleteComponent) {\r\n SearchAutocompleteComponent.initAll();\r\n\r\n var SearchFormComponent = function (settings) {\r\n if (!settings || // There're no settings\r\n (typeof settings !== \"object\") || // Settings are not an object\r\n !(settings.form instanceof HTMLFormElement)) { // Settings don't have a 'form' prop defined\r\n throw new TypeError();\r\n }\r\n\r\n this.form = settings.form;\r\n this.autocomplete = settings.autocomplete || this.form.querySelector(\"[data-component=search-autocomplete]\").searchAutocompleteComponent;\r\n this.searchTextField = settings.searchTextField || this.form.querySelector(\"[name=SearchText]\");\r\n this.pageToHitFields = settings.pageToHitFields || this.form.querySelectorAll(\"[name=pageToHit]\");\r\n this.latitudeField = settings.latitudeField || this.form.querySelector(\"[name=latitude]\") || {};\r\n this.longitudeField = settings.longitudeField || this.form.querySelector(\"[name=longitude]\") || {};\r\n this.locationTypeField = settings.locationTypeField || this.form.querySelector(\"[name=locationType]\");\r\n this.itemIdField = settings.itemIdField || this.form.querySelector(\"[name=itemId]\");\r\n this.marketIdField = settings.marketIdField || this.form.querySelector(\"[name=marketId]\");\r\n this.submitButton = settings.submitButton || this.form.querySelector(\"[type=submit]\");\r\n this.validationError = settings.validationError || this.form.querySelector(\"[data-field-validation-error]\") || this.form.querySelector(\"#nhs_field_validation_error\");\r\n this.useAutocompleteForSubmit = !!settings.useAutocompleteForSubmit || this.form.hasAttribute(\"data-component-useAutocompleteForSubmit\");\r\n this.shouldAlwaysSubmitForm = settings.shouldAlwaysSubmitForm || false;\r\n this.useBaseUrl = settings.useBaseUrl || true;\r\n this.useBaseUrl = settings.useBaseUrl === undefined ? true : settings.useBaseUrl;\r\n\r\n if (this.submitButton) {\r\n this.submitButton.disabled = false;\r\n }\r\n\r\n //If there was an external specified submit button\r\n if (settings.submitButton) {\r\n settings.submitButton.addEventListener(\"click\", this._formSubmitHandler.bind(this));\r\n }\r\n\r\n if (this.useAutocompleteForSubmit) {\r\n this.autocomplete.onSelect = this._formSubmitHandler.bind(this);\r\n }\r\n\r\n if (this.searchTextField) {\r\n this._setDataUserText();\r\n }\r\n\r\n this.form.addEventListener(\"submit\", this._formSubmitHandler.bind(this));\r\n\r\n if(this.searchTextField){\r\n this.searchTextField.parentElement.addEventListener('focusout', (event) => {\r\n const suggestionsContainer = document.querySelector('[data-typeahead-suggestions]');\r\n if (event.relatedTarget === suggestionsContainer) {\r\n return;\r\n }\r\n // close suggestions if the focus is moved to an outside element.\r\n if(event.relatedTarget){\r\n this.autocomplete.hideSuggestions();\r\n }\r\n\r\n // Include populated class\r\n const wrapper = this.searchTextField.closest('[data-typeahead-input-wrapper]');\r\n const hasValue = !!this.searchTextField.value;\r\n if (wrapper) {\r\n if (hasValue) {\r\n wrapper.classList.add('nhs-c-typeahead__container--populated');\r\n } else {\r\n wrapper.classList.remove('nhs-c-typeahead__container--populated');\r\n }\r\n }\r\n });\r\n }\r\n }\r\n\r\n SearchFormComponent.prototype._getPageToHit = function () {\r\n if (this.pageToHitFields.length === 1) {\r\n return this.pageToHitFields[0].value;\r\n }\r\n\r\n for (var i = 0; i < this.pageToHitFields.length; i++) {\r\n if (this.pageToHitFields[i].checked) {\r\n return this.pageToHitFields[i].value;\r\n }\r\n }\r\n return \"\";\r\n };\r\n\r\n SearchFormComponent.prototype._setPageToHitState = function (state) {\r\n for (var i = 0; i < this.pageToHitFields.length; i++) {\r\n this.pageToHitFields[i].disabled = state;\r\n }\r\n };\r\n\r\n /*\r\n * When current location option is selected, this function calculates the url for the search results page to visit,\r\n * and then: redirects the user to that calculated url.\r\n * This algorithm finds out the max latitude/longitude and min latitude/longitude to use in the search results url\r\n * based on the device capabilities like it's height, width and aspect ratio.\r\n */\r\n SearchFormComponent.prototype._redirectToCurrentLocationSearch = function () {\r\n const deviceHeight = window.innerHeight;\r\n const deviceWidth = window.innerWidth;\r\n /*\r\n * Convert the device width (in pixels) into the number of tiles.\r\n * Since there are 256 tiles horizontally at zoom level 9,\r\n * divide the device width by 256 to get the number of tiles across the width of the map.\r\n */\r\n const tilesAcrossWidth = deviceWidth / 256;\r\n /*\r\n * Calculate the horizontal span of the map in degrees. At zoom level 9,\r\n * each tile covers a specific range of longitudes.\r\n * You can calculate the width of a single tile in degrees by dividing\r\n * the total longitude range (360 degrees) by the number of tiles (256).\r\n */\r\n const degreesPerTile = 360 / 256;\r\n /*\r\n * Calculate the maximum and minimum longitude values based on the\r\n * center point and the number of tiles across the width of the map.\r\n */\r\n const maxLongitude = +this.longitudeField.value + (tilesAcrossWidth / 2) * degreesPerTile;\r\n const minLongitude = +this.longitudeField.value - (tilesAcrossWidth / 2) * degreesPerTile;\r\n /*\r\n * The latitude span depends on the aspect ratio of the map.\r\n * To calculate the maximum and minimum latitude values, you need to know the aspect\r\n * ratio of your map view (height divided by width). The latitude span is calculated\r\n * by multiplying the longitude span by the aspect ratio.\r\n */\r\n const aspectRatio = deviceHeight / deviceWidth;\r\n const maxLatitude = +this.latitudeField.value + (tilesAcrossWidth / 2) * degreesPerTile * aspectRatio;\r\n const minLatitude = +this.latitudeField.value - (tilesAcrossWidth / 2) * degreesPerTile * aspectRatio;\r\n this.form.querySelector('ul').setAttribute('hidden', '');\r\n window.location.href = `/communities/map?coordinates=${minLatitude},${minLongitude},${maxLatitude},${maxLongitude}`;\r\n };\r\n\r\n SearchFormComponent.prototype._setUpForLocationNameSearch = function () {\r\n // Change the form action\r\n if (this.form.action.indexOf(\"http://\") !== 0 && this.form.action.indexOf(\"https://\") !== 0) {\r\n this.form.action = \"/submittypeaheadsearch\";\r\n }\r\n\r\n // These fields should not be included in the request\r\n \r\n if(this.longitudeField){\r\n this.longitudeField.value = \"\";\r\n this.longitudeField.disabled = true;\r\n }\r\n\r\n if(this.latitudeField){\r\n this.latitudeField.value = \"\";\r\n this.latitudeField.disabled = true;\r\n }\r\n\r\n // These Fields must be included in the request \r\n this.searchTextField.disabled = false;\r\n this._setPageToHitState(false);\r\n\r\n if(this.locationTypeField){\r\n this.locationTypeField.value = this.autocomplete.value.type;\r\n this.locationTypeField.disabled = false;\r\n }\r\n \r\n if(this.itemIdField){\r\n this.itemIdField.value = this.autocomplete.value.id;\r\n this.itemIdField.disabled = false;\r\n }\r\n \r\n if(this.marketIdField){\r\n this.marketIdField.value = this.autocomplete.value.marketId;\r\n this.marketIdField.disabled = false;\r\n }\r\n };\r\n\r\n SearchFormComponent.prototype._getCurrentLocation = function () {\r\n // User wants to use current location but the Browser needs to ask for permission in order to access the user coords\r\n navigator.geolocation.getCurrentPosition((function (position) {\r\n this.latitudeField.value = position.coords.latitude;\r\n this.longitudeField.value = position.coords.longitude;\r\n this._formSubmitHandler(); // Once the user has accepted the pop up and we have filled the fields as needed, submit the form, to start over.\r\n }).bind(this), (function (err) {\r\n this._showSearchSubmitError(); // If the user did not accept the pop up so we are gonna show the error\r\n }).bind(this), { maximumAge: 0 });\r\n };\r\n\r\n SearchFormComponent.prototype._showSearchSubmitError = function () {\r\n if (this.validationError) {\r\n this.validationError.style.display = \"block\";\r\n this.form.classList.add('nhs-c-typeahead__form--error');\r\n this.autocomplete.hideSuggestions();\r\n this.autocomplete.removeCurrentLocation();\r\n }\r\n };\r\n\r\n SearchFormComponent.prototype._clearSearchSubmitError = function () {\r\n if (this.validationError) {\r\n this.validationError.style.display = \"none\";\r\n this.form.classList.remove('nhs-c-typeahead__form--error');\r\n }\r\n };\r\n\r\n SearchFormComponent.prototype._getRecentSearchValues = function () {\r\n this.autocomplete.update((function () {\r\n var index = -1;\r\n var clearSignsRegex = /,|\\./gi;\r\n for (var i = 0; i < this.autocomplete.suggestions.length; i++) {\r\n if (this.autocomplete.suggestions[i].name.replace(clearSignsRegex, \"\").toLowerCase() === this.searchTextField.value.replace(clearSignsRegex, \"\").toLowerCase().trim()) {\r\n index = i;\r\n break;\r\n }\r\n }\r\n\r\n if (index > -1) {\r\n this.autocomplete.selectSuggestion(index);\r\n this._formSubmitHandler();\r\n } else {\r\n this._showSearchSubmitError();\r\n }\r\n\r\n }).bind(this));\r\n };\r\n\r\n /**\r\n * @private\r\n * _getParamsEvent: function to get the parameter for events to track in element\r\n */\r\n SearchFormComponent.prototype._getParamsEvent = function () {\r\n const params = {};\r\n const elements = this.form.querySelectorAll('[data-ga4-param]');\r\n for (let index = 0; index < elements.length; index++) {\r\n const element = elements[index];\r\n params[element.dataset.ga4Param] = element.value;\r\n }\r\n return params;\r\n };\r\n\r\n SearchFormComponent.prototype._formSubmitHandler = function (event) {\r\n if (event) {\r\n event.preventDefault();\r\n }\r\n\r\n const inputText = this.form.querySelector('input[type=\"search\"], [data-input-typeahead]');\r\n let textValue = inputText.value;\r\n if (inputText.dataset.userText != ''){\r\n textValue = inputText.dataset.userText;\r\n }\r\n const eventSegment = {\r\n event: inputText.id === \"HeaderSearchText\" || inputText.id === \"SearchText\" ? 'Search Term Selected' : \"Header Search Term Selected\",\r\n input_text: textValue,\r\n search_location: inputText.value,\r\n eventType: \"segmentEvent\"\r\n };\r\n\r\n const info = inputText.closest('[data-pandora-info-event]');\r\n const dataset = info && info.dataset;\r\n const eventPandora = dataset && {\r\n event: dataset.pandoraInfoEvent,\r\n pandoraCategory: dataset.pandoraInfoCategory,\r\n pandoraAction: dataset.pandoraInfoAction,\r\n pandoraLabel: inputText.value,\r\n eventType: \"PandoraEvent\"\r\n };\r\n\r\n const infoGa4 = inputText.closest('[data-ga4-info-event-name]');\r\n \r\n if(infoGa4 && this.searchTextField.value) {\r\n const paramsFromElements = this._getParamsEvent();\r\n const eventGa4 = {\r\n eventName: infoGa4.dataset.ga4InfoEventName,\r\n params: {\r\n search_value: inputText.value,\r\n click_target: infoGa4.dataset.ga4InfoEventClick_target\r\n \r\n },\r\n eventType: \"GA4Event\"\r\n };\r\n Object.assign(eventGa4.params, paramsFromElements);\r\n\r\n document.body.dispatchEvent(new CustomEvent(\"trackOnDemandEvent\", {\r\n detail: { data: eventGa4 }\r\n }));\r\n }\r\n\r\n document.body.dispatchEvent(new CustomEvent(\"trackOnDemandEvent\", {\r\n detail: { data: eventSegment }\r\n }));\r\n \r\n eventPandora && document.body.dispatchEvent(new CustomEvent(\"trackOnDemandEvent\", {\r\n detail: { data: eventPandora }\r\n }));\r\n \r\n\r\n if (this.autocomplete.isCurrentLocation && !this.latitudeField.value && !this.longitudeField.value) {\r\n this._getCurrentLocation();\r\n return;\r\n } else if (this.autocomplete.isCurrentLocation && this.latitudeField.value && this.longitudeField.value) {\r\n this._redirectToCurrentLocationSearch();\r\n return;\r\n } else if (this.shouldAlwaysSubmitForm && this.searchTextField.value) {\r\n this.form.submit();\r\n }else if (!!this.searchTextField.value && this.autocomplete && (!this.autocomplete.dependeciesRequested || this.autocomplete.value === null)) {\r\n this._getRecentSearchValues();\r\n return;\r\n } else if (this.autocomplete && this.autocomplete.value !== null) {\r\n this._setUpForLocationNameSearch();\r\n } else {\r\n this._showSearchSubmitError();\r\n return;\r\n }\r\n\r\n this._clearSearchSubmitError();\r\n this.form.submit();\r\n };\r\n\r\n SearchFormComponent.prototype._setDataUserText = function (event) {\r\n const searchTextInputs = document.querySelectorAll(\"[name=SearchText]\");\r\n for (var i = 0; i < searchTextInputs.length; i += 1){\r\n searchTextInputs[i].oninput = function () {\r\n this.dataset.userText = this.value;\r\n };\r\n }\r\n };\r\n\r\n return SearchFormComponent;\r\n});\n","define('loadCss',[], () => {\r\n 'use strict';\r\n\r\n const getFileName = function (str) {\r\n // get the filename from the URL\r\n const nameWithResourceVersion = str.substring(str.lastIndexOf('/') + 1);\r\n // remove the resource version\r\n const nameWithoutResourceVersion = nameWithResourceVersion.substring(0, nameWithResourceVersion.indexOf('.'));\r\n // remove any possible invalid/unsupported characters from the name\r\n const name = nameWithoutResourceVersion.replace(/^[^a-z]+|[^\\w:.-]+/gi, '');\r\n return name;\r\n };\r\n\r\n function loadCss(...params) {\r\n let callback = null;\r\n const filesName = params.filter((item) => {\r\n if (typeof item !== 'function') {\r\n return true;\r\n }\r\n callback = item;\r\n return false;\r\n });\r\n\r\n let linksElements = '';\r\n filesName.forEach((fileName) => {\r\n const id = getFileName(fileName);\r\n const url = fileName;\r\n const rules = document.querySelector('link#' + id);\r\n if (!rules && fileName && window.resourceDomain) {\r\n linksElements += ``;\r\n }\r\n });\r\n\r\n const fragment = document.createRange().createContextualFragment(linksElements);\r\n const links = fragment.querySelectorAll('link');\r\n if (links.length > 0) {\r\n links.forEach((element) => {\r\n const link = element;\r\n link.onload = callback;\r\n });\r\n document.head.appendChild(fragment);\r\n }\r\n }\r\n\r\n return loadCss;\r\n});\r\n\n","(function (global, factory) {\r\n if (\"undefined\" !== typeof define && \"function\" === typeof define && define.amd) {\r\n // If supports for AMD is available return the value to the AMD Loader\r\n // and to the global (window) object in case any JS module is expecting\r\n // the LuxuryHomes to exists on the window object.\r\n require(['SearchFormComponent', 'loadCss', 'lazyLoad'], function (SearchFormComponent, loadCss, lazyLoad) {\r\n factory(global, SearchFormComponent, loadCss, lazyLoad);\r\n });\r\n } else if (\"undefined\" !== typeof exports && \"object\" === typeof exports) {\r\n // If supports for Common JS is available export the module\r\n // and pass is value to the global (window) object in case non Common JS code \r\n // is expected to work with this LuxuryHomes.\r\n\r\n module.exports = (global.LuxuryHomes = factory(global));\r\n } else {\r\n // If not support for AMD or Common JS is available register the module in the global scope.\r\n global.LuxuryHomes = factory(global, SearchFormComponent, NHS.loadCss);\r\n }\r\n})(\"undefined\" !== typeof window ? window : {}, function (root, SearchFormComponent, loadCss, lazyLoad) {\r\n\r\n /**\r\n * formats a number into $xxx,xxx,xxx\r\n * @param {int} number\r\n */\r\n var priceFormatter = function(number) {\r\n if (typeof Intl !== 'undefined') {\r\n var formatted = new Intl.NumberFormat(\"en-US\", {\r\n style: 'currency',\r\n currency: 'USD',\r\n minimumFractionDigits: 0\r\n }).format(number);\r\n return formatted;\r\n }\r\n }\r\n\r\n var priceLowValue = document.getElementById(\"PriceLow\");\r\n if (priceLowValue) {\r\n priceLowValue.addEventListener('input', function() {\r\n var priceNumber = priceLowValue.value.replace(/\\D/g, \"\");\r\n priceLowValue.value = priceNumber == \"\" ? \"\" : priceFormatter(parseInt(priceNumber));\r\n if (priceNumber.length > 6) {\r\n priceLowValue.value = priceFormatter(parseInt(priceNumber.slice(0, 7)));\r\n }\r\n });\r\n }\r\n\r\n var priceHighValue = document.getElementById(\"PriceHigh\");\r\n if (priceHighValue) {\r\n priceHighValue.addEventListener('input', function() {\r\n var priceNumber = priceHighValue.value.replace(/\\D/g, \"\");\r\n priceHighValue.value = priceNumber == \"\" ? \"\" : priceFormatter(parseInt(priceNumber));\r\n if (priceNumber.length > 6) {\r\n priceHighValue.value = priceFormatter(parseInt(priceNumber.slice(0, 7)));\r\n }\r\n });\r\n }\r\n\r\n let form = document.querySelector('#nhs_HomeSearch form');\r\n var search = new SearchFormComponent({\r\n form: form,\r\n validationError: form.querySelector('#nhs_field_validation_error'),\r\n submitButton: form.querySelector('[data-search-submit]'),\r\n searchTextField: form.querySelector('[data-component-rol=\"target-input\"]'),\r\n shouldAlwaysSubmitForm: true,\r\n useBaseUrl: false\r\n });\r\n\r\n var input = document.querySelector('#HeaderSearchText');\r\n input.addEventListener('click', handleInputClick);\r\n\r\n function handleInputClick() {\r\n var options = document.querySelector('#nhs_HomeSearchOptions');\r\n var fieldsets = options.querySelectorAll('fieldset');\r\n options.style.display = 'block';\r\n\r\n for (var i = 0; i < fieldsets.length; i++) {\r\n var element = fieldsets[i];\r\n element.style.display = 'block';\r\n }\r\n\r\n loadCss(document.querySelector('#typeAheadCss').value);\r\n }\r\n\r\n lazyLoad.init();\r\n});\ndefine(\"nhs/views/luxuryhomes/Show\", function(){});\n\n","\nrequire([\"nhs/views/luxuryhomes/Show\"]);\n"]}