/*! VERSION | 11.0.98 */"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[4134],{89325:(e,t,l)=>{l.r(t),l.d(t,{default:()=>F});var a=l(27378),s=l(37226),r=l(95654),n=l(36886),i=l(62203),o=l(70125),m=l(95366),c=l(62182),d=l(9957),u=l(96518),p=l(38487),_=l(99973),g=l(99748),E=l(97606),v=l(62663),h=l(98371),C=l(394),f=l(82216),S=l(79226),w=l(88949);let L=({models:e,reloadModels:t})=>((0,w.J)({reloadModels:t,models:e}),null);var M=l(54488),T=l(79115),N=l(53738),b=l(94380),y=l(77602);let I={},O=({isPopular:e=!1})=>(t,l,{Api:a})=>{let s=l(),r={primaryTag:(0,y.x7)(s)};e&&(r.type="popular");let n=JSON.stringify(r),i=I[n];if(i)return i;let o=a.get("/models/snapshots",r).then(({snapshots:e})=>e);return I[n]=o,o.then(()=>{I[n]=null}),o};var k=l(27329),B=l(40223),P=l(66837),x=l(73804),A=l(48447),R=l(80092);let D={header_skeleton:"ViewCamModelListSection__header_skeleton#D1",headerSkeleton:"ViewCamModelListSection__header_skeleton#D1","model-list-item":"ViewCamModelListSection__model-list-item#p3",modelListItem:"ViewCamModelListSection__model-list-item#p3",slideable_wrapper:"ViewCamModelListSection__slideable_wrapper#_U",slideableWrapper:"ViewCamModelListSection__slideable_wrapper#_U",scrollbar:"ViewCamModelListSection__scrollbar#Wf",lazyLoadPixel:"ViewCamModelListSection__lazyLoadPixel#e8"},V=({tag:e,model:t,shouldResetOnModelChange:l})=>{let{ref:s,inView:i}=(0,d.YD)({skip:!_.BROWSER_CAPABILITIES.intersectionObserver,rootMargin:"200px",triggerOnce:!0}),o=(0,a.useRef)(!0),m=(0,a.useRef)(!1),[c,w]=(0,a.useState)(1),{tags:y,modelList:I,isPending:V,isLazyPending:z,wasLoaded:W,updateModelList:J,reloadModels:K,handlePageChange:U,loadMoreModels:Z}=(0,T.o)({initialTag:e}),H=(0,a.useMemo)(()=>t?[t.id]:[],[t]),q=(0,a.useMemo)(()=>(0,k.f)(I.models,H),[I.models,H]),F=(0,A.x)({experimentKey:"ab_abc_new_undervc",options:{threshold:.2},disabled:V||!q.length});!function({updateModelList:e,updateIntervalMs:t,isPopular:l=!1}){let s=(0,b.T)(),r=(0,a.useRef)(null),n=(0,N.Z)(()=>{r.current&&clearTimeout(r.current),r.current=setTimeout(async()=>{s(O({isPopular:l})).then(t=>{e(e=>({...e,models:function({snapshots:e,models:t,isPopular:l=!1}){return t.map(t=>{let a=e[t.id];return a?{...t,popularSnapshotTimestamp:l?a:t.popularSnapshotTimestamp,snapshotTimestamp:l?t.snapshotTimestamp:a}:t})}({snapshots:t,models:e.models,isPopular:l})}))}),n()},t)});(0,a.useEffect)(()=>(n(),()=>{r.current&&clearTimeout(r.current)}),[n])}({updateModelList:J,updateIntervalMs:6e4});let Y=(0,a.useCallback)(({offset:e,page:t})=>{w(t),U({limit:M.m,offset:e})},[U]),Q=(0,n.t)(),{isLayoutUpToM:X}=(0,v.do)("isLayoutUpToM"),j=(0,r.C)(h.Sx),G=(0,r.C)(R.OO),$=(0,r.C)(x.f_),ee=(0,r.C)(({viewCam:e})=>e.isModelRequestCompleted),et=Q&&!W||!ee,el=V||et,ea=(0,E.QT)(),es=(0,a.useRef)(null);return((0,a.useEffect)(()=>{ee&&(l?(Y({page:1,offset:0}),es.current&&es.current.resetScroll()):m.current||(K(),m.current=!0))},[Y,ee,K,l]),(0,a.useEffect)(()=>{i&&(o.current||l)&&(o.current=!1,Z())},[i,Z,l]),W&&!q.length&&1===c)?null:a.createElement(f.Z,{tag:e,shouldLogPopularSnapshot:!0,className:"widescreen-container",models:q,header:et?a.createElement(P.SM,{className:D.header_skeleton}):a.createElement(u.Z,{text:(0,B.Hc)({tag:e,i18n:ea,isNewRecNameEnabled:G}),titleClassName:"tag-page-title",isH1:!1})},X&&j&&a.createElement("div",{className:D.slideable_wrapper,ref:F},a.createElement(p.Z,{libOptions:{suppressScrollX:_.BROWSER_CAPABILITIES.nonTouch,suppressScrollY:!0},ref:es,disablePs:_.BROWSER_CAPABILITIES.nonTouch,additionalClassName:D.scrollbar},a.createElement("section",{className:(0,g.AK)("model-list model-list-slideable",{"less-8-items":!el&&q.length<8})},el?a.createElement(P.pm,{count:60}):a.createElement(a.Fragment,null,a.createElement(C.q,{models:q,segmentId:e.id||e.primaryTagId,tag:y.currentTag,sortBy:$,shouldLogPopularSnapshot:!0}),z&&a.createElement(P.pm,{count:60}),a.createElement("div",{className:D.lazyLoadPixel,ref:s}))))),(!X||!j)&&a.createElement("div",{className:D.paginated_wrapper},a.createElement(L,{reloadModels:K,models:I.models}),a.createElement(S.M,{ref:F,rowsCount:2,currentPage:c,onPageChange:Y,totalCount:I.filteredCount},t=>el?(0,P.pB)(t):a.createElement(C.q,{maxCount:t,models:q,segmentId:e.id||e.primaryTagId,tag:y.currentTag,sortBy:$,shouldLogPopularSnapshot:!0}))))};var z=l(48868),W=l(33915);let J={spacing:"ViewCamMultipleSectionModelList__spacing#r7"};function K(e){return m.pJB[e.url]?m.hhy[e.primaryTagId]:e}let U=({model:e})=>{let t=(0,r.C)(R.Jm),l=(0,r.C)(c.M8),n=(0,a.useRef)(l),i=(0,r.C)(W.Iz),o=K(s.x.get("viewCamModelListTag")||i),d=(0,z.y)({tag:i}),u=(0,a.useMemo)(()=>t&&!n.current?[o,d]:[d,o],[t,d,o]);return(0,a.useEffect)(()=>{l||s.x.set("viewCamModelListTag",K(i))},[]),a.createElement("div",{"data-testid":"viewcam-model-sections"},a.createElement("div",{className:J.spacing}),u.map(t=>a.createElement(V,{key:t.url,model:e,tag:t,shouldResetOnModelChange:!!m.pJB[t.url]})))},Z=(0,a.memo)(({limit:e})=>a.createElement("div",{className:"view-cam-model-list-skeleton widescreen-container model-list-wrapper"},a.createElement("div",{className:"model-list-container"},a.createElement("div",{className:"view-cam-model-list-skeleton__nav-bar"},a.createElement("div",{className:"view-cam-model-list-skeleton__nav-item"}),a.createElement("div",{className:"view-cam-model-list-skeleton__nav-item"}),a.createElement("div",{className:"view-cam-model-list-skeleton__nav-item"}),a.createElement("div",{className:"view-cam-model-list-skeleton__nav-item"})),a.createElement("div",{className:"model-list-container"},a.createElement("div",{className:"paginated model-list"},a.createElement("div",{className:"paginated-list"},(0,P.pB)(e)))))));var H=l(29421);let q=["girls","men","trans","related","recommended","couples"],F=({model:e})=>{let t=(0,r.C)(i.Km),l=(0,r.C)(H.zO),m=(0,n.t)(),[c,d]=(0,a.useState)(l),u=(0,r.C)(R.z);return((0,a.useEffect)(()=>()=>{s.x.remove("viewCamModelListTag")},[]),(0,a.useEffect)(()=>{!c&&l&&d(!0)},[c,l]),u)?a.createElement(U,{model:e}):m&&c?a.createElement(o.Z,{isWidescreen:!0,model:e,showFilters:!t,shouldLogPopularSnapshot:!0,preferredOrder:q}):a.createElement(Z,{limit:21})}}}]);