!function(){"use strict";var o={n:function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,{a:t}),t},d:function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}},e=Roblox,r=o.n(e),c=CoreUtilities;function u(o,r,i,a){return new Promise(function(t,n){var e=function(e,t,n,o){var r={6:"model",8:"image",9:"audio",14:"video",10:"mesh",7:"plugin"}[t],n=n;if(o=o||6,!e||!e.trim())throw"Prefix has no valid characters, autocomplete request could not be sent";if(n+="?prefix=".concat(e,"&limit=").concat(o),!r)throw"Number: ".concat(t," could not be mapped to a valid category, autocomplete request could not be sent");return{withCredentials:!0,url:n+="&cat=".concat(r)}}(o,r.value,i,a);c.httpService.get(e,{}).then(function(e){e=function(e){try{var t=[],n=e.Args.Prefix;return e.Data.forEach(function(e){t.push(e.Query)}),{prefix:n,suggestions:t}}catch(e){throw e}}(e.data);t(e)}).catch(function(e){n("Something went wrong getting autocomplete suggestions: ".concat(e))})})}function s(e,t){for(var n=document.getElementsByClassName("library-autocomplete-items"),o=0;o<n.length;o++)t!=n[o]&&t!=e&&n[o].parentNode.removeChild(n[o])}var l=null;function i(n,o,r,i,a){var c=null;n.addEventListener("input",function(e){clearTimeout(c);var t=this.value;if(s(n),!t)return!1;c=setTimeout(function(){l=-1,u(n.value,o,r,i).then(function(e){return c=n,u=a,e=(t=e).prefix,t=t.suggestions,d=c.value.toLowerCase(),void(e.toLowerCase()===d&&((l=document.createElement("DIV")).setAttribute("id","".concat(c.id,"autocomplete-list")),l.setAttribute("class","library-autocomplete-items"),c.parentNode.appendChild(l),t.forEach(function(e){var t=e.indexOf(d),n=document.createElement("DIV"),o=document.createElement("STRONG"),r=document.createElement("SPAN"),i=document.createElement("STRONG"),a=document.createElement("INPUT");o.innerText=0<=t?e.substring(0,t):"",r.innerText=0<=t?e.substring(t,t+d.length):"",i.innerText=0<=t?e.substring(t+d.length):e,a.setAttribute("type","hidden"),a.value=e,n.appendChild(o),n.appendChild(r),n.appendChild(i),n.appendChild(a),n.addEventListener("click",function(e){c.value=this.getElementsByTagName("input")[0].value,s(),u(void 0,d)}),l.appendChild(n)})));var c,u,t,l,d}).catch(function(e){console.error(e)})},120)}),n.addEventListener("keydown",function(e){var t=(t=document.getElementById("".concat(this.id,"autocomplete-list")))&&t.getElementsByTagName("div");40===e.keyCode?(l++,d(t)):38===e.keyCode?(l--,d(t)):13===e.keyCode&&(-1<l?(e.preventDefault(),t&&(t[l].click(),l=-1)):s(n))}),document.addEventListener("click",function(e){s(n,e.target)})}function d(e){e&&(function(e){for(var t=0;t<e.length;t++)e[t].removeAttribute("id")}(e),l>=e.length&&(l=0),l<0&&(l=e.length-1),e[l].id="library-autocomplete-active")}r().require(["Pages.Catalog","Pages.CatalogShared"],function(e){var t=r().LibraryAutocompleteParameters||{},n=t.autocompleteEndpoint,o=t.autocompleteLimit;t.autocompleteShouldShow&&(n?i(document.getElementById("keywordTextbox"),document.getElementById("categoriesForKeyword"),n,o,e.SearchOnKeyword):console.error("Autocomplete API endpoint is empty, autocomplete cannot be set up"))})}();
//# sourceMappingURL=https://js.rbxcdn.com/88d462721f67fd5bf1ec-libraryAutocomplete.js.map

/* Bundle detector */
window.Roblox && window.Roblox.BundleDetector && window.Roblox.BundleDetector.bundleDetected("LibraryAutocomplete");