Module 7691

2,861 characters · in no known chunk
Dependencies
Required by (2)
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,n){"use strict";n.d(t,{A:()=>I}),n(775443);var r=n(627968),i=n(64700),s=n(397927),a=n(793574),o=n(58149),l=n(688810),u=n(989837),c=n(485878),d=n(602814),_=n(779309),f=n(198016),p=n(60809),h=n(652215),m=n(900376);let E={width:500,height:p.$V},g={height:p.$V};function A(e,t){let{context:n,entrypoint:s,initHistory:c}=e,{analyticsLocations:d}=(0,l.Ay)(a.A.APP_LAUNCHER);return i.useEffect(()=>{(0,o.zV)(h.HAw.APPLICATION_COMMAND_TOP_OF_FUNNEL,{source:s,location:"app_launcher"})},[s]),i.useEffect(()=>{let e=Date.now();return()=>{(0,o.zV)(h.HAw.APP_LAUNCHER_CLOSED,{reason:u.A.closeReason(),time_spent:Date.now()-e,source:s})}},[s]),(0,r.jsx)("div",{className:m.jP,ref:t,style:E,children:(0,r.jsx)("div",{className:m.FG,children:(0,r.jsx)(l.f5,{value:d,children:(0,r.jsx)(T,{initHistory:c,children:(0,r.jsx)(S,{context:n,entrypoint:s})})})})})}let I=i.memo(i.forwardRef(A));function T(e){let{initHistory:t,children:n}=e,[s,a]=i.useState(t??[{type:c.Wy.HOME}]),[o,l]=i.useState({}),u=s[s.length-1],[d,_]=i.useState(!1),f=i.useCallback(e=>{a(t=>[...t,e])},[]),p=i.useCallback(()=>{let e=null;a(t=>t.length<=1?t:(e=t[t.length-1],t.slice(0,-1))),l(t=>null==e?t:{...t,[e.type]:e})},[]),h=i.useCallback(e=>s.findLast(t=>t.type===e)??o[e],[s,o]);return(0,r.jsx)(c.L8.Provider,{value:{history:s,discard:o,currentView:u,pushHistory:f,goBack:p,getMostRecentHistoryItemByType:h,isSlideReady:d,setSlideReady:_},children:n})}function S(e){let{context:t,entrypoint:n}=e,[a,o]=i.useState(""),{setScroller:l,isCloseToBottom:u}=y(a),{currentView:p,getMostRecentHistoryItemByType:h,setSlideReady:E}=(0,c.uM)();i.useEffect(()=>{E(!1)},[p?.type,E]);let A=i.useCallback(()=>{E(!0)},[E]);if(null==p)return null;let I=h(c.Wy.LIST),T=h(c.Wy.APPLICATION);return(0,r.jsxs)(s.tN_,{activeSlide:p.type,width:500,onSlideReady:A,children:[(0,r.jsx)(s.q7S,{id:c.Wy.HOME,children:(0,r.jsx)("div",{className:m.xD,style:g,children:(0,r.jsx)(_.A,{isScrollCloseToBottom:u,setScroller:l,context:t,entrypoint:n,searchQuery:a,setSearchQuery:o})})}),(0,r.jsx)(s.q7S,{id:c.Wy.LIST,children:(0,r.jsx)("div",{className:m.xD,style:g,children:null!=I&&(0,r.jsx)(f.A,{context:t,entrypoint:n,title:I.title,look:I.look,items:I.items,sectionName:I.sectionName,sectionOverallPosition:I.sectionOverallPosition})})}),(0,r.jsx)(s.q7S,{id:c.Wy.APPLICATION,children:(0,r.jsx)("div",{className:m.xD,style:g,children:null!=T&&(0,r.jsx)(d.A,{context:t,application:T.application,sectionName:T.sectionName})})})]})}function y(e){let[t,n]=i.useState(null),[r,s]=i.useState(!1),a=i.useRef(0);return i.useEffect(()=>{t?.scrollTo(0,0)},[t,e]),i.useEffect(()=>{if(null!=t)return t.scrollTo(0,a.current),t.addEventListener("scroll",e),()=>{t.removeEventListener("scroll",e,!1)};function e(){null==t||(a.current=t.scrollTop,s(t.scrollHeight-(t.scrollTop+t.clientHeight)<340))}},[t]),{setScroller:n,isCloseToBottom:r}}}