CatalogDataSourceSelectorV2.react",["fbt","CatalogDataSourceSelectorV2Query.graphql","CatalogDataSourceTypes","CatalogDataSourcesStringsUtils","CatalogDataSourcesUtils","CommerceManagerHooks","GeoPrivateResetSelectorStyle.react","GeoSearchableSelector.react","GeoSpinner.react","Image.react","LoadingMarkerArea.react","SearchableEntry","StaticSearchSource","XCommerceManagerDataSourceDetailsPageControllerRouteBuilder","multiLevelSortArray","react","react-compiler-runtime","useCatalogContext","useCatalogRouter","useCommerceManagerRouteParams"],(function(t,n,r,o,a,i,l,s){"use strict";var e,u,c=u||(u=o("react")),d=u.useMemo,m=e!==void 0?e:e=n("CatalogDataSourceSelectorV2Query.graphql");function p(e){switch(e){case"FEED":return r("CatalogDataSourceTypes").Feed;case"SMART_PIXEL":return r("CatalogDataSourceTypes").Pixel;case"BATCH_API":return r("CatalogDataSourceTypes").App;case"PARTNER_INTEGRATION":return r("CatalogDataSourceTypes").PartnerIntegration;case"CRAWL_REQUEST":return r("CatalogDataSourceTypes").Website;case"FB_PAGE_PRODUCTS":return r("CatalogDataSourceTypes").FBPageProducts;default:return null}}function _(e,t){switch(e){case r("CatalogDataSourceTypes").App:return o("CatalogDataSourcesStringsUtils").getDataSourceCategoryApps();case r("CatalogDataSourceTypes").FBPageProducts:return o("CatalogDataSourcesStringsUtils").getDataSourceCategoryFacebookPageProducts();case r("CatalogDataSourceTypes").Feed:return t!=null&&t!=="VERSION"?o("CatalogDataSourcesStringsUtils").getDataSourceCategoryCountryAndLanguageData():o("CatalogDataSourcesStringsUtils").getDataSourceCategoryFile();case r("CatalogDataSourceTypes").Pixel:return o("CatalogDataSourcesStringsUtils").getDataSourceCategoryPixel();case r("CatalogDataSourceTypes").PartnerIntegration:return o("CatalogDataSourcesStringsUtils").getDataSourceCategoryPartnerPlatform();case r("CatalogDataSourceTypes").Website:return o("CatalogDataSourcesStringsUtils").getDataSourceCategoryWebsite();case r("CatalogDataSourceTypes").Manual:return o("CatalogDataSourcesStringsUtils").getDataSourceCategoryManualEntry()}}function f(){var e,t=o("react-compiler-runtime").c(27),n=r("useCatalogContext")(),a=n.catalogID,l=r("useCommerceManagerRouteParams")(),u=l.dataSourceID,d=r("useCatalogRouter")(),_;t[0]!==a?(_={catalogID:a},t[0]=a,t[1]=_):_=t[1];var f;t[2]===Symbol.for("react.memo_cache_sentinel")?(f={fetchPolicy:"store-and-network"},t[2]=f):f=t[2];var b=o("CommerceManagerHooks").useCommerceManagerLazyQuery(m,_,f),v;if(t[3]!==((e=b.catalog)==null||(e=e.data_sources_v2)==null?void 0:e.nodes)){var S,R,L;v=[];var E=(S=(R=b.catalog)==null||(R=R.data_sources_v2)==null?void 0:R.nodes)!=null?S:[];for(var k of E)if(k!=null){var I=k.data_source_id,T=p(k.data_upload_type);I!=null&&T!=null&&v.push({dataSourceType:T,fbid:I,icon:k.data_source_icon,name:k.name,overrideType:k.data_override_type,uniqueID:I})}t[3]=(L=b.catalog)==null||(L=L.data_sources_v2)==null?void 0:L.nodes,t[4]=v}else v=t[4];var D=v,x;if(t[5]!==D){var $,P=($=o("multiLevelSortArray")).multiLevelSortArray(D,[$.numberSorter(C),$.stringSorter(y),$.stringSorter(h)]).map(g);x=new(r("StaticSearchSource"))(P),t[5]=D,t[6]=x}else x=t[6];var N=x,M;if(t[7]!==N||t[8]!==u){var w;t[10]!==u?(w=function(t){return t.getUniqueID()===u},t[10]=u,t[11]=w):w=t[11],M=N.getSearchableEntries().find(w),t[7]=N,t[8]=u,t[9]=M}else M=t[9];var A=M,F;t[12]!==a||t[13]!==d?(F=function(t){var e=t.getUniqueID(),n=r("XCommerceManagerDataSourceDetailsPageControllerRouteBuilder").buildUri({catalog_id:a,data_source_id:e});d.navigate(n.toString())},t[12]=a,t[13]=d,t[14]=F):F=t[14];var O=F;if(b.catalog==null){var B;return t[15]===Symbol.for("react.memo_cache_sentinel")?(B=c.jsx(r("LoadingMarkerArea.react"),{name:"CatalogDataSourceSelectorV2:Loading",owner:"catalog_interfaces",children:c.jsx(r("GeoSpinner.react"),{loggingName:i.id})}),t[15]=B):B=t[15],B}var W;t[16]===Symbol.for("react.memo_cache_sentinel")?(W=s._(/*BTDS*/"Data sources"),t[16]=W):W=t[16];var q;t[17]!==A?(q=A==null?void 0:A.getPhoto(),t[17]=A,t[18]=q):q=t[18];var U;t[19]!==q?(U=c.jsx(r("Image.react"),{src:q}),t[19]=q,t[20]=U):U=t[20];var V;t[21]===Symbol.for("react.memo_cache_sentinel")?(V=s._(/*BTDS*/"Search by name"),t[21]=V):V=t[21];var H;return t[22]!==O||t[23]!==N||t[24]!==A||t[25]!==U?(H=c.jsx(r("GeoPrivateResetSelectorStyle.react"),{children:c.jsx(r("GeoSearchableSelector.react"),{"data-button-testid":"data_source_selector",isCategorized:!0,isLabelHidden:!0,label:W,media:U,minMenuWidth:500,placeholder:V,searchSource:N,value:A,onChange:O})}),t[22]=O,t[23]=N,t[24]=A,t[25]=U,t[26]=H):H=t[26],H}function g(e){var t;return new(r("SearchableEntry"))({auxiliaryData:{fbid:e.fbid,overrideType:e.overrideType,partnerIntegrationObjectType:e.partnerIntegrationObjectType,type:e.dataSourceType},keywordString:e.name+" "+e.dataSourceType,photo:o("CatalogDataSourcesUtils").getDataSourceAsset(e.icon),subtitle:"ID: "+e.fbid,title:(t=e.nameFbt)!=null?t:e.name,type:_(e.dataSourceType,e.overrideType),uniqueID:e.uniqueID})}function h(e){return e.fbid}function y(e){return e.name}function C(e){return o("CatalogDataSourcesUtils").getSortOrder(e.dataSourceType)}l.default=f}),226);
-----
CatalogDataSourceSelectorV2Query_facebookRelayOperation",[],(function(t,n,r,o,a,i){a.exports="24399249673110817"}),null);
-----
-----
CatalogDataSourceSelectorV2Query_facebookRelayOperation",[],(function(t,n,r,o,a,i){a.exports="24399249673110817"}),null);
-----