@funhub/platform 0.1.100 → 0.1.102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/components/biz/business/detail/shared/material-route-context.mjs +2 -0
  2. package/dist/components/biz/business/detail/video-detail-actions/server.d.mts +1 -0
  3. package/dist/components/biz/business/detail/video-detail-actions/server.mjs +1 -1
  4. package/dist/components/biz/business/detail/video-detail-info/server.d.mts +1 -0
  5. package/dist/components/biz/business/detail/video-detail-info/server.mjs +1 -1
  6. package/dist/components/biz/business/detail/video-detail-info-title/server.d.mts +5 -1
  7. package/dist/components/biz/business/detail/video-detail-info-title/server.mjs +1 -1
  8. package/dist/components/biz/business/detail/video-detail-info-title-tags-episodes/server.d.mts +1 -0
  9. package/dist/components/biz/business/detail/video-detail-info-title-tags-episodes/server.mjs +1 -1
  10. package/dist/components/biz/business/detail/video-detail-recommend/client.d.mts +1 -1
  11. package/dist/components/biz/business/detail/video-detail-recommend/client.mjs +1 -1
  12. package/dist/components/biz/business/detail/video-detail-recommend/utils.mjs +1 -1
  13. package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
  14. package/dist/components/biz/business/home-recommend/shared/home-recommend-preview.mjs +1 -1
  15. package/dist/components/biz/business/home-recommend/shared/home-recommend-server-data.mjs +1 -1
  16. package/dist/components/biz/business/marquee/client.mjs +1 -1
  17. package/dist/components/biz/business/marquee/material.d.mts +1 -0
  18. package/dist/components/biz/business/marquee/schema.d.mts +1 -0
  19. package/dist/components/biz/business/marquee/schema.mjs +1 -1
  20. package/dist/components/biz/business/text-recommend/client.mjs +1 -1
  21. package/dist/components/pages/search/page-client.mjs +1 -1
  22. package/dist/components/pages/search-result/search-all.mjs +1 -1
  23. package/dist/components/pages/search-result/search-result-skeleton.mjs +2 -0
  24. package/dist/components/pages/video-list/video-list-item.mjs +1 -1
  25. package/dist/components/ui/badge.d.mts +1 -1
  26. package/dist/components/ui/button.d.mts +1 -1
  27. package/package.json +1 -1
  28. package/dist/components/biz/business/detail/shared/video-detail-route-context-server.mjs +0 -2
@@ -0,0 +1,2 @@
1
+
2
+ function e(e){try{return decodeURIComponent(e)}catch{return e}}function t(t){if(Array.isArray(t))return t.map(e=>String(e||``).trim()).filter(Boolean).map(e);if(typeof t==`string`){let n=t.trim();return n?[e(n)]:[]}return[]}function n(e){if(!(!e||typeof e!=`object`))return e}function r(e){let t=Number(e);return!Number.isFinite(t)||t<=0?1:Math.floor(t)}function i(e){let i=n(e),a=i?.params&&typeof i.params==`object`?i.params:void 0,o=t(a?.level),s=t(i?.segments),c=o.length?o:s,l=String(a?.detailId||a?.id||c[0]||``).trim(),u=c.findIndex(e=>e===`episode`);return{detailId:l,currentSeriesNum:r(a?.currentSeriesNum||a?.seriesNum||a?.episode||(u>=0?c[u+1]:void 0))}}export{i as resolveVideoDetailRouteFromMaterialContext};
@@ -6,6 +6,7 @@ import * as react_jsx_runtime0 from "react/jsx-runtime";
6
6
  interface VideoDetailActionsServerProps extends VideoDetailActionsProps {
7
7
  detailId?: string;
8
8
  currentSeriesNum?: number;
9
+ __route?: unknown;
9
10
  }
10
11
  /**
11
12
  * 视频详情行为模块服务端组件。
@@ -1,2 +1,2 @@
1
1
 
2
- import{VideoDetailMaterialRuntimeProvider as e}from"../shared/runtime-context-provider.mjs";import{resolveVideoDetailRouteContext as t}from"../shared/video-detail-route-context-server.mjs";import{getVideoDetailServerInformation as n}from"../shared/video-detail-server-data.mjs";import{VideoDetailActionsClient as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";async function a(a){let{mode:o=`renderer`,detailId:s,currentSeriesNum:c,...l}=a;if(o!==`renderer`)return i(r,{...l,mode:o});let u=await t(),d=String(s||u.detailId||``).trim();if(!d)return i(r,{...l,mode:o});let f=await n(d);if(!f)return i(r,{...l,mode:o});let p=Math.max(1,Number(c||u.currentSeriesNum||1));return i(e,{value:{information:f,detailId:d,currentSeriesNum:p,episodeIndex:Math.max(0,p-1),isShow:!0,isInformationLoading:!1,isInformationResolved:!0},children:i(r,{...l,mode:o})})}export{a as VideoDetailActions};
2
+ import{VideoDetailMaterialRuntimeProvider as e}from"../shared/runtime-context-provider.mjs";import{resolveVideoDetailRouteFromMaterialContext as t}from"../shared/material-route-context.mjs";import{getVideoDetailServerInformation as n}from"../shared/video-detail-server-data.mjs";import{VideoDetailActionsClient as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";async function a(a){let{mode:o=`renderer`,detailId:s,currentSeriesNum:c,__route:l,...u}=a;if(o!==`renderer`)return i(r,{...u,mode:o});let d=t(l),f=String(s||d.detailId||``).trim();if(!f)return i(r,{...u,mode:o});let p=await n(f);if(!p)return i(r,{...u,mode:o});let m=Math.max(1,Number(c||d.currentSeriesNum||1));return i(e,{value:{information:p,detailId:f,currentSeriesNum:m,episodeIndex:Math.max(0,m-1),isShow:!0,isInformationLoading:!1,isInformationResolved:!0},children:i(r,{...u,mode:o})})}export{a as VideoDetailActions};
@@ -6,6 +6,7 @@ import * as react_jsx_runtime0 from "react/jsx-runtime";
6
6
  interface VideoDetailInfoServerProps extends VideoDetailInfoProps {
7
7
  detailId?: string;
8
8
  currentSeriesNum?: number;
9
+ __route?: unknown;
9
10
  }
10
11
  /**
11
12
  * 媒体信息-简介&选集物料服务端组件。
@@ -1,2 +1,2 @@
1
1
 
2
- import{VideoDetailMaterialRuntimeProvider as e}from"../shared/runtime-context-provider.mjs";import{VideoDetailInfoClient as t}from"./client.mjs";import{resolveVideoDetailRouteContext as n}from"../shared/video-detail-route-context-server.mjs";import{getVideoDetailServerInformation as r}from"../shared/video-detail-server-data.mjs";import{jsx as i,jsxs as a}from"react/jsx-runtime";import o from"next/link";async function s(s){let{mode:l=`renderer`,showEpisodes:d=!1,detailId:f,currentSeriesNum:p,...m}=s;if(l!==`renderer`)return i(t,{...m,showEpisodes:d,mode:l});let h=await n(),g=String(f||h.detailId||``).trim();if(!g)return i(t,{...m,showEpisodes:d,mode:l});let _=await r(g);if(!_)return i(t,{...m,showEpisodes:d,mode:l});let v=Math.max(1,Number(p||h.currentSeriesNum||1)),y=c(_),b=d&&_.is_more_link===`y`&&y.length>1;return a(e,{value:{information:_,detailId:g,currentSeriesNum:v,episodeIndex:Math.max(0,v-1),isShow:!0,isInformationLoading:!1,isInformationResolved:!0},children:[i(t,{...m,showEpisodes:!1,mode:l}),b&&i(`div`,{className:`w-full px-[12px] mt-[12px]`,children:i(`div`,{className:`flex flex-wrap gap-[8px]`,children:y.map(e=>{let t=e.seriesNum===v;return i(o,{href:u(g,_.name||``,e.seriesNum),className:`h-[28px] min-w-[40px] rounded-[6px] border px-[8px] text-[12px] leading-[26px] text-center ${t?`border-theme5 text-theme5 bg-theme5/10`:`border-line1 text-text2 bg-bg1`}`,children:e.label},e.key)})})})]})}function c(e){return(Array.isArray(e.links)?e.links:[]).map((e,t)=>{let n=e||{},r=typeof n.id==`string`?n.id:``,i=l(n.id,n.name,t+1);return{key:r||`episode-${i}-${t+1}`,seriesNum:i,label:`第${i}集`}})}function l(e,t,n){let r=Number(e);if(Number.isFinite(r)&&r>0)return Math.floor(r);let i=Number(t);return Number.isFinite(i)&&i>0?Math.floor(i):n}function u(e,t,n){return`/video/${e}/${encodeURIComponent(t||``)}/episode/${n}`}export{s as VideoDetailInfo};
2
+ import{VideoDetailMaterialRuntimeProvider as e}from"../shared/runtime-context-provider.mjs";import{VideoDetailInfoClient as t}from"./client.mjs";import{resolveVideoDetailRouteFromMaterialContext as n}from"../shared/material-route-context.mjs";import{getVideoDetailServerInformation as r}from"../shared/video-detail-server-data.mjs";import{jsx as i,jsxs as a}from"react/jsx-runtime";import o from"next/link";async function s(s){let{mode:l=`renderer`,showEpisodes:d=!1,detailId:f,currentSeriesNum:p,__route:m,...h}=s;if(l!==`renderer`)return i(t,{...h,showEpisodes:d,mode:l});let g=n(m),_=String(f||g.detailId||``).trim();if(!_)return i(t,{...h,showEpisodes:d,mode:l});let v=await r(_);if(!v)return i(t,{...h,showEpisodes:d,mode:l});let y=Math.max(1,Number(p||g.currentSeriesNum||1)),b=c(v),x=d&&v.is_more_link===`y`&&b.length>1;return a(e,{value:{information:v,detailId:_,currentSeriesNum:y,episodeIndex:Math.max(0,y-1),isShow:!0,isInformationLoading:!1,isInformationResolved:!0},children:[i(t,{...h,showEpisodes:!1,mode:l}),x&&i(`div`,{className:`w-full px-[12px] mt-[12px]`,children:i(`div`,{className:`flex flex-wrap gap-[8px]`,children:b.map(e=>{let t=e.seriesNum===y;return i(o,{href:u(_,v.name||``,e.seriesNum),className:`h-[28px] min-w-[40px] rounded-[6px] border px-[8px] text-[12px] leading-[26px] text-center ${t?`border-theme5 text-theme5 bg-theme5/10`:`border-line1 text-text2 bg-bg1`}`,children:e.label},e.key)})})})]})}function c(e){return(Array.isArray(e.links)?e.links:[]).map((e,t)=>{let n=e||{},r=typeof n.id==`string`?n.id:``,i=l(n.id,n.name,t+1);return{key:r||`episode-${i}-${t+1}`,seriesNum:i,label:`第${i}集`}})}function l(e,t,n){let r=Number(e);if(Number.isFinite(r)&&r>0)return Math.floor(r);let i=Number(t);return Number.isFinite(i)&&i>0?Math.floor(i):n}function u(e,t,n){return`/video/${e}/${encodeURIComponent(t||``)}/episode/${n}`}export{s as VideoDetailInfo};
@@ -3,9 +3,13 @@ import { VideoDetailInfoTitleProps } from "./schema.mjs";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
5
5
  //#region components/biz/business/detail/video-detail-info-title/server.d.ts
6
+ interface VideoDetailInfoTitleServerProps extends VideoDetailInfoTitleProps {
7
+ detailId?: string;
8
+ __route?: unknown;
9
+ }
6
10
  /**
7
11
  * 媒体信息物料服务端组件。
8
12
  */
9
- declare function VideoDetailInfoTitle(props: VideoDetailInfoTitleProps): Promise<react_jsx_runtime0.JSX.Element>;
13
+ declare function VideoDetailInfoTitle(props: VideoDetailInfoTitleServerProps): Promise<react_jsx_runtime0.JSX.Element>;
10
14
  //#endregion
11
15
  export { VideoDetailInfoTitle };
@@ -1,2 +1,2 @@
1
1
 
2
- import{VideoDetailMaterialRuntimeProvider as e}from"../shared/runtime-context-provider.mjs";import{resolveVideoDetailRouteContext as t}from"../shared/video-detail-route-context-server.mjs";import{getVideoDetailServerInformation as n}from"../shared/video-detail-server-data.mjs";import{VideoDetailInfoTitleClient as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";async function a(a){let{mode:o=`renderer`,...s}=a;if(o!==`renderer`)return i(r,{...s,mode:o});let c=(await t()).detailId;if(!c)return i(r,{...s,mode:o});let l=await n(c);return l?i(e,{value:{information:l,detailId:c,isShow:!0,isInformationLoading:!1,isInformationResolved:!0},children:i(r,{...s,mode:o})}):i(r,{...s,mode:o})}export{a as VideoDetailInfoTitle};
2
+ import{VideoDetailMaterialRuntimeProvider as e}from"../shared/runtime-context-provider.mjs";import{resolveVideoDetailRouteFromMaterialContext as t}from"../shared/material-route-context.mjs";import{getVideoDetailServerInformation as n}from"../shared/video-detail-server-data.mjs";import{VideoDetailInfoTitleClient as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";async function a(a){let{mode:o=`renderer`,detailId:s,__route:c,...l}=a;if(o!==`renderer`)return i(r,{...l,mode:o});let u=t(c),d=String(s||u.detailId||``).trim();if(!d)return i(r,{...l,mode:o});let f=await n(d);return f?i(e,{value:{information:f,detailId:d,isShow:!0,isInformationLoading:!1,isInformationResolved:!0},children:i(r,{...l,mode:o})}):i(r,{...l,mode:o})}export{a as VideoDetailInfoTitle};
@@ -6,6 +6,7 @@ import * as react_jsx_runtime0 from "react/jsx-runtime";
6
6
  interface VideoDetailInfoTitleTagsEpisodesServerProps extends VideoDetailInfoTitleTagsEpisodesProps {
7
7
  detailId?: string;
8
8
  currentSeriesNum?: number;
9
+ __route?: unknown;
9
10
  }
10
11
  /**
11
12
  * 媒体信息-选集物料服务端组件。
@@ -1,2 +1,2 @@
1
1
 
2
- import{VideoDetailMaterialRuntimeProvider as e}from"../shared/runtime-context-provider.mjs";import{resolveVideoDetailRouteContext as t}from"../shared/video-detail-route-context-server.mjs";import{getVideoDetailServerInformation as n}from"../shared/video-detail-server-data.mjs";import{VideoDetailInfoTitleTagsEpisodesClient as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";async function a(a){let{mode:o=`renderer`,detailId:s,currentSeriesNum:c,...l}=a;if(o!==`renderer`)return i(r,{...l,mode:o});let u=await t(),d=String(s||u.detailId||``).trim();if(!d)return i(r,{...l,mode:o});let f=await n(d);return f?i(e,{value:{information:f,detailId:d,currentSeriesNum:Math.max(1,Number(c||u.currentSeriesNum||1)),isShow:!0,isInformationLoading:!1,isInformationResolved:!0},children:i(r,{...l,mode:o})}):i(r,{...l,mode:o})}export{a as VideoDetailInfoTitleTagsEpisodes};
2
+ import{VideoDetailMaterialRuntimeProvider as e}from"../shared/runtime-context-provider.mjs";import{resolveVideoDetailRouteFromMaterialContext as t}from"../shared/material-route-context.mjs";import{getVideoDetailServerInformation as n}from"../shared/video-detail-server-data.mjs";import{VideoDetailInfoTitleTagsEpisodesClient as r}from"./client.mjs";import{jsx as i}from"react/jsx-runtime";async function a(a){let{mode:o=`renderer`,detailId:s,currentSeriesNum:c,__route:l,...u}=a;if(o!==`renderer`)return i(r,{...u,mode:o});let d=t(l),f=String(s||d.detailId||``).trim();if(!f)return i(r,{...u,mode:o});let p=await n(f);return p?i(e,{value:{information:p,detailId:f,currentSeriesNum:Math.max(1,Number(c||d.currentSeriesNum||1)),isShow:!0,isInformationLoading:!1,isInformationResolved:!0},children:i(r,{...u,mode:o})}):i(r,{...u,mode:o})}export{a as VideoDetailInfoTitleTagsEpisodes};
@@ -13,7 +13,7 @@ declare function VideoDetailRecommendClient({
13
13
  smartTagIds,
14
14
  title,
15
15
  showPlayCount,
16
- playCountDelta: _playCountDelta,
16
+ playCountDelta,
17
17
  showEpisode,
18
18
  enableInfinite,
19
19
  items,
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{gContentGetGuessYouLikeVideos as e,pContentBatchGetVideoDetail as t}from"../../../../../service/generated/client.mjs";import{Box as n}from"../../../../ui/box.mjs";import{Text as r}from"../../../../ui/text.mjs";import{useRequest as i}from"../../../../../hooks/query/use-query.mjs";import{useKeepAliveState as a}from"../../../../common/keep-scroll-position/index.mjs";import o from"../../../../../assets/icons/detail/video_flag.mjs";import{MiniThreeCard as s}from"../../../../common/cards/mini-three-card.mjs";import{useCardDecoration as c}from"../../../../../hooks/use-card-decoration.mjs";import{buildEditorPreviewRecommendList as l}from"../shared/editor-preview.mjs";import{useVideoDetailMaterialRuntimeContext as u}from"../shared/runtime-context-provider.mjs";import{clampColumns as d,mergeManualAndPool as f,normalizeRecommendRuntimeProps as p,resolveRows as ee}from"./utils.mjs";import{useCallback as te,useEffect as m,useMemo as h,useRef as ne,useState as re}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";function ie({rows:ie,columns:ae,smartTagEnabled:v,smartTagIds:y,title:fe,showPlayCount:pe,playCountDelta:me,showEpisode:he,enableInfinite:x,items:S,mode:ge=`renderer`}){let C=u()?.detailId||``,w=ge===`editor`,T=w,{getVerticalHoCoverImageUrl:E,getTitleText:D}=c(),O=ne(null),k=h(()=>p({smartTagEnabled:v,smartTagIds:y,enableInfinite:x,items:S}),[x,S,v,y]),A=k.smartTagEnabled,j=k.smartTagIds,M=h(()=>k.items??[],[k.items]),N=k.enableInfinite&&!w,P=!A,F=N&&A&&!T,_e=ee(ie,N),I=d(ae),L=_e*I,R=Math.max(1,L),z=h(()=>[`video-detail-recommend`,C||`unknown`,R,j.join(`,`)].join(`:`),[C,R,j]),[ve,B]=a(`${z}:pool`,[]),[V,H]=a(`${z}:has-more`,!1),[U,W]=re(!1),G=h(()=>l(L),[L]),{data:K}=i([`video-detail-recommend`,C,F?`paged`:`all`,R,j.join(`,`)],async()=>T?null:await e({page_size:R,tags:j}),{enabled:!T}),q=h(()=>T?G:oe(K?.data?.videos),[K?.data?.videos,G,T]);m(()=>{if(!F){W(!1);return}B(e=>{if(!q.length)return e;if(!e.length)return q;let t=[...q],n=new Set(q.map(e=>e.id).filter(Boolean));return e.forEach(e=>{(!e.id||!n.has(e.id))&&(t.push(e),e.id&&n.add(e.id))}),t});let e=ce(K?.data?.videos,R);H(t=>t||e),W(!1)},[K?.data?.videos,q,R,H,B,F]);let J=F?ve:q,Y=h(()=>P?Array.from(new Set(M.map(e=>b(e.contentId)).filter(Boolean))):[],[M,P]),{data:ye}=i([`video-detail-recommend-manual-details`,Y.join(`,`)],async()=>{if(!Y.length)return[];let e=await t({ids:Y});return(Array.isArray(e.data?.videos)?e.data.videos:[]).map(e=>se(e))},{enabled:Y.length>0}),be=h(()=>P?new Set(M.map(e=>b(e.contentId)).filter(Boolean)):new Set,[M,P]),xe=h(()=>T?J:J.filter(e=>!be.has(e.id)),[J,T,be]),X=h(()=>{if(!P||!M.length)return[];let e=new Map;return J.forEach(t=>{let n=b(t.id);n&&e.set(n,t)}),(ye||[]).forEach(t=>{let n=b(t.id);n&&e.set(n,t)}),M.map((t,n)=>{let r=G[n%Math.max(1,G.length)],i=b(t.contentId),a=e.get(i)??(T?{...r,id:i||r.id||`preview-manual-${n+1}`,name:r.name||`猜你喜欢 ${n+1}`}:null);if(!a)return null;let o=t.titleMode===`custom`?t.title:D(a),s=t.coverMode===`upload`?t.coverUrl:E(a);return{info:{...a,name:o||a.name,img_y:s||a.img_y,img_x:s||a.img_x},config:{showPlayCount:t.showPlayCount,playCountDelta:t.playCountDelta,showEpisode:t.showEpisode}}}).filter(Boolean)},[G,J,D,E,T,ye,M,P]),Z=h(()=>xe.map(e=>({info:e})),[xe]),Se=P&&M.length>0,Ce=h(()=>Se?X:f(X,Z,L),[Se,X,L,Z]),Q=h(()=>{if(F){if(!X.length)return Z;let e=new Set(X.map(e=>e.info.id).filter(Boolean));return X.concat(Z.filter(t=>!e.has(t.info.id)))}if(N){if(!X.length)return Z;let e=new Set(X.map(e=>e.info.id).filter(Boolean));return X.concat(Z.filter(t=>!e.has(t.info.id)))}return Ce},[Ce,X,Z,N,F]),we=V&&Q.length>0?Math.max(0,Q.length-4):-1,Te=String(fe||``).trim(),$=te(async()=>{if(!(!F||!V||U)){W(!0);try{let t=await e({page_size:R,tags:j}),n=Array.isArray(t.data?.videos)?t.data.videos:[],r=oe(n),i=0;B(e=>{let t=new Set(e.map(e=>e.id).filter(Boolean)),n=[...e];return r.forEach(e=>{(!e.id||!t.has(e.id))&&(n.push(e),e.id&&t.add(e.id))}),i=n.length-e.length,n}),H(ce(n,R)&&i>0)}catch(e){console.error(`猜你喜欢分页加载失败`,e),H(!1)}finally{W(!1)}}},[V,U,R,j,H,B,F]);return m(()=>{if(!F)return;let e=O.current;if(!e||!V)return;let t=new IntersectionObserver(e=>{e[0]?.isIntersecting&&!U&&$()});return t.observe(e),()=>{t.disconnect()}},[$,V,U,F,we]),Q.length?_(n,{className:`w-full mt-[16px] ${T?`pointer-events-none`:``}`,children:[Te?g(r,{className:`block pl-[12px] mb-[8px] text-text1 text-[18px] leading-[26px] font-bold`,children:Te}):null,g(n,{className:`w-full flex flex-wrap px-[12px]`,children:Q.map((e,t)=>{let n=D(e.info),i=pe!==!1&&(e.config?.showPlayCount??!0),a=e.config?.showEpisode??he,c=ue(e.info.play_count||0),l=le(e.info),u=Number.isFinite(I)&&I>0?I:3,d=`${100/u}%`,f=t%u,p=u>1?{paddingLeft:8*f/u,paddingRight:8*(u-f-1)/u}:null;return g(`div`,{ref:t===we?O:void 0,style:{width:d,...p||{}},children:g(s,{url:E(e.info),text:n,textChild:g(r,{as:`h3`,className:`text-text1 text-[16px] h-[24px] leading-[24px] mt-[4px] line-clamp-1`,children:n}),style:{width:`100%`},bottomLeftChild:i?_(`div`,{className:`h-[20px] leading-[20px] text-[#fff] text-[12px] px-[4px] rounded-[4px] bg-[#333] ml-[4px] flex items-center`,children:[g(o,{className:`w-[16px] h-[auto] text-[#fff] mr-[4px]`}),c]}):null,bottomRightChild:a&&l?g(`div`,{className:`text-[#fff] text-[12px] leading-[20px] pr-2`,children:l}):null,linkPath:T?``:de(e.info)})},`guess-like-${t}`)})})]}):null}function ae(e){return{id:e.video_id||``,mid:``,name:e.name||``,cat_id:``,cat_name:``,status:`1`,status_text:``,create_time:``,content_type:0,episode_cnt:e.episode_count||0,show_at:e.show_at??``,position:``,img_type:e.img_type??``,img_x:e.img_x??``,img_y:e.img_y??``,img_width:``,img_height:``,play_count:e.play_count,preview_images:[],duration:String(e.duration??``),score:String(e.score??``),is_more_link:e.is_more_link?`y`:`n`,update_status:String(e.update_status??``),description:e.description??``,language:``,director:``,actor:``,area:``,issue_date:``,publisher:``,series:``,number:``,tags:[],source_tags:e.source_tags??``,source_actor:[],links:Array.isArray(e.episodes)?e.episodes.map(e=>({id:e.id??``,name:e.name??``,preview_m3u8_url:e.preview_m3u8_url??``,m3u8_url:e.m3u8_url??``})):[],money:``,up_user:``,source_username:``,task_id:``,file_status:``}}function oe(e){return Array.isArray(e)?e.map(e=>ae(e)):[]}function se(e){let t=String(e?.id||e?.mid||e?.video_id||``),n=Number(e?.content_type||0)===2||e?.is_more_link===`y`||e?.is_more_link===`1`||e?.is_more_link===!0,r=Array.isArray(e?.links)?e.links.map(e=>({id:String(e?.id||``),name:String(e?.name||``),preview_m3u8_url:String(e?.preview_m3u8_url||``),m3u8_url:String(e?.m3u8_url||``)})):[],i=Array.isArray(e?.video_episodes)?e.video_episodes.length:0,a=Number(e?.episode_cnt||i||r.length||0);return{id:t,mid:String(e?.mid||t),name:String(e?.name||``),cat_id:String(e?.cat_id||``),cat_name:String(e?.cat_name||``),status:String(e?.status||`1`),status_text:String(e?.status_text||``),create_time:String(e?.create_time||``),content_type:0,type:n?2:1,episode_cnt:Number.isFinite(a)?a:0,show_at:String(e?.show_at||``),position:String(e?.position||``),img_type:String(e?.img_type||``),img_x:String(e?.img_x||``),img_y:String(e?.img_y||``),img_width:String(e?.img_width||``),img_height:String(e?.img_height||``),play_count:Number(e?.play_count??e?.browse_count??0),preview_images:Array.isArray(e?.preview_images)?e.preview_images:[],duration:String(e?.duration||``),score:String(e?.score||``),is_more_link:n?`y`:`n`,update_status:String(e?.update_status||``),description:String(e?.description||``),language:String(e?.language||``),director:String(e?.director||``),actor:String(e?.actor||``),area:String(e?.area||``),issue_date:String(e?.issue_date||``),publisher:String(e?.publisher||``),series:String(e?.series||``),number:String(e?.number||``),tags:Array.isArray(e?.tags)?e.tags:[],source_tags:String(e?.source_tags||``),source_actor:Array.isArray(e?.source_actor)?e.source_actor:[],links:r,money:String(e?.money||``),up_user:String(e?.up_user||``),source_username:String(e?.source_username||``),task_id:String(e?.task_id||``),file_status:String(e?.file_status||``)}}function ce(e,t){if(!Array.isArray(e)||e.length===0)return!1;let n=e[0];if(typeof n?.has_more==`boolean`)return n.has_more;let r=Number(n?.total??0);return Number.isFinite(r)&&r>0?r>t:e.length>=t}function le(e){if(v(e)){let t=Number(e.episode_cnt||e.links?.length||0);return t>0?`全${t}集`:``}return y(Number(e.duration||0))}function v(e){if(Number(e.type??e.content_type??0)===2)return!0;let t=e.is_more_link;if(t===!0||t===`y`||t===`1`)return!0;let n=Number(e.episode_cnt||e.links?.length||0);return Number.isFinite(n)&&n>1}function y(e){if(!Number.isFinite(e)||e<=0)return``;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=e=>String(e).padStart(2,`0`);return n>0?`${a(n)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}function ue(e){let t=Number(e||`0`);return Number.isNaN(t)||t<=0?`0`:t>=1e4?`${(t/1e4).toFixed(1)}w`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function de(e){if(e.content_type===0){let t=encodeURIComponent(e.name||``);return`/video/${e.id}/${t}/episode/1`}return`/post/${e.id}`}function b(e){return typeof e==`string`?e.trim():``}export{ie as VideoDetailRecommendClient};
2
+ "use client";import{gContentGetGuessYouLikeVideos as e,pContentBatchGetVideoDetail as t}from"../../../../../service/generated/client.mjs";import{Box as n}from"../../../../ui/box.mjs";import{Text as r}from"../../../../ui/text.mjs";import{useRequest as i}from"../../../../../hooks/query/use-query.mjs";import{useKeepAliveState as a}from"../../../../common/keep-scroll-position/index.mjs";import o from"../../../../../assets/icons/detail/video_flag.mjs";import{MiniThreeCard as s}from"../../../../common/cards/mini-three-card.mjs";import{useCardDecoration as c}from"../../../../../hooks/use-card-decoration.mjs";import{buildEditorPreviewRecommendList as l}from"../shared/editor-preview.mjs";import{useVideoDetailMaterialRuntimeContext as u}from"../shared/runtime-context-provider.mjs";import{applyPlayCountDelta as ee,clampColumns as d,mergeManualAndPool as f,normalizeRecommendRuntimeProps as p,resolveRows as m}from"./utils.mjs";import{useCallback as te,useEffect as h,useMemo as g,useRef as ne,useState as re}from"react";import{jsx as _,jsxs as ie}from"react/jsx-runtime";function ae({rows:ae,columns:oe,smartTagEnabled:y,smartTagIds:b,title:fe,showPlayCount:pe,playCountDelta:me,showEpisode:he,enableInfinite:S,items:C,mode:ge=`renderer`}){let w=u()?.detailId||``,T=ge===`editor`,E=T,{getVerticalHoCoverImageUrl:D,getTitleText:O}=c(),k=ne(null),A=g(()=>p({smartTagEnabled:y,smartTagIds:b,enableInfinite:S,items:C}),[S,C,y,b]),j=A.smartTagEnabled,M=A.smartTagIds,N=g(()=>A.items??[],[A.items]),P=A.enableInfinite&&!T,F=!j,I=P&&j&&!E,_e=m(ae,P),L=d(oe),R=_e*L,z=Math.max(1,R),B=g(()=>[`video-detail-recommend`,w||`unknown`,z,M.join(`,`)].join(`:`),[w,z,M]),[ve,V]=a(`${B}:pool`,[]),[H,U]=a(`${B}:has-more`,!1),[W,G]=re(!1),K=g(()=>l(R),[R]),{data:q}=i([`video-detail-recommend`,w,I?`paged`:`all`,z,M.join(`,`)],async()=>E?null:await e({page_size:z,tags:M}),{enabled:!E}),J=g(()=>E?K:se(q?.data?.videos),[q?.data?.videos,K,E]);h(()=>{if(!I){G(!1);return}V(e=>{if(!J.length)return e;if(!e.length)return J;let t=[...J],n=new Set(J.map(e=>e.id).filter(Boolean));return e.forEach(e=>{(!e.id||!n.has(e.id))&&(t.push(e),e.id&&n.add(e.id))}),t});let e=v(q?.data?.videos,z);U(t=>t||e),G(!1)},[q?.data?.videos,J,z,U,V,I]);let Y=I?ve:J,X=g(()=>F?Array.from(new Set(N.filter(e=>e.coverMode===`content`).map(e=>x(e.contentId)).filter(Boolean))):[],[N,F]),{data:ye}=i([`video-detail-recommend-manual-details`,X.join(`,`)],async()=>{if(!X.length)return[];let e=await t({ids:X});return(Array.isArray(e.data?.videos)?e.data.videos:[]).map(e=>ce(e))},{enabled:X.length>0}),be=g(()=>F?new Set(N.map(e=>x(e.contentId)).filter(Boolean)):new Set,[N,F]),xe=g(()=>E?Y:Y.filter(e=>!be.has(e.id)),[Y,E,be]),Z=g(()=>{if(!F||!N.length)return[];let e=new Map;return Y.forEach(t=>{let n=x(t.id);n&&e.set(n,t)}),(ye||[]).forEach(t=>{let n=x(t.id);n&&e.set(n,t)}),N.map((t,n)=>{let r=K[n%Math.max(1,K.length)],i=x(t.contentId),a=typeof t.coverUrl==`string`?t.coverUrl.trim():``,o=e.get(i)??{...r,id:i||r.id||`preview-manual-${n+1}`,name:r.name||`猜你喜欢 ${n+1}`,img_y:a||r.img_y,img_x:a||r.img_x},s=t.titleMode===`custom`?t.title:O(o),c=t.coverMode===`content`?D(o)||a:a||D(o);return{info:{...o,name:s||o.name,img_y:c||o.img_y,img_x:c||o.img_x},config:{showPlayCount:t.showPlayCount,playCountDelta:t.playCountDelta,showEpisode:t.showEpisode}}}).filter(Boolean)},[K,Y,O,D,ye,N,F]),Q=g(()=>xe.map(e=>({info:e})),[xe]),Se=F&&N.length>0,Ce=g(()=>Se?Z:f(Z,Q,R),[Se,Z,R,Q]),$=g(()=>{if(I){if(!Z.length)return Q;let e=new Set(Z.map(e=>e.info.id).filter(Boolean));return Z.concat(Q.filter(t=>!e.has(t.info.id)))}if(P){if(!Z.length)return Q;let e=new Set(Z.map(e=>e.info.id).filter(Boolean));return Z.concat(Q.filter(t=>!e.has(t.info.id)))}return Ce},[Ce,Z,Q,P,I]),we=H&&$.length>0?Math.max(0,$.length-4):-1,Te=String(fe||``).trim(),Ee=te(async()=>{if(!(!I||!H||W)){G(!0);try{let t=await e({page_size:z,tags:M}),n=Array.isArray(t.data?.videos)?t.data.videos:[],r=se(n),i=0;V(e=>{let t=new Set(e.map(e=>e.id).filter(Boolean)),n=[...e];return r.forEach(e=>{(!e.id||!t.has(e.id))&&(n.push(e),e.id&&t.add(e.id))}),i=n.length-e.length,n}),U(v(n,z)&&i>0)}catch(e){console.error(`猜你喜欢分页加载失败`,e),U(!1)}finally{G(!1)}}},[H,W,z,M,U,V,I]);return h(()=>{if(!I)return;let e=k.current;if(!e||!H)return;let t=new IntersectionObserver(e=>{e[0]?.isIntersecting&&!W&&Ee()});return t.observe(e),()=>{t.disconnect()}},[Ee,H,W,I,we]),$.length?ie(n,{className:`w-full mt-[16px] ${E?`pointer-events-none`:``}`,children:[Te?_(r,{className:`block pl-[12px] mb-[8px] text-text1 text-[18px] leading-[26px] font-bold`,children:Te}):null,_(n,{className:`w-full flex flex-wrap px-[12px]`,children:$.map((e,t)=>{let n=O(e.info),i=pe!==!1&&(e.config?.showPlayCount??!0),a=Number(e.config?.playCountDelta??me??0),c=e.config?.showEpisode??he,l=ue(ee(e.info.play_count||0,a)),u=le(e.info),d=Number.isFinite(L)&&L>0?L:3,f=`${100/d}%`,p=t%d,m=d>1?{paddingLeft:8*p/d,paddingRight:8*(d-p-1)/d}:null;return _(`div`,{ref:t===we?k:void 0,style:{width:f,...m||{}},children:_(s,{url:D(e.info),text:n,textChild:_(r,{as:`h3`,className:`text-text1 text-[16px] h-[24px] leading-[24px] mt-[4px] line-clamp-1`,children:n}),style:{width:`100%`},bottomLeftChild:i?ie(`div`,{className:`h-[20px] leading-[20px] text-[#fff] text-[12px] px-[4px] rounded-[4px] bg-[#333] ml-[4px] flex items-center`,children:[_(o,{className:`w-[16px] h-[auto] text-[#fff] mr-[4px]`}),l]}):null,bottomRightChild:c&&u?_(`div`,{className:`text-[#fff] text-[12px] leading-[20px] pr-2`,children:u}):null,linkPath:E?``:de(e.info)})},`guess-like-${t}`)})})]}):null}function oe(e){return{id:e.video_id||``,mid:``,name:e.name||``,cat_id:``,cat_name:``,status:`1`,status_text:``,create_time:``,content_type:0,episode_cnt:e.episode_count||0,show_at:e.show_at??``,position:``,img_type:e.img_type??``,img_x:e.img_x??``,img_y:e.img_y??``,img_width:``,img_height:``,play_count:e.play_count,preview_images:[],duration:String(e.duration??``),score:String(e.score??``),is_more_link:e.is_more_link?`y`:`n`,update_status:String(e.update_status??``),description:e.description??``,language:``,director:``,actor:``,area:``,issue_date:``,publisher:``,series:``,number:``,tags:[],source_tags:e.source_tags??``,source_actor:[],links:Array.isArray(e.episodes)?e.episodes.map(e=>({id:e.id??``,name:e.name??``,preview_m3u8_url:e.preview_m3u8_url??``,m3u8_url:e.m3u8_url??``})):[],money:``,up_user:``,source_username:``,task_id:``,file_status:``}}function se(e){return Array.isArray(e)?e.map(e=>oe(e)):[]}function ce(e){let t=String(e?.id||e?.mid||e?.video_id||``),n=Number(e?.content_type||0)===2||e?.is_more_link===`y`||e?.is_more_link===`1`||e?.is_more_link===!0,r=Array.isArray(e?.links)?e.links.map(e=>({id:String(e?.id||``),name:String(e?.name||``),preview_m3u8_url:String(e?.preview_m3u8_url||``),m3u8_url:String(e?.m3u8_url||``)})):[],i=Array.isArray(e?.video_episodes)?e.video_episodes.length:0,a=Number(e?.episode_cnt||i||r.length||0);return{id:t,mid:String(e?.mid||t),name:String(e?.name||``),cat_id:String(e?.cat_id||``),cat_name:String(e?.cat_name||``),status:String(e?.status||`1`),status_text:String(e?.status_text||``),create_time:String(e?.create_time||``),content_type:0,type:n?2:1,episode_cnt:Number.isFinite(a)?a:0,show_at:String(e?.show_at||``),position:String(e?.position||``),img_type:String(e?.img_type||``),img_x:String(e?.img_x||``),img_y:String(e?.img_y||``),img_width:String(e?.img_width||``),img_height:String(e?.img_height||``),play_count:Number(e?.play_count??e?.browse_count??0),preview_images:Array.isArray(e?.preview_images)?e.preview_images:[],duration:String(e?.duration||``),score:String(e?.score||``),is_more_link:n?`y`:`n`,update_status:String(e?.update_status||``),description:String(e?.description||``),language:String(e?.language||``),director:String(e?.director||``),actor:String(e?.actor||``),area:String(e?.area||``),issue_date:String(e?.issue_date||``),publisher:String(e?.publisher||``),series:String(e?.series||``),number:String(e?.number||``),tags:Array.isArray(e?.tags)?e.tags:[],source_tags:String(e?.source_tags||``),source_actor:Array.isArray(e?.source_actor)?e.source_actor:[],links:r,money:String(e?.money||``),up_user:String(e?.up_user||``),source_username:String(e?.source_username||``),task_id:String(e?.task_id||``),file_status:String(e?.file_status||``)}}function v(e,t){if(!Array.isArray(e)||e.length===0)return!1;let n=e[0];if(typeof n?.has_more==`boolean`)return n.has_more;let r=Number(n?.total??0);return Number.isFinite(r)&&r>0?r>t:e.length>=t}function le(e){if(y(e)){let t=Number(e.episode_cnt||e.links?.length||0);return t>0?`全${t}集`:``}return b(Number(e.duration||0))}function y(e){if(Number(e.type??e.content_type??0)===2)return!0;let t=e.is_more_link;if(t===!0||t===`y`||t===`1`)return!0;let n=Number(e.episode_cnt||e.links?.length||0);return Number.isFinite(n)&&n>1}function b(e){if(!Number.isFinite(e)||e<=0)return``;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=e=>String(e).padStart(2,`0`);return n>0?`${a(n)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}function ue(e){let t=Number(e||`0`);return Number.isNaN(t)||t<=0?`0`:t>=1e4?`${(t/1e4).toFixed(1)}w`:t>=1e3?`${(t/1e3).toFixed(1)}k`:String(t)}function de(e){if(e.content_type===0){let t=encodeURIComponent(e.name||``);return`/video/${e.id}/${t}/episode/1`}return`/post/${e.id}`}function x(e){return typeof e==`string`?e.trim():``}export{ae as VideoDetailRecommendClient};
@@ -1,2 +1,2 @@
1
1
 
2
- function e(e){if(typeof e==`boolean`)return e;if(typeof e==`number`)return e===1;if(typeof e==`string`){let t=e.trim().toLowerCase();return t===`true`||t===`1`||t===`y`||t===`yes`||t===`on`}return!1}function t(t){let n=e(t.smartTagEnabled),r=Array.isArray(t.smartTagIds)?t.smartTagIds.map(e=>String(e||``).trim()).filter(Boolean):[],i=n?e(t.enableInfinite):!1,a=Array.isArray(t.items)?t.items.filter(Boolean):t.items;return{...t,smartTagEnabled:n,smartTagIds:r,enableInfinite:i,items:a}}function n(e,t){let n=Number(e||1);if(!Number.isFinite(n))return 1;let r=Math.max(1,Math.floor(n));return t?r:Math.min(10,r)}function r(e){let t=Number(e??3);return Number.isFinite(t)?Math.min(6,Math.max(1,Math.floor(t))):3}function i(e,t,n){let r=Math.max(0,n),i=e.slice(0,r);return i.length>=r?i:i.concat(t.slice(0,r-i.length))}export{r as clampColumns,i as mergeManualAndPool,t as normalizeRecommendRuntimeProps,n as resolveRows};
2
+ function e(e){if(typeof e==`boolean`)return e;if(typeof e==`number`)return e===1;if(typeof e==`string`){let t=e.trim().toLowerCase();return t===`true`||t===`1`||t===`y`||t===`yes`||t===`on`}return!1}function t(t){let n=e(t.smartTagEnabled),r=Array.isArray(t.smartTagIds)?t.smartTagIds.map(e=>String(e||``).trim()).filter(Boolean):[],i=n?e(t.enableInfinite):!1,a=Array.isArray(t.items)?t.items.filter(Boolean):t.items;return{...t,smartTagEnabled:n,smartTagIds:r,enableInfinite:i,items:a}}function n(e,t){let n=Number(e||1);if(!Number.isFinite(n))return 1;let r=Math.max(1,Math.floor(n));return t?r:Math.min(10,r)}function r(e){let t=Number(e??3);return Number.isFinite(t)?Math.min(6,Math.max(1,Math.floor(t))):3}function i(e,t){let n=Number(e||0),r=Number(t||0);return!Number.isFinite(n)||!Number.isFinite(r)?0:Math.max(0,n+r)}function a(e,t,n){let r=Math.max(0,n),i=e.slice(0,r);return i.length>=r?i:i.concat(t.slice(0,r-i.length))}export{i as applyPlayCountDelta,r as clampColumns,a as mergeManualAndPool,t as normalizeRecommendRuntimeProps,n as resolveRows};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{pContentGetPopularVideoList as e}from"../../../../../service/generated/client.mjs";import{Image as t}from"../../../../ui/image.mjs";import{Box as n}from"../../../../ui/box.mjs";import{Text as r}from"../../../../ui/text.mjs";import i from"../../../../../assets/icons/detail/video_flag.mjs";import{MiniThreeCard as a}from"../../../../common/cards/mini-three-card.mjs";import{HOME_RECOMMEND_DEFAULT_GRID_COLUMNS as o,HOME_RECOMMEND_DEFAULT_GRID_ROWS as s,HOME_RECOMMEND_DEFAULT_PLAY_COUNT_DELTA as c,HOME_RECOMMEND_DEFAULT_SHOW_EPISODE as l,HOME_RECOMMEND_DEFAULT_SHOW_PLAY_COUNT as u,HOME_RECOMMEND_MAX_GRID_COLUMNS as ee,HOME_RECOMMEND_MAX_GRID_ROWS as te}from"./home-recommend-default-config.mjs";import{HOME_RECOMMEND_CARD_CONFIG_FIELD as d}from"./home-recommend-preview.mjs";import{useCallback as f,useEffect as p,useLayoutEffect as m,useMemo as h,useRef as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{useRouter as ne}from"next/navigation";const re={},ie={list:[]};function b({variant:t,props:i=re,data:a=ie,mode:d=`renderer`,props:b={}}){let S=d===`editor`,C=ne(),{list:se,title:T,cursor:E}=a,{items:D}=b,O=h(()=>Array.isArray(D)?D:[],[D]),k=h(()=>Array.isArray(a.icons)?a.icons:[],[a.icons]),{rows:ce,columns:le,moreLink:de,title:fe,smartTagIds:M,catId:pe,showPlayCount:me,playCountDelta:he,showEpisode:ge,enableInfinite:_e}=i,N=_e===!0,P=!S&&N&&O.length>=16,F=h(()=>Array.isArray(M)?M.map(e=>String(e||``).trim()).filter(Boolean):[],[M]),I=typeof pe==`string`?pe.trim():``,[L,ve]=_(0),[R,ye]=_(O),[be,xe]=_(k),[z,B]=_(()=>A(E)),[Se,Ce]=_(!1),we=g(null),V=g(null),H=g(!1);p(()=>{ye(O),xe(k),B(A(E))},[E,k,O]);let Te=oe(ce,s,te),U=oe(le,o,ee),W=N?16:t===`grid`?Te*U:16,Ee=Te*U,De=S&&t===`grid`,G=De?R.slice(0,Ee):R,K=De?be.slice(0,Ee):be,Oe=t===`waterfall`?6:4,q=G.length>0?Math.max(0,G.length-Oe):-1,J=!!z,ke=fe&&fe.trim()||T||``,Y=me??u,X=Number(he??c),Z=ge??l,Ae=!N,Q=Ae?ae(de):``,je=Ae&&!!Q,Me=f(async()=>{let t=z;if(!(!P||!t||H.current)){H.current=!0,Ce(!0);try{let n=await e({cursor:t,page_size:W,tags:F.length>0?F:void 0,cat_id:I||void 0}),r=Array.isArray(n.data?.videos)?n.data.videos:[],i=A(n.data?.cursor);r.length>0&&ye(e=>e.concat(r)),B(e=>{if(!(!r.length||!i))return i===e?void 0:i})}catch(e){console.error(`推荐位加载下一页失败(client)`,e),B(void 0)}finally{H.current=!1,Ce(!1)}}},[z,I,W,F,P]),Ne=f(()=>{Q&&(Q.startsWith(`http`)?window.location.href=Q:C.push(Q))},[Q,C]);p(()=>{let e=V.current;if(!e||!P||!J)return;let t=document.getElementById(`app-scroll-container`)||null,n=new IntersectionObserver(e=>{!e[0]?.isIntersecting||Se||Me()},{root:t,threshold:0});return n.observe(e),()=>{n.disconnect()}},[Me,J,Se,G.length,W,P,q]),m(()=>{let e=we.current;if(!e||t!==`waterfall`)return;let n=()=>{let t=e.clientWidth||0;ve(t>0?(t-12)/2:0)};n();let r=new ResizeObserver(n);return r.observe(e),()=>{r.disconnect()}},[t]);let $=h(()=>t===`waterfall`?ue(G,K,L):{left:[],right:[]},[L,K,G,t]);return G.length?y(n,{className:`w-full mt-[16px]`,children:[y(n,{className:`flex items-center justify-between px-[12px] mb-[8px]`,children:[v(r,{className:`flex-1 min-w-0 text-text1 text-[18px] leading-[26px] font-bold line-clamp-1`,children:ke}),je&&v(r,{className:`text-text3 text-[12px] leading-[18px] cursor-pointer`,onClick:Ne,children:`更多`})]}),t===`grid`&&v(n,{className:`w-full flex flex-wrap px-[12px]`,children:G.map((e,n)=>{let r=K[n],i=w(e),a=Y&&(i?.showPlayCount??!0),o=i?.playCountDelta??X,s=i?.showEpisode??Z,c=n%U,l=U>1?{paddingLeft:12*c/U,paddingRight:12*(U-c-1)/U}:void 0;return v(`div`,{ref:n===q?V:void 0,className:`min-w-0`,style:{width:`${100/U}%`,...l||{}},children:v(x,{variant:t,item:e,icon:r,index:n,showPlayCount:a,playCountDelta:o,showEpisode:s,widthStyle:{width:`100%`}})},j(e,n))})}),t===`waterfall`&&y(n,{ref:we,className:`w-full px-[12px] flex gap-[12px]`,children:[v(n,{className:`flex-1 min-w-0 flex flex-col`,children:$.left.map(e=>{let n=w(e.item),r=Y&&(n?.showPlayCount??!0),i=n?.playCountDelta??X,a=n?.showEpisode??Z;return v(`div`,{ref:e.index===q?V:void 0,children:v(x,{variant:t,item:e.item,icon:e.icon,index:e.index,showPlayCount:r,playCountDelta:i,showEpisode:a,widthStyle:{width:`100%`}})},j(e.item,e.index))})}),v(n,{className:`flex-1 min-w-0 flex flex-col`,children:$.right.map(e=>{let n=w(e.item),r=Y&&(n?.showPlayCount??!0),i=n?.playCountDelta??X,a=n?.showEpisode??Z;return v(`div`,{ref:e.index===q?V:void 0,children:v(x,{variant:t,item:e.item,icon:e.icon,index:e.index,showPlayCount:r,playCountDelta:i,showEpisode:a,widthStyle:{width:`100%`}})},j(e.item,e.index))})})]})]}):null}function x({variant:e,item:t,icon:o,index:s,showPlayCount:c,playCountDelta:l,showEpisode:u,widthStyle:ee}){let te=se(t),d=t.name||t?.title||``,f=O(t.static?.browse_cnt??0),p=E(t,u),m=le(t,o,s);return v(a,{url:te,text:d,className:`w-full`,style:ee,topRightChild:m?v(S,{url:m}):void 0,bottomLeftChild:c?y(n,{className:`h-[20px] leading-[20px] text-[#fff] text-[12px] px-[4px] rounded-[4px] bg-[#333] ml-[4px] flex items-center`,children:[v(i,{className:`w-[16px] h-[auto] text-[#fff] mr-[4px]`}),f]}):null,bottomRightChild:u?p&&v(r,{className:`text-[#fff] text-[12px] leading-[18px] pr-2`,children:p}):null,textChild:v(n,{className:`py-[4px]`,children:v(r,{as:`h3`,className:`text-text1 text-[16px] leading-[24px] ${e===`waterfall`?`break-words line-clamp-3`:`line-clamp-1`}`,children:d})}),linkPath:C(t)})}function S({url:e}){return v(n,{className:`relative w-[40px] h-[20px]`,children:v(t,{src:e,alt:`corner`,fill:!0,objectFit:`cover`})})}function C(e){let t=encodeURIComponent(e.name||``);return`/video/${e.id||``}/${t}/episode/1`}function ae(e){return e?e.trim():``}function oe(e,t,n){let r=Number(e);return!Number.isFinite(r)||r<=0?t:Math.min(n,Math.floor(r))}function w(e){return e[d]}function se(e){return e.img_y||e.img_x||e?.coverUrl}function T(e){return typeof e==`string`?e:``}function E(e,t){if(!t)return``;if(D(e)){let t=Number(e.episode_cnt||e.links?.length||0);return t>0?`全${t}集`:``}return ce(Number(e.duration||0))}function D(e){if(Number(e.type??0)===2)return!0;let t=e.is_more_link;if(t===!0||t===`y`||t===`1`)return!0;let n=Number(e.episode_cnt||e.links?.length||0);return Number.isFinite(n)&&n>1}function O(e){return!Number.isFinite(e)||e<=0?`0`:e>=1e6?`${k(e/1e6)}M`:e>=1e3?`${k(e/1e3)}k`:Math.floor(e).toString()}function k(e){let t=e.toFixed(1);return t.endsWith(`.0`)?t.slice(0,-2):t}function ce(e){if(!Number.isFinite(e)||e<=0)return``;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=e=>String(e).padStart(2,`0`);return n>0?`${a(n)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}function le(e,t,n){return T(e.badge_url)||T(t?.material_url)||``}function ue(e,t,n){let r=[],i=[],a=n<=0,o=0,s=0;return e.forEach((e,c)=>{let l=t[c];if(a){c%2==0?r.push({item:e,icon:l,index:c}):i.push({item:e,icon:l,index:c});return}let u=de(n,e);o<=s?(r.push({item:e,icon:l,index:c}),o+=u):(i.push({item:e,icon:l,index:c}),s+=u)}),{left:r,right:i}}function de(e,t){if(!e)return 0;let n=e*1.3461538461538463,r=E(t,!0)?18:0;return n+20+r+6+16}function A(e){if(typeof e==`string`)return e.trim()||void 0}function j(e,t){return e.id?`home-recommend-${e.id}`:`home-recommend-${t}`}export{b as default};
2
+ "use client";import{pContentGetPopularVideoList as e}from"../../../../../service/generated/client.mjs";import{Image as t}from"../../../../ui/image.mjs";import{Box as n}from"../../../../ui/box.mjs";import{Text as r}from"../../../../ui/text.mjs";import i from"../../../../../assets/icons/detail/video_flag.mjs";import{MiniThreeCard as a}from"../../../../common/cards/mini-three-card.mjs";import{HOME_RECOMMEND_DEFAULT_GRID_COLUMNS as o,HOME_RECOMMEND_DEFAULT_GRID_ROWS as s,HOME_RECOMMEND_DEFAULT_PLAY_COUNT_DELTA as c,HOME_RECOMMEND_DEFAULT_SHOW_EPISODE as l,HOME_RECOMMEND_DEFAULT_SHOW_PLAY_COUNT as u,HOME_RECOMMEND_MAX_GRID_COLUMNS as ee,HOME_RECOMMEND_MAX_GRID_ROWS as te}from"./home-recommend-default-config.mjs";import{HOME_RECOMMEND_CARD_CONFIG_FIELD as d}from"./home-recommend-preview.mjs";import{useCallback as f,useEffect as p,useLayoutEffect as m,useMemo as h,useRef as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{useRouter as ne}from"next/navigation";const re={},ie={list:[]};function b({variant:t,props:i=re,data:a=ie,mode:d=`renderer`}){let b=d===`editor`,S=ne(),{list:C,title:se,cursor:T}=a,E=h(()=>Array.isArray(C)?C:[],[C]),D=h(()=>Array.isArray(a.icons)?a.icons:[],[a.icons]),{rows:ce,columns:le,moreLink:O,title:k,smartTagIds:A,catId:j,showPlayCount:de,playCountDelta:fe,showEpisode:pe,enableInfinite:me}=i,P=me===!0,F=!b&&P&&E.length>=16,I=h(()=>Array.isArray(A)?A.map(e=>String(e||``).trim()).filter(Boolean):[],[A]),L=typeof j==`string`?j.trim():``,[R,he]=_(0),[z,ge]=_(E),[B,_e]=_(D),[V,H]=_(()=>M(T)),[ve,ye]=_(!1),be=g(null),U=g(null),W=g(!1);p(()=>{ge(E),_e(D),H(M(T))},[T,D,E]);let xe=oe(ce,s,te),G=oe(le,o,ee),K=P?16:t===`grid`?xe*G:16,Se=xe*G,Ce=b&&t===`grid`,q=Ce?z.slice(0,Se):z,J=Ce?B.slice(0,Se):B,we=t===`waterfall`?6:4,Y=q.length>0?Math.max(0,q.length-we):-1,Te=!!V,Ee=k&&k.trim()||se||``,X=de??u,Z=Number(fe??c),Q=pe??l,De=!P,$=De?ae(O):``,Oe=De&&!!$,ke=f(async()=>{let t=V;if(!(!F||!t||W.current)){W.current=!0,ye(!0);try{let n=await e({cursor:t,page_size:K,tags:I.length>0?I:void 0,cat_id:L||void 0}),r=Array.isArray(n.data?.videos)?n.data.videos:[],i=M(n.data?.cursor);r.length>0&&ge(e=>e.concat(r)),H(e=>{if(!(!r.length||!i))return i===e?void 0:i})}catch(e){console.error(`推荐位加载下一页失败(client)`,e),H(void 0)}finally{W.current=!1,ye(!1)}}},[V,L,K,I,F]),Ae=f(()=>{$&&($.startsWith(`http`)?window.location.href=$:S.push($))},[$,S]);p(()=>{let e=U.current;if(!e||!F||!Te)return;let t=document.getElementById(`app-scroll-container`)||null,n=new IntersectionObserver(e=>{!e[0]?.isIntersecting||ve||ke()},{root:t,threshold:0});return n.observe(e),()=>{n.disconnect()}},[ke,Te,ve,q.length,K,F,Y]),m(()=>{let e=be.current;if(!e||t!==`waterfall`)return;let n=()=>{let t=e.clientWidth||0;he(t>0?(t-12)/2:0)};n();let r=new ResizeObserver(n);return r.observe(e),()=>{r.disconnect()}},[t]);let je=h(()=>t===`waterfall`?ue(q,J,R):{left:[],right:[]},[R,J,q,t]);return q.length?y(n,{className:`w-full mt-[16px]`,children:[y(n,{className:`flex items-center justify-between px-[12px] mb-[8px]`,children:[v(r,{className:`flex-1 min-w-0 text-text1 text-[18px] leading-[26px] font-bold line-clamp-1`,children:Ee}),Oe&&v(r,{className:`text-text3 text-[12px] leading-[18px] cursor-pointer`,onClick:Ae,children:`更多`})]}),t===`grid`&&v(n,{className:`w-full flex flex-wrap px-[12px]`,children:q.map((e,n)=>{let r=J[n],i=w(e),a=X&&(i?.showPlayCount??!0),o=i?.playCountDelta??Z,s=i?.showEpisode??Q,c=n%G,l=G>1?{paddingLeft:12*c/G,paddingRight:12*(G-c-1)/G}:void 0;return v(`div`,{ref:n===Y?U:void 0,className:`min-w-0`,style:{width:`${100/G}%`,...l||{}},children:v(x,{variant:t,item:e,icon:r,index:n,showPlayCount:a,playCountDelta:o,showEpisode:s,widthStyle:{width:`100%`}})},N(e,n))})}),t===`waterfall`&&y(n,{ref:be,className:`w-full px-[12px] flex gap-[12px]`,children:[v(n,{className:`flex-1 min-w-0 flex flex-col`,children:je.left.map(e=>{let n=w(e.item),r=X&&(n?.showPlayCount??!0),i=n?.playCountDelta??Z,a=n?.showEpisode??Q;return v(`div`,{ref:e.index===Y?U:void 0,children:v(x,{variant:t,item:e.item,icon:e.icon,index:e.index,showPlayCount:r,playCountDelta:i,showEpisode:a,widthStyle:{width:`100%`}})},N(e.item,e.index))})}),v(n,{className:`flex-1 min-w-0 flex flex-col`,children:je.right.map(e=>{let n=w(e.item),r=X&&(n?.showPlayCount??!0),i=n?.playCountDelta??Z,a=n?.showEpisode??Q;return v(`div`,{ref:e.index===Y?U:void 0,children:v(x,{variant:t,item:e.item,icon:e.icon,index:e.index,showPlayCount:r,playCountDelta:i,showEpisode:a,widthStyle:{width:`100%`}})},N(e.item,e.index))})})]})]}):null}function x({variant:e,item:t,icon:o,index:s,showPlayCount:c,playCountDelta:l,showEpisode:u,widthStyle:ee}){let te=se(t),d=t.name||t?.title||``,f=ce(le(t.static?.browse_cnt??0,l)),p=E(t,u),m=A(t,o,s);return v(a,{url:te,text:d,className:`w-full`,style:ee,topRightChild:m?v(S,{url:m}):void 0,bottomLeftChild:c?y(n,{className:`h-[20px] leading-[20px] text-[#fff] text-[12px] px-[4px] rounded-[4px] bg-[#333] ml-[4px] flex items-center`,children:[v(i,{className:`w-[16px] h-[auto] text-[#fff] mr-[4px]`}),f]}):null,bottomRightChild:u?p&&v(r,{className:`text-[#fff] text-[12px] leading-[18px] pr-2`,children:p}):null,textChild:v(n,{className:`py-[4px]`,children:v(r,{as:`h3`,className:`text-text1 text-[16px] leading-[24px] ${e===`waterfall`?`break-words line-clamp-3`:`line-clamp-1`}`,children:d})}),linkPath:C(t)})}function S({url:e}){return v(n,{className:`relative w-[40px] h-[20px]`,children:v(t,{src:e,alt:`corner`,fill:!0,objectFit:`cover`})})}function C(e){let t=encodeURIComponent(e.name||``);return`/video/${e.id||``}/${t}/episode/1`}function ae(e){return e?e.trim():``}function oe(e,t,n){let r=Number(e);return!Number.isFinite(r)||r<=0?t:Math.min(n,Math.floor(r))}function w(e){return e[d]}function se(e){return e.img_y||e.img_x||e?.coverUrl}function T(e){return typeof e==`string`?e:``}function E(e,t){if(!t)return``;if(D(e)){let t=Number(e.episode_cnt||e.links?.length||0);return t>0?`全${t}集`:``}return k(Number(e.duration||0))}function D(e){if(Number(e.type??0)===2)return!0;let t=e.is_more_link;if(t===!0||t===`y`||t===`1`)return!0;let n=Number(e.episode_cnt||e.links?.length||0);return Number.isFinite(n)&&n>1}function ce(e){return!Number.isFinite(e)||e<=0?`0`:e>=1e6?`${O(e/1e6)}M`:e>=1e3?`${O(e/1e3)}k`:Math.floor(e).toString()}function le(e,t){let n=Number(e||0),r=Number(t||0);return!Number.isFinite(n)||!Number.isFinite(r)?0:Math.max(0,n+r)}function O(e){let t=e.toFixed(1);return t.endsWith(`.0`)?t.slice(0,-2):t}function k(e){if(!Number.isFinite(e)||e<=0)return``;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=e=>String(e).padStart(2,`0`);return n>0?`${a(n)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}function A(e,t,n){return T(e.badge_url)||T(t?.material_url)||``}function ue(e,t,n){let r=[],i=[],a=n<=0,o=0,s=0;return e.forEach((e,c)=>{let l=t[c];if(a){c%2==0?r.push({item:e,icon:l,index:c}):i.push({item:e,icon:l,index:c});return}let u=j(n,e);o<=s?(r.push({item:e,icon:l,index:c}),o+=u):(i.push({item:e,icon:l,index:c}),s+=u)}),{left:r,right:i}}function j(e,t){if(!e)return 0;let n=e*1.3461538461538463,r=E(t,!0)?18:0;return n+20+r+6+16}function M(e){if(typeof e==`string`)return e.trim()||void 0}function N(e,t){return e.id?`home-recommend-${e.id}`:`home-recommend-${t}`}export{b as default};
@@ -1,2 +1,2 @@
1
1
 
2
- import{HOME_RECOMMEND_DEFAULT_GRID_COLUMNS as e,HOME_RECOMMEND_DEFAULT_GRID_ROWS as t,HOME_RECOMMEND_DEFAULT_TITLE as n,HOME_RECOMMEND_MAX_GRID_COLUMNS as r,HOME_RECOMMEND_MAX_GRID_ROWS as i}from"./home-recommend-default-config.mjs";const a=`/static/components-thumb/video_player.png`,o=`__homeRecommendCardConfig`,s=Array.from({length:60},(e,t)=>{let n=t%2==1,r={browse_cnt:12345+t*731};return{id:`preview-recommend-${t+1}`,name:`${`媒资标题`.repeat((t+1)*2)}`,img_y:a,img_x:a,type:n?2:1,duration:n?0:60*(18+t),episode_cnt:n?12+t%3*6:0,static:r}});function c({variant:e,enableInfinite:t,rows:n,columns:r,items:i}){let a=Array.isArray(i)?i.length:0;return e===`grid`?a>0?a:Math.max(f(n,r),2,a):t?Math.max(8,a):e===`waterfall`?Math.max(4,a):Math.max(2,a)}function l(e){let t=Math.max(1,Math.floor(e));return Array.from({length:t},(e,t)=>{let n=s[t%s.length];return{...n,id:`preview-recommend-${t+1}`,name:n.name}})}function u(e,t,n){return t.length?e.map((e,r)=>{let i=t[r];if(!i)return e;let a=(i.contentId?n.get(i.contentId):void 0)||e,s=i.titleMode===`custom`?i.title?.trim()||a.name||e.name||``:a.name||e.name||``,c=i.coverMode===`upload`&&!!i.coverUrl,l=c?i.coverUrl||``:a.img_y||a.img_x||e.img_y||e.img_x||``,u=c?i.coverUrl||``:a.img_x||a.img_y||e.img_x||e.img_y||``,f=a.badge_url||e.badge_url||``,p=i.badge_url??f,m=d(i,a);return{...e,...a,id:a.id||e.id||`preview-recommend-${r+1}`,name:s,img_y:l,img_x:u,badge_url:p||void 0,[o]:m}}):e}function d(e,t){let n=t[o],r={showPlayCount:e.showPlayCount??n?.showPlayCount,playCountDelta:e.playCountDelta??n?.playCountDelta,showEpisode:e.showEpisode??n?.showEpisode};if(!(r.showPlayCount===void 0&&r.playCountDelta===void 0&&r.showEpisode===void 0))return r}function f(n,a){return p(n,t,1,i)*p(a,e,1,r)}function p(e,t,n,r){let i=Number(e);return Number.isFinite(i)?Math.min(r,Math.max(n,Math.floor(i))):t}function m({variant:e,schemaTitle:t,enableInfinite:r,smartTagEnabled:i,rows:a,columns:o,items:s}){let d=new Map,f=i?[]:Array.isArray(s)?s.filter(Boolean):[],p=u(l(c({variant:e,enableInfinite:r,rows:a,columns:o,items:f})),f,d);return{title:t&&t.trim()||n,list:p,icons:[],cursor:``,show_style:void 0}}export{o as HOME_RECOMMEND_CARD_CONFIG_FIELD,m as buildHomeRecommendEditorPreviewData};
2
+ import{HOME_RECOMMEND_DEFAULT_GRID_COLUMNS as e,HOME_RECOMMEND_DEFAULT_GRID_ROWS as t,HOME_RECOMMEND_DEFAULT_TITLE as n,HOME_RECOMMEND_MAX_GRID_COLUMNS as r,HOME_RECOMMEND_MAX_GRID_ROWS as i}from"./home-recommend-default-config.mjs";const a=`/static/components-thumb/video_player.png`,o=`__homeRecommendCardConfig`,s=Array.from({length:60},(e,t)=>{let n=t%2==1,r={browse_cnt:12345+t*731};return{id:`preview-recommend-${t+1}`,name:`${`媒资标题`.repeat((t+1)*2)}`,img_y:a,img_x:a,type:n?2:1,duration:n?0:60*(18+t),episode_cnt:n?12+t%3*6:0,static:r}});function c({variant:e,enableInfinite:t,rows:n,columns:r,items:i}){let a=Array.isArray(i)?i.length:0;return e===`grid`?a>0?a:Math.max(f(n,r),2,a):t?Math.max(8,a):e===`waterfall`?Math.max(4,a):Math.max(2,a)}function l(e){let t=Math.max(1,Math.floor(e));return Array.from({length:t},(e,t)=>{let n=s[t%s.length];return{...n,id:`preview-recommend-${t+1}`,name:n.name}})}function u(e,t,n){return t.length?e.map((e,r)=>{let i=t[r];if(!i)return e;let a=(i.contentId?n.get(i.contentId):void 0)||e,s=i.titleMode===`custom`?i.title?.trim()||a.name||e.name||``:a.name||e.name||``,c=i.coverUrl?.trim()||``,l=i.coverMode===`content`,u=l?a.img_y||a.img_x||e.img_y||e.img_x||c||``:c||a.img_y||a.img_x||e.img_y||e.img_x||``,f=l?a.img_x||a.img_y||e.img_x||e.img_y||c||``:c||a.img_x||a.img_y||e.img_x||e.img_y||``,p=a.badge_url||e.badge_url||``,m=i.badge_url??p,h=d(i,a);return{...e,...a,id:a.id||e.id||`preview-recommend-${r+1}`,name:s,img_y:u,img_x:f,badge_url:m||void 0,[o]:h}}):e}function d(e,t){let n=t[o],r={showPlayCount:e.showPlayCount??n?.showPlayCount,playCountDelta:e.playCountDelta??n?.playCountDelta,showEpisode:e.showEpisode??n?.showEpisode};if(!(r.showPlayCount===void 0&&r.playCountDelta===void 0&&r.showEpisode===void 0))return r}function f(n,a){return p(n,t,1,i)*p(a,e,1,r)}function p(e,t,n,r){let i=Number(e);return Number.isFinite(i)?Math.min(r,Math.max(n,Math.floor(i))):t}function m({variant:e,schemaTitle:t,enableInfinite:r,smartTagEnabled:i,rows:a,columns:o,items:s}){let d=new Map,f=i?[]:Array.isArray(s)?s.filter(Boolean):[],p=u(l(c({variant:e,enableInfinite:r,rows:a,columns:o,items:f})),f,d);return{title:t&&t.trim()||n,list:p,icons:[],cursor:``,show_style:void 0}}export{o as HOME_RECOMMEND_CARD_CONFIG_FIELD,m as buildHomeRecommendEditorPreviewData};
@@ -1,2 +1,2 @@
1
1
 
2
- import{pContentGetPopularVideoList as e}from"../../../../../service/generated/client.mjs";import{resolveHomeRecommendFeedMode as t}from"./home-recommend-default-config.mjs";import{HOME_RECOMMEND_CARD_CONFIG_FIELD as n}from"./home-recommend-preview.mjs";import{batchGetHomeRecommendVideoDetailMap as r}from"./home-recommend-video-detail.mjs";function i(e){return typeof e==`string`?e.trim():``}function a(e){return typeof e==`string`?e.trim():``}function o(e){return a(e)}function s(e){return Array.isArray(e)?e.map(e=>a(e)).filter(Boolean):[]}function c(e){let t=Number(e);if(!(!Number.isFinite(t)||t<0))return t}function l(e,t){let n=e,r=i(n.video_id||e.id||e.mid)||t,a=c(n.play_count),o=c(n.like_count),s=c(n.collect_count),l=Array.isArray(n.episodes)?n.episodes.length:0,u=a!==void 0||o!==void 0||s!==void 0?{browse_cnt:a,like_cnt:o,collect_cnt:s}:void 0;return{id:r,mid:i(e.mid),name:e.name||``,img_x:e.img_x||``,img_y:e.img_y||``,img_type:e.img_type,cat_id:e.cat_id,cat_name:e.cat_name,status:e.status,status_text:e.status_text,show_at:e.show_at,update_status:e.update_status,description:e.description,language:e.language,director:e.director,issue_date:e.issue_date,actor:e.actor,up_user:e.up_user,time:e.time,money:e.money,source_username:e.source_username,task_id:e.task_id,error_msg:e.error_msg,file_status:e.file_status,score:c(e.score)??void 0,duration:c(e.duration)??void 0,episode_cnt:l>0?l:void 0,type:e.is_more_link?2:1,static:u}}function u(e){let t={showPlayCount:e.showPlayCount,playCountDelta:e.playCountDelta,showEpisode:e.showEpisode};if(!(t.showPlayCount===void 0&&t.playCountDelta===void 0&&t.showEpisode===void 0))return t}function d(e,t){let r=a(t.coverUrl),i=t.coverMode===`upload`||r&&t.coverMode!==`content`?r:e.img_y||e.img_x||``,o=a(t.title),s=t.titleMode===`custom`||o&&t.titleMode!==`content`?o:e.name||``,c=a(t.description),l=a(t.badge_url),d=u(t);return{...e,name:s||e.name,img_y:i||e.img_y||e.img_x,img_x:i||e.img_x||e.img_y,description:c||e.description,badge_url:l||e.badge_url,[n]:d}}function f(e){let t=i(e.contentId),n=a(e.coverUrl),r=a(e.title),o=a(e.description);return{id:t,mid:t,name:r||``,img_x:n,img_y:n,description:o,type:1}}function p(e){return(Array.isArray(e)?e:[]).map(e=>({...e,contentId:i(e.contentId)})).map(e=>d(f(e),e))}async function m(e){let t=(Array.isArray(e)?e:[]).map(e=>({...e,contentId:i(e.contentId)})).filter(e=>!!e.contentId);if(!t.length)return[];let n=await r(t.map(e=>({id:e.contentId})));return t.map(e=>{let t=n.get(e.contentId||``);return d(t?l(t,e.contentId||``):f(e),e)})}async function h(t,n,r){let a=Math.max(1,Math.floor(Number(t)||16)),c=s(n),l=o(r);try{let t=[],n=new Set,r=new Set,o=``;for(;t.length<a;){let s=o||`__first__`;if(r.has(s))break;r.add(s);let u=await e({cursor:o||void 0,page_size:a-t.length,tags:c.length>0?c:void 0,cat_id:l||void 0}),d=Array.isArray(u.data?.videos)?u.data.videos:[];d.forEach(e=>{let r=i(e?.id||e?.mid);r&&n.has(r)||(r&&n.add(r),t.push(e))});let f=u.data?.cursor||``;if(!f||!d.length){o=``;break}o=f}return{videos:t.slice(0,a),nextCursor:o,loaded:!0}}catch(e){return console.error(`推荐位获取热门视频失败(server)`,e),{videos:[],nextCursor:``,loaded:!1}}}async function g({smartTagEnabled:e,smartTagIds:n,catId:r,pageSize:i=16,items:a=[]}){let c=t(e),l=e===!0?s(n):[],u=o(r),d={list:[],icons:[],title:``,cursor:``,show_style:void 0};if(e!==!0)return{feedMode:c,data:{...d,list:p(a),cursor:``}};if(c===`manual-with-video-detail`){let e=await h(i,l,u);if(e.loaded)return{feedMode:c,data:{...d,list:e.videos,cursor:e.nextCursor}};try{let e=await m(a);return{feedMode:c,data:{...d,list:e,cursor:``}}}catch(e){return console.error(`推荐位智能铺设补齐视频详情失败(server)`,e),{feedMode:c,data:{...d,list:[],cursor:``}}}}return{feedMode:c,data:d}}export{g as resolveHomeRecommendServerData};
2
+ import{pContentGetPopularVideoList as e}from"../../../../../service/generated/client.mjs";import{resolveHomeRecommendFeedMode as t}from"./home-recommend-default-config.mjs";import{HOME_RECOMMEND_CARD_CONFIG_FIELD as n}from"./home-recommend-preview.mjs";import{batchGetHomeRecommendVideoDetailMap as r}from"./home-recommend-video-detail.mjs";function i(e){return typeof e==`string`?e.trim():``}function a(e){return typeof e==`string`?e.trim():``}function o(e){return a(e)}function s(e){return Array.isArray(e)?e.map(e=>a(e)).filter(Boolean):[]}function c(e){let t=Number(e);if(!(!Number.isFinite(t)||t<0))return t}function l(e,t){let n=e,r=i(n.video_id||e.id||e.mid)||t,a=c(n.play_count)??c(e.browse_count),o=c(n.like_count),s=c(n.collect_count),l=(Array.isArray(n.episodes)?n.episodes.length:0)||(Array.isArray(e.video_episodes)?e.video_episodes.length:0)||(Array.isArray(e.links)?e.links.length:0),u=a!==void 0||o!==void 0||s!==void 0?{browse_cnt:a,like_cnt:o,collect_cnt:s}:void 0;return{id:r,mid:i(e.mid),name:e.name||``,img_x:e.img_x||``,img_y:e.img_y||``,img_type:e.img_type,cat_id:e.cat_id,cat_name:e.cat_name,status:e.status,status_text:e.status_text,show_at:e.show_at,update_status:e.update_status,description:e.description,language:e.language,director:e.director,issue_date:e.issue_date,actor:e.actor,up_user:e.up_user,time:e.time,money:e.money,source_username:e.source_username,task_id:e.task_id,error_msg:e.error_msg,file_status:e.file_status,score:c(e.score)??void 0,duration:c(e.duration)??void 0,episode_cnt:l>0?l:void 0,type:e.is_more_link?2:1,static:u}}function u(e){let t={showPlayCount:e.showPlayCount,playCountDelta:e.playCountDelta,showEpisode:e.showEpisode};if(!(t.showPlayCount===void 0&&t.playCountDelta===void 0&&t.showEpisode===void 0))return t}function d(e,t){let r=a(t.coverUrl),i=t.coverMode===`content`?e.img_y||e.img_x||r||``:r||e.img_y||e.img_x||``,o=a(t.title),s=t.titleMode===`custom`||o&&t.titleMode!==`content`?o:e.name||``,c=a(t.description),l=a(t.badge_url),d=u(t);return{...e,name:s||e.name,img_y:i||e.img_y||e.img_x,img_x:i||e.img_x||e.img_y,description:c||e.description,badge_url:l||e.badge_url,[n]:d}}function f(e){let t=i(e.contentId),n=a(e.coverUrl),r=a(e.title),o=a(e.description);return{id:t,mid:t,name:r||``,img_x:n,img_y:n,description:o,type:1}}async function p(e){let t=(Array.isArray(e)?e:[]).map(e=>({...e,contentId:i(e.contentId)})),n=t.filter(e=>!!e.contentId&&e.coverMode===`content`).map(e=>({id:e.contentId})),a=n.length?await r(n):new Map;return t.map(e=>{let t=e.contentId?a.get(e.contentId):void 0;return d(t?l(t,e.contentId||``):f(e),e)})}async function m(e){let t=(Array.isArray(e)?e:[]).map(e=>({...e,contentId:i(e.contentId)})).filter(e=>!!e.contentId);if(!t.length)return[];let n=await r(t.map(e=>({id:e.contentId})));return t.map(e=>{let t=n.get(e.contentId||``);return d(t?l(t,e.contentId||``):f(e),e)})}async function h(t,n,r){let a=Math.max(1,Math.floor(Number(t)||16)),c=s(n),l=o(r);try{let t=[],n=new Set,r=new Set,o=``;for(;t.length<a;){let s=o||`__first__`;if(r.has(s))break;r.add(s);let u=await e({cursor:o||void 0,page_size:a-t.length,tags:c.length>0?c:void 0,cat_id:l||void 0}),d=Array.isArray(u.data?.videos)?u.data.videos:[];d.forEach(e=>{let r=i(e?.id||e?.mid);r&&n.has(r)||(r&&n.add(r),t.push(e))});let f=u.data?.cursor||``;if(!f||!d.length){o=``;break}o=f}return{videos:t.slice(0,a),nextCursor:o,loaded:!0}}catch(e){return console.error(`推荐位获取热门视频失败(server)`,e),{videos:[],nextCursor:``,loaded:!1}}}async function g({smartTagEnabled:e,smartTagIds:n,catId:r,pageSize:i=16,items:a=[]}){let c=t(e),l=e===!0?s(n):[],u=o(r),d=Array.isArray(a)&&a.length>0,f={list:[],icons:[],title:``,cursor:``,show_style:void 0};if(e!==!0){if(d)return{feedMode:c,data:{...f,list:await p(a),cursor:``}};let e=await h(i);return{feedMode:c,data:{...f,list:e.videos,cursor:e.nextCursor}}}if(c===`manual-with-video-detail`){let e=await h(i,l,u);if(e.loaded)return{feedMode:c,data:{...f,list:e.videos,cursor:e.nextCursor}};try{let e=await m(a);return{feedMode:c,data:{...f,list:e,cursor:``}}}catch(e){return console.error(`推荐位智能铺设补齐视频详情失败(server)`,e),{feedMode:c,data:{...f,list:[],cursor:``}}}}return{feedMode:c,data:f}}export{g as resolveHomeRecommendServerData};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Image as e}from"../../../ui/image.mjs";import{Box as t}from"../../../ui/box.mjs";import{Text as n}from"../../../ui/text.mjs";import r from"../../../../assets/icons/right_arrow.mjs";import i from"../../../../assets/images/marquee.mjs";import a from"./marquee.module.mjs";import{defaultMarqueePeriod as o}from"./schema.mjs";import{useEffect as s,useMemo as c,useRef as l,useState as u}from"react";import{X as d}from"lucide-react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{useTranslations as m}from"next-intl";import{useRouter as h}from"next/navigation";const g=[];function _(e,t=20){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function v(e){let t=5381;for(let n=0;n<e.length;n+=1)t=(t<<5)+t^(e.codePointAt(n)??0);return(t>>>0).toString(36)}function y(e,t){return e?t===`once`?!0:new Date(e).toLocaleDateString()===new Date().toLocaleDateString():!1}function b(e){let t=localStorage.getItem(e);if(!t)return{};try{return JSON.parse(t)}catch{let e=Number(t);return Number.isNaN(e)?{}:{closedAt:e}}}function x(e,t){localStorage.setItem(e,JSON.stringify(t))}function S(e,t){return t===`once`?y(e.closedAt,t)||y(e.displayedAt,t):!!e.closedAt}function C(C){let w=m(`components.biz.business.marquee`),{contents:T=g,click:E,close:D,displayStrategy:O,mode:k=`renderer`}=C,A=k===`editor`,j=h(),[M,N]=u(!0),[P,F]=u(!1),[I,L]=u(0),R=l(null);s(()=>{F(!0)},[]);let z=c(()=>{let e=O?.period??o,t=e.start,n=e.end;if(!t&&!n)return!0;let r=Date.now(),i=t?new Date(t).getTime():0,a=n?new Date(n).getTime():2**53-1;return r>=i&&r<=a},[O?.period]),B=c(()=>(T??[]).map(e=>({...e,text:_(String(e?.text??``))})).filter(e=>!!e.text),[T]),V=c(()=>{let e=O?.period??o;return`marquee_state_${v(JSON.stringify({rule:O?.rule??``,start:e.start??``,end:e.end??``,clickEnabled:E?.enabled??!1,clickLink:E?.link??``,items:B.map(e=>({text:e.text??``,link:e.link??``}))}))}`},[E?.enabled,E?.link,O?.period,O?.rule,B]);if(s(()=>{N(!0)},[V]),s(()=>()=>{R.current!=null&&(window.clearTimeout(R.current),R.current=null)},[]),s(()=>{L(0)},[B.length]),s(()=>{if(!(!P||A||!O?.rule||B.length===0)){if(S(b(V),O.rule)){N(!1);return}N(!0)}},[O?.rule,A,P,B.length,V]),s(()=>{if(R.current!=null&&(window.clearTimeout(R.current),R.current=null),!(!P||A||!O?.rule||!M||!z||B.length===0))return()=>{R.current!=null&&(window.clearTimeout(R.current),R.current=null)}},[O?.rule,A,P,z,M,B.length,V]),!A&&(!P||!M||!z)||B.length===0)return null;let H=B[I%B.length],U=E?.enabled===!0,W=E?.link||H.link,G=U&&!!W,K=D?.enabled===!0;function q(){!O?.rule||B.length===0||x(V,{...b(V),closedAt:Date.now()})}let J=e=>{e.stopPropagation(),N(!1),q()},Y=()=>{A||G&&W&&(N(!1),q(),j.push(W))},X=()=>{if(!(A||!M)){if(O?.rule===`once`){let e=b(V);if(y(e.displayedAt,`once`)||e.closedAt)return;x(V,{...e,displayedAt:Date.now()}),N(!1);return}B.length<=1||L(e=>(e+1)%B.length)}},Z=A?a[`marquee-item-paused`]:O?.rule===`once`||B.length>1?a[`marquee-item-once`]:a[`marquee-item-loop`];return f(t,{className:A?`px-3 py-2 w-full bg-bg1 pointer-events-none`:`px-3 py-2 w-full bg-bg1`,children:p(t,{className:`pl-[2px] pr-[12px] py-[2px] flex items-center w-full cursor-pointer relative rounded-[8px] overflow-hidden ${a[`marquee-shell`]}`,onClick:Y,children:[f(t,{className:`relative shrink-0 w-[36px] h-[36px] mr-[4px]`,children:f(e,{src:typeof i==`string`?i:i.src,alt:w(`noticeAlt`),fill:!0,className:`object-cover`,unoptimized:!0})}),f(t,{className:`flex-1 overflow-hidden relative h-[22px] ml-1`,children:f(t,{className:`absolute inset-y-0 left-0 flex items-center whitespace-nowrap ${Z}`,onAnimationEnd:X,children:f(n,{className:`inline-block text-[14px] text-[#f59e0b] leading-[22px] font-medium`,children:H.text})},`marquee-item-${I}`)}),p(t,{className:`flex items-center gap-[12px] shrink-0 ml-[4px]`,children:[G&&f(r,{className:`w-[16px] h-[16px] text-[#f59e0b]`}),K&&f(t,{className:`opacity-30 hover:opacity-100 transition-opacity`,onClick:J,children:f(d,{className:`w-[12px] h-[12px] text-[#F59E0B]`})})]})]})})}export{C as MarqueeClient};
2
+ "use client";import{Image as e}from"../../../ui/image.mjs";import{Box as t}from"../../../ui/box.mjs";import{Text as n}from"../../../ui/text.mjs";import r from"../../../../assets/icons/right_arrow.mjs";import i from"../../../../assets/images/marquee.mjs";import a from"./marquee.module.mjs";import{defaultMarqueePeriod as o}from"./schema.mjs";import{useEffect as s,useMemo as c,useRef as l,useState as u}from"react";import{X as d}from"lucide-react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{useTranslations as m}from"next-intl";import{useRouter as h}from"next/navigation";const g=[],_=`marquee_list`;let v=null;function y(e,t=20){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function b(e,t){if(!e)return!1;if(t===`once`)return!0;let n=new Date(e),r=new Date;return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}function x(){if(v)return v;let e=localStorage.getItem(_);if(!e)return v={},{};try{let t=JSON.parse(e);if(!t||typeof t!=`object`)return{};let n={};return Object.entries(t).forEach(([e,t])=>{if(!t||typeof t!=`object`)return;let r=t.closedAt;typeof r!=`number`||Number.isNaN(r)||(n[e]={closedAt:r})}),v=n,n}catch{return v={},{}}}function S(e){v=e,localStorage.setItem(_,JSON.stringify(e))}function C(e){return x()[e]??{}}function w(e,t){S({...x(),[e]:t})}function T(e,t){return b(e.closedAt,t)}function E(_){let v=m(`components.biz.business.marquee`),{marqueeKey:b,contents:x=g,click:S,close:E,displayStrategy:D,mode:O=`renderer`}=_,k=O===`editor`,A=h(),j=l(!1),[M,N]=u(k),[P,F]=u(k),[I,L]=u(!1),[R,z]=u(0);s(()=>{L(!0)},[]);let B=c(()=>{let e=D?.period??o,t=e.start,n=e.end;if(!t&&!n)return!0;let r=Date.now(),i=t?new Date(t).getTime():0,a=n?new Date(n).getTime():2**53-1;return r>=i&&r<=a},[D?.period]),V=c(()=>(x??[]).map(e=>({...e,text:y(String(e?.text??``))})).filter(e=>!!e.text),[x]),H=b?.trim()??``;if(s(()=>{z(0)},[c(()=>V.map(e=>`${e.text??``}::${e.link??``}`).join(`|`),[V]),H]),s(()=>{k||H||j.current||process.env.NODE_ENV===`production`||(j.current=!0,console.warn(`[MarqueeClient] marqueeKey is required in renderer mode.`))},[k,H]),s(()=>{if(I){if(k){N(!0),F(!0);return}if(!D?.rule||!B||V.length===0){N(!1),F(!0);return}if(!H){N(!1),F(!0);return}N(!T(C(H),D.rule)),F(!0)}},[D?.rule,k,I,B,V.length,H]),!k&&(!I||!P||!M||!B)||V.length===0)return null;let U=V[R%V.length],W=S?.enabled===!0,G=S?.link||U.link,K=W&&!!G,q=E?.enabled===!0;function J(){!H||!D?.rule||V.length===0||w(H,{...C(H),closedAt:Date.now()})}let Y=e=>{e.stopPropagation(),N(!1),J()},X=()=>{k||K&&G&&A.push(G)},Z=()=>{k||!M||V.length<=1||z(e=>(e+1)%V.length)},Q=k?a[`marquee-item-paused`]:V.length>1?a[`marquee-item-once`]:a[`marquee-item-loop`];return f(t,{className:k?`px-3 py-2 w-full bg-bg1 pointer-events-none`:`px-3 py-2 w-full bg-bg1`,children:p(t,{className:`pl-[2px] pr-[12px] py-[2px] flex items-center w-full cursor-pointer relative rounded-[8px] overflow-hidden ${a[`marquee-shell`]}`,onClick:X,children:[f(t,{className:`relative shrink-0 w-[36px] h-[36px] mr-[4px]`,children:f(e,{src:typeof i==`string`?i:i.src,alt:v(`noticeAlt`),fill:!0,className:`object-cover`,unoptimized:!0})}),f(t,{className:`flex-1 overflow-hidden relative h-[22px] ml-1`,children:f(t,{className:`absolute inset-y-0 left-0 flex items-center whitespace-nowrap ${Q}`,onAnimationEnd:Z,children:f(n,{className:`inline-block text-[14px] text-[#f59e0b] leading-[22px] font-medium`,children:U.text})},`marquee-item-${R}`)}),p(t,{className:`flex items-center gap-[12px] shrink-0 ml-[4px]`,children:[K&&f(r,{className:`w-[16px] h-[16px] text-[#f59e0b]`}),q&&f(t,{className:`opacity-30 hover:opacity-100 transition-opacity`,onClick:Y,children:f(d,{className:`w-[12px] h-[12px] text-[#F59E0B]`})})]})]})})}export{E as MarqueeClient};
@@ -12,6 +12,7 @@ import * as zod_v4_core0 from "zod/v4/core";
12
12
  * 跑马灯物料定义
13
13
  */
14
14
  declare const marqueeMaterial: DefineMaterialOption<typeof MarqueeServer, typeof MarqueeClient, zod.ZodObject<{
15
+ marqueeKey: zod.ZodString & SchemaHasDefaultValue;
15
16
  contents: zod.ZodArray<zod.ZodObject<{
16
17
  text: zod.ZodString & SchemaHasDefaultValue;
17
18
  link: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
@@ -16,6 +16,7 @@ declare const defaultMarqueePeriod: {
16
16
  * 跑马灯物料属性定义
17
17
  */
18
18
  declare const marqueeInspectorPropsSchema: z.ZodObject<{
19
+ marqueeKey: z.ZodString & SchemaHasDefaultValue;
19
20
  contents: z.ZodArray<z.ZodObject<{
20
21
  text: z.ZodString & SchemaHasDefaultValue;
21
22
  link: z.ZodOptional<z.ZodString> & SchemaHasDefaultValue;
@@ -1,2 +1,2 @@
1
1
 
2
- import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineObjectPropSchema as n,defineSelectEnumPropSchema as r,defineSwitchPropSchema as i,defineTextPropSchema as a,defineTimeRangePropSchema as o}from"../../../../utils/schema/schema.mjs";import{z as s}from"zod";import c from"dayjs";function l(){return{start:c().startOf(`day`).format(`YYYY-MM-DD HH:mm:ss`),end:c().endOf(`day`).format(`YYYY-MM-DD HH:mm:ss`)}}const u=l(),d=t({contents:e(s.object({text:a({label:`文本内容`,defaultValue:``}),link:a({label:`跳转链接`,defaultValue:``,required:!1})}),{label:`消息内容`,defaultValue:[{text:`请输入跑马灯内容`}],description:`支持多条消息循环播放`}),click:n({enabled:i({label:`支持点击`,defaultValue:!0}),redirectType:r([`content_list`,`content`,`link`],{label:`跳转指向`,defaultValue:`link`,required:!1}),link:a({label:`跳转链接`,defaultValue:``,required:!1})},{label:`点击配置`,defaultValue:{enabled:!0,redirectType:`link`,link:``}}),close:n({enabled:i({label:`支持关闭`,defaultValue:!0})},{label:`关闭配置`,defaultValue:{enabled:!0}}),displayStrategy:n({rule:r([`once`,`daily`],{label:`展示规则`,defaultValue:`once`,description:`「只展示1次」即当前消息只展示1次;「每天展示1次」即当前消息每天展示1次,0点刷新`}),period:o({label:`展示周期`,defaultValue:u,required:!1})},{label:`展示策略`,defaultValue:{rule:`once`,period:u}})});export{u as defaultMarqueePeriod,l as getDefaultMarqueePeriod,d as marqueeInspectorPropsSchema};
2
+ import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineObjectPropSchema as n,defineSelectEnumPropSchema as r,defineSwitchPropSchema as i,defineTextPropSchema as a,defineTimeRangePropSchema as o}from"../../../../utils/schema/schema.mjs";import{z as s}from"zod";import c from"dayjs";function l(){return{start:c().startOf(`day`).format(`YYYY-MM-DD HH:mm:ss`),end:c().endOf(`day`).format(`YYYY-MM-DD HH:mm:ss`)}}const u=l(),d=s.object({text:a({label:`文本内容`,defaultValue:``}),link:a({label:`跳转链接`,defaultValue:``,required:!1})}),f=t({marqueeKey:a({label:`状态唯一标识`,defaultValue:``,required:!0,description:`外部传入唯一 marqueeKey,用于本地展示状态持久化`}),contents:e(d,{label:`消息内容`,defaultValue:[{text:`请输入跑马灯内容`}],description:`支持多条消息循环播放`}),click:n({enabled:i({label:`支持点击`,defaultValue:!0}),redirectType:r([`content_list`,`content`,`link`],{label:`跳转指向`,defaultValue:`link`,required:!1}),link:a({label:`跳转链接`,defaultValue:``,required:!1})},{label:`点击配置`,defaultValue:{enabled:!0,redirectType:`link`,link:``}}),close:n({enabled:i({label:`支持关闭`,defaultValue:!0})},{label:`关闭配置`,defaultValue:{enabled:!0}}),displayStrategy:n({rule:r([`once`,`daily`],{label:`展示规则`,defaultValue:`once`,description:`「只展示1次」即当前消息只展示1次;「每天展示1次」即当前消息每天展示1次,0点刷新`}),period:o({label:`展示周期`,defaultValue:u,required:!1})},{label:`展示策略`,defaultValue:{rule:`once`,period:u}})});export{u as defaultMarqueePeriod,l as getDefaultMarqueePeriod,f as marqueeInspectorPropsSchema};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Box as e}from"../../../ui/box.mjs";import{Text as t}from"../../../ui/text.mjs";import n from"../../../../assets/icons/refresh.mjs";import{useMemo as r,useState as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{usePathname as s,useRouter as c,useSearchParams as l}from"next/navigation";const u=[];function d(e,t){if(e.length<=t)return[...e];let n=[...e];for(let e=0;e<t;e++){let t=e+Math.floor(Math.random()*(n.length-e));[n[e],n[t]]=[n[t],n[e]]}return n.slice(0,t)}function f(f){let{title:p,items:m=u,onItemClick:h,mode:g=`renderer`}=f,_=g===`editor`,v=c(),y=s(),b=l(),[x,S]=i(0),C=r(()=>d(m,6),[m,x]);if(m.length===0)return null;let w=e=>{e.stopPropagation(),S(e=>e+1)},T=e=>{if(h){h(e);return}let t=new URLSearchParams(b.toString());t.set(`q`,e);let n=y.includes(`/search-result`)?y:`/search-result`;v.push(`${n}?${t.toString()}`)};return o(e,{className:`bg-bg1 p-3 flex flex-col gap-3 w-full${_?` pointer-events-none`:``}`,children:[o(e,{className:`flex items-center justify-between w-full`,children:[a(t,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:p}),o(e,{className:`flex items-center gap-1 cursor-pointer active:opacity-70 transition-opacity`,onClick:w,children:[a(t,{className:`text-[14px] text-text3 leading-[22px]`,children:`换一批`}),a(n,{className:`w-3 h-3 text-text3`})]})]}),a(e,{className:`grid grid-cols-2 gap-x-1 gap-y-1 w-full`,children:C.map((n,r)=>a(e,{className:`flex items-center h-[32px] cursor-pointer active:opacity-70 transition-opacity overflow-hidden`,onClick:()=>T(n.label),children:a(t,{className:`text-[14px] text-text1 leading-[22px] truncate w-full`,children:n.label})},`${x}-${r}`))})]})}export{f as TextRecommendClient};
2
+ "use client";import{Box as e}from"../../../ui/box.mjs";import{Text as t}from"../../../ui/text.mjs";import{useMemo as n,useState as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{usePathname as o,useRouter as s,useSearchParams as c}from"next/navigation";const l=[];function u(e,t){if(e.length<=t)return[...e];let n=[...e];for(let e=0;e<t;e++){let t=e+Math.floor(Math.random()*(n.length-e));[n[e],n[t]]=[n[t],n[e]]}return n.slice(0,t)}function d(d){let{title:f,items:p=l,onItemClick:m,mode:h=`renderer`}=d,g=h===`editor`,_=s(),v=o(),y=c(),[b,x]=r(0),S=n(()=>u(p,6),[p,b]);if(p.length===0)return null;let C=e=>{if(m){m(e);return}let t=new URLSearchParams(y.toString());t.set(`q`,e);let n=v.includes(`/search-result`)?v:`/search-result`;_.push(`${n}?${t.toString()}`)};return a(e,{className:`bg-bg1 p-3 flex flex-col gap-3 w-full${g?` pointer-events-none`:``}`,children:[i(e,{className:`flex items-center justify-between w-full`,children:i(t,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:f})}),i(e,{className:`grid grid-cols-2 gap-x-1 gap-y-1 w-full`,children:S.map((n,r)=>i(e,{className:`flex items-center h-[32px] cursor-pointer active:opacity-70 transition-opacity overflow-hidden`,onClick:()=>C(n.label),children:i(t,{className:`text-[14px] text-text1 leading-[22px] truncate w-full`,children:n.label})},`${b}-${r}`))})]})}export{d as TextRecommendClient};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{updateUrlParams as e}from"../../../utils/common.mjs";import t from"../../../utils/event-bus.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{gContentGetRecommendSearchList as r}from"../../../service/generated/client.mjs";import{Text as i}from"../../ui/text.mjs";import{useRequest as a}from"../../../hooks/query/use-query.mjs";import{eventKey as o}from"../../../constants/event-key.mjs";import{useSearchHistory as s}from"../../../hooks/use-search-history.mjs";import{SearchHistoryClient as c}from"../../biz/business/search-history/client.mjs";import l from"./hot-recommend.mjs";import u from"./hot-search.mjs";import d from"./search-result/index.mjs";import f from"./top-header.mjs";import{memo as p,useEffect as m,useMemo as h,useState as g}from"react";import{Fragment as _,jsx as v,jsxs as y}from"react/jsx-runtime";import{useTranslations as b}from"next-intl";import{usePathname as x,useRouter as S,useSearchParams as C}from"next/navigation";const w=[{labelKey:`tabs.all`,value:`all`},{labelKey:`tabs.video`,value:`video`},{labelKey:`tabs.post`,value:`info`},{labelKey:`tabs.user`,value:`user`}],T=p(({searchType:e,onChange:t,tabList:n})=>v(`nav`,{className:`w-full h-[42px] bg-bg1 flex items-center px-[3px] sticky top-[53px] left-0 z-50`,children:n.map(n=>v(i,{className:`h-[30px] rounded-[15px] leading-[30px] px-[9px] text-[16px] bg-transparent transition-all duration-150 ${e===n.value?`text-theme5 !text-[20px] font-bold`:`text-text2`}`,onClick:()=>{e!==n.value&&t(n.value)},children:n.label},n.value))}));function E(){let i=b(`components.pages.search.pageClient`),{userInfo:p}=n(),E=p?.user_id||`guest`,D=C(),O=x(),k=S(),A=D.get(`q`)?.toString()||``,j=A?decodeURIComponent(A):``,{data:M,refetch:N}=a([`hotSearchKey`],()=>r({user_id:E})),P=h(()=>M?.data?.recommend_list??[],[M]),[F,I]=g(j),L=h(()=>w.map(e=>({value:e.value,label:i(e.labelKey)})),[i]),[R,z]=g(j),[B,V]=g(0),[H,U]=g(w[0].value),[,W]=g([]),{history:G,addHistory:K}=s({storageKey:E}),q=h(()=>F.trim()===``?P.length>0||G.length>0||F.trim()===``:!1,[P,F,G]),J=h(()=>F.trim()!==``&&!q,[F,q]);return m(()=>(t.on(o.EXCHANGE_SEARCH_TYPE,U),()=>{t.off(o.EXCHANGE_SEARCH_TYPE,U)}),[U]),y(`div`,{className:`w-full min-h-screen bg-bg1 pb-[12px]`,children:[v(f,{setSearchInputVal:t=>{t!==F&&(W([]),I(t),e({q:t}))},initInputVal:R,initInputVersion:B,addSearchHistory:K}),q&&y(`div`,{className:`w-full pt-[8px]`,children:[G.length>0&&v(c,{title:i(`searchHistory`),rows:2,storageKey:E,onHistoryClick:e=>{z(e),V(e=>e+1);let t=new URLSearchParams(D.toString());t.set(`q`,e),k.push(`${O}?${t.toString()}`)}}),v(u,{initHotSearchKeywordList:P,onRefreshHotKey:async()=>(await N()).data??{code:0,message:``,data:{recommend_list:[]}},onClick:e=>{z(e.title||``),V(e=>e+1)}})]}),v(l,{isShow:F.trim()===``}),J&&y(_,{children:[v(T,{searchType:H,tabList:L,onChange:e=>{U(e),W([])}}),v(d,{inputVal:F,searchType:H},`${H}-${F}`)]})]})}export{E as default};
2
+ "use client";import{updateUrlParams as e}from"../../../utils/common.mjs";import t from"../../../utils/event-bus.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{gContentGetRecommendSearchList as r}from"../../../service/generated/client.mjs";import{Text as i}from"../../ui/text.mjs";import{useRequest as a}from"../../../hooks/query/use-query.mjs";import{eventKey as o}from"../../../constants/event-key.mjs";import{useSearchHistory as s}from"../../../hooks/use-search-history.mjs";import{SearchHistoryClient as c}from"../../biz/business/search-history/client.mjs";import l from"./hot-recommend.mjs";import u from"./hot-search.mjs";import d from"./search-result/index.mjs";import f from"./top-header.mjs";import{memo as p,useEffect as m,useMemo as h,useState as g}from"react";import{Fragment as _,jsx as v,jsxs as y}from"react/jsx-runtime";import{useTranslations as b}from"next-intl";import{usePathname as x,useRouter as S,useSearchParams as C}from"next/navigation";const w=[{labelKey:`tabs.all`,value:`all`},{labelKey:`tabs.video`,value:`video`},{labelKey:`tabs.post`,value:`info`},{labelKey:`tabs.user`,value:`user`}],T=p(({searchType:e,onChange:t,tabList:n})=>v(`nav`,{className:`w-full h-[42px] bg-bg1 flex items-center px-[3px] sticky top-[53px] left-0 z-50`,children:n.map(n=>v(i,{className:`h-[30px] rounded-[15px] leading-[30px] px-[9px] text-[16px] bg-transparent transition-all duration-150 ${e===n.value?`text-theme5 !text-[20px] font-bold`:`text-text2`}`,onClick:()=>{e!==n.value&&t(n.value)},children:n.label},n.value))}));function E(){let i=b(`components.pages.search.pageClient`),{userInfo:p}=n(),E=p?.user_id||`guest`,D=C(),O=x(),k=S(),A=D.get(`q`)?.toString()||``,j=A?decodeURIComponent(A):``,{data:M,refetch:N}=a([`hotSearchKey`],()=>r({user_id:E})),P=h(()=>M?.data?.recommend_list??[],[M]),[F,I]=g(j),L=h(()=>w.map(e=>({value:e.value,label:i(e.labelKey)})),[i]),[R,z]=g(j),[B,V]=g(0),[H,U]=g(w[0].value),[,W]=g([]),{history:G,addHistory:K}=s({storageKey:E}),q=h(()=>F.trim()===``?P.length>0||G.length>0||F.trim()===``:!1,[P,F,G]),J=h(()=>F.trim()!==``&&!q,[F,q]);return m(()=>(t.on(o.EXCHANGE_SEARCH_TYPE,U),()=>{t.off(o.EXCHANGE_SEARCH_TYPE,U)}),[U]),y(`div`,{className:`w-full min-h-screen bg-bg1 pb-[12px]`,children:[v(f,{setSearchInputVal:t=>{t!==F&&(W([]),I(t),e({q:t}))},initInputVal:R,initInputVersion:B,addSearchHistory:K}),q&&y(`div`,{className:`w-full pt-[8px]`,children:[G.length>0&&v(c,{title:i(`searchHistory`),rows:2,storageKey:E,onHistoryClick:e=>{z(e),V(e=>e+1);let t=new URLSearchParams(D.toString());t.set(`q`,e),k.push(`${O}?${t.toString()}`)}}),v(u,{initHotSearchKeywordList:P,onRefreshHotKey:async()=>(await N()).data??{code:0,message:``,data:{recommend_list:[]}},onClick:e=>{z(e.title||``),V(e=>e+1),K(e.title)}})]}),v(l,{isShow:F.trim()===``}),J&&y(_,{children:[v(T,{searchType:H,tabList:L,onChange:e=>{U(e),W([])}}),v(d,{inputVal:F,searchType:H},`${H}-${F}`)]})]})}export{E as default};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{gContentGetRecommendVideoList as e}from"../../../service/generated/client.mjs";import{gContentGetRecommendVideoListKey as t}from"../../../service/generated/tanstack.mjs";import{Box as n}from"../../ui/box.mjs";import{List as r}from"../../ui/list.mjs";import{useRequest as i}from"../../../hooks/query/use-query.mjs";import a from"./search-user.mjs";import o from"./search-video.mjs";import{useMemo as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{useTranslations as u}from"next-intl";function d(e,t=1){return JSON.stringify({type:1,keywords:e,sort:t})}function f({searchInputVal:f,sort:p,refreshVersion:m}){let h=u(`components.pages.search.searchResult`),g=s(()=>d(f,p),[f,p]),{data:_,isFetching:v}=i(s(()=>[...t({data_type:2,extra_params:g,page:1,page_size:10}),m],[m,g]),async()=>(await e({data_type:2,extra_params:g,page:1,page_size:10})).data??{}),y=s(()=>_?.videos?.list??[],[_]),b=s(()=>!!_?.videos?.has_more,[_]),x=s(()=>_?.users?.list??[],[_]);return y.length===0&&x.length===0&&!v?c(n,{className:`w-full pt-[12px]`,children:c(r,{loading:v,empty:`nodata`,emptyText:h(`searchAll.emptyResult`)})}):l(n,{className:`w-full pt-[12px]`,children:[x.length>0&&c(a,{mode:`all`,list:x}),c(o,{mode:`all`,list:y,hasMore:b})]})}export{f as default};
2
+ "use client";import{gContentGetRecommendVideoList as e}from"../../../service/generated/client.mjs";import{gContentGetRecommendVideoListKey as t}from"../../../service/generated/tanstack.mjs";import{Box as n}from"../../ui/box.mjs";import{List as r}from"../../ui/list.mjs";import{useRequest as i}from"../../../hooks/query/use-query.mjs";import{SearchResultSkeleton as a}from"./search-result-skeleton.mjs";import o from"./search-user.mjs";import s from"./search-video.mjs";import{useMemo as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{useTranslations as d}from"next-intl";function f(e,t=1){return JSON.stringify({type:1,keywords:e,sort:t})}function p({searchInputVal:p,sort:m,refreshVersion:h}){let g=d(`components.pages.search.searchResult`),_=c(()=>f(p,m),[p,m]),{data:v,isFetching:y,isLoading:b}=i(c(()=>[...t({data_type:2,extra_params:_,page:1,page_size:10}),h],[h,_]),async()=>(await e({data_type:2,extra_params:_,page:1,page_size:10})).data??{}),x=c(()=>v?.videos?.list??[],[v]),S=c(()=>!!v?.videos?.has_more,[v]),C=c(()=>v?.users?.list??[],[v]),w=x.length===0&&C.length===0&&!y;return x.length===0&&C.length===0&&(b||y)?l(a,{}):w?l(n,{className:`w-full pt-[12px]`,children:l(r,{loading:y,empty:`nodata`,emptyText:g(`searchAll.emptyResult`)})}):u(n,{className:`w-full pt-[12px]`,children:[C.length>0&&l(o,{mode:`all`,list:C}),l(s,{mode:`all`,list:x,hasMore:S})]})}export{p as default};
@@ -0,0 +1,2 @@
1
+
2
+ "use client";import{Box as e}from"../../ui/box.mjs";import{VideoListItemSkeleton as t}from"../../common/skeleton/video-list-item-skeleton.mjs";import{jsx as n}from"react/jsx-runtime";function r({count:r=6}){return n(e,{className:`w-full pt-[12px] bg-bg1`,children:Array.from({length:r}).map((e,r)=>n(t,{isEditMode:!1,showVideoProgress:!1},`search-result-skeleton-${r}`))})}export{r as SearchResultSkeleton};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Image as e}from"../../ui/image.mjs";import{Box as t}from"../../ui/box.mjs";import{Text as n}from"../../ui/text.mjs";import{memo as r,useMemo as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";const s=r(({item:r})=>{let s=r.img_x??r.img_y??``,c=r.name??r.id??``;function l(e){if(!Number.isFinite(e)||e<=0)return``;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=e=>String(e).padStart(2,`0`);return n>0?`${a(n)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}let u=i(()=>{let e=r.static?.browse_cnt??0;if(!Number.isFinite(e)||e<=0)return``;if(e>=1e6){let t=(e/1e6).toFixed(1);return t.endsWith(`.0`)?`${t.slice(0,-2)}M`:`${t}M`}if(e>=1e3){let t=(e/1e3).toFixed(1);return t.endsWith(`.0`)?`${t.slice(0,-2)}k`:`${t}k`}return Math.floor(e).toString()},[r]),d=i(()=>{let{type:e,duration:t,links:n}=r;if(e===1)return l(t??0);if(e===2)return`全${n?.length??0}集`},[r]);return o(t,{className:`overflow-hidden rounded-[8px] shadow-sm relative`,children:[s?a(t,{className:`relative w-full aspect-video h-[240px]`,children:a(e,{src:s,alt:c,fill:!0,className:`object-cover`})}):null,a(t,{className:`py-[8px]`,children:a(n,{as:`h3`,className:`line-clamp-1 text-[16px] text-bold text-text1`,children:c})}),u&&o(t,{className:`absolute z-[2] bottom-10 left-1 rounded-xs bg-black/60 px-1 text-[10px] text-white flex items-center gap-1`,children:[a(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`10`,viewBox:`0 0 12 10`,fill:`none`,className:`shrink-0`,"aria-hidden":!0,children:a(`path`,{d:`M7.56 5.18437L5.013 6.56737C4.893 6.63337 4.761 6.66937 4.638 6.66937C4.269 6.66937 4.002 6.38737 4.002 5.99737V3.28237C4.002 2.89237 4.269 2.61037 4.638 2.61037C4.764 2.61037 4.893 2.64637 5.013 2.70937L7.572 4.09237C7.803 4.21837 7.938 4.41637 7.938 4.63237C7.938 4.85137 7.8 5.05537 7.56 5.18437ZM9.807 9.27637L2.133 8.52937C0.954 8.52937 0 7.57537 0 6.39637V2.79937C0 1.62037 0.954 0.666368 2.133 0.666368L9.81 0.000367165C10.989 0.000367165 11.943 0.954367 11.943 2.13337V7.14337C11.9422 7.70935 11.7168 8.25188 11.3163 8.65181C10.9158 9.05174 10.373 9.27637 9.807 9.27637ZM10.875 2.13337C10.875 1.99351 10.8475 1.85502 10.7939 1.72581C10.7404 1.5966 10.662 1.47919 10.5631 1.3803C10.4642 1.2814 10.3468 1.20296 10.2176 1.14944C10.0883 1.09591 9.94986 1.06837 9.81 1.06837L2.133 1.73437C1.99314 1.73437 1.85465 1.76191 1.72544 1.81544C1.59623 1.86896 1.47883 1.9474 1.37993 2.0463C1.28104 2.14519 1.20259 2.2626 1.14907 2.39181C1.09555 2.52102 1.068 2.65951 1.068 2.79937V6.39637C1.068 6.67882 1.1802 6.94971 1.37993 7.14944C1.57966 7.34916 1.85054 7.46137 2.133 7.46137L9.807 8.20837C9.94686 8.20837 10.0853 8.18082 10.2146 8.1273C10.3438 8.07378 10.4612 7.99533 10.5601 7.89644C10.659 7.79754 10.7374 7.68014 10.7909 7.55093C10.8445 7.42171 10.872 7.28323 10.872 7.14337V2.13337H10.875Z`,fill:`white`})}),a(n,{className:`text-white text-[12px] leading-[20px]`,children:u})]}),d&&a(t,{className:`absolute z-[2] bottom-10 right-1`,children:a(n,{className:`text-white text-[12px] leading-[20px]`,children:d})})]})});export{s as VideoListItemComponent};
2
+ "use client";import{Image as e}from"../../ui/image.mjs";import{Box as t}from"../../ui/box.mjs";import{Text as n}from"../../ui/text.mjs";import{memo as r,useMemo as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";const s=r(({item:r})=>{let s=r.img_x??r.img_y??``,c=r.name??r.id??``;function l(e){if(!Number.isFinite(e)||e<=0)return``;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=e=>String(e).padStart(2,`0`);return n>0?`${a(n)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}let u=i(()=>{let e=r.static?.browse_cnt??0;if(!Number.isFinite(e)||e<=0)return 0;if(e>=1e6){let t=(e/1e6).toFixed(1);return t.endsWith(`.0`)?`${t.slice(0,-2)}M`:`${t}M`}if(e>=1e3){let t=(e/1e3).toFixed(1);return t.endsWith(`.0`)?`${t.slice(0,-2)}k`:`${t}k`}return Math.floor(e).toString()},[r]),d=i(()=>{let{type:e,duration:t,links:n}=r;if(e===1)return l(t??0);if(e===2)return`全${n?.length??0}集`},[r]);return o(t,{className:`overflow-hidden rounded-[8px] shadow-sm relative`,children:[s?a(t,{className:`relative w-full aspect-video h-[240px]`,children:a(e,{src:s,alt:c,fill:!0,className:`object-cover`})}):null,a(t,{className:`py-[8px]`,children:a(n,{as:`h3`,className:`line-clamp-1 text-[16px] text-bold text-text1`,children:c})}),o(t,{className:`absolute z-[2] bottom-10 left-1 rounded-xs bg-black/60 px-1 text-[10px] text-white flex items-center gap-1`,children:[a(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`10`,viewBox:`0 0 12 10`,fill:`none`,className:`shrink-0`,"aria-hidden":!0,children:a(`path`,{d:`M7.56 5.18437L5.013 6.56737C4.893 6.63337 4.761 6.66937 4.638 6.66937C4.269 6.66937 4.002 6.38737 4.002 5.99737V3.28237C4.002 2.89237 4.269 2.61037 4.638 2.61037C4.764 2.61037 4.893 2.64637 5.013 2.70937L7.572 4.09237C7.803 4.21837 7.938 4.41637 7.938 4.63237C7.938 4.85137 7.8 5.05537 7.56 5.18437ZM9.807 9.27637L2.133 8.52937C0.954 8.52937 0 7.57537 0 6.39637V2.79937C0 1.62037 0.954 0.666368 2.133 0.666368L9.81 0.000367165C10.989 0.000367165 11.943 0.954367 11.943 2.13337V7.14337C11.9422 7.70935 11.7168 8.25188 11.3163 8.65181C10.9158 9.05174 10.373 9.27637 9.807 9.27637ZM10.875 2.13337C10.875 1.99351 10.8475 1.85502 10.7939 1.72581C10.7404 1.5966 10.662 1.47919 10.5631 1.3803C10.4642 1.2814 10.3468 1.20296 10.2176 1.14944C10.0883 1.09591 9.94986 1.06837 9.81 1.06837L2.133 1.73437C1.99314 1.73437 1.85465 1.76191 1.72544 1.81544C1.59623 1.86896 1.47883 1.9474 1.37993 2.0463C1.28104 2.14519 1.20259 2.2626 1.14907 2.39181C1.09555 2.52102 1.068 2.65951 1.068 2.79937V6.39637C1.068 6.67882 1.1802 6.94971 1.37993 7.14944C1.57966 7.34916 1.85054 7.46137 2.133 7.46137L9.807 8.20837C9.94686 8.20837 10.0853 8.18082 10.2146 8.1273C10.3438 8.07378 10.4612 7.99533 10.5601 7.89644C10.659 7.79754 10.7374 7.68014 10.7909 7.55093C10.8445 7.42171 10.872 7.28323 10.872 7.14337V2.13337H10.875Z`,fill:`white`})}),a(n,{className:`text-white text-[12px] leading-[20px]`,children:u})]}),d&&a(t,{className:`absolute z-[2] bottom-10 right-1`,children:a(n,{className:`text-white text-[12px] leading-[20px]`,children:d})})]})});export{s as VideoListItemComponent};
@@ -6,7 +6,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
6
6
  //#region components/ui/badge.d.ts
7
7
  /** badgeVariants 工具定义。 */
8
8
  declare const badgeVariants: (props?: ({
9
- variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
9
+ variant?: "default" | "link" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
10
10
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
11
11
  /** Badge 组件。 */
12
12
  declare function Badge({
@@ -7,7 +7,7 @@ import * as class_variance_authority_types0 from "class-variance-authority/types
7
7
  //#region components/ui/button.d.ts
8
8
  /** buttonVariants 工具定义。 */
9
9
  declare const buttonVariants: (props?: ({
10
- variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
10
+ variant?: "default" | "link" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
11
11
  size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
12
12
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
13
13
  /** Button 组件属性。 */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@funhub/platform",
3
3
  "type": "module",
4
- "version": "0.1.100",
4
+ "version": "0.1.102",
5
5
  "private": false,
6
6
  "sideEffects": [
7
7
  "**/*.css"
@@ -1,2 +0,0 @@
1
-
2
- import{headers as e}from"next/headers";const t={detailId:``,currentSeriesNum:1};async function n(){let n=await e(),a=[n.get(`next-url`),n.get(`x-next-url`),n.get(`x-original-uri`),n.get(`x-rewrite-url`),n.get(`x-invoke-path`),n.get(`x-matched-path`),n.get(`referer`)].map(e=>r(e)).filter(Boolean);for(let e of a){let t=i(e);if(t.detailId)return t}return t}function r(e){if(!e)return``;let t=e.trim();if(!t)return``;if(t.startsWith(`/`))return t.split(`?`)[0]||``;try{return new URL(t).pathname||``}catch{return``}}function i(e){let n=e.split(`/`).filter(Boolean);if(!n.length)return t;let r=n.findIndex(e=>e===`video`||e===`webview`);if(r<0||n.length<=r+1)return t;let i=o(n[r+1]);if(!i)return t;let s=n.findIndex((e,t)=>t>r&&e===`episode`);return{detailId:i,currentSeriesNum:a(s>=0?n[s+1]:void 0)}}function a(e){let t=Number(e);return!Number.isFinite(t)||t<=0?1:Math.floor(t)}function o(e){let t=String(e||``).trim();if(!t)return``;let n=s(t).trim();return!n||n.includes(`[`)||n.includes(`]`)?``:n}function s(e){try{return decodeURIComponent(e)}catch{return e}}export{n as resolveVideoDetailRouteContext};