@funhub/platform 0.1.68 → 0.1.70

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.
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{gContentGetGuessYouLikeVideos as e}from"../../../../../service/generated/client.mjs";import{Box as t}from"../../../../ui/box.mjs";import{Text as n}from"../../../../ui/text.mjs";import{useRequest as r}from"../../../../../hooks/query/use-query.mjs";import i from"../../../../../assets/icons/detail/video_flag.mjs";import{MiniThreeCard as a}from"../../../../common/cards/mini-three-card.mjs";import{useCardDecoration as o}from"../../../../../hooks/use-card-decoration.mjs";import{buildEditorPreviewRecommendList as s}from"../shared/editor-preview.mjs";import{useVideoDetailMaterialRuntimeContext as c}from"../shared/runtime-context-provider.mjs";import{clampColumns as l,mergeManualAndPool as u,resolveRows as d}from"./utils.mjs";import{useCallback as f,useEffect as p,useMemo as m,useRef as ee,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";function v({rows:v,columns:y,smartTagEnabled:x,smartTagIds:S,title:ae,showPlayCount:oe,playCountDelta:se,showEpisode:ce,enableInfinite:le,items:w,mode:ue=`renderer`}){let T=c()?.detailId||``,E=ue===`editor`,D=E,{getVerticalHoCoverImageUrl:O,getTitleText:k}=o(),de=ee(null),A=m(()=>S??[],[S]),j=m(()=>w??[],[w]),M=!!le&&!E,N=x===!0,P=!N,F=M&&N&&!D,fe=d(v,M),I=l(y),L=fe*I,[pe,R]=h([]),[z,B]=h(2),[V,H]=h(!1),[U,W]=h(!1),G=m(()=>s(L),[L]),{data:K}=r([`video-detail-recommend`,T,F?`paged`:`all`],async()=>!T||D?null:F?await e({page:1,page_size:16}):await e(),{enabled:!D&&!!T}),q=m(()=>D?G:b(K?.data?.videos,T),[K?.data?.videos,T,G,D]);p(()=>{if(!F){R([]),B(2),H(!1),W(!1);return}R(q),B(2),H(te(K?.data?.videos,16)),W(!1)},[K?.data?.videos,q,F]);let J=F?pe:q,Y=m(()=>P?new Set(j.map(e=>C(e.contentId)).filter(Boolean)):new Set,[j,P]),X=m(()=>{if(D)return J;let e=J.filter(e=>!Y.has(e.id));if(!N||A.length===0)return e;let t=new Set(A.map(String));return e.filter(e=>(Array.isArray(e.source_tags)?e.source_tags:String(e.source_tags||``).split(`,`).filter(Boolean)).some(e=>t.has(String(e?.id??e))))},[J,D,N,Y,A]),Z=m(()=>{if(!P||!j.length)return[];let e=new Map;return J.forEach(t=>{let n=C(t.id);n&&e.set(n,t)}),j.map((t,n)=>{let r=G[n%Math.max(1,G.length)],i=C(t.contentId),a=e.get(i)??(D?{...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:k(a),s=t.coverMode===`upload`?t.coverUrl:O(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,k,O,D,j,P]),Q=m(()=>X.map(e=>({info:e})),[X]),me=m(()=>u(Z,Q,L),[Z,L,Q]),$=m(()=>{if(F){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(M){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 me},[me,Z,Q,M,F]),he=V&&$.length>0?Math.max(0,$.length-4):-1,ge=String(ae||``).trim(),_e=f(async()=>{if(!(!F||!V||U)){W(!0);try{let t=await e({page:z,page_size:16}),n=Array.isArray(t.data?.videos)?t.data.videos:[],r=b(n,T),i=0;R(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}),B(e=>e+1),H(te(n,16)&&i>0)}catch(e){console.error(`猜你喜欢分页加载失败`,e),H(!1)}finally{W(!1)}}},[T,V,U,z,F]);return p(()=>{if(!F)return;let e=de.current;if(!e||!V)return;let t=new IntersectionObserver(e=>{e[0]?.isIntersecting&&!U&&_e()});return t.observe(e),()=>{t.disconnect()}},[_e,V,U,F,he]),$.length?_(t,{className:`w-full mt-[16px] ${D?`pointer-events-none`:``}`,children:[ge?g(n,{className:`block pl-[12px] mb-[8px] text-text1 text-[18px] leading-[26px] font-bold`,children:ge}):null,g(t,{className:`w-full flex flex-wrap px-[12px]`,children:$.map((e,t)=>{let r=k(e.info),o=oe!==!1&&(e.config?.showPlayCount??!0),s=e.config?.showEpisode??ce,c=re(e.info.play_count||0),l=ne(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===he?de:void 0,style:{width:d,...p||{}},children:g(a,{url:O(e.info),text:r,textChild:g(n,{as:`h3`,className:`text-text1 text-[16px] h-[24px] leading-[24px] mt-[4px] line-clamp-1`,children:r}),style:{width:`100%`},bottomLeftChild:o?_(`div`,{className:`h-[20px] leading-[20px] text-[#fff] text-[12px] px-[4px] rounded-[4px] bg-[#333] ml-[4px] flex items-center`,children:[g(i,{className:`w-[16px] h-[auto] text-[#fff] mr-[4px]`}),c]}):null,bottomRightChild:s&&l?g(`div`,{className:`text-[#fff] text-[12px] leading-[20px] pr-2`,children:l}):null,linkPath:D?``:ie(e.info)})},`guess-like-${t}`)})})]}):null}function y(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 b(e,t){if(!Array.isArray(e))return[];let n=C(t);return e.map(e=>y(e)).filter(e=>!n||!e.id||C(e.id)!==n)}function te(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 ne(e){if(x(e)){let t=Number(e.episode_cnt||e.links?.length||0);return t>0?`全${t}集`:``}return S(Number(e.duration||0))}function x(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 S(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 re(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 ie(e){if(e.content_type===0){let t=encodeURIComponent(e.name||``);return`/video/${e.id}/${t}/episode/1`}return`/post/${e.id}`}function C(e){return typeof e==`string`?e.trim():``}export{v as VideoDetailRecommendClient};
2
+ "use client";import{gContentGetGuessYouLikeVideos as e}from"../../../../../service/generated/client.mjs";import{Box as t}from"../../../../ui/box.mjs";import{Text as n}from"../../../../ui/text.mjs";import{useRequest as r}from"../../../../../hooks/query/use-query.mjs";import i from"../../../../../assets/icons/detail/video_flag.mjs";import{MiniThreeCard as a}from"../../../../common/cards/mini-three-card.mjs";import{useCardDecoration as o}from"../../../../../hooks/use-card-decoration.mjs";import{buildEditorPreviewRecommendList as s}from"../shared/editor-preview.mjs";import{useVideoDetailMaterialRuntimeContext as c}from"../shared/runtime-context-provider.mjs";import{clampColumns as l,mergeManualAndPool as u,resolveRows as d}from"./utils.mjs";import{useCallback as f,useEffect as p,useMemo as m,useRef as ee,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";function v({rows:v,columns:y,smartTagEnabled:S,smartTagIds:C,title:ie,showPlayCount:ae,playCountDelta:oe,showEpisode:se,enableInfinite:ce,items:T,mode:le=`renderer`}){let E=c()?.detailId||``,D=le===`editor`,O=D,{getVerticalHoCoverImageUrl:k,getTitleText:A}=o(),j=ee(null),M=S===!0,N=m(()=>Array.isArray(C)?C.map(e=>String(e||``).trim()).filter(Boolean):[],[C]),P=m(()=>T??[],[T]),F=!!ce&&M&&!D,I=!M,L=F&&M&&!O,ue=d(v,F),R=l(y),z=ue*R,[de,B]=h([]),[V,H]=h(2),[U,W]=h(!1),[G,K]=h(!1),q=m(()=>s(z),[z]),{data:J}=r([`video-detail-recommend`,E,L?`paged`:`all`],async()=>!E||O?null:L?await e({page:1,page_size:16}):await e(),{enabled:!O&&!!E}),Y=m(()=>O?q:b(J?.data?.videos,E),[J?.data?.videos,E,q,O]);p(()=>{if(!L){B([]),H(2),W(!1),K(!1);return}B(Y),H(2),W(x(J?.data?.videos,16)),K(!1)},[J?.data?.videos,Y,L]);let X=L?de:Y,fe=m(()=>I?new Set(P.map(e=>w(e.contentId)).filter(Boolean)):new Set,[P,I]),pe=m(()=>{if(O)return X;let e=X.filter(e=>!fe.has(e.id));if(!M||N.length===0)return e;let t=new Set(N.map(String));return e.filter(e=>(Array.isArray(e.source_tags)?e.source_tags:String(e.source_tags||``).split(`,`).filter(Boolean)).some(e=>t.has(String(e?.id??e))))},[X,O,M,fe,N]),Z=m(()=>{if(!I||!P.length)return[];let e=new Map;return X.forEach(t=>{let n=w(t.id);n&&e.set(n,t)}),P.map((t,n)=>{let r=q[n%Math.max(1,q.length)],i=w(t.contentId),a=e.get(i)??(O?{...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:A(a),s=t.coverMode===`upload`?t.coverUrl:k(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)},[q,X,A,k,O,P,I]),Q=m(()=>pe.map(e=>({info:e})),[pe]),me=m(()=>u(Z,Q,z),[Z,z,Q]),$=m(()=>{if(L){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(F){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 me},[me,Z,Q,F,L]),he=U&&$.length>0?Math.max(0,$.length-4):-1,ge=String(ie||``).trim(),_e=f(async()=>{if(!(!L||!U||G)){K(!0);try{let t=await e({page:V,page_size:16}),n=Array.isArray(t.data?.videos)?t.data.videos:[],r=b(n,E),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(e=>e+1),W(x(n,16)&&i>0)}catch(e){console.error(`猜你喜欢分页加载失败`,e),W(!1)}finally{K(!1)}}},[E,U,G,V,L]);return p(()=>{if(!L)return;let e=j.current;if(!e||!U)return;let t=new IntersectionObserver(e=>{e[0]?.isIntersecting&&!G&&_e()});return t.observe(e),()=>{t.disconnect()}},[_e,U,G,L,he]),$.length?_(t,{className:`w-full mt-[16px] ${O?`pointer-events-none`:``}`,children:[ge?g(n,{className:`block pl-[12px] mb-[8px] text-text1 text-[18px] leading-[26px] font-bold`,children:ge}):null,g(t,{className:`w-full flex flex-wrap px-[12px]`,children:$.map((e,t)=>{let r=A(e.info),o=ae!==!1&&(e.config?.showPlayCount??!0),s=e.config?.showEpisode??se,c=ne(e.info.play_count||0),l=te(e.info),u=Number.isFinite(R)&&R>0?R: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===he?j:void 0,style:{width:d,...p||{}},children:g(a,{url:k(e.info),text:r,textChild:g(n,{as:`h3`,className:`text-text1 text-[16px] h-[24px] leading-[24px] mt-[4px] line-clamp-1`,children:r}),style:{width:`100%`},bottomLeftChild:o?_(`div`,{className:`h-[20px] leading-[20px] text-[#fff] text-[12px] px-[4px] rounded-[4px] bg-[#333] ml-[4px] flex items-center`,children:[g(i,{className:`w-[16px] h-[auto] text-[#fff] mr-[4px]`}),c]}):null,bottomRightChild:s&&l?g(`div`,{className:`text-[#fff] text-[12px] leading-[20px] pr-2`,children:l}):null,linkPath:O?``:re(e.info)})},`guess-like-${t}`)})})]}):null}function y(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 b(e,t){if(!Array.isArray(e))return[];let n=w(t);return e.map(e=>y(e)).filter(e=>!n||!e.id||w(e.id)!==n)}function x(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 te(e){if(S(e)){let t=Number(e.episode_cnt||e.links?.length||0);return t>0?`全${t}集`:``}return C(Number(e.duration||0))}function S(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 C(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 ne(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 re(e){if(e.content_type===0){let t=encodeURIComponent(e.name||``);return`/video/${e.id}/${t}/episode/1`}return`/post/${e.id}`}function w(e){return typeof e==`string`?e.trim():``}export{v as VideoDetailRecommendClient};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{cn as e}from"../../../../../utils/cn.mjs";import{Button as t}from"../../../../ui/button.mjs";import{useUserStore as n}from"../../../../../store/modules/user-store.mjs";import{gUserGetUserInfo as r,gUserViewUserInfo as i,pInteractionFollow as a,pInteractionUnfollow as o}from"../../../../../service/generated/client.mjs";import{Box as s}from"../../../../ui/box.mjs";import{Text as c}from"../../../../ui/text.mjs";import{useLoginModalStore as l}from"../../../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as u,useMutation as d,useRequest as f,useUpdateRequest as p}from"../../../../../hooks/query/use-query.mjs";import{LeftArrowIcon as m}from"../../../../common/icons/left-arrow.mjs";import{SettingIcon as h}from"../../../../common/icons/setting.mjs";import{UserProfileAvatar as g}from"./user-profile-avatar.mjs";import{UserProfileCoverBackground as _}from"./user-profile-cover-background.mjs";import{useEffect as v,useMemo as y,useState as b}from"react";import{jsx as x,jsxs as S}from"react/jsx-runtime";import{toast as C}from"sonner";import{useTranslations as w}from"next-intl";import T from"next/link";import{useRouter as ee}from"next/navigation";const E=n.persist,D=`https://guadd-sg-ccs-sing-dev.s3.ap-southeast-1.amazonaws.com/default/default_avatar.png`,O=`/images/mine/img_mine_head_bg.png`;function te({userId:e,currentUserId:n,isFollowing:r}){let i=w(`components.pages.profile`),{open:s}=l(),c=u(),f=p(),{mutateAsync:m,isPending:h}=d(async e=>a(e)),{mutateAsync:g,isPending:_}=d(async e=>o(e)),v=h||_;async function y(){if(!v){if(!n){s();return}try{if(r){let t=await g({app_id:0,follower_id:n,followee_id:e});t.code===0?(C.success(i(`client.unfollowSuccess`)),b(!1),c([`check-follow`,e]),c([`user-profile`,`profile`,e])):C.error(t.message||i(`client.unfollowFailed`))}else{let t=await m({app_id:0,follower_id:n,followee_id:e});t.code===0?(C.success(i(`client.followSuccess`)),b(!0),c([`check-follow`,e]),c([`user-profile`,`profile`,e])):C.error(t.message||i(`client.followFailed`))}}catch(e){console.error(`关注操作失败`,e),C.error(i(`client.operationFailed`))}}}function b(t){f([`user-profile`,`profile`,e],e=>!e||!e.data?e:{...e,data:{...e.data,is_following:t}})}return x(t,{variant:r?`outline`:`default`,className:`rounded-full disabled:opacity-100`,onClick:y,disabled:v,children:i(v?`client.processing`:r?`client.followed`:`client.follow`)})}function k({id:a,enableCustomBackground:o=!0,showBackButton:u=!0,requireLogin:d=!1,cookieToken:p,cookieUserId:C,isEditorPreview:k=!1,className:A,mode:j=`renderer`}){let M=w(`components.pages.profile`);w(`components.pages.profile.components`);let N=k||j===`editor`,ne=!N,re=ee(),{open:ie}=l(),{isLogin:ae,userId:P,token:F}=n(),[I,L]=b(!1);v(()=>{if(!E){L(!0);return}L(E.hasHydrated());let e=E.onHydrate(()=>{L(!1)}),t=E.onFinishHydration(()=>{L(!0)});return()=>{e(),t()}},[]);let R=N?!1:I?ae&&!!P&&!!F:!!C&&!!p,z=N?``:I?P:P||C,B=z,V=a==null||!!a&&!!B&&a===B,oe=!V&&!!a,H=V?[`user-profile`,`mine`]:[`user-profile`,`profile`,a],{data:U}=f(N?[`editor-preview`,...H]:H,()=>a?i({target_user_id:a,user_id:z||a}):r({user_id:a||z||``}),{staleTime:0,enabled:ne&&(!!a||!!z)}),W=y(()=>{let e=U?U.data:void 0;return e?{userId:e.user_id,isFollowing:e.is_following||!1,name:e.nick_name||`User${a??``}`,avatar:e.avatar||D,followingCnt:e.following_count??0,followersCnt:e.follower_count??0,likeCnt:e.like_count??0,signature:e.signature||``,background:e.bg_image||O}:{}},[a,U]),G=N||d&&V&&!R,K=!G&&!R&&oe,q=V&&R&&!G,J=!R,se=o&&q,ce=o&&J,le={name:M(`client.welcomeToPlanet`),description:M(`client.exploreAdventures`),avatar:D,followingCnt:0,followersCnt:0,likeCnt:0,background:O};function Y(){ie()}function X(){re.back()}let ue=G?x(t,{className:`rounded-full`,size:`lg`,onClick:Y,children:M(`client.loginNow`)}):K?x(t,{className:`rounded-full`,size:`lg`,onClick:Y,children:M(`client.follow`)}):R?V?x(T,{href:`/edit`,children:x(t,{variant:`outline`,className:`rounded-full`,children:M(`client.editProfile`)})}):x(te,{userId:a||``,currentUserId:z,isFollowing:W?.isFollowing}):x(t,{className:`rounded-full`,size:`lg`,onClick:Y,children:M(`client.loginNow`)}),Z=G?le:W,Q=Z.name||``,$=Z.description||Z.signature||``;Z.followingCnt,Z.followersCnt,Z.likeCnt;let de=Z.avatar||``;return S(s,{className:e(`flex flex-col relative`,A),children:[S(s,{className:`absolute top-0 p-3 z-10 flex items-center justify-between w-full`,children:[x(t,{variant:`ghost`,size:`icon-xs`,onClick:X,className:e(`h-4 w-4 p-0 hover:bg-transparent`,{invisible:!u}),children:x(m,{className:`w-4 h-4`})}),x(T,{href:`/settings`,className:e({invisible:!V}),children:x(h,{})})]}),x(_,{isMine:se,enableCustomBackground:o,src:Z.background,onUnauthorizedClick:ce?Y:void 0}),S(s,{className:`flex-1 px-3`,children:[S(s,{className:`relative flex justify-end`,children:[x(g,{isMine:q,src:de,alt:Q||`avatar`,onUnauthorizedClick:J?Y:void 0}),x(s,{className:`flex divide-x divide-text1/5 py-4 h-12`})]}),S(s,{className:`flex items-center justify-between gap-1`,children:[x(c,{as:`p`,className:`text-text1 text-xl overflow-hidden whitespace-nowrap text-ellipsis font-bold `,children:Q}),ue]}),$&&x(c,{as:`p`,className:`text-sm py-1 line-clamp-2 break-all text-text1/66`,children:$})]})]})}export{k as UserProfileHeaderClient};
2
+ "use client";import{cn as e}from"../../../../../utils/cn.mjs";import{Button as t}from"../../../../ui/button.mjs";import{useUserStore as n}from"../../../../../store/modules/user-store.mjs";import{gUserGetUserInfo as r,gUserViewUserInfo as i,pInteractionFollow as a,pInteractionUnfollow as o}from"../../../../../service/generated/client.mjs";import{Box as s}from"../../../../ui/box.mjs";import{Text as c}from"../../../../ui/text.mjs";import{useLoginModalStore as l}from"../../../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as u,useMutation as d,useRequest as f,useUpdateRequest as p}from"../../../../../hooks/query/use-query.mjs";import{LeftArrowIcon as m}from"../../../../common/icons/left-arrow.mjs";import{SettingIcon as h}from"../../../../common/icons/setting.mjs";import{UserProfileAvatar as g}from"./user-profile-avatar.mjs";import{UserProfileCoverBackground as _}from"./user-profile-cover-background.mjs";import{useEffect as v,useMemo as y,useState as b}from"react";import{jsx as x,jsxs as S}from"react/jsx-runtime";import{toast as C}from"sonner";import{useTranslations as w}from"next-intl";import T from"next/link";import{useRouter as ee}from"next/navigation";const E=n.persist,D=`https://guadd-sg-ccs-sing-dev.s3.ap-southeast-1.amazonaws.com/default/default_avatar.png`,O=`/images/mine/img_mine_head_bg.png`;function te({userId:e,currentUserId:n,isFollowing:r}){let i=w(`components.pages.profile`),{open:s}=l(),c=u(),f=p(),{mutateAsync:m,isPending:h}=d(async e=>a(e)),{mutateAsync:g,isPending:_}=d(async e=>o(e)),v=h||_;async function y(){if(!v){if(!n){s();return}try{if(r){let t=await g({app_id:0,follower_id:n,followee_id:e});t.code===0?(C.success(i(`client.unfollowSuccess`)),b(!1),c([`check-follow`,e]),c([`user-profile`,`profile`,e])):C.error(t.message||i(`client.unfollowFailed`))}else{let t=await m({app_id:0,follower_id:n,followee_id:e});t.code===0?(C.success(i(`client.followSuccess`)),b(!0),c([`check-follow`,e]),c([`user-profile`,`profile`,e])):C.error(t.message||i(`client.followFailed`))}}catch(e){console.error(`关注操作失败`,e),C.error(i(`client.operationFailed`))}}}function b(t){f([`user-profile`,`profile`,e],e=>!e||!e.data?e:{...e,data:{...e.data,is_following:t}})}return x(t,{variant:r?`outline`:`default`,className:`rounded-full disabled:opacity-100`,onClick:y,disabled:v,children:i(v?`client.processing`:r?`client.followed`:`client.follow`)})}function k({id:a,enableCustomBackground:o=!0,showBackButton:u=!0,requireLogin:d=!1,cookieToken:p,cookieUserId:C,isEditorPreview:k=!1,className:A,mode:j=`renderer`}){let M=w(`components.pages.profile`);w(`components.pages.profile.components`);let N=k||j===`editor`,ne=!N,re=ee(),{open:ie}=l(),{isLogin:ae,userId:P,token:F}=n(),[I,L]=b(!1);v(()=>{if(!E){L(!0);return}L(E.hasHydrated());let e=E.onHydrate(()=>{L(!1)}),t=E.onFinishHydration(()=>{L(!0)});return()=>{e(),t()}},[]);let R=N?!1:I?ae&&!!P&&!!F:!!C&&!!p,z=N?``:I?P:P||C,B=z,V=a==null||!!a&&!!B&&a===B,oe=!V&&!!a,H=V?[`user-profile`,`mine`]:[`user-profile`,`profile`,a],{data:U}=f(N?[`editor-preview`,...H]:H,()=>a?i({target_user_id:a,user_id:z||a}):r({user_id:a||z||``}),{staleTime:0,enabled:ne&&(!!a||!!z)}),W=y(()=>{let e=U?U.data:void 0;return e?{userId:e.user_id,isFollowing:e.is_following||!1,name:e.nick_name||`User${a??``}`,avatar:e.avatar||D,followingCnt:e.following_count??0,followersCnt:e.follower_count??0,likeCnt:e.like_count??0,signature:e.signature||``,background:e.bg_image||O}:{}},[a,U]),G=N||d&&V&&!R,K=!G&&!R&&oe,q=V&&R&&!G,J=!R,se=o&&q,ce=o&&J,le={name:M(`client.welcomeToPlanet`),description:M(`client.exploreAdventures`),avatar:D,followingCnt:0,followersCnt:0,likeCnt:0,background:O};function Y(){ie()}function X(){re.back()}let ue=G?x(t,{className:`rounded-full`,size:`lg`,onClick:Y,children:M(`client.loginNow`)}):K?x(t,{className:`rounded-full`,size:`lg`,onClick:Y,children:M(`client.follow`)}):R?V?x(T,{href:`/edit`,children:x(t,{variant:`outline`,className:`rounded-full`,children:M(`client.editProfile`)})}):x(te,{userId:a||``,currentUserId:z,isFollowing:W?.isFollowing}):x(t,{className:`rounded-full`,size:`lg`,onClick:Y,children:M(`client.loginNow`)}),Z=G?le:W,Q=Z.name||``,$=Z.description||Z.signature||``;Z.followingCnt,Z.followersCnt,Z.likeCnt;let de=Z.avatar||``;return S(s,{className:e(`flex flex-col relative`,A),children:[S(s,{className:`absolute top-0 p-3 z-10 flex items-center justify-between w-full`,children:[x(t,{variant:`ghost`,size:`icon-xs`,onClick:X,className:e(`h-4 w-4 p-0 hover:bg-transparent`,{invisible:!u}),children:x(m,{className:`w-4 h-4`})}),x(T,{href:`/settings`,className:e({invisible:!V}),children:x(h,{})})]}),x(_,{isMine:se,enableCustomBackground:o,src:Z.background,onUnauthorizedClick:ce?Y:void 0}),S(s,{className:`flex-1 px-3`,children:[S(s,{className:`relative flex justify-end`,children:[x(g,{isMine:q,src:de,alt:Q||`avatar`,onUnauthorizedClick:J?Y:void 0}),x(s,{className:`flex divide-x divide-text1/5 py-4 h-12`})]}),S(s,{className:`flex items-center justify-between gap-1`,children:[x(c,{as:`p`,className:`text-text1 text-xl overflow-hidden whitespace-nowrap text-ellipsis font-bold `,children:Q}),ue]}),$&&x(c,{as:`p`,className:`text-sm pt-1 pb-0 line-clamp-2 break-all text-text1/66`,children:$})]})]})}export{k as UserProfileHeaderClient};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Button as e}from"../../../ui/button.mjs";import t from"../../../../utils/event-bus.mjs";import{Box as n}from"../../../ui/box.mjs";import{Text as r}from"../../../ui/text.mjs";import{eventKey as i}from"../../../../constants/event-key.mjs";import{DeleteConfirmDialog as a}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{useCallback as o,useEffect as s,useMemo as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{useTranslations as f}from"next-intl";import{usePathname as p,useRouter as m,useSearchParams as h}from"next/navigation";function g(g){let _=f(`components.biz.business.searchHistory`),{title:v,rows:y=1,clearText:b,confirmDescription:x,storageKey:S=`guest`,onHistoryClick:C,mode:w=`renderer`}=g,T=b??_(`clear`),E=x??_(`confirmClearDescription`),D=c(()=>[_(`mockHistory1`),_(`mockHistory2`),_(`mockHistory3`)],[_]),[O,k]=l([]),[A,j]=l(!1),M=m(),N=p(),P=h(),F=`search_history_${S}`,I=o(()=>{let e=localStorage.getItem(F);if(e)try{k(JSON.parse(e))}catch(e){console.error(`Failed to parse search history`,e)}else k([])},[F]);s(()=>{I()},[I]),s(()=>(t.on(i.SEARCH_HISTORY_UPDATE,I),()=>{t.off(i.SEARCH_HISTORY_UPDATE,I)}),[I]);let L=()=>{k([]),localStorage.removeItem(F),j(!1),t.emit(i.SEARCH_HISTORY_UPDATE)},R=c(()=>{let e=O.length>0?O:w===`editor`?D:[],t=y*10;return e.slice(0,t)},[O,w,D,y]);if(R.length===0)return null;let z=e=>{if(C)C(e);else{let t=new URLSearchParams(P.toString());t.set(`q`,e);let n=N.includes(`/search-result`)?N:`/search-result`;M.push(`${n}?${t.toString()}`)}};return d(n,{className:`px-4 py-2`,children:[d(n,{className:`flex justify-between items-center mb-2`,children:[u(r,{className:`text-[16px] font-bold text-text1`,children:v}),u(e,{variant:`ghost`,size:`sm`,className:`text-text3 text-[12px] p-0 h-auto`,onClick:()=>j(!0),children:T})]}),u(n,{className:`flex flex-wrap gap-2 overflow-hidden`,style:{maxHeight:`${y*40}px`},children:R.map((e,t)=>u(n,{className:`px-3 py-1 bg-bg2 rounded-full cursor-pointer`,onClick:()=>z(e),children:u(r,{className:`text-[14px] text-text2 truncate max-w-[150px]`,children:e})},t))}),u(a,{open:A,onOpenChange:j,onConfirm:()=>{L()},title:``,description:E})]})}export{g as SearchHistoryClient};
2
+ "use client";import{Button as e}from"../../../ui/button.mjs";import t from"../../../../utils/event-bus.mjs";import{Box as n}from"../../../ui/box.mjs";import{Text as r}from"../../../ui/text.mjs";import{eventKey as i}from"../../../../constants/event-key.mjs";import{DeleteConfirmDialog as a}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{useCallback as o,useEffect as s,useMemo as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{usePathname as f,useRouter as p,useSearchParams as m}from"next/navigation";function h(e,t){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function g(g){let{title:_,rows:v=1,clearText:y,confirmDescription:b,storageKey:x=`guest`,onHistoryClick:S,mode:C=`renderer`}=g,w=_??`搜索历史`,T=y??`清空`,E=b??`确定要清除所有搜索历史吗?`,D=c(()=>[`搜索历史1`,`搜索历史2`,`搜索历史3`],[]),[O,k]=l([]),[A,j]=l(!1),M=p(),N=f(),P=m(),F=`search_history_${x}`,I=o(()=>{let e=[];try{let t=localStorage.getItem(F);if(t)try{let n=JSON.parse(t);e=Array.isArray(n)?n:[]}catch{e=[]}k(e)}catch(e){console.error(`Failed to parse search history`,e),k([])}},[F]);s(()=>(I(),t.on(i.SEARCH_HISTORY_UPDATE,I),()=>t.off(i.SEARCH_HISTORY_UPDATE,I)),[I]);let L=()=>{k([]),localStorage.removeItem(F),j(!1),t.emit(i.SEARCH_HISTORY_UPDATE)},R=c(()=>(O.length?O:C===`editor`?D:[]).slice(0,v*10),[O,C,D,v]);if(R.length===0)return null;let z=e=>{if(S){S(e);return}let t=new URLSearchParams(P.toString());t.set(`q`,e);let n=N.includes(`/search-result`)?N:`/search-result`;M.push(`${n}?${t.toString()}`)};return d(n,{className:`px-4 py-2`,children:[d(n,{className:`flex justify-between items-center mb-2`,children:[u(r,{className:`text-[16px] font-bold text-text1`,children:w}),u(e,{variant:`ghost`,size:`sm`,className:`text-text3 text-[12px] p-0 h-auto`,onClick:()=>j(!0),children:T})]}),u(n,{className:`flex flex-wrap gap-2 overflow-hidden`,style:{maxHeight:`${v*40}px`},children:R.map((e,t)=>u(n,{className:`px-3 py-1 bg-bg2 rounded-full cursor-pointer`,onClick:()=>z(e),children:u(r,{className:`text-[14px] text-text2`,children:h(e,8)})},t))}),u(a,{open:A,onOpenChange:j,onConfirm:L,title:``,description:E})]})}export{g as SearchHistoryClient};
@@ -8,8 +8,8 @@ interface ServerProps extends SearchHistoryProps {
8
8
  onHistoryClick?: (keyword: string) => void;
9
9
  }
10
10
  /**
11
- * 搜索历史物料组件 (search-history) - 服务端部分
11
+ * 搜索历史物料组件 (search-history) - 服务端部分,国际化由 Client 内 useTranslations 处理
12
12
  */
13
- declare function SearchHistoryServer(props: ServerProps): Promise<react_jsx_runtime0.JSX.Element>;
13
+ declare function SearchHistoryServer(props: ServerProps): react_jsx_runtime0.JSX.Element;
14
14
  //#endregion
15
15
  export { SearchHistoryServer };
@@ -1,2 +1,2 @@
1
1
 
2
- import{SearchHistoryClient as e}from"./client.mjs";import{jsx as t}from"react/jsx-runtime";import{getTranslations as n}from"next-intl/server";async function r(r){let{mode:i=`renderer`,...a}=r,o=await n(`components.biz.business.searchHistory`);return t(e,{...a,mode:i,title:a.title||o(`defaultTitle`),clearText:o(`clear`),confirmDescription:o(`confirmClearDescription`)})}export{r as SearchHistoryServer};
2
+ import{SearchHistoryClient as e}from"./client.mjs";import{jsx as t}from"react/jsx-runtime";function n(n){let{mode:r=`renderer`,...i}=n;return t(e,{...i,mode:r})}export{n as SearchHistoryServer};
@@ -5,7 +5,6 @@ import * as react_jsx_runtime0 from "react/jsx-runtime";
5
5
  //#region components/biz/business/search-input/client.d.ts
6
6
  type SearchInputProps = SearchInputInspectorProps;
7
7
  interface ClientProps extends SearchInputProps {
8
- /** 占位符,未配置时由服务端 defaultPlaceholder 兜底 */
9
8
  placeholder?: string;
10
9
  defaultPlaceholder?: string;
11
10
  searchLabel?: string;
@@ -14,7 +13,6 @@ interface ClientProps extends SearchInputProps {
14
13
  }
15
14
  /**
16
15
  * 搜索输入框物料组件 (SearchInput) - 客户端交互部分
17
- * 适配 Figma 设计稿布局:包含返回按钮、带边框的输入框、外部搜索按钮
18
16
  */
19
17
  declare function SearchInputClient(props: ClientProps): react_jsx_runtime0.JSX.Element;
20
18
  //#endregion
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import e from"../../../../utils/event-bus.mjs";import{Box as t}from"../../../ui/box.mjs";import{Input as n}from"../../../ui/input.mjs";import{Text as r}from"../../../ui/text.mjs";import{eventKey as i}from"../../../../constants/event-key.mjs";import a from"../../../../assets/icons/left_arrow.mjs";import o from"../../../../assets/icons/search.mjs";import s from"../../../../assets/icons/clear.mjs";import{useCallback as c,useEffect as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{useTranslations as p}from"next-intl";import{usePathname as m,useRouter as h,useSearchParams as g}from"next/navigation";function _(_){let v=p(`components.pages.search`),{placeholder:y,defaultPlaceholder:b,searchLabel:x,storageKey:S=`guest`,onSearch:C,mode:w=`renderer`}=_,T=y||(b??v(`topHeader.placeholder`)),E=x??v(`topHeader.search`),D=w===`editor`,[O,k]=u(``),A=h(),j=m(),M=g(),N=`search_history_${S}`,P=c(t=>{if(D)return;let n=t.trim();if(n){try{let t=localStorage.getItem(N),r=[];if(t)try{let e=JSON.parse(t);r=Array.isArray(e)?e:[]}catch{r=[]}let a=[n,...r.map(e=>String(e).trim()).filter(Boolean).filter(e=>e!==n)];localStorage.setItem(N,JSON.stringify(a.slice(0,20))),e.emit(i.SEARCH_HISTORY_UPDATE)}catch(e){console.error(`Failed to save search history`,e)}if(C)C(n);else{let e=new URLSearchParams(M.toString());e.set(`q`,n);let t=j.includes(`/search-result`)?j:`/search-result`;A.push(`${t}?${e.toString()}`)}}},[N,D,C,j,A,M]);l(()=>{let e=M.get(`q`);e&&e!==O&&(k(e),P(e))},[M,P,O]),l(()=>{if(!D&&O===``){if(M.has(`q`)){let e=new URLSearchParams(M.toString());e.delete(`q`);let t=j.includes(`/search-result`)?j:`/search-result`;A.push(`${t}${e.toString()?`?${e.toString()}`:``}`)}e.emit(i.SEARCH_HISTORY_UPDATE)}},[D,O,j,A,M]);let F=()=>{P(O)};function I(){k(``),!D&&(A.push(`/search`),e.emit(i.SEARCH_HISTORY_UPDATE))}return f(t,{className:D?`px-3 py-2 bg-bg1 flex items-center gap-3 w-full pointer-events-none`:`px-3 py-2 bg-bg1 flex items-center gap-3 w-full`,children:[d(t,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:()=>{D||A.back()},children:d(a,{className:`w-4 h-4 text-text1`})}),f(t,{className:`flex-1 flex items-center gap-1 bg-bg2 border border-theme5 rounded-[20px] px-2 py-1.5 overflow-hidden`,children:[d(t,{className:`p-1 shrink-0`,children:d(o,{className:`w-[14px] h-[14px] text-text3`})}),d(n,{className:`flex-1 border-none bg-transparent p-0 h-auto text-[14px] leading-[22px] focus-visible:ring-0 text-text1 placeholder:text-text3`,placeholder:T,value:O,onChange:e=>k(e.target.value),onKeyDown:e=>e.key===`Enter`&&F()}),O&&d(s,{className:`w-[15px] h-[15px] text-text3 shrink-0 cursor-pointer active:opacity-70`,onClick:I})]}),d(t,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:F,children:d(r,{className:`text-[16px] text-text1 leading-[24px] font-normal`,children:E})})]})}export{_ as SearchInputClient};
2
+ "use client";import{Box as e}from"../../../ui/box.mjs";import{Input as t}from"../../../ui/input.mjs";import{Text as n}from"../../../ui/text.mjs";import r from"../../../../assets/icons/left_arrow.mjs";import i from"../../../../assets/icons/search.mjs";import a from"../../../../assets/icons/clear.mjs";import{useCallback as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{usePathname as u,useRouter as d,useSearchParams as f}from"next/navigation";function p(e){if(!e||typeof e!=`string`)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.map(e=>e==null?``:String(e).trim()).filter(Boolean):[]}catch{return[]}}function m(m){let{placeholder:h,defaultPlaceholder:g,searchLabel:_,storageKey:v=`guest`,onSearch:y,mode:b=`renderer`}=m,x=h||(g??`请输入搜索内容`),S=_??`搜索`,C=b===`editor`,[w,T]=s(``),E=d(),D=u(),O=f(),k=`search_history_${v}`,A=o(e=>{if(C)return;let t=e.trim();if(t){try{let e=[t,...p(localStorage.getItem(k)).filter(e=>e!==t)].slice(0,20);localStorage.setItem(k,JSON.stringify(e))}catch(e){console.error(`Failed to save search history`,e)}if(y)y(t);else{let e=new URLSearchParams(O.toString());e.set(`q`,t);let n=D.includes(`/search-result`)?D:`/search-result`;E.push(`${n}?${e.toString()}`)}}},[k,C,y,D,E,O]);return l(e,{className:`px-3 py-2 bg-bg1 flex items-center gap-3 w-full${C?` pointer-events-none`:``}`,children:[c(e,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:()=>{C||E.back()},children:c(r,{className:`w-4 h-4 text-text1`})}),l(e,{className:`flex-1 flex items-center gap-1 bg-bg2 border border-theme5 rounded-[20px] px-2 py-1.5 overflow-hidden`,children:[c(e,{className:`p-1 shrink-0`,children:c(i,{className:`w-[14px] h-[14px] text-text3`})}),c(t,{className:`flex-1 border-none bg-transparent p-0 h-auto text-[14px] leading-[22px] focus-visible:ring-0 text-text1 placeholder:text-text3`,placeholder:x,value:w,maxLength:128,onChange:e=>T(e.target.value),onKeyDown:e=>e.key===`Enter`&&A(w)}),w&&c(a,{className:`w-[15px] h-[15px] text-text3 shrink-0 cursor-pointer active:opacity-70`,onClick:()=>T(``)})]}),c(e,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:()=>A(w),children:c(n,{className:`text-[16px] text-text1 leading-[24px] font-normal`,children:S})})]})}export{m as SearchInputClient};
@@ -4,8 +4,8 @@ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
5
5
  //#region components/biz/business/search-input/server.d.ts
6
6
  /**
7
- * 搜索输入框物料组件 (SearchInput) - 服务端部分
7
+ * 搜索输入框物料组件 (SearchInput) - 服务端部分,国际化由 Client 内 useTranslations 处理
8
8
  */
9
- declare function SearchInputServer(props: SearchInputProps): Promise<react_jsx_runtime0.JSX.Element>;
9
+ declare function SearchInputServer(props: SearchInputProps): react_jsx_runtime0.JSX.Element;
10
10
  //#endregion
11
11
  export { SearchInputServer };
@@ -1,2 +1,2 @@
1
1
 
2
- import{SearchInputClient as e}from"./client.mjs";import{jsx as t}from"react/jsx-runtime";import{getTranslations as n}from"next-intl/server";async function r(r){let{mode:i=`renderer`,...a}=r,o=await n(`components.pages.search`);return t(e,{...a,mode:i,defaultPlaceholder:o(`topHeader.placeholder`),searchLabel:o(`topHeader.search`)})}export{r as SearchInputServer};
2
+ import{SearchInputClient as e}from"./client.mjs";import{jsx as t}from"react/jsx-runtime";function n(n){let{mode:r=`renderer`,...i}=n;return t(e,{...i,mode:r})}export{n as SearchInputServer};
@@ -11,7 +11,6 @@ interface ClientProps extends TextRecommendProps {
11
11
  }
12
12
  /**
13
13
  * 文字推荐物料组件 (推荐搜索) - 客户端交互部分
14
- * 适配 Figma 设计稿布局:一行展示2个,包含“换一批”功能,每批固定 6 个
15
14
  */
16
15
  declare function TextRecommendClient(props: ClientProps): react_jsx_runtime0.JSX.Element | null;
17
16
  //#endregion
@@ -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{useTranslations as s}from"next-intl";import{usePathname as c,useRouter as l,useSearchParams as u}from"next/navigation";const d=[];function f(f){let p=s(`components.biz.business.textRecommend`),{title:m,items:h=d,onItemClick:g,mode:_=`renderer`}=f,v=_===`editor`,y=l(),b=c(),x=u(),[S,C]=i(0),w=Math.ceil(h.length/6),T=r(()=>{if(h.length<=6)return h;let e=S%w*6;return h.slice(e,e+6)},[h,S,w]);if(h.length===0)return null;let E=e=>{e.stopPropagation(),C(e=>e+1)},D=e=>{if(g)g(e);else{let t=new URLSearchParams(x.toString());t.set(`q`,e);let n=b.includes(`/search-result`)?b:`/search-result`;y.push(`${n}?${t.toString()}`)}};return o(e,{className:v?`bg-bg1 p-3 flex flex-col gap-3 w-full pointer-events-none`:`bg-bg1 p-3 flex flex-col gap-3 w-full`,children:[o(e,{className:`flex items-center justify-between w-full`,children:[a(t,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:m||p(`defaultTitle`)}),o(e,{className:`flex items-center gap-1 cursor-pointer active:opacity-70 transition-opacity`,onClick:E,children:[a(t,{className:`text-[14px] text-text3 leading-[22px]`,children:p(`refreshBatch`)}),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:T.map((n,r)=>a(e,{className:`flex items-center h-[32px] cursor-pointer active:opacity-70 transition-opacity overflow-hidden`,onClick:()=>D(n.label),children:a(t,{className:`text-[14px] text-text1 leading-[22px] truncate w-full`,children:n.label})},`${S}-${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 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(d){let{title:f,items:p=u,onItemClick:m,mode:h=`renderer`}=d,g=h===`editor`,_=c(),v=s(),y=l(),[b,x]=i(0),S=r(()=>{if(p.length<=6)return p;let e=b%Math.ceil(p.length/6)*6;return p.slice(e,e+6)},[p,b]);if(p.length===0)return null;let C=e=>{e.stopPropagation(),x(e=>e+1)},w=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 o(e,{className:`bg-bg1 p-3 flex flex-col gap-3 w-full${g?` 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:f}),o(e,{className:`flex items-center gap-1 cursor-pointer active:opacity-70 transition-opacity`,onClick:C,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:S.map((n,r)=>a(e,{className:`flex items-center h-[32px] cursor-pointer active:opacity-70 transition-opacity overflow-hidden`,onClick:()=>w(n.label),children:a(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
- import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineNumberPropSchema as n,defineTextPropSchema as r}from"../../../../utils/schema/schema.mjs";import{z as i}from"zod";const a=t({title:r({label:`标题名称`,defaultValue:`推荐搜索`,description:`支持输入,中/英/数/符,6个字符`}),displayCount:n({label:`展示数`,defaultValue:2}),items:e(i.object({label:r({label:`热词`,defaultValue:`爱回家中文`})}),{label:`推荐位模块`,defaultValue:[{label:`爱回家中文`},{label:`爱回家中文`}]})});export{a as textRecommendInspectorPropsSchema};
2
+ import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineNumberPropSchema as n,defineTextPropSchema as r}from"../../../../utils/schema/schema.mjs";import{z as i}from"zod";const a=t({title:r({label:`标题名称`,defaultValue:`文字推荐标题`,description:`支持输入,中/英/数/符,6个字符`}),displayCount:n({label:`展示数`,defaultValue:2}),items:e(i.object({label:r({label:`热词`,defaultValue:`推荐搜索1`})}),{label:`推荐位模块`,defaultValue:[{label:`推荐搜索2`},{label:`推荐搜索3`}]})});export{a as textRecommendInspectorPropsSchema};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Input as e}from"../../ui/input.mjs";import{useKeepAliveEffect as t,useKeepAliveState as n}from"../../common/keep-scroll-position/index.mjs";import{isPCEnv as r}from"../../../utils/tools.mjs";import{HeaderNav as i}from"../../common/header-nav/client.mjs";import a from"../../../assets/icons/search.mjs";import o from"../../../assets/icons/clear.mjs";import s from"./style.module.mjs";import{memo as c,useCallback as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{useTranslations as f}from"next-intl";import{useSearchParams as p}from"next/navigation";const m=c(({setSearchInputVal:c,initInputVal:m,initInputVersion:h,addSearchHistory:g})=>{let _=f(`components.pages.search`),[v,y]=n(`search-input-val`,``),b=p().get(`q`),x=e=>{let t=e.target.value;y(t)},S=l(e=>{c(e),g(e)},[g,c]);return t(()=>{m&&(y(m),S(m))},[m,h],`search-init-input-effect`),t(()=>{b&&(y(b),S(b))},[b],`search-url-params-effect`),u(i,{className:`h-[55px]`,rightChild:u(`div`,{className:`cursor-pointer w-[52px] flex items-center justify-center`,onClick:()=>{v&&S(v)},children:u(`span`,{className:`text-[16px] text-text1`,children:_(`topHeader.search`)})}),centerChild:d(`header`,{className:`w-[calc(100%-52px-48px)] ml-[-15px] h-[35px] rounded-[20px] flex items-center justify-center relative overflow-hidden border-line1 border-[1px]`,children:[u(`div`,{className:`absolute left-0 top-0 w-full h-full bg-bg2 opacity-50`}),u(a,{className:`w-[16px] h-[16px] text-text3 absolute left-[12px] top-[9px] z-[1]`}),u(e,{placeholder:_(`topHeader.placeholder`),maxLength:20,value:v,className:s.searchInput,onChange:x,onKeyDown:e=>{if(e.key===`Enter`){if(e.preventDefault(),!v)return;S(v)}}}),v&&u(o,{className:`w-[15px] h-[15px] text-text3 z-10 absolute right-[12px]`,onClick:()=>{r()||(y(``),c(``))}})]})})});export{m as default};
2
+ "use client";import{Input as e}from"../../ui/input.mjs";import{useKeepAliveEffect as t,useKeepAliveState as n}from"../../common/keep-scroll-position/index.mjs";import{isPCEnv as r}from"../../../utils/tools.mjs";import{HeaderNav as i}from"../../common/header-nav/client.mjs";import a from"../../../assets/icons/search.mjs";import o from"../../../assets/icons/clear.mjs";import s from"./style.module.mjs";import{memo as c,useCallback as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{useTranslations as f}from"next-intl";import{useSearchParams as p}from"next/navigation";function m(){}const h=c(({setSearchInputVal:c,initInputVal:h,initInputVersion:g,addSearchHistory:_,clearCallback:v=m})=>{let y=f(`components.pages.search`),[b,x]=n(`search-input-val`,``),S=p().get(`q`),C=e=>{let t=e.target.value;x(t)},w=l(e=>{c(e),_(e)},[_,c]);return t(()=>{h&&(x(h),w(h))},[h,g],`search-init-input-effect`),t(()=>{S&&(x(S),w(S))},[S],`search-url-params-effect`),u(i,{className:`h-[55px]`,rightChild:u(`div`,{className:`cursor-pointer w-[52px] flex items-center justify-center`,onClick:()=>{b&&w(b)},children:u(`span`,{className:`text-[16px] text-text1`,children:y(`topHeader.search`)})}),centerChild:d(`header`,{className:`w-[calc(100%-52px-48px)] ml-[-15px] h-[35px] rounded-[20px] flex items-center justify-center relative overflow-hidden border-line1 border-[1px]`,children:[u(`div`,{className:`absolute left-0 top-0 w-full h-full bg-bg2 opacity-50`}),u(a,{className:`w-[16px] h-[16px] text-text3 absolute left-[12px] top-[9px] z-[1]`}),u(e,{placeholder:y(`topHeader.placeholder`),maxLength:20,value:b,className:s.searchInput,onChange:C,onKeyDown:e=>{if(e.key===`Enter`){if(e.preventDefault(),!b)return;w(b)}}}),b&&u(o,{className:`w-[15px] h-[15px] text-text3 z-10 absolute right-[12px]`,onClick:()=>{r()||(x(``),c(``),v())}})]})})});export{h as default};
@@ -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{Box as r}from"../../ui/box.mjs";import{eventKey as i}from"../../../constants/event-key.mjs";import{useSearchHistory as a}from"../../../hooks/use-search-history.mjs";import o from"../search/top-header.mjs";import s from"./search-user.mjs";import c from"./search-video.mjs";import l from"./search-all.mjs";import{SORT_OPTIONS as u,SearchTab as d}from"./search-tab.mjs";import{useEffect as f,useMemo as p,useState as m}from"react";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";import{useSearchParams as v}from"next/navigation";const y=[{label:`综合`,value:`all`},{label:`视频`,value:`video`},{label:`用户`,value:`user`}];function b(){let{userInfo:b}=n(),x=b?.user_id||`guest`,S=v().get(`q`)?.toString()||``,C=S?decodeURIComponent(S):``,[w,T]=m(C),[E]=m(C),[D]=m(0),[O,k]=m(y[0].value),[A,j]=m(u[0].value),[M,N]=m(0),[,P]=m([]),{addHistory:F}=a({storageKey:x}),I=p(()=>w.trim()!==``,[w]);return f(()=>(t.on(i.EXCHANGE_SEARCH_TYPE,k),()=>{t.off(i.EXCHANGE_SEARCH_TYPE,k)}),[k]),_(r,{className:`w-full min-h-screen bg-bg1 pb-[12px] overscroll-y-none`,children:[g(o,{setSearchInputVal:t=>{t!==w&&(P([]),T(t),e({q:t}))},initInputVal:E,initInputVersion:D,addSearchHistory:F}),g(d,{searchType:O,tabList:y,onChange:e=>{k(e),P([])},sort:A,onSortChange:e=>{j(e),N(e=>e+1)}}),I&&_(h,{children:[O===`user`&&g(s,{mode:`user`,inputVal:w,sort:A,refreshVersion:M}),O===`all`&&g(l,{searchInputVal:w,sort:A,refreshVersion:M}),O===`video`&&g(c,{mode:`video`,inputVal:w,sort:A,refreshVersion:M})]}),!I&&g(r,{className:`w-full pt-[12px]`})]})}export{b 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{Box as r}from"../../ui/box.mjs";import{eventKey as i}from"../../../constants/event-key.mjs";import{useSearchHistory as a}from"../../../hooks/use-search-history.mjs";import o from"../search/top-header.mjs";import s from"./search-user.mjs";import c from"./search-video.mjs";import l from"./search-all.mjs";import{SORT_OPTIONS as u,SearchTab as d}from"./search-tab.mjs";import{useEffect as f,useMemo as p,useState as m}from"react";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";import{useRouter as v,useSearchParams as y}from"next/navigation";const b=[{label:`综合`,value:`all`},{label:`视频`,value:`video`},{label:`用户`,value:`user`}];function x(){let x=v(),{userInfo:S}=n(),C=S?.user_id||`guest`,w=y().get(`q`)?.toString()||``,T=w?decodeURIComponent(w):``,[E,D]=m(T),[O]=m(T),[k]=m(0),[A,j]=m(b[0].value),[M,N]=m(u[0].value),[P,F]=m(0),[,I]=m([]),{addHistory:L}=a({storageKey:C}),R=p(()=>E.trim()!==``,[E]);f(()=>(t.on(i.EXCHANGE_SEARCH_TYPE,j),()=>{t.off(i.EXCHANGE_SEARCH_TYPE,j)}),[j]);function z(){x.push(`/search`)}return _(r,{className:`w-full min-h-screen bg-bg1 pb-[12px] overscroll-y-none`,children:[g(o,{setSearchInputVal:t=>{t!==E&&(I([]),D(t),e({q:t}))},initInputVal:O,initInputVersion:k,addSearchHistory:L,clearCallback:z}),g(d,{searchType:A,tabList:b,onChange:e=>{j(e),I([])},sort:M,onSortChange:e=>{N(e),F(e=>e+1)}}),R&&_(h,{children:[A===`user`&&g(s,{mode:`user`,inputVal:E,sort:M,refreshVersion:P}),A===`all`&&g(l,{searchInputVal:E,sort:M,refreshVersion:P}),A===`video`&&g(c,{mode:`video`,inputVal:E,sort:M,refreshVersion:P})]}),!R&&g(r,{className:`w-full pt-[12px]`})]})}export{x as default};
@@ -1,2 +1,2 @@
1
1
 
2
- "use client";import{Button as e}from"../../../ui/button.mjs";import{hashPassword as t}from"../../../../utils/common.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{pUserResetPassword as r,pUserSendResetPasswordEmailCode as i,pUserVerifyResetPasswordEmailCode as a}from"../../../../service/generated/client.mjs";import{getPasswordValidationErrorText as o,validatePasswordPair as ee}from"../../../../utils/password-validator.mjs";import{Box as s}from"../../../ui/box.mjs";import{Drawer as c,DrawerContent as l,DrawerDescription as u,DrawerHeader as d,DrawerTitle as f}from"../../../ui/drawer.mjs";import{Text as p}from"../../../ui/text.mjs";import m from"../../../ui/legacy/button.mjs";import{EyeIcon as h}from"../../../../assets/icons/eye-icon.mjs";import{EyeOffIcon as g}from"../../../../assets/icons/eye-off-icon.mjs";import{HeaderNav as _}from"../../../common/header-nav/client.mjs";import v from"../../../ui/legacy/input.mjs";import{useEffect as y,useMemo as b,useRef as x,useState as S}from"react";import{jsx as C,jsxs as w}from"react/jsx-runtime";import{toast as T}from"sonner";import{useTranslations as te}from"next-intl";function E(E){let D=te(`components.pages.settings.components`),{open:O,onOpenChange:k}=E,A=n(e=>e.userInfo),[j,M]=S(``),ne=j.length!==6,N=x(null),[P,F]=S(60),[I,L]=S(!1);async function R(){if(I)return;let e=T.loading(D(`resetPasswordDrawer.sending`));try{let t=await i({user_id:A?.user_id});t.code===0?(T.success(D(`resetPasswordDrawer.codeSentSuccess`),{id:e}),L(!0),F(60)):T.error(t.message||D(`resetPasswordDrawer.sendFailed`),{id:e})}catch(t){console.error(t),T.error(D(`resetPasswordDrawer.sendFailed`),{id:e})}}function z(){H(e=>e===1?e:e+1)}async function B(){let e=T.loading(D(`resetPasswordDrawer.verifying`));try{let t=await a({user_id:A?.user_id,email_code:j});t.code===0?(T.success(D(`resetPasswordDrawer.verifySuccess`),{id:e}),z()):T.error(t.message||D(`resetPasswordDrawer.verifyFailed`),{id:e})}catch(t){console.error(t),T.error(D(`resetPasswordDrawer.verifyFailed`),{id:e})}}y(()=>{if(I)return N.current=setInterval(()=>{F(e=>e<=1?(N.current&&clearInterval(N.current),L(!1),60):e-1)},1e3),()=>{N.current&&clearInterval(N.current)}},[I]);let[V,H]=S(0),[U,W]=S({password:``,confirmPassword:``}),[G,K]=S(!1),[q,J]=S(!1),[Y,X]=S(!1),Z=b(()=>ee(U.password,U.confirmPassword),[U.password,U.confirmPassword]),Q=b(()=>o(Z),[Z]),$=b(()=>G||U.password.length===0||U.confirmPassword.length===0||Z.type!==`none`,[G,U.password.length,U.confirmPassword.length,Z.type]);async function re(){if($)return;let e=T.loading(D(`resetPasswordDrawer.submitting`));try{K(!0);let n=await r({user_id:A?.user_id,password:t(U.password)});n.code===0?(T.success(D(`resetPasswordDrawer.passwordResetSuccess`),{id:e}),W({password:``,confirmPassword:``}),M(``),k(!1)):T.error(n.message||D(`resetPasswordDrawer.resetFailed`),{id:e})}catch(t){console.error(t),T.error(D(`resetPasswordDrawer.resetFailed`),{id:e})}finally{K(!1)}}let ie=w(s,{className:`p-6`,children:[C(s,{children:w(p,{className:`text-text2`,children:[D(`resetPasswordDrawer.boundEmailNotice`),C(p,{className:`dark:text-white text-white`,children:A?.email}),D(`resetPasswordDrawer.verifyHint`)]})}),w(s,{className:`mt-6 space-y-6`,children:[w(s,{className:`flex relative items-center px-2 rounded-[50px] h-16.5 bg-line1 border border-line1`,children:[C(v,{value:j,onChange:e=>M(e)}),C(e,{variant:`link`,disabled:I,onClick:R,children:I?`${P}s ${D(`resetPasswordDrawer.resendAfter`)}`:D(`resetPasswordDrawer.sendCode`)})]}),C(m,{onClick:B,disabled:ne,className:`w-full h-15 !rounded-[30px] !text-[18px] font-bold leading-6.5 bg-theme6 disabled:bg-theme6/40 disabled:text-text3 active:opacity-90 !px-0 !py-0`,children:D(`resetPasswordDrawer.verifyEmailButton`)})]})]}),ae=w(s,{className:`p-6`,children:[C(s,{children:C(p,{className:`text-text2`,children:D(`resetPasswordDrawer.setNewPasswordHint`)})}),w(s,{className:`mt-6 space-y-6`,children:[w(s,{className:`flex relative items-center px-2 rounded-[50px] h-16.5 bg-line1 border ${Q?`border-theme5`:`border-line1`}`,children:[C(v,{value:U.password,onChange:e=>W(t=>({...t,password:e})),placeholder:D(`resetPasswordDrawer.passwordPlaceholder`),type:q?`text`:`password`,autoComplete:`new-password`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`pr-10`}),C(`button`,{type:`button`,onClick:()=>J(!q),className:`absolute right-4 top-1/2 -translate-y-1/2 text-text2 hover:text-text1 transition-colors`,children:C(q?g:h,{className:`w-5 h-5`})})]}),w(s,{className:`flex relative items-center px-2 rounded-[50px] h-16.5 bg-line1 border ${Z.type===`not-match`?`border-theme5`:`border-line1`}`,children:[C(v,{value:U.confirmPassword,onChange:e=>W(t=>({...t,confirmPassword:e})),placeholder:D(`resetPasswordDrawer.confirmPasswordPlaceholder`),type:Y?`text`:`password`,autoComplete:`new-password`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`pr-10`}),C(`button`,{type:`button`,onClick:()=>X(!Y),className:`absolute right-4 top-1/2 -translate-y-1/2 text-text2 hover:text-text1 transition-colors`,children:C(Y?g:h,{className:`w-5 h-5`})})]}),C(p,{className:`min-h-[22px] text-[14px] text-theme5 px-[12px]`,children:Q}),C(m,{onClick:re,disabled:$,className:`w-full h-15 !rounded-[30px] !text-[18px] font-bold leading-6.5 bg-theme6 disabled:bg-theme6/40 disabled:text-text3 active:opacity-90 !px-0 !py-0`,children:D(G?`resetPasswordDrawer.submitting`:`resetPasswordDrawer.resetPassword`)})]})]});return w(c,{open:O,onOpenChange:k,direction:`right`,handleOnly:!0,children:[w(d,{className:`hidden`,children:[C(f,{children:D(`resetPasswordDrawer.title`)}),C(u,{children:D(`resetPasswordDrawer.title`)})]}),w(l,{className:`!w-full`,children:[C(_,{onBack:()=>k(!1),title:D(`resetPasswordDrawer.title`)}),V===0&&ie,V===1&&ae]})]})}export{E as ResetPasswordDrawer};
2
+ "use client";import{Button as e}from"../../../ui/button.mjs";import{hashPassword as t}from"../../../../utils/common.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{pUserResetPassword as r,pUserSendResetPasswordEmailCode as i,pUserVerifyResetPasswordEmailCode as a}from"../../../../service/generated/client.mjs";import{getPasswordValidationErrorText as o,validatePasswordPair as ee}from"../../../../utils/password-validator.mjs";import{Box as s}from"../../../ui/box.mjs";import{Drawer as c,DrawerContent as l,DrawerDescription as u,DrawerHeader as d,DrawerTitle as f}from"../../../ui/drawer.mjs";import{Text as p}from"../../../ui/text.mjs";import m from"../../../ui/legacy/button.mjs";import{EyeIcon as h}from"../../../../assets/icons/eye-icon.mjs";import{EyeOffIcon as g}from"../../../../assets/icons/eye-off-icon.mjs";import{HeaderNav as _}from"../../../common/header-nav/client.mjs";import v from"../../../ui/legacy/input.mjs";import{useEffect as y,useMemo as b,useRef as x,useState as S}from"react";import{jsx as C,jsxs as w}from"react/jsx-runtime";import{toast as T}from"sonner";import{useTranslations as te}from"next-intl";function E(E){let D=te(`components.pages.settings.components`),{open:O,onOpenChange:k}=E,A=n(e=>e.userInfo),[j,M]=S(``),ne=j.length!==6,N=x(null),[P,F]=S(60),[I,L]=S(!1);async function R(){if(I)return;let e=T.loading(D(`resetPasswordDrawer.sending`));try{let t=await i({user_id:A?.user_id});t.code===0?(T.success(D(`resetPasswordDrawer.codeSentSuccess`),{id:e}),L(!0),F(60)):T.error(t.message||D(`resetPasswordDrawer.sendFailed`),{id:e})}catch(t){console.error(t),T.error(D(`resetPasswordDrawer.sendFailed`),{id:e})}}function z(){H(e=>e===1?e:e+1)}async function B(){let e=T.loading(D(`resetPasswordDrawer.verifying`));try{let t=await a({user_id:A?.user_id,email_code:j});t.code===0?(T.success(D(`resetPasswordDrawer.verifySuccess`),{id:e}),z()):T.error(t.message||D(`resetPasswordDrawer.verifyFailed`),{id:e})}catch(t){console.error(t),T.error(D(`resetPasswordDrawer.verifyFailed`),{id:e})}}y(()=>{if(I)return N.current=setInterval(()=>{F(e=>e<=1?(N.current&&clearInterval(N.current),L(!1),60):e-1)},1e3),()=>{N.current&&clearInterval(N.current)}},[I]);let[V,H]=S(0),[U,W]=S({password:``,confirmPassword:``}),[G,K]=S(!1),[q,J]=S(!1),[Y,X]=S(!1),Z=b(()=>ee(U.password,U.confirmPassword),[U.password,U.confirmPassword]),Q=b(()=>o(Z),[Z]),$=b(()=>G||U.password.length===0||U.confirmPassword.length===0||Z.type!==`none`,[G,U.password.length,U.confirmPassword.length,Z.type]);async function re(){if($)return;let e=T.loading(D(`resetPasswordDrawer.submitting`));try{K(!0);let n=await r({user_id:A?.user_id,password:t(U.password)});n.code===0?(T.success(D(`resetPasswordDrawer.passwordResetSuccess`),{id:e}),W({password:``,confirmPassword:``}),M(``),k(!1)):T.error(n.message||D(`resetPasswordDrawer.resetFailed`),{id:e})}catch(t){console.error(t),T.error(D(`resetPasswordDrawer.resetFailed`),{id:e})}finally{K(!1)}}let ie=w(s,{className:`p-6`,children:[C(s,{children:w(p,{className:`text-text2`,children:[D(`resetPasswordDrawer.boundEmailNotice`),C(p,{className:`dark:text-white text-white`,children:A?.email}),D(`resetPasswordDrawer.verifyHint`)]})}),w(s,{className:`mt-6 space-y-6`,children:[w(s,{className:`flex relative items-center px-2 rounded-[50px] h-16.5 bg-line1 border border-line1`,children:[C(v,{value:j,onChange:e=>M(e)}),C(e,{variant:`link`,disabled:I,onClick:R,children:I?`${P}s ${D(`resetPasswordDrawer.resendAfter`)}`:D(`resetPasswordDrawer.sendCode`)})]}),C(m,{onClick:B,disabled:ne,className:`w-full h-15 !rounded-[30px] !text-[18px] font-bold leading-6.5 bg-theme6 disabled:bg-theme6/40 disabled:text-text3 active:opacity-90 !px-0 !py-0`,children:D(`resetPasswordDrawer.verifyEmailButton`)})]})]}),ae=w(s,{className:`p-6`,children:[C(s,{children:C(p,{className:`text-text2`,children:D(`resetPasswordDrawer.setNewPasswordHint`)})}),w(s,{className:`mt-6 space-y-6`,children:[w(s,{className:`flex relative items-center px-2 rounded-[50px] h-16.5 bg-line1 border ${Q?`border-theme5`:`border-line1`}`,children:[C(v,{value:U.password,onChange:e=>W(t=>({...t,password:e})),placeholder:D(`resetPasswordDrawer.passwordPlaceholder`),type:q?`text`:`password`,autoComplete:`new-password`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`pr-10`}),C(`button`,{type:`button`,onClick:()=>J(!q),className:`absolute right-4 top-1/2 -translate-y-1/2 text-text2 hover:text-text1 transition-colors`,children:C(q?g:h,{className:`w-5 h-5`})})]}),w(s,{className:`flex relative items-center px-2 rounded-[50px] h-16.5 bg-line1 border ${Z.type===`not-match`?`border-theme5`:`border-line1`}`,children:[C(v,{value:U.confirmPassword,onChange:e=>W(t=>({...t,confirmPassword:e})),placeholder:D(`resetPasswordDrawer.confirmPasswordPlaceholder`),type:Y?`text`:`password`,autoComplete:`new-password`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`pr-10`}),C(`button`,{type:`button`,onClick:()=>X(!Y),className:`absolute right-4 top-1/2 -translate-y-1/2 text-text2 hover:text-text1 transition-colors`,children:C(Y?g:h,{className:`w-5 h-5`})})]}),C(s,{children:C(p,{className:`min-h-[22px] text-[14px] text-theme5 px-[12px]`,children:Q})}),C(m,{onClick:re,disabled:$,className:`w-full h-15 !rounded-[30px] !text-[18px] font-bold leading-6.5 bg-theme6 disabled:bg-theme6/40 disabled:text-text3 active:opacity-90 !px-0 !py-0`,children:D(G?`resetPasswordDrawer.submitting`:`resetPasswordDrawer.resetPassword`)})]})]});return w(c,{open:O,onOpenChange:k,direction:`right`,handleOnly:!0,children:[w(d,{className:`hidden`,children:[C(f,{children:D(`resetPasswordDrawer.title`)}),C(u,{children:D(`resetPasswordDrawer.title`)})]}),w(l,{className:`!w-full`,children:[C(_,{onBack:()=>k(!1),title:D(`resetPasswordDrawer.title`)}),V===0&&ie,V===1&&ae]})]})}export{E as ResetPasswordDrawer};
@@ -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?: "default" | "link" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
9
+ variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
10
10
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
11
11
  /** Badge 组件。 */
12
12
  declare function Badge({
@@ -7,8 +7,8 @@ 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?: "default" | "link" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
11
- size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
10
+ variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost" | null | undefined;
11
+ size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
12
12
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
13
13
  /** Button 组件属性。 */
14
14
  type ButtonProps = Button.Props & VariantProps<typeof buttonVariants> & {
@@ -1,11 +1,11 @@
1
1
 
2
2
  import * as React from "react";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
- import NextImage from "next/image";
4
+ import Image from "next/image";
5
5
 
6
6
  //#region components/ui/image.d.ts
7
7
  /** BaseImageProps 属性定义。 */
8
- type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof NextImage>, 'className' | 'src' | 'alt' | 'width' | 'height' | 'loading' | 'priority' | 'fill' | 'style'>;
8
+ type BaseImageProps = Omit<React.ComponentPropsWithoutRef<typeof Image>, 'className' | 'src' | 'alt' | 'width' | 'height' | 'loading' | 'priority' | 'fill' | 'style'>;
9
9
  type CommonImageProps = BaseImageProps & {
10
10
  /** 图片地址,支持普通 URL、默认资源路径和加密地址。 */src: string; /** 图片替代文本。 */
11
11
  alt?: string; /** 图片类名。 */
@@ -27,6 +27,6 @@ type ImagePropsWithSize = CommonImageProps & {
27
27
  /** ImageProps 属性定义。 */
28
28
  type ImageProps = ImagePropsWithFill | ImagePropsWithSize;
29
29
  /** 图片组件:支持 bnc 解密、默认资源域名拼接与错误占位。 */
30
- declare function Image(props: ImageProps): react_jsx_runtime0.JSX.Element;
30
+ declare function Image$1(props: ImageProps): react_jsx_runtime0.JSX.Element;
31
31
  //#endregion
32
- export { BaseImageProps, CommonImageProps, Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };
32
+ export { BaseImageProps, CommonImageProps, Image$1 as Image, ImageProps, ImagePropsWithFill, ImagePropsWithSize };
@@ -1,2 +1,2 @@
1
1
 
2
- import e from"../utils/event-bus.mjs";import{eventKey as t}from"../constants/event-key.mjs";import{useEffect as n,useState as r}from"react";function i({storageKey:i,maxCount:a=20}){let[o,s]=r([]),c=`search_history_${i}`;return n(()=>{let e=localStorage.getItem(c);if(e)try{s(JSON.parse(e))}catch(e){console.error(`Failed to parse search history`,e)}},[c]),{history:o,addHistory:n=>{if(!n.trim())return;let r=[n,...o.filter(e=>e!==n)].slice(0,a);s(r),localStorage.setItem(c,JSON.stringify(r)),e.emit(t.SEARCH_HISTORY_UPDATE)},clearHistory:()=>{s([]),localStorage.removeItem(c),e.emit(t.SEARCH_HISTORY_UPDATE)}}}export{i as useSearchHistory};
2
+ import e from"../utils/event-bus.mjs";import{eventKey as t}from"../constants/event-key.mjs";import{useEffect as n,useState as r}from"react";function i({storageKey:i,maxCount:a=20}){let[o,s]=r([]),c=`search_history_${i}`;return n(()=>{let e=localStorage.getItem(c);if(e)try{s(JSON.parse(e))}catch(e){console.error(`Failed to parse search history`,e)}},[c]),{history:o,addHistory:n=>{if(!n.trim())return;let r=n.trim();try{let e=localStorage.getItem(c),t=[];if(e)try{let n=JSON.parse(e);t=Array.isArray(n)?n.map(e=>String(e).trim()).filter(Boolean):[]}catch{t=[]}let n=[r,...t.filter(e=>e!==r)].slice(0,a);s(n),localStorage.setItem(c,JSON.stringify(n))}catch(e){console.error(`Failed to save search history`,e)}e.emit(t.SEARCH_HISTORY_UPDATE)},clearHistory:()=>{s([]),localStorage.removeItem(c),e.emit(t.SEARCH_HISTORY_UPDATE)}}}export{i as useSearchHistory};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@funhub/platform",
3
3
  "type": "module",
4
- "version": "0.1.68",
4
+ "version": "0.1.70",
5
5
  "private": false,
6
6
  "sideEffects": [
7
7
  "**/*.css"