{"version":3,"file":"main.BwBWc1.js","sources":["theme-61/virtual:theme","theme-61/discourse/api-initializers/theme-initializer.gjs","theme-61/virtual:entrypoint:main"],"sourcesContent":["import { getObjectForTheme } from \"discourse/lib/theme-settings-store\";\n\nexport const settings = getObjectForTheme(61);\n\nexport function themePrefix(key) {\n  return `theme_translations.61.${key}`;\n}\n","import { apiInitializer } from \"discourse/lib/api\";\n\nexport default apiInitializer(\"0.8.42\", (api) => {\n  function setupAutocomplete() {\n    const searchInput = document.querySelector('[data-behavior=\"autocomplete\"]');\n    if (!searchInput) return;\n    \n    // Create dropdown container\n    const dropdown = document.createElement('div');\n    dropdown.className = 'custom-autocomplete-dropdown';\n    dropdown.style.cssText = `\n      position: absolute;\n      background: white;\n      border: 1px solid #ccc;\n      border-radius: 4px;\n      box-shadow: 0 2px 10px rgba(0,0,0,0.1);\n      max-height: 300px;\n      overflow-y: auto;\n      z-index: 1100;\n      display: none;\n      margin-top: 5px;\n      width: ${searchInput.offsetWidth}px;\n    `;\n    \n    // Add to DOM\n    searchInput.parentNode.style.position = 'relative';\n    searchInput.parentNode.appendChild(dropdown);\n    \n    // Fetch suggestions\n    async function fetchSuggestions(query) {\n      try {\n        const response = await fetch(`https://devtalk.com/portals/search.json?q=${encodeURIComponent(query)}`);\n        if (!response.ok) return [];\n        return await response.json();\n      } catch (error) {\n        console.error('Autocomplete error:', error);\n        return [];\n      }\n    }\n    \n    // Render suggestions\n    function renderSuggestions(suggestions) {\n      dropdown.innerHTML = '';\n      \n      if (suggestions.length === 0) {\n        const noResults = document.createElement('div');\n        noResults.textContent = 'No results found';\n        noResults.style.padding = '10px 15px';\n        noResults.style.color = '#999';\n        dropdown.appendChild(noResults);\n      } else {\n        suggestions.forEach((item) => {\n          const link = document.createElement('a');\n          link.href = item.link;\n          link.className = 'autocomplete-item';\n          link.textContent = item.name;\n          link.style.cssText = `\n            display: block;\n            padding: 10px 15px;\n            color: #202020;\n            text-decoration: none;\n            border-bottom: 1px solid #f0f0f0;\n            cursor: pointer;\n          `;\n          \n          link.addEventListener('mouseover', () => {\n            link.style.background = '#f8f9fa';\n          });\n          \n          link.addEventListener('mouseout', () => {\n            link.style.background = 'white';\n          });\n          \n          dropdown.appendChild(link);\n        });\n      }\n      \n      dropdown.style.display = 'block';\n    }\n    \n    // Handle input with debounce\n    let debounceTimer;\n    searchInput.addEventListener('input', function() {\n      clearTimeout(debounceTimer);\n      \n      if (this.value.length < 2) {\n        dropdown.style.display = 'none';\n        return;\n      }\n      \n      debounceTimer = setTimeout(async () => {\n        const suggestions = await fetchSuggestions(this.value);\n        renderSuggestions(suggestions);\n      }, 300);\n    });\n    \n    // Handle focus - show results if there are any\n    searchInput.addEventListener('focus', function() {\n      if (dropdown.children.length > 0) {\n        dropdown.style.display = 'block';\n      }\n    });\n    \n    // Handle blur - hide dropdown with delay to allow clicks\n    searchInput.addEventListener('blur', function() {\n      setTimeout(() => {\n        dropdown.style.display = 'none';\n      }, 200);\n    });\n    \n    // Update dropdown width when window resizes\n    window.addEventListener('resize', () => {\n      dropdown.style.width = `${searchInput.offsetWidth}px`;\n    });\n    \n    // Add styles\n    const style = document.createElement('style');\n    style.textContent = `\n      .custom-autocomplete-dropdown {\n        font-family: Rubik, 'Helvetica Neue', Helvetica, Arial, sans-serif;\n        font-size: 14px;\n      }\n      \n      .autocomplete-item:hover {\n        background-color: #ddf0f6 !important;\n      }\n      \n      .autocomplete-item:last-child {\n        border-bottom: none !important;\n      }\n    `;\n    document.head.appendChild(style);\n  }\n  \n  // Initialize\n  if (document.readyState === 'loading') {\n    document.addEventListener('DOMContentLoaded', setupAutocomplete);\n  } else {\n    setTimeout(setupAutocomplete, 1000);\n  }\n});","import * as Mod1 from \"./discourse/api-initializers/theme-initializer\";\nconst compatModules = {\n  \"discourse/api-initializers/theme-initializer\": Mod1,\n};\nexport { compatModules };\nexport default compatModules;\n"],"names":["getObjectForTheme","themeInitializer","apiInitializer","api","setupAutocomplete","searchInput","document","querySelector","dropdown","createElement","debounceTimer","className","style","cssText","offsetWidth","parentNode","position","appendChild","addEventListener","clearTimeout","this","value","length","display","setTimeout","async","suggestions","innerHTML","noResults","textContent","padding","color","forEach","item","link","href","name","background","renderSuggestions","query","response","fetch","encodeURIComponent","ok","json","error","console","fetchSuggestions","children","window","width","head","readyState","compatModules"],"mappings":";AAEwBA,EAAkB;;ACA1C,IAAAC;oCAAeC,CAAe,SAAWC,IACvC,SAASC,IACP,MAAMC,EAAcC,SAASC,cAAc;AAC3C,IAAKF,EAAa;AAGlB,MAAMG,EAAWF,SAASG,cAAc;AAyExC,IAAIC;AAxEJF,EAASG,UAAY,+BACrBH,EAASI,MAAMC,QAAU,uSAWdR,EAAYS,uBAIvBT,EAAYU,WAAWH,MAAMI,SAAW,WACxCX,EAAYU,WAAWE,YAAYT,GAwDnCH,EAAYa,iBAAiB,QAAS,WACpCC,aAAaT,GAETU,KAAKC,MAAMC,OAAS,EACtBd,EAASI,MAAMW,QAAU,OAI3Bb,EAAgBc,WAAWC,WAjD7B,SAA2BC,GAGzB,GAFAlB,EAASmB,UAAY,GAEM,IAAvBD,EAAYJ,OAAc,CAC5B,MAAMM,EAAYtB,SAASG,cAAc;AACzCmB,EAAUC,YAAc,mBACxBD,EAAUhB,MAAMkB,QAAU,YAC1BF,EAAUhB,MAAMmB,MAAQ,OACxBvB,EAASS,YAAYW,EACvB,MACEF,EAAYM,QAASC,IACnB,MAAMC,EAAO5B,SAASG,cAAc;AACpCyB,EAAKC,KAAOF,EAAKC,KACjBA,EAAKvB,UAAY,oBACjBuB,EAAKL,YAAcI,EAAKG,KACxBF,EAAKtB,MAAMC,QAAU,2NASrBqB,EAAKhB,iBAAiB,YAAa,KACjCgB,EAAKtB,MAAMyB,WAAa,YAG1BH,EAAKhB,iBAAiB,WAAY,KAChCgB,EAAKtB,MAAMyB,WAAa,UAG1B7B,EAASS,YAAYiB;AAIzB1B,EAASI,MAAMW,QAAU,OAC3B,EAcIe,OA/DJb,eAAgCc,GAC9B,IACE,MAAMC,Q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