{"version":3,"file":"destinations-DWH2oYsR.js","sources":["../../../../scripts/services/layout/environment.ts","../../../../scripts/services/search/product-search.ts","../../../../scripts/services/helpers/destinations.ts"],"sourcesContent":["import { EnvironmentAbbreviations } from \"interfaces/types/app-types\";\r\n\r\n/**\r\n * Returns true if global variable isEmbeddedMode is set to true\r\n * */\r\nexport function isEmbeddedMode(): boolean {\r\n return (window.VIRTUOSO.isEmbeddedMode) ? true : false;\r\n}\r\n\r\n/**\r\n * Determines if the current viewport is considered \"mobile\" based on its width.\r\n * \r\n * Returns true when the `window.innerWidth` is less than or equal to 768 pixels, \r\n *\r\n * @returns {boolean} - Returns `true` indicating a mobile device.\r\n **/\r\nexport function isMobileScreenWidth(): boolean {\r\n return window.innerWidth <= 768;\r\n}\r\n\r\n/**\r\n * Returns true if in the production environment\r\n * */\r\nexport function isProductionEnvironment(urlHost: string = window.location.hostname): boolean {\r\n return urlHost === \"www.virtuoso.com\";\r\n}\r\n\r\n\r\n/**\r\n * Returns dev/pre/pro based on site URL. Defaults to \"dev\".\r\n * @param urlHost - Only used for testing, do not pass a value here otherwise\r\n * @returns \"dev\", \"pre\", or \"pro\"\r\n */\r\nexport function getEnvironmentAbbr(urlHost: string = window.location.hostname): EnvironmentAbbreviations {\r\n let env: EnvironmentAbbreviations = \"dev\";\r\n if (urlHost === \"www.virtuoso.com\") {\r\n env = \"pro\";\r\n } else if (urlHost === \"pre.virtuoso.com\") {\r\n env = \"pre\";\r\n }\r\n return env;\r\n}\r\n\r\n/**\r\n * Returns dashboard based on site URL. Defaults to \"https://my.virtuoso.com\".\r\n * @param urlHost - Only used for testing, do not pass a value here otherwise\r\n * @returns \"https://my-dev.virtuoso.com\", \"https://my-pre.virtuoso.com\", or \"https://my.virtuoso.com\"\r\n */\r\nexport function getDashboardUrl(urlHost: string = window.location.hostname): string {\r\n\r\n if (urlHost === \"www.virtuoso.com\") {\r\n return \"https://my.virtuoso.com\";\r\n }\r\n\r\n if (urlHost === \"pre.virtuoso.com\") {\r\n return \"https://my-pre.virtuoso.com\";\r\n }\r\n\r\n if (/^localhost(\\.virtuoso\\.com)?$/.test(urlHost) || urlHost === \"dev.virtuoso.com\") {\r\n return \"https://my-dev.virtuoso.com\";\r\n }\r\n\r\n return \"https://my.virtuoso.com\";\r\n}","import { facetsByProduct } from \"config/search-facet-data\";\r\nimport { OmniboxAutoCompleteResponseItem } from \"interfaces/autocomplete\";\r\nimport { DestinationSelectedFacets } from \"interfaces/destination\";\r\nimport { ProductType } from \"interfaces/enums\";\r\nimport { ProductSearchConfig, ProductSearchCriteria, ProductSearchPagingOptions } from \"interfaces/product\";\r\nimport { virtuosoUser } from \"services/auth/user-info\";\r\nimport { initOmniBoxAutoComplete, OmniboxAutoCompleteConfig } from \"virtuoso-shared-web-ui\";\r\n\r\n/**\r\n * Returns a parameterized query string representation of a single search facet\r\n * @param qsIndex - Incremented index of the selected search facet, zero-based\r\n * @param qsCategory - Search facet category\r\n * @param qsName - Search facet name\r\n * @param qsDisplayName - Search facet display name -- often the same as qsName\r\n * @param qsSelected - Optional, whether it's selected or not, defaulted to true\r\n * @param qsIsInterval - Optional, whether the search facet is an interval, defaulted to false\r\n */\r\nexport function buildSingleFacetQueryString(qsIndex: number, qsCategory: string, qsOperator: string, qsName: string, qsDisplayName: string, qsSelected: string = \"true\", qsIsInterval: string = \"false\"): string {\r\n let qs: string = `&SelectedFacets[${qsIndex}][Category]=${qsCategory}`;\r\n\r\n if (qsOperator) {\r\n qs += `&SelectedFacets[${qsIndex}][CategoryLogicalOperator]=${qsOperator}`;\r\n }\r\n\r\n qs += `&SelectedFacets[${qsIndex}][Name]=${encodeURIComponent(qsName).replace(/%20/g, \"+\")}`;\r\n qs += `&SelectedFacets[${qsIndex}][DisplayName]=${encodeURIComponent(qsDisplayName).replace(/%20/g, \"+\")}`;\r\n qs += `&SelectedFacets[${qsIndex}][Selected]=${qsSelected}`;\r\n qs += `&SelectedFacets[${qsIndex}][IsIntervalFacet]=${qsIsInterval}`;\r\n return qs;\r\n}\r\n\r\n\r\n\r\n/**\r\n * Translates the consumer search catalog criteria to the legacy B2B link using legacy category names and format\r\n * @param consumerSearchCriteria\r\n * @param productType\r\n */\r\nexport function getLegacyCatalogLink(consumerSearchCriteria: ProductSearchCriteria, productType: ProductType, baseLink: string): string {\r\n\r\n let b2bQS = \"#FacetLimit=6\";\r\n let facetIndex = 0;\r\n\r\n for (const categoryName in consumerSearchCriteria) {\r\n const categoryMetadata: ProductSearchConfig = (facetsByProduct[productType]).find(thisCat => thisCat.categoryName === categoryName);\r\n if (categoryMetadata && categoryMetadata.legacyCategoryName && categoryMetadata.legacyCategoryName.length) { // Only add if we have the legacy property name\r\n if (categoryMetadata.dataType === \"stringArray\") {\r\n if ((consumerSearchCriteria[categoryName] as string[]) &&\r\n (consumerSearchCriteria[categoryName] as string[]).length) {\r\n (consumerSearchCriteria[categoryName] as string[]).forEach((facetValue: string) => {\r\n b2bQS += buildSingleFacetQueryString(facetIndex++, categoryMetadata.legacyCategoryName[0], \"OR\", mapConsumerValueToB2B(categoryName, facetValue, productType), facetValue);\r\n });\r\n }\r\n } else if (categoryMetadata.dataType === \"boolean\") { // Booleans should only have one facet per category\r\n if ((consumerSearchCriteria[categoryName] as boolean)) {\r\n b2bQS += buildSingleFacetQueryString(facetIndex++, categoryMetadata.legacyCategoryName[0], \"OR\", \"true\", categoryMetadata.facets[0]);\r\n }\r\n } else if (categoryMetadata.dataType === \"string\") {\r\n if ((consumerSearchCriteria[categoryName] as string)) {\r\n b2bQS += `&${categoryMetadata.legacyCategoryName[0]}=${encodeURIComponent(consumerSearchCriteria[categoryName] as string)}`;\r\n }\r\n }\r\n }\r\n }\r\n\r\n b2bQS += `&SortType=${consumerSearchCriteria.sortBy}`;\r\n\r\n return `${baseLink}${b2bQS}`;\r\n}\r\n\r\n\r\n\r\n/**\r\n * Removes the selected search criteria (string or string array item) from the supplied object and returns the modified object\r\n * @param searchCriteria\r\n * @param searchCategory\r\n * @param searchValue\r\n */\r\nexport function removeItemFromCriteria(searchCriteria: ProductSearchCriteria, searchCategory: string, searchValue: string): ProductSearchCriteria {\r\n if (typeof searchCriteria[searchCategory] === \"string\") {\r\n (searchCriteria[searchCategory]) = \"\";\r\n } else if (typeof searchCriteria[searchCategory] === \"boolean\") {\r\n (searchCriteria[searchCategory]) = null;\r\n } else if (typeof (searchCriteria[searchCategory] as string[]) === \"object\") {\r\n // It's an array\r\n (searchCriteria[searchCategory] as string[]) = (searchCriteria[searchCategory] as string[]).reduce((acc: string[], cur: string) => {\r\n if (cur !== searchValue) {\r\n acc.push(cur);\r\n }\r\n return acc;\r\n }, []);\r\n }\r\n\r\n return searchCriteria;\r\n}\r\n\r\n\r\n\r\n/**\r\n * Toggles the product search filter panel open and closed\r\n */\r\nexport function toggleProductSearchPanel(doOpen = false): void {\r\n const panel = document.getElementById(\"search-filters-panel\");\r\n const readContainer = document.getElementById(\"filter-read\");\r\n if (doOpen) {\r\n panel.classList.remove(\"d-none\");\r\n readContainer.classList.add(\"d-none\");\r\n } else {\r\n panel.classList.add(\"d-none\");\r\n readContainer.classList.remove(\"d-none\");\r\n }\r\n}\r\n\r\n\r\n\r\n/**\r\n * Tracks the click on the legacy catalog link\r\n * @param productType\r\n * @param link\r\n */\r\nexport function trackLegacyCatalogClick(): boolean {\r\n return true;\r\n}\r\n\r\n\r\n\r\n/**\r\n * Some Consumer facet values are different than the Solr values that B2B uses, this translates them.\r\n * @param consumerValue\r\n */\r\nexport function mapConsumerValueToB2B(consumerCategory: string, consumerValue: string, catalogType: ProductType): string {\r\n let returnVal = consumerValue;\r\n\r\n if ((catalogType === ProductType.CRUISES || catalogType === ProductType.TOURS)\r\n && consumerCategory === \"virtuosoExclusives\"\r\n && consumerValue === \"Promotion(s) Available\") {\r\n returnVal = `Promotions ${virtuosoUser.userRegionId} ${virtuosoUser.isoCode}`;\r\n } else if (catalogType === ProductType.CRUISES && consumerCategory === \"virtuosoExclusives\" && consumerValue === \"Cruise Benefits\") {\r\n returnVal = `Virtuoso Voyages ${virtuosoUser.userRegionId} ${virtuosoUser.isoCode}`;\r\n }\r\n\r\n return returnVal;\r\n}\r\n\r\nexport function initProductSearchOmnibox(input: HTMLInputElement, autoCompleteType: ProductType, selectCallback?: (arg1: string, arg2: string) => void, clearCallback?: () => void): void {\r\n const companyType = (autoCompleteType === ProductType.CRUISES) ? \"cruise line\" : (autoCompleteType === ProductType.HOTELS) ? \"hotel\" : \"company\";\r\n\r\n const searchCategories = [\"all fields\", \"city\", \"country\", `${companyType} name`];\r\n\r\n const executeOnSelect = (item: OmniboxAutoCompleteResponseItem): void => {\r\n selectCallback(item.category, item.searchTerm);\r\n };\r\n\r\n const autoCompleteConfig: OmniboxAutoCompleteConfig<OmniboxAutoCompleteResponseItem> = {\r\n input: input,\r\n selectCallback: executeOnSelect,\r\n clearCallback: clearCallback,\r\n categories: searchCategories,\r\n customize: (input: HTMLInputElement, inputRect: DOMRect, container: HTMLDivElement) => {\r\n container.style.right = \"0\";\r\n container.style.left = \"auto\";\r\n container.style.top = `${inputRect.height}px`;\r\n input.style.borderRightWidth = \"1px\";\r\n input.insertAdjacentElement(\"afterend\", container);\r\n }\r\n };\r\n\r\n initOmniBoxAutoComplete<OmniboxAutoCompleteResponseItem>(autoCompleteConfig);\r\n}\r\n\r\n/**\r\n * Given the destination's property tile selectedFacets, returns the BOB catalog params\r\n * @param sf\r\n */\r\nexport function buildConsumerFacets(sf: DestinationSelectedFacets[]): string {\r\n let params = \"\";\r\n let separator = \"\";\r\n\r\n sf.forEach((facet) => {\r\n params += `${separator}${translateB2BFacetToConsumer(facet.category)}=${encodeURIComponent(facet.name)}`;\r\n separator = \"&\";\r\n });\r\n\r\n return params;\r\n}\r\n\r\n\r\n\r\n/**\r\n * Translates the destination's property tile facet categories to the Consumer values\r\n * @param facetName\r\n */\r\nexport function translateB2BFacetToConsumer(facetName: string): string {\r\n const translatedName = facetName || \"\";\r\n\r\n if (facetName) {\r\n for (const productType in facetsByProduct) {\r\n const foundCategory = facetsByProduct[productType as ProductType].find((category: ProductSearchConfig) => {\r\n if (category.legacyCategoryName && category.legacyCategoryName.length) {\r\n return category.legacyCategoryName.includes(facetName);\r\n }\r\n return false;\r\n });\r\n if (foundCategory && foundCategory.categoryName) {\r\n return foundCategory.categoryName;\r\n }\r\n }\r\n\r\n }\r\n\r\n return translatedName;\r\n}\r\n\r\nexport function getProductDefaultSort(catalogType: ProductType) {\r\n let defaultSort = \"HotelNameAsc\";\r\n\r\n if (catalogType === ProductType.ADVISORS) {\r\n defaultSort = \"LeadGenDesc\";\r\n } else if (catalogType === ProductType.CRUISES) {\r\n defaultSort = \"CruiseTravelDateAsc\";\r\n } else if (catalogType === ProductType.TOURS) {\r\n defaultSort = \"TourTravelDateAsc\";\r\n }\r\n\r\n return defaultSort;\r\n}\r\n\r\nexport function generateProductFilterHash(catalogType: ProductType, searchCriteria: ProductSearchCriteria, pagingOptions?: ProductSearchPagingOptions) {\r\n const productFacets = facetsByProduct[catalogType];\r\n\r\n let queryParams = [];\r\n\r\n if (pagingOptions?.currentPage && pagingOptions?.currentPage > 1) {\r\n queryParams.push(`page=${pagingOptions?.currentPage}`);\r\n }\r\n\r\n if (pagingOptions?.scrollToId) {\r\n queryParams.push(`productId=${pagingOptions?.scrollToId}`);\r\n }\r\n\r\n if (searchCriteria?.productsIds && searchCriteria?.productsIds.length) {\r\n queryParams.push(`productsIds=${searchCriteria?.productsIds.join(\",\")}`);\r\n }\r\n\r\n productFacets.forEach((category: ProductSearchConfig) => {\r\n if (category.dataType === \"stringArray\") {\r\n\r\n const selectedValues: string[] = [];\r\n\r\n if (searchCriteria[category.categoryName] && (searchCriteria[category.categoryName] as string[]).length) {\r\n (searchCriteria[category.categoryName] as string[]).forEach((facetValue: string) => {\r\n if (facetValue && facetValue !== \"\") {\r\n selectedValues.push(encodeURIComponent(facetValue));\r\n }\r\n });\r\n }\r\n\r\n if (selectedValues.length) {\r\n queryParams.push(`${category.categoryName}=${selectedValues.join(\"|\")}`);\r\n }\r\n } else if (category.dataType === \"string\") {\r\n if (searchCriteria[category.categoryName] && searchCriteria[category.categoryName] !== \"\") {\r\n queryParams.push(`${category.categoryName}=${encodeURIComponent(searchCriteria[category.categoryName] as string)}`);\r\n }\r\n } else if (category.dataType === \"boolean\") {\r\n // \"boolean\" should only have one facet per category\r\n if (searchCriteria[category.categoryName]) {\r\n queryParams.push(`${category.categoryName}=true`);\r\n }\r\n }\r\n\r\n });\r\n\r\n if (searchCriteria?.sortBy && searchCriteria?.sortBy !== \"\") {\r\n queryParams.push(`sort=${searchCriteria.sortBy}`);\r\n }\r\n\r\n // If it's ONLY the default sort value, don't stick that up there, it's ugly.\r\n if (queryParams.length === 1 && queryParams[0] === `sort=${getProductDefaultSort(catalogType)}`) {\r\n queryParams = [];\r\n }\r\n\r\n return queryParams.join(\"&\");\r\n}","import { FeatureCard } from \"interfaces/card\";\r\nimport { DestinationSelectedFacets, DestinationTile } from \"interfaces/destination\";\r\nimport { ProductType } from \"interfaces/enums\";\r\nimport { SolrLocation } from \"interfaces/map\";\r\nimport { generateCmsImageUrl, getRandomImage } from \"services/helpers/images\";\r\nimport { isProductionEnvironment } from \"services/layout/environment\";\r\nimport { buildConsumerFacets } from \"services/search/product-search\";\r\nimport * as virtuosoSharedHeader from \"virtuoso-shared-web-ui\";\r\n\r\n\r\n/**\r\n * Returns cobranded URL for the supplied destination tag, also supporting Arbitrary Destination URLs\r\n * @param destinationTag - formatted |region|country|optional-state|city\r\n * @param isArbitraryDestination - true when destination is manually set as an Arbitrary Destination in dotCMS\r\n */\r\nexport function buildDestinationPageURL(destinationTag: string, isArbitraryDestination: boolean = false): string {\r\n if (!destinationTag) {\r\n return \"\";\r\n }\r\n const basepath = (isArbitraryDestination) ? \"/travel/destinationregions\" : \"/travel/destinations\";\r\n return virtuosoSharedHeader.cobrandLink(basepath + destinationTag.replace(/\\|/g, \"/\"));\r\n}\r\n\r\n// All of these functions take an array of destination levels, based on the URL, e.g. /north-america/united-states/tennessee/nashville\r\n// 1 = Region, 2 = Country, 3 = State OR City, 4 = City\r\nexport function isRegion(destinationParts: string[]): boolean {\r\n if (destinationParts && destinationParts.length) {\r\n return (destinationParts.length === 1);\r\n }\r\n return false;\r\n}\r\n\r\nexport function isCountry(destinationParts: string[]): boolean {\r\n if (destinationParts && destinationParts.length) {\r\n return (destinationParts.length === 2);\r\n }\r\n return false;\r\n}\r\n\r\nexport function isState(destinationParts: string[]): boolean {\r\n if (destinationParts && destinationParts.length) {\r\n return (destinationParts.length === 3 && hasStates(destinationParts));\r\n }\r\n return false;\r\n}\r\n\r\nexport function isCity(destinationParts: string[]): boolean {\r\n if (destinationParts && destinationParts.length) {\r\n return ((destinationParts.length === 3 && !hasStates(destinationParts)) || destinationParts.length === 4);\r\n }\r\n return false;\r\n}\r\n\r\nexport function hasStates(destinationParts: string[]): boolean {\r\n if (destinationParts && destinationParts.length) {\r\n return (destinationParts.length >= 2 && destinationParts[1] === \"united-states\");\r\n }\r\n return false;\r\n\r\n}\r\n\r\nexport function getRegion(destinationParts: string[]): string {\r\n return (destinationParts && destinationParts.length >= 1) ? destinationParts[0] : \"\";\r\n}\r\n\r\nexport function getCountry(destinationParts: string[]): string {\r\n return (destinationParts && destinationParts.length >= 2) ? destinationParts[1] : \"\";\r\n}\r\n\r\nexport function getState(destinationParts: string[]): string {\r\n return (destinationParts && destinationParts.length >= 3 && hasStates(destinationParts)) ? destinationParts[2] : \"\";\r\n}\r\n\r\nexport function getCity(destinationParts: string[]): string {\r\n let cityName = \"\";\r\n if (destinationParts && destinationParts.length >= 3) {\r\n if (isCity(destinationParts)) {\r\n cityName = (hasStates(destinationParts)) ? destinationParts[3] : destinationParts[2];\r\n }\r\n }\r\n return cityName;\r\n}\r\n\r\nexport function isDestinationHubEnabled(useHub: boolean, hubPath: string, isLive: boolean): boolean {\r\n\r\n if (hubPath && useHub) {\r\n if ((isLive && isProductionEnvironment()) || (!isProductionEnvironment())) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n}\r\n\r\n/**\r\n * Returns formatted city, state country. State only shown for US/CAN.\r\n * @param locCity\r\n * @param locState\r\n * @param locCountry\r\n */\r\nexport function formatLocation(locCity: string, locState: string, locCountry: string): string {\r\n let loc = \"\";\r\n const shouldShowCity: boolean = (locCity && locCity !== \"\") ? true : false;\r\n const hasState: boolean = (locState && locState !== \"\") ? true : false;\r\n const shouldShowCountry: boolean = (locCountry && locCountry !== \"\") ? true : false;\r\n const shouldShowState: boolean = (hasState && shouldShowCountry && (locCountry === \"United States\" || locCountry === \"Canada\")) ? true : false;\r\n\r\n if (shouldShowCity) {\r\n loc = (shouldShowState || shouldShowCountry) ? locCity + \", \" : locCity;\r\n }\r\n if (shouldShowState) {\r\n loc += (shouldShowCountry) ? locState + \", \" : locState;\r\n }\r\n if (shouldShowCountry) {\r\n loc += locCountry;\r\n }\r\n\r\n return loc;\r\n}\r\n\r\n/**\r\n * Returns the Country from a location string.\r\n * @param location - a string representation of a location (i.e. East Greenbush, NY United States)\r\n */\r\nexport function extractCountryFromLocationString(location: string): string {\r\n // Regex to match the country name at the end of the string, if 2 letters appears before the country, it's assumed to be a state abbreviation and is ignored\r\n const regex = /(?:,\\s*[A-Za-z]{2}\\s+|\\s+)([A-Za-z\\s]+)$/;\r\n const match = location.match(regex);\r\n return match ? match[1].trim() : \"\";\r\n}\r\n\r\n/**\r\n * Given an object of formatted names from the 4 levels, returns formatted location name based on what was passed in:\r\n * RegionName\r\n * CountryName\r\n * StateRegion (Artibtrary Destination)\r\n * StateName, CountryName (US only)\r\n * StateName (if ONLY state passed in)\r\n * CityName, StateName, CountryName (US only)\r\n * CityName, StateName (if no country is passed in)\r\n * CityName, CountryName (non-US only)\r\n * CityName (if no state or country is passed in)\r\n * @param loc\r\n */\r\nexport function formatSolrLocation(loc: SolrLocation): string {\r\n let formattedLocation = \"\";\r\n\r\n if (loc) {\r\n if (loc.city) {\r\n formattedLocation = loc.city;\r\n formattedLocation += ((loc.state && loc.country === \"United States\") || (loc.state && !loc.country)) ? `, ${loc.state}` : \"\";\r\n formattedLocation += (loc.country) ? `, ${loc.country}` : \"\";\r\n } else if ((loc.state && loc.country === \"United States\") || (loc.state && !loc.country)) {\r\n formattedLocation = loc.state;\r\n formattedLocation += (loc.country) ? `, ${loc.country}` : \"\";\r\n if (loc.stateRegion) {\r\n formattedLocation = `${loc.stateRegion}, ${formattedLocation}`;\r\n }\r\n } else if (loc.country) {\r\n if (loc.stateRegion) {\r\n formattedLocation = `${loc.stateRegion}, ${loc.country}`;\r\n } else {\r\n formattedLocation = loc.country;\r\n }\r\n } else if (loc.region) {\r\n if (loc.stateRegion) {\r\n formattedLocation = `${loc.stateRegion}, ${loc.region}`;\r\n } else {\r\n formattedLocation = loc.region;\r\n }\r\n } else if (loc.stateRegion) {\r\n formattedLocation = loc.stateRegion;\r\n }\r\n }\r\n\r\n return formattedLocation;\r\n}\r\n\r\n/**\r\n * Extracts destination hub tags from a string of tags.\r\n * @param destinationHubTags A string containing destination hub tags separated by commas.\r\n * @returns An array of destination hub tags.\r\n */\r\nexport function getDestinationHubDestinationTags(destinationTags: string | undefined): string[] {\r\n if (destinationTags === undefined) {\r\n return [];\r\n }\r\n\r\n return destinationTags.split(\",\")\r\n .filter(tag => tag.startsWith(\"destination-hub:\"))\r\n .map(hubTag => hubTag.replace(\"destination-hub:\", \"\"));\r\n\r\n}\r\n\r\nexport function buildFacetedProductSearchUrl(productType: ProductType, selectedFacets: DestinationSelectedFacets[]): string {\r\n const facets = buildConsumerFacets(selectedFacets);\r\n const urlPrependText = productType === ProductType.ADVISORS ? \"\" : \"luxury-\";\r\n\r\n return virtuosoSharedHeader.cobrandLink(`/travel/${urlPrependText}${productType}/search#${facets}`);\r\n\r\n}\r\n\r\nexport function buildProductCatalogTile(productType: ProductType, tile: DestinationTile): FeatureCard {\r\n const catalogLink = buildFacetedProductSearchUrl(productType, tile.selectedFacets);\r\n\r\n return {\r\n imageUrl: generateCmsImageUrl(getRandomImage(`/images/destinations/catalog-${productType}_`, \".jpg\", 10)),\r\n name: productType[0].toUpperCase() + productType.slice(1),\r\n url: catalogLink\r\n };\r\n}\r\n"],"names":["isEmbeddedMode","isMobileScreenWidth","isProductionEnvironment","urlHost","getDashboardUrl","buildSingleFacetQueryString","qsIndex","qsCategory","qsOperator","qsName","qsDisplayName","qsSelected","qsIsInterval","qs","getLegacyCatalogLink","consumerSearchCriteria","productType","baseLink","b2bQS","facetIndex","categoryName","categoryMetadata","facetsByProduct","thisCat","facetValue","mapConsumerValueToB2B","removeItemFromCriteria","searchCriteria","searchCategory","searchValue","acc","cur","toggleProductSearchPanel","doOpen","panel","readContainer","trackLegacyCatalogClick","consumerCategory","consumerValue","catalogType","returnVal","ProductType","virtuosoUser","initProductSearchOmnibox","input","autoCompleteType","selectCallback","clearCallback","searchCategories","initOmniBoxAutoComplete","item","inputRect","container","buildConsumerFacets","sf","params","separator","facet","translateB2BFacetToConsumer","facetName","translatedName","foundCategory","category","getProductDefaultSort","defaultSort","generateProductFilterHash","pagingOptions","productFacets","queryParams","selectedValues","buildDestinationPageURL","destinationTag","isArbitraryDestination","virtuosoSharedHeader.cobrandLink","isRegion","destinationParts","isCountry","isState","hasStates","isCity","isDestinationHubEnabled","useHub","hubPath","isLive","formatLocation","locCity","locState","locCountry","loc","shouldShowCity","hasState","shouldShowCountry","shouldShowState","extractCountryFromLocationString","location","regex","match","formatSolrLocation","formattedLocation","buildFacetedProductSearchUrl","selectedFacets","facets","urlPrependText","buildProductCatalogTile","tile","catalogLink","generateCmsImageUrl","getRandomImage"],"mappings":"yFAKO,SAASA,GAA0B,CAC9B,MAAA,SAAO,SAAS,cAC5B,CASO,SAASC,GAA+B,CAC3C,OAAO,OAAO,YAAc,GAChC,CAKO,SAASC,EAAwBC,EAAkB,OAAO,SAAS,SAAmB,CACzF,OAAOA,IAAY,kBACvB,CAuBO,SAASC,EAAgBD,EAAkB,OAAO,SAAS,SAAkB,CAEhF,OAAIA,IAAY,mBACL,0BAGPA,IAAY,mBACL,8BAGP,gCAAgC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