MWSDevicePresetCollectionEditorModal.react",["fbt","CometImage.react","CometRelayErrorHandling","DynamicSearchSource","GeoButton.react","GeoCancelButton.react","GeoDraggableList.react","GeoDraggableListItem.react","GeoHStack.react","GeoLink.react","GeoList.react","GeoListGenericItem.react","GeoMediaItem.react","GeoModalCard.react","GeoModalFooter.react","GeoModalHeader.react","GeoNextButton.react","GeoNotice.react","GeoSection.react","GeoStep.react","GeoStepperModal.react","GeoText.react","GeoTextInput.react","GeoTextPairing.react","GeoToast.react","GeoTokenizer.react","GeoVStack.react","MMAQPLUserFlow","MWSDevicePresetCollectionEditorModalFragment.graphql","MWSDevicePresetCollectionEditorModalMutation.graphql","MWSDevicesAppsConstants","MWSDevicesStringUtils","QPLUserFlow","RelayHooks","SearchableEntry","clamp","getMWSDevicesAppVersion","qpl","react","useGeoToaster"],(function(a,b,c,d,e,f,g,h){"use strict";var i,j,k,l=k||(k=d("react"));e=k;var m=e.useCallback,n=e.useMemo,o=e.useRef,p=e.useState;function a(a){a=a.props;var b=a.appCollectionId,e=a.fragmentKey,f=a.onHide,g=a.onNavigateToRequiredAppsTab,i=d("RelayHooks").useFragment(y,e);a=c("useGeoToaster")();var j=a.add;e=p();var k=e[0],o=e[1],r=m(function(){f("layerHideButton")},[f]);a=d("RelayHooks").useMutation(z);var s=a[0],t=a[1],u=m(function(a,e){c("QPLUserFlow").start(v,{annotations:{bool:{isCreatingNew:b==null}}});var f=b!=null?x:w;s({onCompleted:function(){c("QPLUserFlow").endSuccess(v),j(l.jsx(c("GeoToast.react"),{heading:f,status:"success"})),r()},onError:function(a){d("MMAQPLUserFlow").endCancelOrFailure(v,a),d("CometRelayErrorHandling").markErrorAsHandled(a),o(d("MWSDevicesStringUtils").Q4B_GENERIC_ERROR_MESSAGE)},variables:{input:{app_collection_id:b,device_config_id:i.id,name:a,ordered_app_ids:e}}})},[j,b,s,i.id,r]);e=((a=(e=i.device_apps)==null?void 0:e.nodes)!=null?a:[]).map(function(a){var b;return{iconUri:(b=(b=a.app_icon_image)==null?void 0:b.uri)!=null?b:d("MWSDevicesAppsConstants").MWS_DEFAULT_APP_LOGO_URI,id:a.id,name:(b=a.name)!=null?b:"",version:c("getMWSDevicesAppVersion")(a.version,(b=a.installed_app_versions)==null?void 0:b.nodes)}});var A=e.map(function(a){var b=a.iconUri,e=a.id,f=a.name;a=a.version;return new(c("SearchableEntry"))({photo:(b=b)!=null?b:d("MWSDevicesAppsConstants").MWS_DEFAULT_APP_LOGO_URI,subtitle:a,title:f,uniqueID:e})}),B=b!=null;e=(a=i.ordered_app_collections)==null?void 0:a.nodes.find(function(a){return a.id===b});a=(a=e==null?void 0:e.name)!=null?a:"";e=(e=e==null?void 0:(e=e.ordered_apps)==null?void 0:e.nodes.map(function(a){var b=a.id;return A.find(function(a){return b===a.getUniqueID()})}).filter(Boolean))!=null?e:[];a=p(a);var C=a[0],D=a[1];a=p(e);var E=a[0],F=a[1],G=E.map(function(a){return a.getUniqueID()}),H=n(function(){var a=new(c("DynamicSearchSource"))([],null,{setQueryStringAsExhausted:!0});a.replaceSearchEntries(A.filter(function(a){return!G.some(function(b){return b===a.getUniqueID()})}));return a},[A,G]);e=p(0);var I=e[0],J=e[1];a=[{id:0,label:h._(/*BTDS*/"u540du79f0")},{id:1,label:h._(/*BTDS*/"u5e94u7528")},{id:2,label:h._(/*BTDS*/"u68c0u67e5")}];var K=a.length,L=m(function(){return J(c("clamp")(I+1,0,K-1))},[I,K]),M=m(function(a){switch(a){case 0:return C!=="";case 1:return G.length>0;case 2:return C!==""&&G.length>0}},[C,G.length]),N=m(function(a){if(a=0;a--)if(!M(a))return!0;return!1},[M]);e=B?h._(/*BTDS*/"u7f16u8f91u5e94u7528u96c6"):h._(/*BTDS*/"u521bu5efau5e94u7528u96c6");var P=B?h._(/*BTDS*/"u7f16u8f91"):h._(/*BTDS*/"u521bu5efa"),Q=n(function(){switch(I){case 0:return h._(/*BTDS*/"u9009u62e9u540du79f0");case 1:return h._(/*BTDS*/"u628au5fc5u8981u5e94u7528u52a0u5165{name}",[h._param("name",C)]);case 2:return h._(/*BTDS*/"u68c0u67e5{name}u5e94u7528u96c6",[h._param("name",C)])}},[C,I]);return l.jsx(c("GeoStepperModal.react"),{activeStepID:I,isShown:!0,onHide:f,onStepperChange:J,stepperHeader:e,steps:a.map(function(a){var b=a.id;a=a.label;return l.jsx(c("GeoStep.react"),{id:b,isDisabled:O(b),label:a,status:N(b)},b)}),width:800,children:function(a){a=a.activeStepID;return l.jsx(c("GeoModalCard.react"),{footer:l.jsx(c("GeoModalFooter.react"),{primaryButton:a===K-1?l.jsx(c("GeoButton.react"),{isDisabled:t||!M(a),label:P,onClick:function(){return u(C,G)},variant:"primary"}):l.jsx(c("GeoNextButton.react"),{isDisabled:t||!M(a),onClick:L}),secondaryButton:l.jsx(c("GeoCancelButton.react"),{onClick:r})}),header:l.jsx(c("GeoModalHeader.react"),{heading:Q}),height:500,children:l.jsx(q,{activeStepID:a,collectionName:C,errorMessage:k,onHideModal:r,onNavigateToRequiredAppsTab:g,searchSource:H,selectedAppIDs:G,selectedEntries:E,setCollectionName:D,setSelectedEntries:F})})}})}a.displayName=a.name+" [from "+f.id+"]";function q(a){var b=a.activeStepID,d=a.collectionName,e=a.errorMessage,f=a.onHideModal,g=a.onNavigateToRequiredAppsTab,h=a.searchSource,i=a.selectedAppIDs,j=a.selectedEntries,k=a.setCollectionName;a=a.setSelectedEntries;return l.jsxs(c("GeoSection.react"),{children:[b===0&&l.jsx(r,{collectionName:d,setCollectionName:k}),b===1&&l.jsx(s,{onHide:f,onNavigateToRequiredAppsTab:g,searchSource:h,selectedAppIDs:i,selectedEntries:j,setSelectedEntries:a}),b===2&&l.jsx(t,{selectedAppIDs:i,selectedEntries:j}),e!=null&&l.jsx(c("GeoNotice.react"),{status:"error",children:e})]})}q.displayName=q.name+" [from "+f.id+"]";function r(a){var b=a.collectionName;a=a.setCollectionName;return l.jsxs(c("GeoVStack.react"),{children:[l.jsx(c("GeoText.react"),{children:h._(/*BTDS*/"u9996u5148uff0cu8bf7u4e3au5e94u7528u96c6u8f93u5165u4e00u4e2au540du79f0u3002")}),l.jsx(c("GeoTextInput.react"),{isLabelHidden:!0,label:"Name",onChange:a,value:b})]})}r.displayName=r.name+" [from "+f.id+"]";function s(a){var b=a.onHide,d=a.onNavigateToRequiredAppsTab,e=a.searchSource,f=a.selectedAppIDs,g=a.selectedEntries,i=a.setSelectedEntries,j=o(null);return l.jsxs(c("GeoVStack.react"),{children:[l.jsx(c("GeoText.react"),{children:h._(/*BTDS*/"u628au5e94u7528u52a0u5165u5e94u7528u96c6u524duff0cu8bf7{=m2}",[h._implicitParam("=m2",l.jsx(c("GeoLink.react"),{onClick:function(){b(),d()},children:h._(/*BTDS*/"u628au5e94u7528u52a0u5165u8fd9u9879u8bbeu5907u9884u8bbeu3002")}))])}),l.jsx(c("GeoTokenizer.react"),{inputRef:j,label:h._(/*BTDS*/"u641cu7d22u5e94u7528"),onChange:function(a){i([].concat(g,a));(a=j.current)==null?void 0:a.blur()},searchSource:e,showEntriesOnFocus:!0,value:[]}),l.jsx(c("GeoDraggableList.react"),{density:"dense",hasBoldItemLabel:!0,itemIDs:f,onRemove:function(a,b){i(g.filter(function(b){return a.some(function(a){return a===b.getUniqueID()})}))},onReorder:function(a,b,c){b=a.map(function(a){return g.find(function(b){return a===b.getUniqueID()})}).filter(Boolean);i([]);i(b)},children:g.map(function(a){return l.jsx(c("GeoDraggableListItem.react"),{isMovable:!0,isRemovable:!0,itemID:a.getUniqueID(),children:l.jsx(c("GeoListGenericItem.react"),{children:l.jsx(u,{description:a.getSubtitle(),heading:a.getTitle(),icon:a.getPhoto()})})},a.getUniqueID())})})]})}s.displayName=s.name+" [from "+f.id+"]";function t(a){var b=a.selectedAppIDs;a=a.selectedEntries;b=b.length<=1?h._(/*BTDS*/{"*":"u8fd9u4e2au5e94u7528u96c6u5c06u5305u542b{number}u4e2au5e94u7528","_1":"u8fd9u4e2au5e94u7528u96c6u5c06u5305u542b 1 u4e2au5e94u7528"},[h._plural(b.length,"number")]):h._(/*BTDS*/{"*":"u8fd9u4e2au5e94u7528u96c6u5c06u5305u542b{number}u4e2au5e94u7528uff0cu7528u4ee5u4e0bu987au5e8fu663eu793a","_1":"u8fd9u4e2au5e94u7528u96c6u5c06u5305u542b 1 u4e2au5e94u7528uff0cu7528u4ee5u4e0bu987au5e8fu663eu793a"},[h._plural(b.length,"number")]);return l.jsxs(c("GeoVStack.react"),{children:[l.jsx(c("GeoText.react"),{children:b}),l.jsx(c("GeoList.react"),{density:"dense",children:a.map(function(a){return l.jsx(c("GeoListGenericItem.react"),{children:l.jsx(u,{description:a.getSubtitle(),heading:a.getTitle(),icon:a.getPhoto()})},a.getUniqueID())})})]})}t.displayName=t.name+" [from "+f.id+"]";function u(a){var b=a.description,d=a.heading;a=a.icon;return l.jsx(c("GeoListGenericItem.react"),{children:l.jsxs(c("GeoHStack.react"),{alignItems:"center",children:[l.jsx(c("GeoMediaItem.react"),{fit:"cover",media:l.jsx(c("CometImage.react"),{alt:h._(/*BTDS*/"u5e94u7528u56feu6807"),src:a}),ratio:"square",size:32}),l.jsx(c("GeoHStack.react"),{alignSelf:"stretch",children:l.jsx(c("GeoTextPairing.react"),{description:b,heading:d,size:"value"})})]})})}u.displayName=u.name+" [from "+f.id+"]";var v=c("qpl")._(440731057,"2583"),w=h._(/*BTDS*/"u5e94u7528u96c6u521bu5efau6210u529f"),x=h._(/*BTDS*/"u5e94u7528u96c6u66f4u65b0u6210u529f"),y=i!==void 0?i:i=b("MWSDevicePresetCollectionEditorModalFragment.graphql"),z=j!==void 0?j:j=b("MWSDevicePresetCollectionEditorModalMutation.graphql");g["default"]=a}),226);
-----
MWSDevicePresetCollectionEditorModalMutation_facebookRelayOperation",[],(function(a,b,c,d,e,f){e.exports="23872578799022047"}),null);
-----