CareersV2RefreshSearchResultsBookmarkV3.react",["fbt","CandidatePortalBrowserSession","CandidatePortalLoggingUtils","CandidatePortalProfileUpdateBookmarkedReqsMutation.graphql","CandidatePortalRouteConfigs","CandidatePortalURLQueryParamsContext","CareersV2RefreshSearchResultsBookmarkV3Query.graphql","CareersV2Search","CareersV2SearchFiltersStore","MCDSIcon.react","MCDSIconButton.react","MCDSIconRectangleNotchedBottomVerticalFilled.svg.react","MCDSIconRectangleNotchedBottomVerticalOutline.svg.react","MCDSToast.react","RelayHooks","asyncToGeneratorRuntime","filterNulls","nullthrows","react","useBoolean","useCPNavigate","useCandidatePortalRelayMutation","useMCDSToaster"],(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.useContext,n=e.useEffect,o=e.useMemo,p=e.useRef,q=e.useState,r="action";function a(a){var e=a.isDetailedPage,f=a.isLoggedIn,g=a.passesRefreshGK,j=g===void 0?!0:g,s=a.reqID;g=c("useBoolean")(!1);var t=g.set,u=g.value;a=c("useBoolean")(!1);var v=a.set;g=a.value;var w=c("useCandidatePortalRelayMutation")();a=m(c("CandidatePortalURLQueryParamsContext"));var x=a.viewasUserID,y=c("CareersV2SearchFiltersStore").getInstance();a=c("useCPNavigate")();var z=a.cpGoURI,A=o(function(){return new URL(window.location.href)},[]),B=p(!1);a=d("RelayHooks").useLazyLoadQuery(i!==void 0?i:i=b("CareersV2RefreshSearchResultsBookmarkV3Query.graphql"),{viewasUserID:x});var C=c("useMCDSToaster")(),D=C.add;C=c("filterNulls")((a=(C=a.viewer)==null||(C=C.user)==null||(C=C.profile)==null||(C=C.bookmarked_reqs)==null?void 0:C.nodes)!=null?a:[]);a=C.map(function(a){return c("nullthrows")(a.id)});C=q(a);var E=C[0],F=C[1];n(function(){y.subscribe(function(){F(y.getCurrentSavedJobs())})},[y]);var G=l(function(b,a){b=b===!0?E.concat(a):E.filter(function(b){return b!==a});y.setCurrentSavedJobs(b);!j?y.update():y.notifySubscribersOfChange();F(b)},[E,y,j]),H=l(b("asyncToGeneratorRuntime").asyncToGenerator(function*(){d("CandidatePortalLoggingUtils").logCriticalAction("CAREERS_SITE_SAVED_JOBS","SUBMIT_CLICK");v(!0);u===!1?G(!0,s):G(!1,s);try{var a=window.location.href;if(a.includes("saved_jobs")&&u===!0&&!j){a=new(c("CareersV2Search"))();a.search("search_result")}t(!u);v(!1);yield w({eventType:"careers.update_saved_jobs",mutation:c("CandidatePortalProfileUpdateBookmarkedReqsMutation.graphql"),mutationData:{requisition_ids:u===!1?E.concat(s):E.filter(function(a){return a!==s}),session_id:d("CandidatePortalBrowserSession").getSessionKey()}});d("CandidatePortalLoggingUtils").logCompletion("CAREERS_SITE_SAVED_JOBS",{payload:{saved_job_ids:s,user_id:x,all_saved_jobs:E}})}catch(a){d("CandidatePortalLoggingUtils").logError("CAREERS_SITE_SAVED_JOBS",100,"USER_PROFILE_UPDATE_SAVED_JOBS_ERROR",a),D(k.jsx(c("MCDSToast.react"),{message:h._(/*BTDS*/"Oops! Something went wrong. Try again!")}))}}),[D,w,E,u,j,s,t,v,G,x]);n(function(){E.includes(s)?t(!0):t(!1)},[E,s,t]);function I(){A.searchParams.set(r,"bookmark"),z(d("CandidatePortalRouteConfigs").routes.SIGNUP+("?redirect="+encodeURIComponent(A.toString())))}n(function(){var a=A.searchParams.get(r)==="bookmark";!B.current&&a&&e&&f&&(void H(),A.searchParams["delete"](r),window.history.pushState({},"",A),B.current=!0)},[f,e,A,s,H]);function J(a){a.preventDefault(),a.stopPropagation(),f?void H():I()}return k.jsx(c("MCDSIconButton.react"),{"aria-label":h._(/*BTDS*/"Bookmark this job"),icon:k.jsx(c("MCDSIcon.react"),{icon:u?c("MCDSIconRectangleNotchedBottomVerticalFilled.svg.react"):c("MCDSIconRectangleNotchedBottomVerticalOutline.svg.react"),size:16}),isDisabled:g,onClick:function(a){return J(a)},type:"border"})}a.displayName=a.name+" [from "+f.id+"]";g["default"]=a}),226);
-----
CareersV2RefreshSearchResultsBookmarkV3Query.graphql",["CareersV2RefreshSearchResultsBookmarkV3Query_candidate_portalRelayOperation"],(function(a,b,c,d,e,f){"use strict";a=function(){var a=[{defaultValue:null,kind:"LocalArgument",name:"viewasUserID"}],c=[{kind:"Variable",name:"viewas_user_id",variableName:"viewasUserID"}],d={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},e={alias:null,args:null,concreteType:"UserProfileBookmarkedReqsConnection",kind:"LinkedField",name:"bookmarked_reqs",plural:!1,selections:[{alias:null,args:null,concreteType:"XCPProdRequisitionExport",kind:"LinkedField",name:"nodes",plural:!0,selections:[d],storageKey:null}],storageKey:null};return{fragment:{argumentDefinitions:a,kind:"Fragment",metadata:null,name:"CareersV2RefreshSearchResultsBookmarkV3Query",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:c,concreteType:"CPUser",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,concreteType:"UserProfile",kind:"LinkedField",name:"profile",plural:!1,selections:[e],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:a,kind:"Operation",name:"CareersV2RefreshSearchResultsBookmarkV3Query",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:c,concreteType:"CPUser",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,concreteType:"UserProfile",kind:"LinkedField",name:"profile",plural:!1,selections:[e,d],storageKey:null},d],storageKey:null}],storageKey:null}]},params:{id:b("CareersV2RefreshSearchResultsBookmarkV3Query_candidate_portalRelayOperation"),metadata:{},name:"CareersV2RefreshSearchResultsBookmarkV3Query",operationKind:"query",text:null}}}();e.exports=a}),null);
-----
CareersV2RefreshSearchResultsBookmarkV3Query_candidate_portalRelayOperation",[],(function(a,b,c,d,e,f){e.exports="23889602907381648"}),null);
-----
-----
CareersV2RefreshSearchResultsBookmarkV3Query.graphql",["CareersV2RefreshSearchResultsBookmarkV3Query_candidate_portalRelayOperation"],(function(a,b,c,d,e,f){"use strict";a=function(){var a=[{defaultValue:null,kind:"LocalArgument",name:"viewasUserID"}],c=[{kind:"Variable",name:"viewas_user_id",variableName:"viewasUserID"}],d={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},e={alias:null,args:null,concreteType:"UserProfileBookmarkedReqsConnection",kind:"LinkedField",name:"bookmarked_reqs",plural:!1,selections:[{alias:null,args:null,concreteType:"XCPProdRequisitionExport",kind:"LinkedField",name:"nodes",plural:!0,selections:[d],storageKey:null}],storageKey:null};return{fragment:{argumentDefinitions:a,kind:"Fragment",metadata:null,name:"CareersV2RefreshSearchResultsBookmarkV3Query",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:c,concreteType:"CPUser",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,concreteType:"UserProfile",kind:"LinkedField",name:"profile",plural:!1,selections:[e],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:a,kind:"Operation",name:"CareersV2RefreshSearchResultsBookmarkV3Query",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:c,concreteType:"CPUser",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,concreteType:"UserProfile",kind:"LinkedField",name:"profile",plural:!1,selections:[e,d],storageKey:null},d],storageKey:null}],storageKey:null}]},params:{id:b("CareersV2RefreshSearchResultsBookmarkV3Query_candidate_portalRelayOperation"),metadata:{},name:"CareersV2RefreshSearchResultsBookmarkV3Query",operationKind:"query",text:null}}}();e.exports=a}),null);
-----
CareersV2RefreshSearchResultsBookmarkV3Query_candidate_portalRelayOperation",[],(function(a,b,c,d,e,f){e.exports="23889602907381648"}),null);
-----