RoboticsSafetyV2Hold.react",["ix","CurrentUser","DateConsts","GeoFlexbox.react","GeoSpinner.react","Image.react","Instant","Pressable.react","RelayHooks","RoboticsROSArdioInterface","RoboticsRobotDisplayButton.react","RoboticsRobotDisplayText.react","RoboticsSafetyV2HoldDockingModal.react","RoboticsSafetyV2HoldMutation.graphql","RoboticsSafetyV2LowBatteryResumeModal.react","RoboticsSafetyV2ReleaseFailedModal.react","RoboticsSafetyV2Selectors","RoboticsSafetyV2StateContainer","RoboticsStateContainerROSModuleActions","emptyFunction","react","useCountdownSeconds","usePrevious"],(function(a,b,c,d,e,f,g,h){"use strict";var i,j,k=j||(j=d("react"));e=j;var l=e.useCallback,m=e.useEffect,n=e.useState,o=3600,p=300,q=(e=c("CurrentUser").getID())!=null?e:"",r=function(a){var b=Math.floor(a/60);a=a%60;var c;a>=10?c=b+":"+a:c=b+":0"+a;return c},s=i!==void 0?i:i=b("RoboticsSafetyV2HoldMutation.graphql");function a(a){var b=a.reservationEndTime,e=a.reservationID,f=(a=d("RoboticsSafetyV2StateContainer")).useDispatch();m(function(){f(d("RoboticsStateContainerROSModuleActions").rosParamRequested({paramName:d("RoboticsROSArdioInterface").ROSParam.LowBatteryThreshold}))},[f]);var g=n(!1),i=g[0],j=g[1];g=d("RelayHooks").useMutation(s);var v=g[0];g=function(){f(d("RoboticsStateContainerROSModuleActions").rosServiceRequested({serviceName:d("RoboticsROSArdioInterface").ROSService.Resume,requestPayload:null})),f(d("RoboticsStateContainerROSModuleActions").rosServiceRequested({serviceName:d("RoboticsROSArdioInterface").ROSService.Dock,requestPayload:null}))};var w=e!=null,x=l(function(){w&&v({variables:{input:{force:!0,robot_user_id:q,reservation_id:e,status:"CANCELLED"}},onError:function(){j(!0)}}),f(d("RoboticsStateContainerROSModuleActions").rosServiceRequested({serviceName:d("RoboticsROSArdioInterface").ROSService.Resume,requestPayload:null})),f(d("RoboticsStateContainerROSModuleActions").rosServiceResponseRemoved({serviceName:d("RoboticsROSArdioInterface").ROSService.Pause}))},[v,f,e,w]),y=n(!1),z=y[0],A=y[1];y=a.useTopic(d("RoboticsROSArdioInterface").ROSTopic.Battery,d("RoboticsSafetyV2Selectors").getBatteryStatus);y=y.isCharging;var B=a.useTopic(d("RoboticsROSArdioInterface").ROSTopic.RobotStatus,d("RoboticsSafetyV2Selectors").getRobotStatus),C=a.useSelector(d("RoboticsSafetyV2Selectors").getIsPauseRequested);a=B===d("RoboticsROSArdioInterface").RobotState.Pause;var D=a&&C,E=!C&&a&&!w;a=C&&a||w;var F=d("RoboticsSafetyV2StateContainer").useTopic(d("RoboticsROSArdioInterface").ROSTopic.Battery,d("RoboticsSafetyV2Selectors").getIsOnHoldBatteryLow);B=B===d("RoboticsROSArdioInterface").RobotState.Docking;var G=n(u(b)),H=G[0],I=G[1];m(function(){I(u(b)),A(!1)},[b]);var J=c("useCountdownSeconds")(x,H);G=c("usePrevious")(w);H=!w&&G;var K=D&&H;m(function(){K===!0&&(f(d("RoboticsStateContainerROSModuleActions").rosServiceRequested({serviceName:d("RoboticsROSArdioInterface").ROSService.Resume,requestPayload:null})),C&&f(d("RoboticsStateContainerROSModuleActions").rosServiceResponseRemoved({serviceName:d("RoboticsROSArdioInterface").ROSService.Pause})))},[f,C,K]);G=J!=null&&J<=p;D=J!=null&&J===o;H=D||!w||z;D=G||!w||z;var L=function(a){if(J!=null&&w){a=Math.max(0,Math.min(J+a,o));A(!0);v({variables:{input:{robot_user_id:q,reservation_id:e,end_time:d("Instant").now()+a,force:!0}},onError:function(){A(!1)}})}};return k.jsxs(k.Fragment,{children:[F&&a&&k.jsx(c("RoboticsSafetyV2LowBatteryResumeModal.react"),{handleRelease:x}),i&&k.jsx(c("RoboticsSafetyV2ReleaseFailedModal.react"),{setIsShowReleaseErrorModal:j}),B&&k.jsx(c("RoboticsSafetyV2HoldDockingModal.react"),{timeLeft:J}),k.jsxs(c("GeoFlexbox.react"),{alignItems:"stretch",xstyle:t.main,children:[k.jsx(c("GeoFlexbox.react"),{alignItems:"center",justifyContent:"space-around",direction:"column",xstyle:t.countdownPane,grow:2,basis:"0",children:E?k.jsx(c("RoboticsRobotDisplayText.react"),{color:"GRAY",use:"BODY_EMPHASIZED",textAlign:"CENTER",children:"Paused by a remote user"}):k.jsxs(k.Fragment,{children:[k.jsx(c("RoboticsRobotDisplayText.react"),{color:"GRAY",use:"BODY_EMPHASIZED",children:"On Hold for"}),J!=null?k.jsx(c("RoboticsRobotDisplayText.react"),{use:"HEADLINE",color:J<300?"RED":"DEFAULT",children:r(J)}):k.jsx(c("GeoSpinner.react"),{}),k.jsxs(c("GeoFlexbox.react"),{xstyle:t.timerButtonContainer,children:[k.jsx(c("Pressable.react"),{accessibilityRole:"button",disabled:D,onPress:function(){L(-300)},style:{opacity:D?.25:1,pointerEvents:D?"none":"auto"},children:k.jsx(c("GeoFlexbox.react"),{alignItems:"center",justifyContent:"center",xstyle:t.timerButton,children:k.jsx(c("Image.react"),{src:h("154118")})})}),k.jsx(c("Pressable.react"),{accessibilityRole:"button",disabled:H,onPress:function(){L(300)},style:{opacity:H?.25:1,pointerEvents:H?"none":"auto"},children:k.jsx(c("GeoFlexbox.react"),{alignItems:"center",justifyContent:"center",xstyle:t.timerButton,children:k.jsx(c("Image.react"),{src:h("154119")})})})]})]})}),k.jsxs(c("GeoFlexbox.react"),{alignItems:"center",direction:"column",xstyle:t.buttonPane,grow:1,basis:"0",children:[y?k.jsx(c("RoboticsRobotDisplayButton.react"),{direction:"VERTICAL",flex:!0,icon:k.jsx(c("Image.react"),{src:h("164102")}),onClick:c("emptyFunction"),label:"Charging",textSize:"MEDIUM",isDisabled:!0}):k.jsx(c("RoboticsRobotDisplayButton.react"),{direction:"VERTICAL",flex:!0,icon:B?k.jsx(c("GeoFlexbox.react"),{alignItems:"center",justifyContent:"center",xstyle:t.buttonIcon,children:k.jsx(c("GeoSpinner.react"),{shade:"light"})}):k.jsx(c("Image.react"),{src:h("154049")}),label:B?"Docking":"Dock",onClick:g,textSize:"MEDIUM",use:"PRIMARY"}),k.jsx(c("RoboticsRobotDisplayButton.react"),{direction:"VERTICAL",flex:!0,icon:k.jsx(c("Image.react"),{src:h("154050")}),label:"Release",onClick:x,textSize:"MEDIUM",use:"SUCCESS"})]})]})]})}a.displayName=a.name+" [from "+f.id+"]";var t={buttonIcon:{height:"xnnlda6",width:"x15yg21f",$$css:!0},buttonPane:{rowGap:"xgpatz3",$$css:!0},countdownPane:{backgroundColor:"x10softn",borderTopStartRadius:"x1v38n6o",borderTopEndRadius:"xg5ltox",borderBottomEndRadius:"x1j3q6us",borderBottomStartRadius:"x1ybjxci",paddingTop:"xyamay9",paddingEnd:"x1pi30zi",paddingBottom:"x1l90r2v",paddingStart:"x1swvt13",width:"xh8yej3",$$css:!0},main:{columnGap:"x40hh3e",paddingTop:"xyamay9",paddingEnd:"x1pi30zi",paddingBottom:"x1l90r2v",paddingStart:"x1swvt13",$$css:!0},timerButton:{height:"x1wkxgih",width:"xygnafs",backgroundColor:"x39viwf",borderTopStartRadius:"x14yjl9h",borderTopEndRadius:"xudhj91",borderBottomEndRadius:"x18nykt9",borderBottomStartRadius:"xww2gxu",":active_transform":"xk4oym4",":active_boxShadow":"x1iqhkd5",$$css:!0},timerButtonContainer:{columnGap:"x1tmqnbw",paddingTop:"xyamay9",paddingEnd:"x1pi30zi",paddingBottom:"x1l90r2v",paddingStart:"x1swvt13",$$css:!0}},u=function(a){return a!=null?a-Math.round(d("DateConsts").getCurrentTimeInSeconds()):null};g["default"]=a}),98);
-----
RoboticsSafetyV2HoldMutation.graphql",["RoboticsSafetyV2HoldMutation_facebookRelayOperation"],(function(a,b,c,d,e,f){"use strict";a=function(){var a=[{defaultValue:null,kind:"LocalArgument",name:"input"}],c=[{kind:"Variable",name:"params",variableName:"input"}],d={alias:null,args:null,kind:"ScalarField",name:"client_mutation_id",storageKey:null},e={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"unencoded_id",storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"start_time",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"end_time",storageKey:null},j={alias:null,args:null,kind:"ScalarField",name:"status",storageKey:null},k={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null};return{fragment:{argumentDefinitions:a,kind:"Fragment",metadata:null,name:"RoboticsSafetyV2HoldMutation",selections:[{alias:null,args:c,concreteType:"RoboticsRobotTaskReservationUpsertResponsePayload",kind:"LinkedField",name:"robotics_robot_task_reservation_upsert",plural:!1,selections:[d,{alias:null,args:null,concreteType:"RobotTaskReservation",kind:"LinkedField",name:"reservation",plural:!1,selections:[e,f,{alias:null,args:null,concreteType:"RobotTaskReservationOwnersConnection",kind:"LinkedField",name:"owners",plural:!1,selections:[{alias:null,args:null,concreteType:"ProdInternalUser",kind:"LinkedField",name:"nodes",plural:!0,selections:[g],storageKey:null}],storageKey:null},h,i,j,k],storageKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:a,kind:"Operation",name:"RoboticsSafetyV2HoldMutation",selections:[{alias:null,args:c,concreteType:"RoboticsRobotTaskReservationUpsertResponsePayload",kind:"LinkedField",name:"robotics_robot_task_reservation_upsert",plural:!1,selections:[d,{alias:null,args:null,concreteType:"RobotTaskReservation",kind:"LinkedField",name:"reservation",plural:!1,selections:[e,f,{alias:null,args:null,concreteType:"RobotTaskReservationOwnersConnection",kind:"LinkedField",name:"owners",plural:!1,selections:[{alias:null,args:null,concreteType:"ProdInternalUser",kind:"LinkedField",name:"nodes",plural:!0,selections:[g,e],storageKey:null}],storageKey:null},h,i,j,k],storageKey:null}],storageKey:null}]},params:{id:b("RoboticsSafetyV2HoldMutation_facebookRelayOperation"),metadata:{},name:"RoboticsSafetyV2HoldMutation",operationKind:"mutation",text:null}}}();e.exports=a}),null);
-----
RoboticsSafetyV2HoldMutation_facebookRelayOperation",[],(function(a,b,c,d,e,f){e.exports="29552200334428072"}),null);
-----