class Blueshift{constructor(n){this.enabled=n;this.SavedSearches=savedSearchesBlueshiftModule;this.FavoriteListings=favoriteListingBlueshiftModule}track(n,t){this.enabled&&blueshift.track(n,t)}identify(n,t){this.enabled&&blueshift.identify({customer_id:n,email:t})}listingView(n){this.enabled&&blueshift.track("listing_view",{product_id:this.formatListingId(n),site_id:P2H.settings.site})}contactAgent(n){if(this.enabled){let t=new ContactAgent(null,n);blueshift.track("contact_agent",t.eventInputs)}}listingSearch(n){if(this.enabled){var t=$("#rfsform").serializeArray();let i=new ListingSearch(t,null,n);blueshift.track("listing_search",i.eventInputs)}}formatListingId(n){return P2H.settings.site+"_listing_"+n}}class BlueshiftBaseModel{constructor(n,t,i){var r={},u;n&&$(n).each(function(n,t){i[t.name]&&(t.value||t.value===!1)&&(r[i[t.name]]=t.value)});t&&(u=JSON.parse(t),$(u).each(function(n,t){i[t.name]&&(t.value||t.value===!1)&&(r[i[t.name]]=t.value)}));r.site_id||(r.site_id=P2H.settings.site);this.keyMappings=i;this.eventInputs=r}}class IdentifyRegister extends BlueshiftBaseModel{constructor(n,t){super(n,t,{CustomerId:"customer_id",FirstName:"firstname",LastName:"lastname",Email:"email",unsubscribed:"unsubscribed",UserRole:"role",PhoneNumber:"phone_number",City:"city",StateCode:"state",CountryCode:"country_code",OfficeName:"office_name",RegisterPage:"account_created_from",active:"active"})}}class RegisterAccount extends BlueshiftBaseModel{constructor(n,t){super(n,t,{UserId:"customer_id",Email:"email"})}}class ContactAgent extends BlueshiftBaseModel{constructor(n,t){super(n,t,{ProductIds:"product_ids",Email:"email",FirstName:"firstname",LastName:"lastname",PhoneNumber:"phone_number",FormLocation:"form_location",SiteId:"site_id"})}}class ListingSearch extends BlueshiftBaseModel{constructor(n,t,i){var u,r;for(super(n,t,{location:"location",Country:"country",CheckboxPriceDrop:"checkbox_price_drop",NewDevelopment:"new_development",Bedrooms:"bedrooms",Bathrooms:"bathrooms",PriceMin:"price_min",PriceMax:"price_max",SquareFeetMin:"sqft_min",SquareFeetMax:"sqft_max",LotSizeMin:"lot_size_min",LotSizeMax:"lot_size_max",YearBuiltMin:"year_built_min",YearBuiltMax:"year_built_max",ListingDate:"listing_date",OpenHouse:"open_house",page:"page",sort_by:"sort_by",search_mode:"search_mode",SelectedView:"selected_view",PropertyType:"property_types",Keywords:"keywords",MlsNumber:"mls_number",DirectoryId:"directory",ExcludePendingListings:"exclude_pending_listings",ResultsListingIds:"product_ids",RedirectToDirectory:"default_directory_type"}),u=[],r=0;r<i.searchResultIds.length;r++)i.searchResultIds[r]!==undefined&&i.searchResultIds[r]!==null&&(u[r]=P2H.Blueshift.formatListingId(i.searchResultIds[r]));this.eventInputs.product_ids=u;this.eventInputs.directory=i.directoryId;this.eventInputs.selected_view=i.page;this.eventInputs.property_types&&(this.eventInputs.property_types=this.eventInputs.property_types.split(", "));this.eventInputs.keywords&&(this.eventInputs.keywords=this.eventInputs.keywords.split(", "))}}var savedSearchesBlueshiftModule=function(){function n(n){var t,i;if(typeof n=="number"){P2H.Blueshift.track("saved_search_removed",{saved_search_id:n,active:0});return}if(t=n.split(","),t.length!==0)for(i=0;i<t.length;i++)P2H.Blueshift.track("saved_search_removed",{saved_search_id:t[i],active:0})}function t(n,t,i){P2H.Blueshift.track("saved_search_modified",{saved_search_id:n,frequency:t,active:i})}function i(n,t){P2H.Blueshift.track("saved_search_modified",{saved_search_id:n,title:t})}return{savedSearchesRemoved:n,updateSavedSearchFrequency:t,updateSavedSearchTitle:i}}(),favoriteListingBlueshiftModule=function(){function t(t,i){var r=new n(t,i);P2H.Blueshift.track("save_listing",r)}function i(t,i){var r,u;if(typeof t=="number"||typeof t=="string"){let r=new n(t,i);P2H.Blueshift.track("saved_listing_removed",r);return}if(r=t,r.length!==0)for(u=0;u<r.length;u++){let t=new n(r[u],i);P2H.Blueshift.track("saved_listing_removed",t)}}function r(n,t){return n+"_"+t}class n{constructor(n,t){this.transaction_id=r(t,n);this.product_id=P2H.Blueshift.formatListingId(n)}}return{saveListing:t,savedListingsRemoved:i}}()