"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[499],{16085:(e,o,i)=>{i.d(o,{kh:()=>w,vZ:()=>v,Z9:()=>p});var t=i(93341),l=i(43723),n=i(31209),a=i(35043),s=i(38771),r=i(92597),d=i(63849);const u=(0,l.p)("immersivePlayerItemListConfigAtom@tiktok/webapp-atoms",null),c=(0,l.p)("immersivePlayerItemListAtom@tiktok/webapp-atoms",(e=>{const o=e(u);if(!o)return[];if("single"===o.mode){const i=(0,r.D)(o.itemListKey);return i?e(i).list:[]}return"id"===o.mode&&"user-playlist"===o.source?e(d.DB)[o.id].list:[]}),((e,o,i)=>{o(u,i)})),_=(0,l.p)("immersivePlayerStateAtom@tiktok/webapp-atoms",{index:-1,isOpen:!1,isCommentsOpen:!1}),m=(0,l.p)("immersivePlayerAtom@tiktok/webapp-atoms",(e=>{const o=e(_),i=e(c),t=e(u);return Object.assign({itemList:i,itemListSourceConfig:t},o)}),((e,o,i)=>{console.warn("Tried to set immersivePlayerAtom with:",i)})),{useAtomService:v,useServiceState:p,useServiceDispatchers:w,getStaticApi:g}=(0,n.i)(m,((e,o)=>({syncStateToPlayerAtom({id:o}={}){const i=e(u),{index:l}=e(m),n=null!=o?o:e(c)[l],r=e(s.jD)[n],d="video"===(null==r?void 0:r.contentType)?r.currentTime:void 0,_={currentVideo:{index:l,id:n,mode:9},playProgress:null!=d?d:0,pageType:"single"===(null==i?void 0:i.mode)?a.FB[i.itemListKey]:999};(0,t.LM)().updateVideo(_),"video"===(null==r?void 0:r.contentType)?(0,s.Q3)().setVideoInfo({itemId:n,currentTime:d}):"photo"===(null==r?void 0:r.contentType)&&(0,s.Q3)().setPhotoInfo({itemId:n})},openImmersivePlayer({id:e,index:i,itemListSourceConfig:t,teaParams:l,isCommentsOpen:n}){o(u,t),o(_,{index:i,isOpen:!0,isCommentsOpen:n,teaParams:l}),this.syncStateToPlayerAtom({id:e})},closeImmersivePlayer(){this.syncStateToPlayerAtom(),o(_,{index:-1,isOpen:!1,isCommentsOpen:!1,teaParams:void 0}),o(u,null)},setIndex(e,i){o(_,(o=>Object.assign(Object.assign({},o),{index:e}))),this.syncStateToPlayerAtom({id:i})},setIsCommentsOpen(e){o(_,(o=>Object.assign(Object.assign({},o),{isCommentsOpen:e})))}})))},63849:(e,o,i)=>{i.d(o,{DB:()=>v,V6:()=>w});var t=i(57431),l=i(39785),n=i(56070),a=i(43723),s=i(14374),r=i(31209),d=i(89049),u=i(68783),c=function(e,o,i,t){return new(i||(i=Promise))((function(l,n){function a(e){try{r(t.next(e))}catch(e){n(e)}}function s(e){try{r(t.throw(e))}catch(e){n(e)}}function r(e){var o;e.done?l(e.value):(o=e.value,o instanceof i?o:new i((function(e){e(o)}))).then(a,s)}r((t=t.apply(e,o||[])).next())}))};const _=(0,l.M)({csr:e=>c(void 0,void 0,void 0,(function*(){return n.h.get("/api/mix/item_list/",{query:e,baseUrlType:2})}))}),m=(0,a.p)("activePlaylistItemListAtom@tiktok/webapp-atoms",d.hA),v=(0,s._)((0,a.p)("playlistItemListAtom@tiktok/webapp-atoms",{}),{rehydrationKey:"desktop.playlistPage.playlistItemList"}),{useAtomService:p,useServiceDispatchers:w,useServiceState:g}=(0,r.i)(v,((e,o)=>({fetchPlaylistItemList(i){var l;return c(this,void 0,void 0,(function*(){const n=e(v),{mixId:a,itemListKey:s}=i,r=s||a;if(!(r in n)||n[r].hasMore)try{const i=n[r],c=null!==(l=null==i?void 0:i.cursor)&&void 0!==l?l:"0",{language:p}=(0,t.x)(),w=yield _({mixId:a,language:p,cursor:c,aid:d.xE,count:d.vu});o(m,(e=>{var o;return null!==(o=n[r])&&void 0!==o?o:e})),(0,u.Tj)(e,o,m,r,w,{isPlayList:!0}),o(v,(o=>Object.assign(Object.assign(Object.assign({},o),{[a]:e(m)}),s&&{[s]:e(m)})))}catch(e){(0,u.e_)(o,m)}else o(m,n[r])}))}})))},40935:(e,o,i)=>{i.d(o,{yS:()=>h,Tu:()=>P,_6:()=>O});var t,l=i(58632),n=i(46682),a=i(40099),s=i(2584),r=i(30023),d=i(97792),u=i(8046),c=i(25616),_=i(49057),m=i(88920),v=i(52333),p=i(32125),w=i(84908),g=i(69589),f=i(94777);!function(e){e[e.FollowNormal=0]="FollowNormal",e[e.FollowPrivate=1]="FollowPrivate",e[e.FollowFollower=2]="FollowFollower",e[e.Unfollow=3]="Unfollow"}(t||(t={}));var y=i(11983);function h(e=""){return(0,w.nW)((o=>o.users[e]),p.bN)}const k={[-1]:"Follow",0:"Follow",1:"Following",3:"requested",2:"friends",4:"webapp_unblocked_button1",5:"Follow",6:"Follow"},b="Inbox_Follow_back",F=(e,o)=>{if(1===o){if(e<1)return b;if(1===e)return k[2]}else if(!o&&6===e)return b;return k[e]};function P({uniqueId:e,followerStatus:o,prevent:i,onNeedLogin:t,teaParams:l={},isInLiveCard:d=!1,liveCardTeaParams:u={},liveFollowStatus:g}){const f=(0,_.W)((()=>["user"]),[]),y=Boolean(null==f?void 0:f.user),[{relation:h,secUid:k},b]=(0,w.JY)((o=>{var i,t,l,n;return{relation:null!==(t=null===(i=o.users[e])||void 0===i?void 0:i.relation)&&void 0!==t?t:-1,secUid:null!==(n=null===(l=o.users[e])||void 0===l?void 0:l.secUid)&&void 0!==n?n:""}}),p.bN);(0,a.useEffect)((()=>{d&&b.setUserRelation({uniqueId:e,relation:Number(null!=g?g:0)})}),[]);const P=(0,n.w)(v.k),O=(0,m.tc)(),{play_mode:I,group_id:S}=l,L=(0,a.useCallback)((o=>{var n;if(i&&(o.preventDefault(),o.stopPropagation()),s.O.handleGeneralClick("follow",{scene:null!==(n=l.scene)&&void 0!==n?n:"video_feed",group_id:S,play_mode:I}),!y)return null==t?void 0:t();4!==h?(b.postCommitFollowUser(Object.assign(Object.assign({},l),{uniqueId:e,useFollowV2:O})),1!==h&&P.addMlModelTrainData({id:l.group_id,action:"follow"}),d&&(1===h?r.YH.handleUnFollow(u):r.YH.handleFollow(u))):b.blockOrUnblockUser({uniqueId:e,secUid:k,isBlock:!0})}),[i,y,h,b,l,e,O,d,t,k,u]),U=(0,c.s)()(F(h,o));return{isFollowing:1===h||2===h,text:U,handleFollow:L,relation:h}}function O({uniqueId:e,secUid:o,followerStatus:i,prevent:t,onNeedLogin:r,teaParams:p={}}){const h=(0,c.s)(),k=(0,_.W)((()=>["user"]),[]),b=Boolean(null==k?void 0:k.user),P=(0,n.w)(v.k),O=(0,m.tc)(),{play_mode:I,group_id:S}=p,{data:L,isLoading:U,isError:C}=(0,g.useData)({query:"getUserDetail",queryKeyParams:{uniqueId:e},queryParams:{uniqueId:e,secUid:o}}),[,A]=(0,w.JY)(),{mutate:j}=(0,g.useMutateAction)({mutatorName:"postCommitFollowUser",queryKeyParams:{uniqueId:e}}),{mutate:x}=(0,g.useMutateAction)({mutatorName:"blockOrUnblockUser",queryKeyParams:{uniqueId:e}}),q=(0,a.useCallback)(((i,n)=>a=>{var c;return t&&(a.preventDefault(),a.stopPropagation()),s.O.handleGeneralClick("follow",{scene:null!==(c=p.scene)&&void 0!==c?c:"video_feed",group_id:S,play_mode:I}),b?4===i?(A.handleWebappQueryOptimisticUpdate({uniqueId:e,isBlock:!0}),void x({uniqueId:e,secUid:o,isBlock:!0},{onSuccess:()=>{y.F.open({content:h("webapp_mig_unblocked"),duration:3,e2eTag:"block-toast"})}})):(A.handleWebappQueryOptimisticUpdate({uniqueId:e,targetUser:n,relation:i}),j({uniqueId:e,useFollowV2:O},{onSettled:(o=>i=>(0,l.__awaiter)(this,void 0,void 0,(function*(){var t;const l=function(e){return function({relation:e,handleIsUnfollow:o,handleIsFollow:i}){switch(e){case 0:case-1:case 4:case 5:case 6:return o();default:return i()}}({relation:e,handleIsUnfollow:()=>1,handleIsFollow:()=>0})}(o),{statusCode:n,followStatus:a}=null!==(t=yield i)&&void 0!==t?t:{statusCode:-1,followStatus:-1};if(d.t.handleFollowUser(Object.assign(Object.assign({},p),{status_code:n,follow_status:a,group_id:S,enter_method:p.enter_method,action_position:p.action_position,to_user_id:e,author_id:e,follow_type:2===a?"mutual":"single",is_private:4===a?1:0}),l),p.is_ad_event&&p.tag&&p.value&&p.log_extra&&0===l){const{tag:e,value:o,log_extra:i}=p;u.pg.handleFollowCancel({log_extra:i,tag:e,value:o,is_ad_event:"1"})}})))(i)}),void(1!==i&&P.addMlModelTrainData({id:p.group_id,action:"follow"}))):null==r?void 0:r()}),[t,p,S,I,b,A,e,j,O,h,r,x,o,P]);if(U||C)return{isFollowing:!1,text:h("Follow"),handleFollow:f.l,relation:-1};const{user:D}=L,{relation:N}=D;return{isFollowing:1===N||2===N,text:h(F(N,i)),handleFollow:q(N,D),relation:N}}},30023:(e,o,i)=>{i.d(o,{YH:()=>u,t9:()=>d});var t,l,n,a,s,r=i(93608);!function(e){e.Show="livesdk_live_show",e.Duration="livesdk_live_window_duration_v2",e.StartPlay="livesdk_live_window_play",e.RecPlay="livesdk_rec_live_play",e.Follow="livesdk_follow",e.Unfollow="livesdk_unfollow",e.CancelGuide="livesdk_live_guide_cancel",e.GuideShow="livesdk_live_guide_show"}(t||(t={})),function(e){e.OneColumn="one_column",e.BrowserMode="browser_mode",e.ImmersivePlayer="immersive_player"}(l||(l={})),function(e){e.PageMode="page_mode",e.BrowserMode="browser_mode"}(n||(n={})),function(e){e.Cell="live_cell",e.Head="live_head",e.Btn="live_btn",e.FollowingPreview="live_cover_preview",e.Like="live_fyp_like",e.Share="live_fyp_share"}(a||(a={})),function(e){e.FYP="homepage_hot",e.FollowingPage="homepage_follow",e.FYPGuide="homepage_fyp_guide"}(s||(s={}));const d={0:"video_live",1:"third_party",2:"media",3:"audio",4:"screen_share",5:"social_live",6:"live_studio"},u={handleLiveShow:e=>{r.f.event("livesdk_live_show",Object.assign({enter_from_merge:"homepage_hot",enter_method:"live_cell",action_type:"click",live_type:d[Number(e.live_room_mode)]},e))},handleLiveEntranceClick:e=>{r.f.event("livesdk_rec_live_play",Object.assign({enter_from_merge:"homepage_hot",action_type:"click",live_type:d[Number(e.live_room_mode)]},e))},handleLiveDuration:e=>{r.f.event("livesdk_live_window_duration_v2",Object.assign({enter_from_merge:"homepage_hot",action_type:"click",live_type:d[Number(e.live_room_mode)]},e))},handleFollow:e=>{r.f.event("livesdk_follow",Object.assign({enter_from_merge:"homepage_hot",action_type:"click",live_type:d[Number(e.live_room_mode)]},e))},handleUnFollow:e=>{r.f.event("livesdk_unfollow",Object.assign({enter_from_merge:"homepage_hot",action_type:"click",live_type:d[Number(e.live_room_mode)]},e))},handleStartPlay:e=>{r.f.event("livesdk_live_window_play",Object.assign({enter_from_merge:"homepage_hot",action_type:"click",live_type:d[Number(e.live_room_mode)]},e))},handleLiveCancelGuideClick:e=>{r.f.event("livesdk_live_guide_cancel",Object.assign({enter_from_merge:"homepage_hot",action_type:"click",live_type:d[Number(e.live_room_mode)]},e))},handleLiveGuideShow:e=>{r.f.event("livesdk_live_guide_show",Object.assign({enter_from_merge:"homepage_hot",action_type:"click",live_type:d[Number(e.live_room_mode)]},e))}}}}]);