;// bundle: Pages___CatalogShared___7976e9a9daddf7f947da70884162fc5a_m
;// files: modules/Pages/CatalogShared.js

;// modules/Pages/CatalogShared.js
typeof Roblox==typeof undefined&&(Roblox={}),Roblox.CatalogShared=Roblox.CatalogShared||{},Roblox.CatalogSharedConstructor=function(n){function u(){var t=$("#catalog");n.getElementById("CatalogNewScript")===null&&($(function(){var i,n;Roblox.require(["Pages.Catalog","Pages.CatalogShared","Widgets.HierarchicalDropdown"],function(n){var r=t.data("query-state"),u=t.data("total-pages"),f=t.data("save-filters-between-searches"),i;if(n.init(r,u,f),Roblox.Widgets.HierarchicalDropdown.init(),Roblox.CatalogValues.ContainerID){i=$("#"+Roblox.CatalogValues.ContainerID),i.off(Roblox.CatalogShared.CatalogLoadedViaAjaxEventName);i.on(Roblox.CatalogShared.CatalogLoadedViaAjaxEventName,null,null,Roblox.CatalogShared.handleCatalogLoadedViaAjaxEvent)}}),i=t.data("page-number"),$(".Paging_Input").val(i),n=t.data("catalog-context"),n!==null&&(Roblox.CatalogValues=Roblox.CatalogValues||{},Roblox.CatalogValues.CatalogContext=n)}),Roblox.LibraryAutocompleteParameters=Roblox.LibraryAutocompleteParameters||{autocompleteShouldShow:t.data("autocomplete-enabled"),autocompleteEndpoint:t.data("autocomplete-endpoint"),autocompleteLimit:t.data("autocomplete-limit")})}function f(n,t,f,e,o,s,h){if(n&&f&&f.length!==0){i+=1;var l=i,c=$("#catalog").data("search-id");s||typeof c==typeof undefined||(n=n+"&SearchId="+c),Roblox.AjaxPageLoadEvent&&Roblox.AjaxPageLoadEvent.SendEvent("legacyCatalog",n),f.find(".loading").length<1&&f.find(".right-content").append($('<div class="loading">')),f.find(".subcategories [hover='true']").hide(),f.css("cursor","progress"),$.ajax({method:"GET",params:t,url:n,crossDomain:!0,xhrFields:{withCredentials:!0}}).done(function(t){if(i==l){if(f.html(t),u(),f.css("cursor","default"),!e){var c=$.Event(r,{url:n,replaceCurrentState:o});f.trigger(c)}s!==!1&&Roblox.LibraryMetrics&&(Roblox.LibraryMetrics.logAutocompleteUsage(),Roblox.LibraryMetrics.sendMarketplaceLibrarySearchEvent(h,t,n))}}).fail(function(){if(f.find(".error-message").length<1){var n=$("<div>Library temporarily unavailable, please try again later.</div>").addClass("error-message");f.prepend(n)}f.find(".loading").remove()})}}function e(i){var r,u;!t&&i.clickTargetID&&(doNotUpdateHistory=!0,i.clickTargetID==="catalog"?(r=i.url?i.url.split("?")[1]:n.URL.split("?")[1],r&&Roblox.CatalogValues&&Roblox.CatalogValues.CatalogContentsUrl?(u=$("#"+Roblox.CatalogValues.ContainerID),Roblox.CatalogShared.LoadCatalogAjax(Roblox.CatalogValues.CatalogContentsUrl+"?"+r,null,u,!0)):window.location.href=i.url):$("#"+i.clickTargetID).click(),doNotUpdateHistory=!1)}function o(i){var u,r,o,s,f,e;Roblox.AdsHelper&&Roblox.AdsHelper.AdRefresher&&Roblox.AdsHelper.AdRefresher.refreshAds(),i.url&&(u=i.url.split("?")[1],u&&(r=n.URL.split("?")[0].toLowerCase(),r=r.indexOf("#")===-1?r:r.split("#")[0],r=r.replace("catalog/default.aspx","catalog/"),r.indexOf("browse.aspx")<0&&r.indexOf("/develop/library")<0&&(o=r.length,s=r.lastIndexOf("/")===o-1,r+=s?"browse.aspx":"/browse.aspx"),f=r+"?"+u,$("#LibraryTabLink").attr("data-query-params",u),e=r.indexOf("/develop/library")>=0?"/develop/library/?"+u:"/catalog/?"+u,GoogleAnalyticsEvents&&GoogleAnalyticsEvents.ViewVirtual(e),t=!0,i.replaceCurrentState?History.replaceState({clickTargetID:"catalog",url:f},n.title,f):History.pushState({clickTargetID:"catalog",url:f},n.title,f),t=!1))}var r="CatalogLoadedViaAjax",t=!1,i=0;return{LoadCatalogAjax:f,CatalogLoadedViaAjaxEventName:r,handleURLChange:e,handleCatalogLoadedViaAjaxEvent:o}},Roblox.CatalogShared=Roblox.CatalogSharedConstructor(document);

;//Bundle detector
Roblox && Roblox.BundleDetector && Roblox.BundleDetector.bundleDetected('Pages___CatalogShared');