PageSourceSearch

https://assets.bbb.org/header-footer/8f221d988ef29c230549c78e8c79e311a2e81fd5/assets/js/scripts-for-search.js

js bbb.org collected 2026-09-24 07:34:02 UTC 44,653 bytes, 493 lines download raw bytes

1import { B as BaseAutocomplete, g as getCookie, s as setCookie, a as BaseCustomSelect, c as countries } from "./BaseAutocomplete.js";
2function getPopularCategoryIcon(categoryName) {
3  switch (categoryName) {
4    case "bathroom remodel":
5      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 512 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M96 77.3C96 70 101.9 64 109.3 64c3.5 0 6.9 1.4 9.4 3.9l14.9 14.9c-3.6 9-5.6 18.9-5.6 29.2 0 19.9 7.2 38 19.2 52-5.3 9.2-4 21.1 3.8 29 9.4 9.4 24.6 9.4 33.9 0L289 89c9.4-9.4 9.4-24.6 0-33.9-7.9-7.9-19.8-9.1-29-3.8C246 39.2 227.9 32 208 32c-10.3 0-20.2 2-29.2 5.5l-14.9-14.9C149.4 8.1 129.7 0 109.3 0 66.6 0 32 34.6 32 77.3V256c-17.7 0-32 14.3-32 32s14.3 32 32 32h448c17.7 0 32-14.3 32-32s-14.3-32-32-32H96V77.3zM32 352v16c0 28.4 12.4 54 32 71.6V480c0 17.7 14.3 32 32 32s32-14.3 32-32v-16h256v16c0 17.7 14.3 32 32 32s32-14.3 32-32v-40.4c19.6-17.6 32-43.1 32-71.6v-16H32z"></path></svg>`;
6    case "carpet cleaning":
7    case "janitor service":
8    case "home cleaning":
9    case "house cleaning":
10      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 640 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M301.6 64H512c35.3 0 64 28.7 64 64 0 21.9-11 41.2-27.8 52.8-34.4-32.7-81-52.8-132.2-52.8-35.3 0-64 28.7-64 64v100c10.2-2.6 21-4 32-4 70.7 0 128 57.3 128 128 0 38.2-16.8 72.5-43.3 96H544c35.3 0 64-28.7 64-64V320c0-31.7-7.7-61.7-21.3-88C619 208.7 640 170.8 640 128 640 57.3 582.7 0 512 0H301.6c-60.3 0-112.5 42.2-125.2 101.2L150.1 224h65.5L239 114.6c6.4-29.5 32.4-50.6 62.6-50.6zm-92.9 192h-65.4L109 416H83.8c-33.8 0-64.7 18.9-80 49-2.4 4.5-3.8 9.6-3.8 15 0 17.7 14.3 32 32 32h144c26.5 0 48-21.5 48-48s-21.5-48-48-48h-1.6l34.3-160zM480 416a96 96 0 1 0-192 0 96 96 0 1 0 192 0zm-128 0a32 32 0 1 1 64 0 32 32 0 1 1-64 0z"></path></svg>`;
11    case "concrete contractors":
12      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 177.66 120.63" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M123.62 64.72 177.66 0H37.9l20.13 40.55 65.59 24.17zM143.9 70.41A25.11 25.11 0 1 0 169 95.52a25.11 25.11 0 0 0-25.1-25.11Zm0 36a10.9 10.9 0 1 1 10.9-10.89 10.9 10.9 0 0 1-10.9 10.89Z"></path><path d="M127.45 93.87 41.87 56.8 16.89 10.05H0V0h22.91l26.18 48.96 82.35 35.68-3.99 9.23z"></path></svg>`;
13    case "contractor":
14    case "drywall contractor":
15    case "general contractor":
16      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 512 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M176 88v40h160V88c0-4.4-3.6-8-8-8H184c-4.4 0-8 3.6-8 8zm-48 40V88c0-30.9 25.1-56 56-56h144c30.9 0 56 25.1 56 56v40h28.1c12.7 0 24.9 5.1 33.9 14.1l51.9 51.9c9 9 14.1 21.2 14.1 33.9V304H384v-16c0-17.7-14.3-32-32-32s-32 14.3-32 32v16H192v-16c0-17.7-14.3-32-32-32s-32 14.3-32 32v16H0v-76.1C0 215.2 5.1 203 14.1 194L66 142.1c9-9 21.2-14.1 33.9-14.1H128zM0 416v-80h128v16c0 17.7 14.3 32 32 32s32-14.3 32-32v-16h128v16c0 17.7 14.3 32 32 32s32-14.3 32-32v-16h128v80c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64z"></path></svg>`;
17    case "dentist":
18      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 448 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M186.1 52.1c-16.8-13-37.4-20.1-58.6-20.1C74.7 32 32 74.7 32 127.5v6.2c0 15.8 3.7 31.3 10.7 45.5l23.5 47.1c4.5 8.9 7.6 18.4 9.4 28.2l36.7 205.8c2 11.2 11.6 19.4 22.9 19.8s21.4-7.4 24-18.4l28.9-121.3C192.2 323.7 207 312 224 312s31.8 11.7 35.8 28.3l28.9 121.3c2.6 11.1 12.7 18.8 24 18.4s20.9-8.6 22.9-19.8l36.7-205.8c1.8-9.8 4.9-19.3 9.4-28.2l23.5-47.1c7.1-14.1 10.7-29.7 10.7-45.5v-2.1c0-55-44.6-99.6-99.6-99.6-24.1 0-47.4 8.8-65.6 24.6l-3.2 2.8L267 74.5c7 5.4 8.2 15.5 2.8 22.5s-15.5 8.2-22.5 2.8l-24.4-19-37-28.8z"></path></svg>`;
19    case "dog":
20      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 576 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="m309.6 158.5 23.1-138.7C334.6 8.4 344.5 0 356.1 0c7.5 0 14.5 3.5 19 9.5L392 32h52.1c12.7 0 24.9 5.1 33.9 14.1L496 64h56c13.3 0 24 10.7 24 24v24c0 44.2-35.8 80-80 80h-69.3l-5.1 30.5-112-64zM416 256.1V480c0 17.7-14.3 32-32 32h-32c-17.7 0-32-14.3-32-32V364.8c-24 12.3-51.2 19.2-80 19.2s-56-6.9-80-19.2V480c0 17.7-14.3 32-32 32H96c-17.7 0-32-14.3-32-32V249.8c-28.8-10.9-51.4-35.3-59.2-66.5L1 167.8c-4.3-17.1 6.1-34.5 23.3-38.8s34.5 6.1 38.8 23.3l3.9 15.5C70.5 182 83.3 192 98 192h205.8L416 256.1zM464 80a16 16 0 1 0-32 0 16 16 0 1 0 32 0z"></path></svg>`;
21    case "fence contractors":
22      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewB
22ox="0 0 48 36" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M13.81 6.603a54.745 54.745 0 0 1-3.4-6.054A1.288 1.288 0 0 0 9.364 0C8.95 0 8.56.204 8.315.549a54.844 54.844 0 0 1-3.26 6.054 1.56 1.56 0 0 0 0 .823v26.976C5 35.197 5.552 35.899 6.313 36h6.426c.76-.1 1.313-.803 1.257-1.598V7.426a2.151 2.151 0 0 0-.186-.823zm15.148 0A53.913 53.913 0 0 1 25.09.55 1.349 1.349 0 0 0 24 0c-.433 0-.84.205-1.09.55a53.913 53.913 0 0 1-3.868 6.053 2.035 2.035 0 0 0 0 .824v26.975c-.06.795.529 1.497 1.339 1.598h7.189c.83-.077 1.445-.786 1.388-1.598V7.427a2.035 2.035 0 0 0 0-.824zm13.717 0A55.093 55.093 0 0 1 39.459.549 1.266 1.266 0 0 0 38.426 0c-.408 0-.791.204-1.034.549a54.96 54.96 0 0 1-3.353 6.054 2.193 2.193 0 0 0 0 .823v26.976c-.055.795.49 1.497 1.24 1.598h6.477c.75-.1 1.295-.803 1.24-1.598V7.426a1.546 1.546 0 0 0-.321-.823z"></path><path d="M1.44 25h45.12c.785.026 1.415.683 1.44 1.5 0 .828-.645 1.5-1.44 1.5H1.44C.645 28 0 27.328 0 26.5c.025-.817.655-1.474 1.44-1.5zm0-16h45.12c.785.026 1.415.683 1.44 1.5 0 .828-.645 1.5-1.44 1.5H1.44C.645 12 0 11.328 0 10.5.025 9.683.655 9.026 1.44 9z"></path></svg>`;
23    case "garage door repair":
24    case "garage door services":
25      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 640 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M0 488V171.3c0-26.2 15.9-49.7 40.2-59.4L308.1 4.8c7.6-3.1 16.1-3.1 23.8 0l267.9 107.1c24.3 9.7 40.2 33.3 40.2 59.4V488c0 13.3-10.7 24-24 24h-48c-13.3 0-24-10.7-24-24V224c0-17.7-14.3-32-32-32H128c-17.7 0-32 14.3-32 32v264c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24zm254.3-194.6L242.2 328h155.6l-12.1-34.6c-1.1-3.2-4.2-5.4-7.6-5.4H261.8c-3.4 0-6.4 2.2-7.6 5.4zM188.9 335l20.1-57.5c7.9-22.5 29.1-37.5 52.9-37.5h116.3c23.8 0 45 15.1 52.9 37.5l20 57.5c17.2 9.5 28.9 27.9 28.9 49v96c0 17.7-14.3 32-32 32s-32-14.3-32-32v-16H224v16c0 17.7-14.3 32-32 32s-32-14.3-32-32v-96c0-21.1 11.7-39.5 28.9-49zm51.1 89a24 24 0 1 0 0-48 24 24 0 1 0 0 48zm184-24a24 24 0 1 0-48 0 24 24 0 1 0 48 0z"></path></svg>`;
26    case "handyman":
27      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 512 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M78.6 5c-9.5-7.4-23-6.5-31.6 2L7 47c-8.5 8.5-9.4 22-2.1 31.6l80 104c4.5 5.9 11.6 9.4 19 9.4H158l109 109c-14.7 29-10 65.4 14.3 89.6l112 112c12.5 12.5 32.8 12.5 45.3 0l64-64c12.5-12.5 12.5-32.8 0-45.3l-112-112c-24.2-24.2-60.6-29-89.6-14.3L192 158v-54c0-7.5-3.5-14.5-9.4-19L78.6 5zM19.9 396.1C7.2 408.8 0 426.1 0 444.1 0 481.6 30.4 512 67.9 512c18 0 35.3-7.2 48-19.9l117.8-117.8c-7.8-20.9-9-43.6-3.6-65.1l-61.7-61.7L19.9 396.1zM512 144c0-10.5-1.1-20.7-3.2-30.5-2.4-11.2-16.1-14.1-24.2-6l-63.9 63.9c-3 3-7.1 4.7-11.3 4.7H352c-8.8 0-16-7.2-16-16v-57.5c0-4.2 1.7-8.3 4.7-11.3l63.9-63.9c8.1-8.1 5.2-21.8-6-24.2C388.7 1.1 378.5 0 368 0c-79.5 0-144 64.5-144 144v.8l85.3 85.3c36-9.1 75.8.5 104 28.7l15.7 15.7c49-23 83-72.8 83-130.5zM56 432a24 24 0 1 1 48 0 24 24 0 1 1-48 0z"></path></svg>`;
28    case "health":
29      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 576 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M575.8 255.5c0 18-15 32.1-32 32.1h-32l.7 160.2c.2 35.5-28.5 64.3-64 64.3H128.1c-35.3 0-64-28.7-64-64V287.6H32c-18 0-32-14-32-32.1 0-9 3-17 10-24L266.4 8c7-7 15-8 22-8s15 2 21 7L416 100.7V64c0-17.7 14.3-32 32-32h32c17.7 0 32 14.3 32 32v121l52.8 46.4c8 7 12 15 11 24zM272 192c-8.8 0-16 7.2-16 16v48h-48c-8.8 0-16 7.2-16 16v32c0 8.8 7.2 16 16 16h48v48c0 8.8 7.2 16 16 16h32c8.8 0 16-7.2 16-16v-48h48c8.8 0 16-7.2 16-16v-32c0-8.8-7.2-16-16-16h-48v-48c0-8.8-7.2-16-16-16h-32z"></path></svg>`;
30    case "heating and air conditioning":
31      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 384 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="m372.5 256.5-.7-1.9C337.8 160.8 282 76.5 209.1 8.5l-3.3-3C202.1 2 197.1 0 192 0s-10.1 2-13.8 5.5l-3.3 3C102 76.5 46.2 160.8 12.2 254.6l-.7 1.9C3.9 277.3 0 299.4 0 321.6 0 426.7 86.8 512 192 512s192-85.3 192-190.4c0-22.2-3.9-44.2-11.5-65.1zM281.7 306a73.3 73.3 0 0 1 6.2 29.5c0 53-43 96.5-96 96.5s-96-43.5-96-96.5c0-10.1 2.1-20.3 6.2-29.5l1.9-4.3c15.8-35.4 37.9-67.7 65.3-95.1l8.9-8.9c3.6-3.6 8.5-5.6 13.6-5.6s10 2 13.6 5.6l8.9 8.9c27.4 27.4 49.6 59.7 65.3 95.1l1.9 4.3z"></path></svg>`;
32    case "home improvement":
33    case "remodel contractors":
34    case "remodeling":
35      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewB
35ox="0 0 512 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M0 32v416c0 35.3 28.7 64 64 64h416c17.7 0 32-14.3 32-32v-2.7c0-8.5-3.4-16.6-9.4-22.6l-51.3-51.3-24 24c-6.2 6.2-16.4 6.2-22.6 0s-6.2-16.4 0-22.6l24-24-57.4-57.4-24 24c-6.2 6.2-16.4 6.2-22.6 0s-6.2-16.4 0-22.6l24-24-57.4-57.4-24 24c-6.2 6.2-16.4 6.2-22.6 0s-6.2-16.4 0-22.6l24-24-57.4-57.4-24 24c-6.2 6.2-16.4 6.2-22.6 0s-6.2-16.4 0-22.6l24-24-57.4-57.5-24 24c-6.2 6.2-16.4 6.2-22.6 0s-6.2-16.4 0-22.6l24-24L57.4 9.4c-6-6-14.2-9.4-22.7-9.4H32C14.3 0 0 14.3 0 32zm128 224 128 128H128V256z"></path></svg>`;
36    case "hvac":
37      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 576 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M64 0C28.7 0 0 28.7 0 64v96c0 35.3 28.7 64 64 64h448c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64H64zm16 128h416c8.8 0 16 7.2 16 16s-7.2 16-16 16H80c-8.8 0-16-7.2-16-16s7.2-16 16-16zm176 128h-64v160c0 17.7-14.3 32-32 32s-32-14.3-32-32c0-11.8 6.4-22.2 16-27.7 15.3-8.9 20.5-28.4 11.7-43.7s-28.4-20.5-43.7-11.7c-28.6 16.5-48 47.5-48 83.1 0 53 43 96 96 96s96-43 96-96V256zm64 128c0 53 43 96 96 96s96-43 96-96c0-35.6-19.4-66.6-48-83.1-15.3-8.8-34.9-3.6-43.7 11.7s-3.6 34.9 11.7 43.7c9.6 5.6 16 15.9 16 27.7 0 17.7-14.3 32-32 32s-32-14.3-32-32V256h-64v128z"></path></svg>`;
38    case "insurance":
39      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 512 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M269.4 2.9C265.2 1 260.7 0 256 0s-9.2 1-13.4 2.9L54.3 82.8c-22 9.3-38.4 31-38.3 57.2.5 99.2 41.3 280.7 213.6 363.2 16.7 8 36.1 8 52.8 0C454.7 420.7 495.5 239.2 496 140c.1-26.2-16.3-47.9-38.3-57.2L269.4 2.9zM369 209 241 337c-9.4 9.4-24.6 9.4-33.9 0l-64-64c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l47 47L335 175c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9z"></path></svg>`;
40    case "landing contractors":
41      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 512 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M288 281.3c9.8 4.3 20.6 6.7 32 6.7 44.2 0 80-35.8 80-80 0-26.2-12.6-49.4-32-64 19.4-14.6 32-37.8 32-64 0-44.2-35.8-80-80-80-26.2 0-49.4 12.6-64 32-14.6-19.4-37.8-32-64-32-44.2 0-80 35.8-80 80 0 26.2 12.6 49.4 32 64-19.4 14.6-32 37.8-32 64 0 44.2 35.8 80 80 80 11.4 0 22.2-2.4 32-6.7v113.5C192.1 349.5 139.5 320 80 320H29.5C13.2 320 0 333.2 0 349.5 0 439.3 72.7 512 162.5 512h187c89.8 0 162.5-72.7 162.5-162.5 0-16.3-13.2-29.5-29.5-29.5H432c-59.5 0-112.1 29.5-144 74.8V281.3zM208 144a48 48 0 1 1 96 0 48 48 0 1 1-96 0z"></path></svg>`;
42    case "mason contractors":
43      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 448 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M0 64c0-17.7 14.3-32 32-32h384c17.7 0 32 14.3 32 32v64c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32V64zm32 128h96v128H32V192zm384 0v128H160V192h256zM288 352v128H32V352h256zm128 0v128h-96V352h96z"></path></svg>`;
44    case "movers companies":
45    case "moving companies":
46      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 640 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M48 0C21.5 0 0 21.5 0 48v320c0 26.5 21.5 48 48 48h16c0 53 43 96 96 96s96-43 96-96h128c0 53 43 96 96 96s96-43 96-96h32c17.7 0 32-14.3 32-32s-14.3-32-32-32V237.3c0-17-6.7-33.3-18.7-45.3L512 114.7c-12-12-28.3-18.7-45.3-18.7H416V48c0-26.5-21.5-48-48-48H48zm368 160h50.7l77.3 77.3V256H416v-96zM112 416a48 48 0 1 1 96 0 48 48 0 1 1-96 0zm368-48a48 48 0 1 1 0 96 48 48 0 1 1 0-96z"></path></svg>`;
47    case "painting contractors":
48      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 384 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M162.4 6c-1.5-3.6-5-6-8.9-6h-19c-3.9 0-7.5 2.4-8.9 6l-20.7 51.7c-3.2 8-14.6 8-17.8 0L66.4 6c-1.5-3.6-5-6-8.9-6H48C21.5 0 0 21.5 0 48v208H384V48c0-26.5-21.5-48-48-48H230.5c-3.9 0-7.5 2.4-8.9 6l-20.7 51.7c-3.2 8-14.6 8-17.8 0L162.4 6zM0 288v32c0 35.3 28.7 64 64 64h64v64c0 35.3 28.7 64 64 64s64-28.7 64-64v-64h64c35.3 0 64-28.7 64-64v-32H0zm192 144a16 16 0 1 1 0 32 16 16 0 1 1 0-32z"></path></svg>`;
49    case "paving contractors":
50      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewB
50ox="0 0 576 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M208 64a48 48 0 1 1 96 0 48 48 0 1 1-96 0zM9.8 214.8c5.1-12.2 19.1-18 31.4-12.9l19.5 8.1 22.9-38.1C99.9 144.6 129.3 128 161 128c51.4 0 97 32.9 113.3 81.7l34.6 103.7 79.3 33.1 34.2-45.6c6.4-8.5 16.6-13.3 27.2-12.8s20.3 6.4 25.8 15.5l96 160c5.9 9.9 6.1 22.2.4 32.2S555.5 512 544 512H288c-11.1 0-21.4-5.7-27.2-15.2s-6.4-21.2-1.4-31.1l16-32c5.4-10.8 16.5-17.7 28.6-17.7h32l22.5-30L22.8 246.2c-12.2-5.1-18-19.1-12.9-31.4zm82.8 91.8 112 48c11.8 5 19.4 16.6 19.4 29.4v96c0 17.7-14.3 32-32 32s-32-14.3-32-32v-74.9l-60.6-26-37 111c-5.6 16.8-23.7 25.8-40.5 20.2s-25.8-23.7-20.3-40.4l48-144 11-33 32 13.7z"></path></svg>`;
51    case "pest control":
52      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 512 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M256 0c53 0 96 43 96 96v3.6c0 15.7-12.7 28.4-28.4 28.4H188.4c-15.7 0-28.4-12.7-28.4-28.4V96c0-53 43-96 96-96zM41.4 105.4c12.5-12.5 32.8-12.5 45.3 0l64 64c.7.7 1.3 1.4 1.9 2.1 14.2-7.3 30.4-11.4 47.5-11.4H312c17.1 0 33.2 4.1 47.5 11.4.6-.7 1.2-1.4 1.9-2.1l64-64c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3l-64 64c-.7.7-1.4 1.3-2.1 1.9 6.2 12 10.1 25.3 11.1 39.5H480c17.7 0 32 14.3 32 32s-14.3 32-32 32h-64c0 24.6-5.5 47.8-15.4 68.6 2.2 1.3 4.2 2.9 6 4.8l64 64c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0l-63.1-63.1c-24.5 21.8-55.8 36.2-90.3 39.6V240c0-8.8-7.2-16-16-16s-16 7.2-16 16v239.2c-34.5-3.4-65.8-17.8-90.3-39.6l-63 63c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l64-64c1.9-1.9 3.9-3.4 6-4.8C101.5 367.8 96 344.6 96 320H32c-17.7 0-32-14.3-32-32s14.3-32 32-32h64.3c1.1-14.1 5-27.5 11.1-39.5-.7-.6-1.4-1.2-2.1-1.9l-64-64c-12.5-12.5-12.5-32.8 0-45.3z"></path></svg>`;
53    case "plumbers":
54    case "plumbing":
55      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 512 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M352 320c88.4 0 160-71.6 160-160 0-15.3-2.2-30.1-6.2-44.2-3.1-10.8-16.4-13.2-24.3-5.3l-76.8 76.8c-3 3-7.1 4.7-11.3 4.7H336c-8.8 0-16-7.2-16-16v-57.4c0-4.2 1.7-8.3 4.7-11.3l76.8-76.8c7.9-7.9 5.4-21.2-5.3-24.3C382.1 2.2 367.3 0 352 0c-88.4 0-160 71.6-160 160 0 19.1 3.4 37.5 9.5 54.5L19.9 396.1C7.2 408.8 0 426.1 0 444.1 0 481.6 30.4 512 67.9 512c18 0 35.3-7.2 48-19.9l181.6-181.6c17 6.2 35.4 9.5 54.5 9.5zM80 408a24 24 0 1 1 0 48 24 24 0 1 1 0-48z"></path></svg>`;
56    case "pool contractors":
57      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 576 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="m309.5 178.4 138.4 118.7c-1.6.9-3.2 2-4.8 3-18 12.4-40.1 20.3-59.2 20.3-19.6 0-40.8-7.7-59.2-20.3-22.1-15.5-51.6-15.5-73.7 0-17.1 11.8-38 20.3-59.2 20.3-10.1 0-21.1-2.2-31.9-6.2C163.1 193.2 262.2 96 384 96h64c17.7 0 32 14.3 32 32s-14.3 32-32 32h-64c-26.9 0-52.3 6.6-74.5 18.4zM160 160a64 64 0 1 1-128 0 64 64 0 1 1 128 0zm146.5 165.9c22.5 15.5 50 26.1 77.5 26.1 26.9 0 55.4-10.8 77.4-26.1 11.9-8.5 28.1-7.8 39.2 1.7 14.4 11.9 32.5 21 50.6 25.2 17.2 4 27.9 21.2 23.9 38.4s-21.2 27.9-38.4 23.9c-24.5-5.7-44.9-16.5-58.2-25-29 15.6-61.5 25.9-94.5 25.9-31.9 0-60.6-9.9-80.4-18.9-5.8-2.7-11.1-5.3-15.6-7.7-4.5 2.4-9.7 5.1-15.6 7.7-19.8 9-48.5 18.9-80.4 18.9-33 0-65.5-10.3-94.5-25.8-13.4 8.4-33.7 19.3-58.2 25-17.2 4-34.4-6.7-38.4-23.9s6.7-34.4 23.9-38.4c18.1-4.2 36.2-13.3 50.6-25.2 11.1-9.4 27.3-10.1 39.2-1.7 22.1 15.2 50.5 26 77.4 26 27.5 0 55-10.6 77.5-26.1 11.1-7.9 25.9-7.9 37 0z"></path></svg>`;
58    case "restaurants":
59      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 576 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M475.3 27.3c5.8-5.8 6.3-15.1 1.1-21.5S462-1.9 455.1 2.7l-106.5 71c-27.8 18.6-44.6 49.9-44.6 83.4 0 19.3 5.5 37.9 15.7 53.9L73.4 457.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L365 256.3c16 10.2 34.7 15.7 53.9 15.7 33.5 0 64.8-16.8 83.4-44.6l71-106.5c4.6-6.8 3.2-16-3.2-21.2s-15.6-4.8-21.5 1.1L457.4 192c-5.2 5.2-13.6 5.2-18.8 0-4.9-4.9-5.2-12.8-.6-18.1l86.1-99.4c5.5-6.3 5.2-15.9-.8-21.8s-15.4-6.3-21.8-.8L402.1 138c-5.3 4.6-13.2 4.3-18.1-.6-5.2-5.2-5.2-13.6 0-18.8l91.3-91.3zM52.5 7.3C47.9 2.6 41.5 0 34.9 0c-11.2 0-21 7.5-23.5 18.4C6.7 38.6 0 71.5 0 96c0 83.3 48.2 130.5 128.9 209.4 6.5 6.4 13.3 13 20.3 19.9 1.9 1.8 3.8 3.5 5.9 5.1l110.3-110.3L52.5 7.3zm404.9 495.3c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L355.9 310.6l-45.3 45.3 146.8 146.7z"></path></svg>`;
60    case "siding contractors":
61      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewB
61ox="0 0 60 56" aria-hidden="true" focusable="false" height="1em" width="1em"><g fill-rule="evenodd"><path d="M53 20v36H8V20h45Zm-7 25H15v5h31v-5Zm0-11H15v5h31v-5Zm0-11H15v5h31v-5Z"></path><path d="m30 0 30 22H0z"></path></g></svg>`;
62    case "snow removal services":
63      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 640 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="m298.9 64 68.6 160H256l-64-64V64h106.9zm146.2 178.7-87.4-204C347.6 15.3 324.5 0 298.9 0H176c-26.5 0-48 21.5-48 48v112H96c-17.7 0-32 14.3-32 32v106.8C26.2 316.8 0 355.3 0 400c0 61.9 50.1 112 112 112h256c61.9 0 112-50.1 112-112 0-17.2-3.9-33.5-10.8-48H512v50.7c0 17 6.7 33.3 18.7 45.3l54.6 54.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L576 402.7V235.2l57-71.2c11-13.8 8.8-33.9-5-45s-33.9-8.8-45 5l-57 71.2c-9.1 11.3-14 25.4-14 40V288h-64v-31.3c.1-2.4-.2-4.8-.6-7.1s-1.2-4.7-2.2-6.8zM368 352c26.5 0 48 21.5 48 48s-21.5 48-48 48H112c-26.5 0-48-21.5-48-48s21.5-48 48-48h256zm-224 48a24 24 0 1 0-48 0 24 24 0 1 0 48 0zm216 24a24 24 0 1 0 0-48 24 24 0 1 0 0 48zm-56-24a24 24 0 1 0-48 0 24 24 0 1 0 48 0zm-104 24a24 24 0 1 0 0-48 24 24 0 1 0 0 48z"></path></svg>`;
64    case "tree service":
65      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 448 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M210.6 5.9 62 169.4c-3.9 4.2-6 9.8-6 15.5 0 12.8 10.3 23.1 23.1 23.1H104l-73.4 73.4c-4.2 4.2-6.6 10-6.6 16 0 12.5 10.1 22.6 22.6 22.6H80L5.4 409.5c-3.5 4.2-5.4 9.5-5.4 15 0 13 10.5 23.5 23.5 23.5H192v32c0 17.7 14.3 32 32 32s32-14.3 32-32v-32h168.5c13 0 23.5-10.5 23.5-23.5 0-5.5-1.9-10.8-5.4-15L368 320h33.4c12.5 0 22.6-10.1 22.6-22.6 0-6-2.4-11.8-6.6-16L344 208h24.9c12.7 0 23.1-10.3 23.1-23.1 0-5.7-2.1-11.3-6-15.5L237.4 5.9C234 2.1 229.1 0 224 0s-10 2.1-13.4 5.9z"></path></svg>`;
66    case "window washing":
67      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 512 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M480 224V64c0-35.3-28.7-64-64-64H96C60.7 0 32 28.7 32 64v224h448v-64zm-64 0H280V64h136v160zm-184 0H96V64h136v160zM96 448V320H32v128c-17.7 0-32 14.3-32 32s14.3 32 32 32h448c17.7 0 32-14.3 32-32s-14.3-32-32-32V320h-64v128H96z"></path></svg>`;
68    case "construction":
69    case "construction services":
70      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 448 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M216 0c-13.3 0-24 10.7-24 24v56l-28.4-56.9C125.6 43.5 99 82.6 96.2 
70128H96c-13.3 0-24 10.7-24 24s10.7 24 24 24h256c13.3 0 24-10.7 24-24s-10.7-24-24-24h-.2c-2.8-45.4-29.4-84.5-67.4-104.9L256 80V24c0-13.3-10.7-24-24-24h-16zm8 320c65.3 0 119.1-48.9 127-112H97c7.9 63.1 61.7 112 127 112zm-89.6 32C60.2 352 0 412.2 0 486.4 0 500.5 11.5 512 25.6 512h396.8c14.1 0 25.6-11.5 25.6-25.6 0-74.2-60.2-134.4-134.4-134.4H134.4z"></path></svg>`;
71    case "electrician":
72    case "electricians":
73      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 448 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M349.4 44.6c5.9-13.7 1.5-29.7-10.6-38.5s-28.6-8-39.9 1.8l-256 224c-10 8.8-13.6 22.9-8.9 35.3S50.7 288 64 288h111.5L98.6 467.4c-5.9 13.7-1.5 29.7 10.6 38.5s28.6 8 39.9-1.8l256-224c10-8.8 13.6-22.9 8.9-35.3s-16.6-20.7-30-20.7H272.5l76.9-179.5z"></path></svg>`;
74    case "financial services":
75      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 576 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M64 64C28.7 64 0 92.7 0 128v256c0 35.3 28.7 64 64 64h448c35.3 0 64-28.7 64-64V128c0-35.3-28.7-64-64-64H64zm208 128h224c8.8 0 16 7.2 16 16s-7.2 16-16 16H272c-8.8 0-16-7.2-16-16s7.2-16 16-16zm-16 112c0-8.8 7.2-16 16-16h224c8.8 0 16 7.2 16 16s-7.2 16-16 16H272c-8.8 0-16-7.2-16-16zm-92-152v13.9c7.5 1.2 14.6 2.9 21.1 4.7 10.7 2.8 17 13.8 14.2 24.5s-13.8 17-24.5 14.2c-11-2.9-21.6-5-31.2-5.2-7.9-.1-16 1.8-21.5 5-4.8 2.8-6.2 5.6-6.2 9.3 0 1.8.1 3.5 5.3 6.7 6.3 3.8 15.5 6.7 28.3 10.5l.7.2c11.2 3.4 25.6 7.7 37.1 15 12.9 8.1 24.3 21.3 24.6 41.6.3 20.9-10.5 36.1-24.8 45-7.2 4.5-15.2 7.3-23.2 9V360c0 11-9 20-20 20s-20-9-20-20v-14.6c-10.3-2.2-20-5.5-28.2-8.4-2.1-.7-4.1-1.4-6.1-2.1-10.5-3.5-16.1-14.8-12.6-25.3s14.8-16.1 25.3-12.6c2.5.8 4.9 1.7 7.2 2.4 13.6 4.6 24 8.1 35.1 8.5 8.6.3 16.5-1.6 21.4-4.7 4.1-2.5 6-5.5 5.9-10.5 0-2.9-.8-5-5.9-8.2-6.3-4-15.4-6.9-28-10.7l-1.7-.5c-10.9-3.3-24.6-7.4-35.6-14-12.7-7.7-24.6-20.5-24.7-40.7-.1-21.1 11.8-35.7 25.8-43.9 6.9-4.1 14.5-6.8 22.2-8.5V152c0-11 9-20 20-20s20 9 20 20z"></path></svg>`;
76    case "home builders":
77      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 576 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M575.8 255.5c0 18-15 32.1-32 32.1h-32l.7 160.2c0 2.7-.2 5.4-.5 8.1V472c0 22.1-17.9 40-40 40h-16c-1.1 0-2.2 0-3.3-.1-1.4.1-2.8.1-4.2.1H392c-22.1 0-40-17.9-40-40v-88c0-17.7-14.3-32-32-32h-64c-17.7 0-32 14.3-32 32v88c0 22.1-17.9 40-40 40h-55.9c-1.5 0-3-.1-4.5-.2-1.2.1-2.4.2-3.6.2h-16c-22.1 0-40-17.9-40-40V360c0-.9 0-1.9.1-2.8v-69.6H32c-18 0-32-14-32-32.1 0-9 3-17 10-24L266.4 8c7-7 15-8 22-8s15 2 21 7l255.4 224.5c8 7 12 15 11 24z"></path></svg>`;
78    case "lawyers":
79      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 640 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M384 32h128c17.7 0 32 14.3 32 32s-14.3 32-32 32H398.4c-5.2 25.8-22.9 47.1-46.4 57.3V448h160c17.7 0 32 14.3 32 32s-14.3 32-32 32H128c-17.7 0-32-14.3-32-32s14.3-32 32-32h160V153.3c-23.5-10.3-41.2-31.6-46.4-57.3H128c-17.7 0-32-14.3-32-32s14.3-32 32-32h128c14.6-19.4 37.8-32 64-32s49.4 12.6 64 32zm55.6 288h144.8L512 195.8 439.6 320zm72.4 96c-62.9 0-115.2-34-126-78.9-2.6-11 1-22.3 6.7-32.1l95.2-163.2c5-8.6 14.2-13.8 24.1-13.8s19.1 5.3 24.1 13.8L631.3 305c5.7 9.8 9.3 21.1 6.7 32.1C627.2 382 574.9 416 512 416zM126.8 195.8 54.4 320h144.9l-72.5-124.2zM.9 337.1c-2.6-11 1-22.3 6.7-32.1l95.2-163.2c5-8.6 14.2-13.8 24.1-13.8s19.1 5.3 24.1 13.8L246.2 305c5.7 9.8 9.3 21.1 6.7 32.1C242 382 189.7 416 126.8 416S11.7 382 .9 337.1z"></path></svg>`;
80    case "property management":
81    case "real estate":
82      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 640 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M36.8 192h566.4c20.3 0 36.8-16.5 36.8-36.8 0-7.3-2.2-14.4-6.2-20.4L558.2 21.4C549.3 8 534.4 0 518.3 0H121.7c-16 0-31 8-39.9 21.4L6.2 134.7c-4 6.1-6.2 13.2-6.2 20.4C0 175.5 16.5 192 36.8 192zM64 224v240c0 26.5 21.5 48 48 48h224c26.5 0 48-21.5 48-48V224h-64v160H128V224H64zm448 0v256c0 17.7 14.3 32 32 32s32-14.3 32-32V224h-64z"></path></svg>`;
83    case "roofing contractors":
84    case "roofer":
85    case "roofers":
86      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 191 107" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M54.83 34.43V0H22.61v61.41l32.22-27v.02Zm40.43-18.32 95.25 80.32-10.41 10.41L95.26 35.3l-84.85 71.54L0 96.43l95.26-80.32Z"></path><path d="m95.42 50.63-63.66 53.88h127.31z"></path></svg>`;
87    case "auto detailing":
88    case "auto repair":
89    case "used car dealers":
90      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 512 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M135.2 117.4 109.1 192h293.8l-26.1-74.6c-4.5-12.8-16.6-21.4-30.2-21.4H165.4c-13.6 0-25.7 8.6-30.2 21.4zm-95.6 79.4L74.8 96.3C88.3 57.8 124.6 32 165.4 32h181.2c40.8 0 77.1 25.8 90.6 64.3l35.2 100.5c23.2 9.6 39.6 32.5 39.6 59.2v192c0 17.7-14.3 32-32 32h-32c-17.7 0-32-14.3-32-32v-48H96v48c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32V256c0-26.7 16.4-49.6 39.6-59.2zM128 288a32 32 0 1 0-64 0 32 32 0 1 0 64 0zm288 32a32 32 0 1 0 0-64 32 32 0 1 0 0 64z"></path></svg>`;
91    default:
92      return `<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 512 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M184 48h144c4.4 0 8 3.6 8 8v40H176V56c0-4.4 3.6-8 8-8zm-56 8v40H64c-35.3 0-64 28.7-64 64v96h512v-96c0-35.3-28.7-64-64-64h-64V56c0-30.9-25.1-56-56-56H184c-30.9 0-56 25.1-56 56zm384 232H320v32c0 17.7-14.3 32-32 32h-64c-17.7 0-32-14.3-32-32v-32H0v128c0 35.3 28.7 64 64 64h384c35.3 0 64-28.7 64-64V288z"></path></svg>`;
93  }
94}
95const AB_SEAL_VERTICAL_URL = "https://m.bbb.org/brand/seals/Accredited_Business_Seal_Vertical_NoRating_RGB.svg";
96const AB_SEAL_VERTICAL_CAN_URL = AB_SEAL_VERTICAL_URL;
97const AB_SEAL_HORIZONTAL_URL = "https://m.bbb.org/brand/seals/Accredited_Business_Seal_NoRating_RGB.svg";
98const AB_SEAL_HORIZONTAL_CAN_URL = AB_SEAL_HORIZONTAL_URL;
99class FindAutocomplete extends BaseAutocomplete {
100  entityIdInputName = "find_entity";
101  grouped = true;
102  connectedCallback() {
103    this.render();
104    const queryParams = new URLSearchParams(window.location.search);
105    const searchedQuery = queryParams.get("find_text");
106    if (searchedQuery) {
107      this.querySelector("input").value = searchedQuery;
108      this.showClearButton();
109    }
110  }
111  getOptionAttributes = (result, inputText) => {
112    if (result.isPopularCategory) {
113      return { html: `${getPopularCategoryIcon(result.title.toLowerCase())}${result.title}` };
114    }
115    const highlightedTitle = inputText.trim().length > 1 ? result.title.replaceAll(new RegExp(inputText, "ig"), (match) => `<span>${match}</span>`) : result.title;
116    if (result.entityType !== "Organization") {
117      return {
118        html: highlightedTitle,
119        attributes: [{ name: "data-entity-id", value: result.entityId }]
120      };
121    }
122    const isHq = result.metaTags?.includes("headquarters");
123    const isAccreditedBusiness = result.metaTags?.includes("accredited") && !result.metaTags.includes("charity");
124    const isAccreditedCharity = result.metaTags?.includes("charityseal") && result.metaTags.includes("charity");
125    let html = `<div class="find-ta">`;
126    html += `<div class="business-details">`;
127    if (isHq) {
128      html += `<span class="hq-badge">Headquarters</span>`;
129    }
130    html += `<div class="business-title">`;
131    html += `<span>${highlightedTitle}</span>`;
132    html += "</div>";
133    if (result.altTitleHighlight) {
134      html += `<span class="aka-highlight">also known as ${result.altTitleHighlight}</span>`;
135    }
136    if (result.secondaryTitle) {
137      html += `<div class="business-address">${result.secondaryTitle}</div>`;
138    }
139    html += "</div>";
140    if (isAccreditedBusiness) {
141      const businessSealUrl = result.country === "CAN" ? AB_SEAL_VERTICAL_CAN_URL : AB_SEAL_VERTICAL_URL;
142      html += `<img src="${businessSealUrl}" alt="Accredited Business" width="60" height="63">`;
143    }
144    if (isAccreditedCharity) {
145      const charitySealUrl = result.country === "CAN" ? "https://m.bbb.org/terminuscontent/dist/img/ac-seal-vertical-can.svg?tx=f_svg" : "https://m.bbb.org/terminuscontent/dist/img/ac-seal-vertical.svg?tx=f_svg";
146      html += `<img src="${charitySealUrl}" alt="Accredited Charity" width="43" height="64">`;
147    }
148    html += "</div>";
149    return {
150      html,
151      attributes: [
152        { name: "data-url", value: result.url },
153        { name: "data-title", value: result.title.replace(/<[^>]*>/g, "") }
154      ]
155    };
156  };
157  getLegacyOptionAttributes = (result, inputText) => {
158    if (result.isPopularCategory) {
159      return { html: `${getPopularCategoryIcon(result.title.toLowerCase())}${result.title}` };
160    }
161    const highlightedTitle = inputText.trim().length > 1 ? result.title.replaceAll(new RegExp(inputText, "ig"), (match) => `<span>${match}</span>`) : result.title;
162    if (result.entityType !== "Organization") {
163      return {
164        html: highlightedTitle,
165        attributes: [{ name: "data-entity-id", value: result.entityId }]
166      };
167    }
168    const isHq = result.metaTags?.includes("headquarters");
169    const isAccreditedBusiness = result.metaTags?.includes("accredited") && !result.metaTags.includes("charity");
170    const isAccreditedCharity = result.metaTags?.includes("charityseal") && result.metaTags.includes("charity");
171    let html = `<div class="find-ta">`;
172    html += "<div>";
173    html += `<div class="business-title">`;
174    html += `<span>${highlightedTitle}</span>`;
175    if (isHq) {
176      html += `<span class="hq-badge">Headquarters</span>`;
177    }
178    html += "</div>";
179    if (result.altTitleHighlight) {
180      html += `<span class="aka-highlight">also known as ${result.altTitleHighlight}</span>`;
181    }
182    if (result.secondaryTitle) {
183      html += `<div class="business-address">${result.secondaryTitle}</div>`;
184    }
185    html += "</div>";
186    if (isAccreditedBusiness) {
187      const businessSealUrl = result.country === "CAN" ? AB_SEAL_HORIZONTAL_CAN_URL : AB_SEAL_HORIZONTAL_URL;
188      html += `<img src="${businessSealUrl}" alt="Accredited Business" width="91" height="35">`;
189    }
190    if (isAccreditedCharity) {
191      const charitySealUrl = result.country === "CAN" ? "https://m.bbb.org/terminuscontent/dist/img/ac-seal-horizontal-can.svg" : "https://m.bbb.org/terminuscontent/dist/img/ac-seal-horizontal.svg";
192      html += `<img src="${charitySealUrl}" alt="Accredited Charity" width="91" height="34">`;
193    }
194    html += "</div>";
195    return {
196      html,
197      attributes: [
198        { name: "data-url", value: result.url },
199        { name: "data-title", value: result.title.replace(/<[^>]*>/g, "") }
200      ]
201    };
202  };
203  getOptions = (query) => {
204    if (query.trim().length === 0) {
205      if (!window.headerFooterData) {
206        return Promise.resolve([]);
207      }
208      return window.headerFooterData.bbb.popularCategories ? Promise.resolve([
209        {
210          results: window.headerFooterData.bbb.popularCategories.map((category) => ({
211            title: category.name,
212            entityId: category.entityId,
213            isPopularCategory: true
214          })),
215          category: "Popular Categories"
216        }
217      ]) : Promise.resolve([]);
218    }
219    const country = document.querySelector('[name="find_country"]').value;
220    const locationInput = document.querySelector('[name="find_loc"]').value;
221    if (query.length > 100) {
222      return Promise.resolve([]);
223    }
224    return fetch(
225      `/api/suggest/find?country=${country}&entityTypes=Category&entityTypes=Organization&input=${query}${locationInput ? `&locationInput=${locationInput}` : ""}`
226    ).then((res) => {
227      if (res.ok) {
228        return res.json();
229      }
230      return res.text().then((msg) => {
231        throw msg;
232      });
233    }).then((results) => {
234      const groupedResults = results.reduce((acc, result) => {
235        const groupLabel = result.entityType === "Organization" ? "Businesses" : "Categories";
236        let group = acc.find((x) => x.category === groupLabel);
237        if (!group) {
238          acc.push({ category: groupLabel, results: [] });
239          group = acc[acc.length - 1];
240        }
241        group.results.push(result);
242        return acc;
243      }, []);
244      return groupedResults;
245    }).catch((error) => {
246      console.error(error);
247      return Promise.resolve([]);
248    });
249  };
250}
251customElements.define("iabbb-find-autocomplete", FindAutocomplete);
252const usPlaceholder = "city, state, or zip";
253const caPlaceholder = "city, prov or postal";
254class NearAutocomplete extends BaseAutocomplete {
255  connectedCallback() {
256    this.render();
257    const queryParams = new URLSearchParams(window.location.search);
258    const searchedLocation = queryParams.get("find_loc");
259    const searchedCountry = queryParams.get("find_country");
260    if (searchedLocation) {
261      this.querySelector("input").value = searchedLocation;
262      this.showClearButton();
263    }
264    if (searchedCountry === "CAN") {
265      this.querySelector("input").placeholder = caPlaceholder;
266    }
267    if (!searchedLocation) {
268      const savedNearLocationId = decodeURIComponent(getCookie("iabbb_find_location"));
269      if (savedNearLocationId) {
270        const nearLocationIdParts = decodeURIComponent(savedNearLocationId).split("_");
271        const nearCountry = nearLocationIdParts[nearLocationIdParts.length - 1];
272        const nearState = nearLocationIdParts[nearLocationIdParts.length - 2];
273        const nearCity = nearLocationIdParts.slice(0, nearLocationIdParts.length - 2).join(" ");
274        if (nearState && nearCity) {
275          this.querySelector("input").value = `${nearCity}, ${nearState}`;
276          this.showClearButton();
277        }
278        if (!searchedCountry && nearCountry === "CAN") {
279          this.querySelector("input").placeholder = caPlaceholder;
280        }
281      }
282      self.addEventListener("iabbb-country-custom-select:select", this.changeCountryEventListener);
283    }
284  }
285  getOptionAttributes = (result, inputText) => {
286    const raw = result.displayText ?? "";
287    const normalized = raw.replace(/,\s*/g, ", ").replace(/\s{2,}/g, " ").trim();
288    const html = inputText.trim().length > 1 ? normalized.replaceAll(new RegExp(inputText, "ig"), (match) => `<span>${match}</span>`) : normalized;
289    return {
290      html,
291      attributes: result.isCurrentLocation ? [{ name: "data-value", value: result.value }] : null
292    };
293  };
294  getOptions = (query) => {
295    const userLocation = decodeURIComponent(getCookie("iabbb_user_physical_location"));
296    const country = document.querySelector('[name="find_country"]').value;
297    let currentLocationOption;
298    if (userLocation) {
299      const [city, state, userCountry] = userLocation.split(", ");
300      if (country === userCountry) {
301        currentLocationOption = {
302          displayText: "Current location",
303          value: `${city}, ${state}`,
304          isCurrentLocation: true
305        };
306      }
307    }
308    if (query.trim().length === 0) {
309      return currentLocationOption ? Promise.resolve([currentLocationOption]) : Promise.resolve([]);
310    }
311    return fetch(
312      `/api/suggest/location?country=${country}&input=${query}&maxMatches=10&includePostalCodes=${window.headerFooterData?.includePostalCodesInNearAutocomplete ?? true}`,
313      { credentials: "omit" }
314    ).then((res) => {
315      if (res.ok) {
316        return res.json();
317      }
318      return res.text().then((msg) => {
319        throw msg;
320      });
321    }).then((results) => currentLocationOption ? [currentLocationOption, ...results] : results).catch((error) => {
322      console.error(error);
323      return Promise.resolve([]);
324    });
325  };
326  changeCountryEventListener = (event) => {
327    this.querySelector("input").value = "";
328    this.querySelector("input").placeholder = event.detail.value === "CAN" ? caPlaceholder : usPlaceholder;
329  };
330}
331customElements.define("iabbb-near-autocomplete", NearAutocomplete);
332class SearchBar extends HTMLElement {
333  constructor() {
334    super();
335    this.render = () => {
336      this.isResizeListenerInitialized = false;
337      this.querySelector("form").addEventListener("submit", this.handleFormSubmit);
338      if (typeof HTMLDialogElement === "function") {
339        this.createMobileSearchDialog();
340        this.replaceMobileLinkWithButton();
341      }
342    };
343  }
344  connectedCallback() {
345    this.render();
346  }
347  disconnectedCallback() {
348    window.removeEventListener("resize", this.onResize);
349  }
350  /**
351   * Emit a custom event
352   * @param {string} type - The event type
353   * @param {object} detail - Any details to pass along with the event
354   */
355  emit = (type, detail = {}) => {
356    const event = new CustomEvent(`${this.localName}:${type}`, {
357      bubbles: true,
358      cancelable: true,
359      detail
360    });
361    return this.dispatchEvent(event);
362  };
363  handleFormSubmit = (e) => {
364    if ("FormData" in window) {
365      const formValues = Object.fromEntries(new FormData(e.target));
366      const query = formValues.find_text;
367      const location = formValues.find_loc;
368      this.emit("execute", { query, location });
369      if (query.startsWith("accredited ")) {
370        setCookie("iabbb_accredited_search", "true");
371        setCookie("iabbb_accredited_toggle_state", "seen");
372      }
373    }
374  };
375  replaceMobileLinkWithButton = () => {
376    const link = this.querySelector(".dialog-trigger");
377    if (!link) {
378      return;
379    }
380    const btn = document.createElement("button");
381    btn.innerHTML = link.innerHTML;
382    btn.className = link.className;
383    btn.onclick = () => {
384      this.querySelector(".mobile-search-bar dialog").showModal();
385      this.querySelector(".mobile-search-bar iabbb-find-autocomplete input").focus();
386      if (!this.isResizeListenerInitialized) {
387        this.initializeResizeListener();
388      }
389    };
390    link.replaceWith(btn);
391  };
392  // Close dialog if it is open, and user resizes to a desktop-sized window.
393  // If this doesn't happen, keyboard users will run into a fatal error when they cannot move focus back to the rest of the document.
394  initializeResizeListener = () => {
395    window.addEventListener("resize", this.onResize, { passive: true });
396    this.isResizeListenerInitialized = true;
397  };
398  createMobileSearchDialog = () => {
399    const mobileSearchDialog = document.createElement("dialog");
400    mobileSearchDialog.tabIndex = -1;
401    const mobileSearchForm = this.querySelector("form").cloneNode(false);
402    mobileSearchForm.setAttribute("name", "mobile-search");
403    const mobileSearchFormActions = document.createElement("div");
404    mobileSearchFormActions.className = "actions";
405    const dialogCloseButton = document.createElement("button");
406    dialogCloseButton.type = "button";
407    dialogCloseButton.className = "bds-button-unstyled search-dialog-close";
408    dialogCloseButton.innerHTML = '<span class="visually-hidden">close</span><svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 384 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3l105.4 105.3c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256l105.3-105.4z"></path></svg>';
409    dialogCloseButton.onclick = (e) => {
410      e.preventDefault();
411      mobileSearchDialog.close();
412    };
413    const searchButton = document.createElement("button");
414    searchButton.className = "bds-button";
415    searchButton.setAttribute("data-type", "search");
416    searchButton.innerText = "Search";
417    mobileSearchFormActions.appendChild(dialogCloseButton);
418    mobileSearchFormActions.appendChild(searchButton);
419    mobileSearchForm.appendChild(mobileSearchFormActions);
420    mobileSearchDialog.appendChild(mobileSearchForm);
421    const findTypeahead = this.createFindAutocomplete();
422    const nearTypeahead = this.createNearAutocomplete();
423    mobileSearchForm.appendChild(findTypeahead);
424    mobileSearchForm.appendChild(nearTypeahead);
425    this.querySelector(".mobile-search-bar").appendChild(mobileSearchDialog);
426  };
427  createFindAutocomplete = () => {
428    const findAutocomplete = document.createElement("iabbb-find-autocomplete");
429    findAutocomplete.innerHTML = `<div class="input-group"><label for="find_text-mobile"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M416 208c0 45.9-14.9 88.3-40 122.7l126.6 126.7c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0s208 93.1 208 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"></path></svg><span class="visually-hidden">Find</span></label><input id="find_text-mobile" name="find_text" placeholder="businesses, category" autocomplete="off" autocapitalize="none"></div>`;
430    findAutocomplete.showOptionsOnFocus = true;
431    findAutocomplete.className = "autocomplete";
432    return findAutocomplete;
433  };
434  createNearAutocomplete = () => {
435    const container = document.createElement("div");
436    container.className = "near-typeahead";
437    const nearAutocomplete = document.createElement("iabbb-near-autocomplete");
438    nearAutocomplete.className = "autocomplete";
439    nearAutocomplete.innerHTML = `<div class="input-group"><label for="find_loc-mobile"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512" aria-hidden="true" focusable="false" height="1em" width="1em"><path d="M215.7 499.2C267 435 384 279.4 384 192 384 86 298 0 192 0S0 86 0 192c0 87.4 117 243 168.3 307.2 12.3 15.3 35.1 15.3 47.4 0zM192 128a64 64 0 1 1 0 128 64 64 0 1 1 0-128z"></path></svg><span class="visually-hidden">Near</span></label><input id="find_loc-mobile" name="find_loc" placeholder="city, state or zip" autocomplete="off" autocapitalize="none"></div>`;
440    container.appendChild(nearAutocomplete);
441    const countryCombobox = document.createElement("iabbb-country-custom-select");
442    countryCombobox.className = "enhanced-select";
443    countryCombobox.innerHTML = `<label class="visually-hidden" for="find_country-mobile">Country</label>
444      <select id="find_country-mobile" name="find_country">
445        <option value="USA">US</option>
446        <option value="CAN">CA</option>
447      </select>`;
448    container.appendChild(countryCombobox);
449    return container;
450  };
451  onResize = () => {
452    this.closeDialogOnResize(document.body);
453  };
454  closeDialogOnResize = (element) => {
455    if (element.clientWidth < 992) {
456      return;
457    }
458    const dialog = this.querySelector("dialog");
459    if (dialog.open) {
460      dialog.close();
461    }
462  };
463}
464customElements.define("iabbb-search-bar", SearchBar);
465class CountryCustomSelect extends BaseCustomSelect {
466  getInitialValue = () => {
467    const queryParams = new URLSearchParams(window.location.search);
468    const searchedCountry = queryParams.get("find_country");
469    const savedCulture = getCookie("iabbb_user_culture");
470    if (searchedCountry) {
471      return countries.find((x) => x.value === searchedCountry)?.value || this.select.value;
472    }
473    if (savedCulture) {
474      return countries.find((x) => x.culture === savedCulture.toLowerCase())?.value || this.select.value;
475    }
476    return this.select.value;
477  };
478  getComboboxHtml = (val) => {
479    const country = countries.find((x) => x.value === val);
480    return `
481      <img src="${country.flag}" alt="" />
482      <span aria-hidden>${country.shortLabel}</span>
483      <span class="visually-hidden">${country.fullLabel}</span>
484    `;
485  };
486  getOptionHtml = (val) => {
487    const country = countries.find((x) => x.value === val);
488    return `<img src="${country.flag}" alt="" />${country.fullLabel}`;
489  };
490  optionClassName = "dtm-header-near-typeahead-country-item";
491}
492customElements.define("iabbb-country-custom-select", CountryCustomSelect);
493//# sourceMappingURL=scripts-for-search.js.map

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.