5 lines
51 KiB
JavaScript
5 lines
51 KiB
JavaScript
module.exports=[97445,(a,b,c)=>{"use strict";function d({widthInt:a,heightInt:b,blurWidth:c,blurHeight:d,blurDataURL:e,objectFit:f}){let g=c?40*c:a,h=d?40*d:b,i=g&&h?`viewBox='0 0 ${g} ${h}'`:"";return`%3Csvg xmlns='http://www.w3.org/2000/svg' ${i}%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${i?"none":"contain"===f?"xMidYMid":"cover"===f?"xMidYMid slice":"none"}' style='filter: url(%23b);' href='${e}'/%3E%3C/svg%3E`}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"getImageBlurSvg",{enumerable:!0,get:function(){return d}})},75457,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d={VALID_LOADERS:function(){return f},imageConfigDefault:function(){return g}};for(var e in d)Object.defineProperty(c,e,{enumerable:!0,get:d[e]});let f=["default","imgix","cloudinary","akamai","custom"],g={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:14400,formats:["image/webp"],maximumRedirects:3,dangerouslyAllowLocalIP:!1,dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"attachment",localPatterns:void 0,remotePatterns:[],qualities:[75],unoptimized:!1}},889,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"getImgProps",{enumerable:!0,get:function(){return i}}),a.r(93089);let d=a.r(97445),e=a.r(75457),f=["-moz-initial","fill","none","scale-down",void 0];function g(a){return void 0!==a.default}function h(a){return void 0===a?a:"number"==typeof a?Number.isFinite(a)?a:NaN:"string"==typeof a&&/^[0-9]+$/.test(a)?parseInt(a,10):NaN}function i({src:a,sizes:b,unoptimized:c=!1,priority:i=!1,preload:j=!1,loading:k,className:l,quality:m,width:n,height:o,fill:p=!1,style:q,overrideSrc:r,onLoad:s,onLoadingComplete:t,placeholder:u="empty",blurDataURL:v,fetchPriority:w,decoding:x="async",layout:y,objectFit:z,objectPosition:A,lazyBoundary:B,lazyRoot:C,...D},E){var F;let G,H,I,{imgConf:J,showAltText:K,blurComplete:L,defaultLoader:M}=E,N=J||e.imageConfigDefault;if("allSizes"in N)G=N;else{let a=[...N.deviceSizes,...N.imageSizes].sort((a,b)=>a-b),b=N.deviceSizes.sort((a,b)=>a-b),c=N.qualities?.sort((a,b)=>a-b);G={...N,allSizes:a,deviceSizes:b,qualities:c}}if(void 0===M)throw Object.defineProperty(Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config"),"__NEXT_ERROR_CODE",{value:"E163",enumerable:!1,configurable:!0});let O=D.loader||M;delete D.loader,delete D.srcSet;let P="__next_img_default"in O;if(P){if("custom"===G.loader)throw Object.defineProperty(Error(`Image with src "${a}" is missing "loader" prop.
|
|
Read more: https://nextjs.org/docs/messages/next-image-missing-loader`),"__NEXT_ERROR_CODE",{value:"E252",enumerable:!1,configurable:!0})}else{let a=O;O=b=>{let{config:c,...d}=b;return a(d)}}if(y){"fill"===y&&(p=!0);let a={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[y];a&&(q={...q,...a});let c={responsive:"100vw",fill:"100vw"}[y];c&&!b&&(b=c)}let Q="",R=h(n),S=h(o);if((F=a)&&"object"==typeof F&&(g(F)||void 0!==F.src)){let b=g(a)?a.default:a;if(!b.src)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(b)}`),"__NEXT_ERROR_CODE",{value:"E460",enumerable:!1,configurable:!0});if(!b.height||!b.width)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(b)}`),"__NEXT_ERROR_CODE",{value:"E48",enumerable:!1,configurable:!0});if(H=b.blurWidth,I=b.blurHeight,v=v||b.blurDataURL,Q=b.src,!p)if(R||S){if(R&&!S){let a=R/b.width;S=Math.round(b.height*a)}else if(!R&&S){let a=S/b.height;R=Math.round(b.width*a)}}else R=b.width,S=b.height}let T=!i&&!j&&("lazy"===k||void 0===k);(!(a="string"==typeof a?a:Q)||a.startsWith("data:")||a.startsWith("blob:"))&&(c=!0,T=!1),G.unoptimized&&(c=!0),P&&!G.dangerouslyAllowSVG&&a.split("?",1)[0].endsWith(".svg")&&(c=!0);let U=h(m),V=Object.assign(p?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:z,objectPosition:A}:{},K?{}:{color:"transparent"},q),W=L||"empty"===u?null:"blur"===u?`url("data:image/svg+xml;charset=utf-8,${(0,d.getImageBlurSvg)({widthInt:R,heightInt:S,blurWidth:H,blurHeight:I,blurDataURL:v||"",objectFit:V.objectFit})}")`:`url("${u}")`,X=f.includes(V.objectFit)?"fill"===V.objectFit?"100% 100%":"cover":V.objectFit,Y=W?{backgroundSize:X,backgroundPosition:V.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:W}:{},Z=function({config:a,src:b,unoptimized:c,width:d,quality:e,sizes:f,loader:g}){if(c)return{src:b,srcSet:void 0,sizes:void 0};let{widths:h,kind:i}=function({deviceSizes:a,allSizes:b},c,d){if(d){let c=/(^|\s)(1?\d?\d)vw/g,e=[];for(let a;a=c.exec(d);)e.push(parseInt(a[2]));if(e.length){let c=.01*Math.min(...e);return{widths:b.filter(b=>b>=a[0]*c),kind:"w"}}return{widths:b,kind:"w"}}return"number"!=typeof c?{widths:a,kind:"w"}:{widths:[...new Set([c,2*c].map(a=>b.find(b=>b>=a)||b[b.length-1]))],kind:"x"}}(a,d,f),j=h.length-1;return{sizes:f||"w"!==i?f:"100vw",srcSet:h.map((c,d)=>`${g({config:a,src:b,quality:e,width:c})} ${"w"===i?c:d+1}${i}`).join(", "),src:g({config:a,src:b,quality:e,width:h[j]})}}({config:G,src:a,unoptimized:c,width:R,quality:U,sizes:b,loader:O}),$=T?"lazy":k;return{props:{...D,loading:$,fetchPriority:w,width:R,height:S,decoding:x,className:l,style:{...V,...Y},sizes:Z.sizes,srcSet:Z.srcSet,src:r||Z.src},meta:{unoptimized:c,preload:j||i,placeholder:u,fill:p}}}},97836,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"default",{enumerable:!0,get:function(){return f}});let d=a.r(54297),e=()=>{};function f(a){let{headManager:b,reduceComponentsToState:c}=a;function f(){if(b&&b.mountedInstances){let a=d.Children.toArray(Array.from(b.mountedInstances).filter(Boolean));b.updateHead(c(a))}}return b?.mountedInstances?.add(a.children),f(),e(()=>(b?.mountedInstances?.add(a.children),()=>{b?.mountedInstances?.delete(a.children)})),e(()=>(b&&(b._pendingUpdate=f),()=>{b&&(b._pendingUpdate=f)})),null}},30314,(a,b,c)=>{"use strict";b.exports=a.r(81232).vendored.contexts.HeadManagerContext},8076,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d={default:function(){return p},defaultHead:function(){return l}};for(var e in d)Object.defineProperty(c,e,{enumerable:!0,get:d[e]});let f=a.r(2657),g=a.r(18253),h=a.r(6155),i=g._(a.r(54297)),j=f._(a.r(97836)),k=a.r(30314);function l(){return[(0,h.jsx)("meta",{charSet:"utf-8"},"charset"),(0,h.jsx)("meta",{name:"viewport",content:"width=device-width"},"viewport")]}function m(a,b){return"string"==typeof b||"number"==typeof b?a:b.type===i.default.Fragment?a.concat(i.default.Children.toArray(b.props.children).reduce((a,b)=>"string"==typeof b||"number"==typeof b?a:a.concat(b),[])):a.concat(b)}a.r(93089);let n=["name","httpEquiv","charSet","itemProp"];function o(a){let b,c,d,e;return a.reduce(m,[]).reverse().concat(l().reverse()).filter((b=new Set,c=new Set,d=new Set,e={},a=>{let f=!0,g=!1;if(a.key&&"number"!=typeof a.key&&a.key.indexOf("$")>0){g=!0;let c=a.key.slice(a.key.indexOf("$")+1);b.has(c)?f=!1:b.add(c)}switch(a.type){case"title":case"base":c.has(a.type)?f=!1:c.add(a.type);break;case"meta":for(let b=0,c=n.length;b<c;b++){let c=n[b];if(a.props.hasOwnProperty(c))if("charSet"===c)d.has(c)?f=!1:d.add(c);else{let b=a.props[c],d=e[c]||new Set;("name"!==c||!g)&&d.has(b)?f=!1:(d.add(b),e[c]=d)}}}return f})).reverse().map((a,b)=>{let c=a.key||b;return i.default.cloneElement(a,{key:c})})}let p=function({children:a}){let b=(0,i.useContext)(k.HeadManagerContext);return(0,h.jsx)(j.default,{reduceComponentsToState:o,headManager:b,children:a})};("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)},24044,(a,b,c)=>{"use strict";b.exports=a.r(81232).vendored.contexts.ImageConfigContext},77540,(a,b,c)=>{"use strict";b.exports=a.r(81232).vendored.contexts.RouterContext},51682,(a,b,c)=>{"use strict";function d(a,b){let c=a||75;return b?.qualities?.length?b.qualities.reduce((a,b)=>Math.abs(b-c)<Math.abs(a-c)?b:a,0):c}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"findClosestQuality",{enumerable:!0,get:function(){return d}})},1705,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"default",{enumerable:!0,get:function(){return f}});let d=a.r(51682);function e({config:a,src:b,width:c,quality:e}){if(b.startsWith("/")&&b.includes("?")&&a.localPatterns?.length===1&&"**"===a.localPatterns[0].pathname&&""===a.localPatterns[0].search)throw Object.defineProperty(Error(`Image with src "${b}" is using a query string which is not configured in images.localPatterns.
|
|
Read more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`),"__NEXT_ERROR_CODE",{value:"E871",enumerable:!1,configurable:!0});let f=(0,d.findClosestQuality)(e,a);return`${a.path}?url=${encodeURIComponent(b)}&w=${c}&q=${f}${b.startsWith("/_next/static/media/"),""}`}e.__next_img_default=!0;let f=e},3104,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"Image",{enumerable:!0,get:function(){return u}});let d=a.r(2657),e=a.r(18253),f=a.r(6155),g=e._(a.r(54297)),h=d._(a.r(7614)),i=d._(a.r(8076)),j=a.r(889),k=a.r(75457),l=a.r(24044);a.r(93089);let m=a.r(77540),n=d._(a.r(1705)),o=a.r(78133),p={deviceSizes:[640,750,828,1080,1200,1920],imageSizes:[16,32,48,64,96,128,256],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function q(a,b,c,d,e,f,g){let h=a?.src;a&&a["data-loaded-src"]!==h&&(a["data-loaded-src"]=h,("decode"in a?a.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(a.parentElement&&a.isConnected){if("empty"!==b&&e(!0),c?.current){let b=new Event("load");Object.defineProperty(b,"target",{writable:!1,value:a});let d=!1,e=!1;c.current({...b,nativeEvent:b,currentTarget:a,target:a,isDefaultPrevented:()=>d,isPropagationStopped:()=>e,persist:()=>{},preventDefault:()=>{d=!0,b.preventDefault()},stopPropagation:()=>{e=!0,b.stopPropagation()}})}d?.current&&d.current(a)}}))}function r(a){return g.use?{fetchPriority:a}:{fetchpriority:a}}globalThis.__NEXT_IMAGE_IMPORTED=!0;let s=(0,g.forwardRef)(({src:a,srcSet:b,sizes:c,height:d,width:e,decoding:h,className:i,style:j,fetchPriority:k,placeholder:l,loading:m,unoptimized:n,fill:p,onLoadRef:s,onLoadingCompleteRef:t,setBlurComplete:u,setShowAltText:v,sizesInput:w,onLoad:x,onError:y,...z},A)=>{let B=(0,g.useCallback)(a=>{a&&(y&&(a.src=a.src),a.complete&&q(a,l,s,t,u,n,w))},[a,l,s,t,u,y,n,w]),C=(0,o.useMergedRef)(A,B);return(0,f.jsx)("img",{...z,...r(k),loading:m,width:e,height:d,decoding:h,"data-nimg":p?"fill":"1",className:i,style:j,sizes:c,srcSet:b,src:a,ref:C,onLoad:a=>{q(a.currentTarget,l,s,t,u,n,w)},onError:a=>{v(!0),"empty"!==l&&u(!0),y&&y(a)}})});function t({isAppRouter:a,imgAttributes:b}){let c={as:"image",imageSrcSet:b.srcSet,imageSizes:b.sizes,crossOrigin:b.crossOrigin,referrerPolicy:b.referrerPolicy,...r(b.fetchPriority)};return a&&h.default.preload?(h.default.preload(b.src,c),null):(0,f.jsx)(i.default,{children:(0,f.jsx)("link",{rel:"preload",href:b.srcSet?void 0:b.src,...c},"__nimg-"+b.src+b.srcSet+b.sizes)})}let u=(0,g.forwardRef)((a,b)=>{let c=(0,g.useContext)(m.RouterContext),d=(0,g.useContext)(l.ImageConfigContext),e=(0,g.useMemo)(()=>{let a=p||d||k.imageConfigDefault,b=[...a.deviceSizes,...a.imageSizes].sort((a,b)=>a-b),c=a.deviceSizes.sort((a,b)=>a-b),e=a.qualities?.sort((a,b)=>a-b);return{...a,allSizes:b,deviceSizes:c,qualities:e,localPatterns:d?.localPatterns}},[d]),{onLoad:h,onLoadingComplete:i}=a,o=(0,g.useRef)(h);(0,g.useEffect)(()=>{o.current=h},[h]);let q=(0,g.useRef)(i);(0,g.useEffect)(()=>{q.current=i},[i]);let[r,u]=(0,g.useState)(!1),[v,w]=(0,g.useState)(!1),{props:x,meta:y}=(0,j.getImgProps)(a,{defaultLoader:n.default,imgConf:e,blurComplete:r,showAltText:v});return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(s,{...x,unoptimized:y.unoptimized,placeholder:y.placeholder,fill:y.fill,onLoadRef:o,onLoadingCompleteRef:q,setBlurComplete:u,setShowAltText:w,sizesInput:a.sizes,ref:b}),y.preload?(0,f.jsx)(t,{isAppRouter:!c,imgAttributes:x}):null]})});("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)},18054,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d={default:function(){return k},getImageProps:function(){return j}};for(var e in d)Object.defineProperty(c,e,{enumerable:!0,get:d[e]});let f=a.r(2657),g=a.r(889),h=a.r(3104),i=f._(a.r(1705));function j(a){let{props:b}=(0,g.getImgProps)(a,{defaultLoader:i.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920],imageSizes:[16,32,48,64,96,128,256],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[a,c]of Object.entries(b))void 0===c&&delete b[a];return{props:b}}let k=h.Image},87552,(a,b,c)=>{b.exports=a.r(18054)},32216,a=>{"use strict";var b=a.i(6155),c=a.i(31483),d=a.i(87552),e=a.i(16616),f=a.i(8895);a.i(99766);var g=a.i(38075),h=a.i(87240),i=a.i(74719),j=a.i(57657),k=a.i(16606),l=a.i(20334),m=a.i(18116),n=a.i(18951),o=a.i(64584),p=a.i(53902),q=a.i(38076),r=a.i(37111);let s=(0,r.default)("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);var t=a.i(92412),u=a.i(80218),v=a.i(46128),w=a.i(279),w=w,x=a.i(43181),y=a.i(54297),z=a.i(14672),A=a.i(90383),B=a.i(1845),C=a.i(59580),D=a.i(85801),E=a.i(90247),F=a.i(78802),G=a.i(65119);let H=(0,r.default)("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var I=a.i(75525),J=a.i(24749),K=a.i(6364);function L(){let{data:a}=(0,B.useSession)(),{currentTree:c}=(0,x.useFamily)(),{showConfirm:d,showAlert:e}=(0,K.useDialog)(),[g,i]=(0,y.useState)(!1),[j,k]=(0,y.useState)([]),[l,m]=(0,y.useState)(!1),[o,p]=(0,y.useState)(""),[q,r]=(0,y.useState)("VIEWER"),[s,t]=(0,y.useState)(""),[u,v]=(0,y.useState)(""),[w,z]=(0,y.useState)("");(0,y.useEffect)(()=>{g&&c?.id&&A()},[g,c?.id]);let A=async()=>{if(c?.id)try{let a=await fetch(`/api/trees/${c.id}/collaborators`);if(a.ok){let b=await a.json();k(b.collaborators)}}catch(a){console.error("加载协作者失败:",a)}},L=async a=>{if(a.preventDefault(),c?.id){m(!0),v(""),z("");try{let a=await fetch(`/api/trees/${c.id}/invite`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:o,role:q,password:s||void 0})}),b=await a.json();if(!a.ok)throw Error(b.error||"邀请失败");z(b.message),p(""),t(""),A()}catch(a){v(a.message)}finally{m(!1)}}},M=async a=>{if(c?.id&&await d("确定要移除此协作者吗?","移除协作者"))try{if(!(await fetch(`/api/trees/${c.id}/collaborators?userId=${a}`,{method:"DELETE"})).ok)throw Error("移除失败");A()}catch(a){console.error(a),await e("移除失败","错误")}};return c&&c.ownerId===a?.user?.id?(0,b.jsxs)(h.Dialog,{open:g,onOpenChange:i,children:[(0,b.jsx)(h.DialogTrigger,{asChild:!0,children:(0,b.jsxs)(f.Button,{variant:"outline",className:"gap-2",children:[(0,b.jsx)(n.Users,{className:"h-4 w-4"}),"协作管理"]})}),(0,b.jsxs)(h.DialogContent,{className:"sm:max-w-[600px]",children:[(0,b.jsxs)(h.DialogHeader,{children:[(0,b.jsxs)(h.DialogTitle,{children:["协作管理 - ",c.name]}),(0,b.jsx)(h.DialogDescription,{children:"邀请其他用户协作编辑或查看您的家族树。"})]}),(0,b.jsxs)("div",{className:"space-y-6 py-4",children:[(0,b.jsxs)("form",{onSubmit:L,className:"space-y-4 border-b pb-6",children:[(0,b.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(D.Label,{htmlFor:"email",children:"邮箱地址"}),(0,b.jsx)(C.Input,{id:"email",type:"email",placeholder:"输入对方邮箱",value:o,onChange:a=>p(a.target.value),required:!0})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(D.Label,{htmlFor:"role",children:"权限角色"}),(0,b.jsxs)(E.Select,{value:q,onValueChange:a=>r(a),children:[(0,b.jsx)(E.SelectTrigger,{children:(0,b.jsx)(E.SelectValue,{})}),(0,b.jsxs)(E.SelectContent,{children:[(0,b.jsx)(E.SelectItem,{value:"EDITOR",children:(0,b.jsxs)("div",{className:"flex items-center",children:[(0,b.jsx)(I.Edit,{className:"mr-2 h-4 w-4"}),"编辑者 (可以增删改)"]})}),(0,b.jsx)(E.SelectItem,{value:"VIEWER",children:(0,b.jsxs)("div",{className:"flex items-center",children:[(0,b.jsx)(H,{className:"mr-2 h-4 w-4"}),"查看者 (只读)"]})})]})]})]}),(0,b.jsxs)("div",{className:"space-y-2 sm:col-span-2",children:[(0,b.jsx)(D.Label,{htmlFor:"password",children:"初始密码 (仅新用户)"}),(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsx)(C.Input,{id:"password",type:"text",placeholder:"为新用户设置密码(可选)",value:s,onChange:a=>t(a.target.value),minLength:6,className:"flex-1"}),(0,b.jsx)(f.Button,{type:"submit",disabled:l,children:l?"处理中...":"发送邀请"})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"如果是现有用户,此密码将被忽略。"})]})]}),u&&(0,b.jsxs)(J.Alert,{variant:"destructive",children:[(0,b.jsx)(J.AlertTitle,{children:"错误"}),(0,b.jsx)(J.AlertDescription,{children:u})]}),w&&(0,b.jsxs)(J.Alert,{className:"bg-green-50 text-green-700 border-green-200",children:[(0,b.jsx)(J.AlertTitle,{children:"成功"}),(0,b.jsx)(J.AlertDescription,{children:w})]})]}),(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)("h3",{className:"font-medium text-sm text-muted-foreground",children:"现有协作者"}),0===j.length?(0,b.jsx)("div",{className:"text-center py-8 text-muted-foreground border border-dashed rounded-lg",children:"暂无协作者"}):(0,b.jsx)("div",{className:"space-y-2 max-h-[300px] overflow-y-auto pr-2",children:j.map(a=>(0,b.jsxs)("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-muted/30",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)(F.Avatar,{className:"h-9 w-9 border border-border",children:(0,b.jsx)(F.AvatarFallback,{children:a.user.name?.charAt(0).toUpperCase()||a.user.email.charAt(0).toUpperCase()})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"font-medium text-sm",children:a.user.name||"用户"}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground",children:a.user.email})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("span",{className:`text-[10px] px-2 py-0.5 rounded-full border ${"EDITOR"===a.role?"bg-blue-50 text-blue-700 border-blue-200":"bg-gray-50 text-gray-700 border-gray-200"}`,children:"EDITOR"===a.role?"编辑者":"查看者"}),(0,b.jsx)(f.Button,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>M(a.userId),children:(0,b.jsx)(G.Trash2,{className:"h-4 w-4"})})]})]},a.id))})]})]})]})]}):null}var M=a.i(17400),N=a.i(17160),O=a.i(26269),P=a.i(68771),Q=a.i(58011),R=a.i(9478),S=a.i(26039),T=a.i(33293),U=a.i(18607),V=a.i(39622),W=a.i(94446),X="Collapsible",[Y,Z]=(0,Q.createContextScope)(X),[$,_]=Y(X),aa=y.forwardRef((a,c)=>{let{__scopeCollapsible:d,open:e,defaultOpen:f,disabled:g,onOpenChange:h,...i}=a,[j=!1,k]=(0,R.useControllableState)({prop:e,defaultProp:f,onChange:h});return(0,b.jsx)($,{scope:d,disabled:g,contentId:(0,W.useId)(),open:j,onOpenToggle:y.useCallback(()=>k(a=>!a),[k]),children:(0,b.jsx)(U.Primitive.div,{"data-state":ag(j),"data-disabled":g?"":void 0,...i,ref:c})})});aa.displayName=X;var ab="CollapsibleTrigger",ac=y.forwardRef((a,c)=>{let{__scopeCollapsible:d,...e}=a,f=_(ab,d);return(0,b.jsx)(U.Primitive.button,{type:"button","aria-controls":f.contentId,"aria-expanded":f.open||!1,"data-state":ag(f.open),"data-disabled":f.disabled?"":void 0,disabled:f.disabled,...e,ref:c,onClick:(0,P.composeEventHandlers)(a.onClick,f.onOpenToggle)})});ac.displayName=ab;var ad="CollapsibleContent",ae=y.forwardRef((a,c)=>{let{forceMount:d,...e}=a,f=_(ad,a.__scopeCollapsible);return(0,b.jsx)(V.Presence,{present:d||f.open,children:({present:a})=>(0,b.jsx)(af,{...e,ref:c,present:a})})});ae.displayName=ad;var af=y.forwardRef((a,c)=>{let{__scopeCollapsible:d,present:e,children:f,...g}=a,h=_(ad,d),[i,j]=y.useState(e),k=y.useRef(null),l=(0,T.useComposedRefs)(c,k),m=y.useRef(0),n=m.current,o=y.useRef(0),p=o.current,q=h.open||i,r=y.useRef(q),s=y.useRef(void 0);return y.useEffect(()=>{let a=requestAnimationFrame(()=>r.current=!1);return()=>cancelAnimationFrame(a)},[]),(0,S.useLayoutEffect)(()=>{let a=k.current;if(a){s.current=s.current||{transitionDuration:a.style.transitionDuration,animationName:a.style.animationName},a.style.transitionDuration="0s",a.style.animationName="none";let b=a.getBoundingClientRect();m.current=b.height,o.current=b.width,r.current||(a.style.transitionDuration=s.current.transitionDuration,a.style.animationName=s.current.animationName),j(e)}},[h.open,e]),(0,b.jsx)(U.Primitive.div,{"data-state":ag(h.open),"data-disabled":h.disabled?"":void 0,id:h.contentId,hidden:!q,...g,ref:l,style:{"--radix-collapsible-content-height":n?`${n}px`:void 0,"--radix-collapsible-content-width":p?`${p}px`:void 0,...a.style},children:q&&f})});function ag(a){return a?"open":"closed"}function ah({...a}){return(0,b.jsx)(aa,{"data-slot":"collapsible",...a})}function ai({...a}){return(0,b.jsx)(ac,{"data-slot":"collapsible-trigger",...a})}function aj({...a}){return(0,b.jsx)(ae,{"data-slot":"collapsible-content",...a})}var ak=a.i(17660);let al=(0,e.default)(async()=>{},{loadableGenerated:{modules:[68845]},ssr:!1,loading:()=>(0,b.jsxs)("div",{className:"w-full h-64 flex items-center justify-center",children:[(0,b.jsx)(t.Loader2,{className:"h-8 w-8 animate-spin text-primary"}),(0,b.jsx)("span",{className:"ml-2 text-muted-foreground",children:"加载统计图表..."})]})});function am(){let a,e,r,t,{treeData:C,isLoading:D,currentTree:E,updateMember:F}=(0,x.useFamily)(),{data:G}=(0,B.useSession)(),[H,I]=(0,y.useState)([]),[J,K]=(0,y.useState)(null),[P,Q]=(0,y.useState)(!0),[R,S]=(0,y.useState)(null),T=(0,z.useRouter)();(0,y.useEffect)(()=>{!G?.user?.id||G.user.hasSeenHelp||T.replace("/help")},[T,G?.user?.id,G?.user?.hasSeenHelp]),(0,y.useEffect)(()=>{if(!E?.id||!G?.user?.id)return void I([]);let a=new AbortController;return fetch(`/api/trees/${E.id}/activity-logs?limit=10`,{signal:a.signal}).then(a=>{if(!a.ok)throw Error(`HTTP error! status: ${a.status}`);return a.json()}).then(a=>{a.logs&&Array.isArray(a.logs)&&I(a.logs)}).catch(a=>{"AbortError"!==a.name&&console.error("获取活动日志失败:",a),I([])}),()=>a.abort()},[E?.id,G?.user?.id]);let U=(0,y.useMemo)(()=>{let a=Object.values(C.members),b=a.length,c=a.filter(a=>!a.deathDate).length,d=a.filter(a=>a.deathDate).length,e=a.filter(a=>"MALE"===a.gender).length,f=a.filter(a=>"FEMALE"===a.gender).length,g=a.map(a=>a.generation||0),h=g.length>0?Math.max(...g):0,i=a.map(a=>a.birthDate?new Date(a.birthDate).getFullYear():null).filter(a=>null!==a),j=i.length>0?Math.min(...i):new Date().getFullYear(),k=i.length>0?new Date().getFullYear()-j:0,l=a.filter(a=>a.birthDate&&a.deathDate),m=l.reduce((a,b)=>{let c=new Date(b.birthDate).getFullYear();return a+(new Date(b.deathDate).getFullYear()-c)},0);return{totalMembers:b,livingMembers:c,deceasedMembers:d,maleCount:e,femaleCount:f,maxGeneration:h,yearsSpan:k,earliestYear:j,averageLifespan:l.length>0?Math.round(m/l.length):0}},[C]);(0,y.useMemo)(()=>Object.values(C.members).sort((a,b)=>parseInt(b.id)-parseInt(a.id)).slice(0,5),[C]);let V=G&&E?.ownerId===G.user?.id,W=(0,y.useMemo)(()=>{let a=[];return Object.values(C.members).forEach(b=>{b.photos&&b.photos.length>0&&b.photos.forEach(c=>{let d=c.visibleInOverview??!1;if(!d)return;let e=c.adminVisibleOverride??!0;(e||V)&&a.push({url:c.url,caption:c.caption,uploadedAt:c.uploadedAt,memberId:b.id,memberName:b.fullName,isDead:!!b.deathDate,adminVisibleOverride:e,visibleInOverview:d})})}),a.sort((a,b)=>new Date(b.uploadedAt).getTime()-new Date(a.uploadedAt).getTime())},[C,V]),X=(0,y.useCallback)(async(a,b,c)=>{if(!V)return;let d=C.members[a];if(d&&d.photos&&0!==d.photos.length){S(`${a}|${b}`);try{let e=d.photos.map(a=>a.url===b?{...a,adminVisibleOverride:c}:a);await F(a,{photos:e})}catch(a){console.error("更新管理员展示权限失败:",a)}finally{S(null)}}},[V,C.members,F]),Y=(0,y.useMemo)(()=>{let a=Object.values(C.members),b=[];return a.forEach(a=>{if(a.birthDate){let c=a.isLunarDate||!1,d=(0,N.isInCurrentMonth)(a.birthDate,c);if(d){let e;if(c){let b=(0,N.solar2lunar)(new Date(a.birthDate));b&&(e=`${b.monthName}${b.dayName}`)}b.push({member:a,type:"birth",date:a.birthDate,day:d.day,month:d.month,isLunar:c,lunarDisplay:e})}}if(a.deathDate){let c=a.isLunarDate||!1,d=(0,N.isInCurrentMonth)(a.deathDate,c);if(d){let e;if(c){let b=(0,N.solar2lunar)(new Date(a.deathDate));b&&(e=`${b.monthName}${b.dayName}`)}b.push({member:a,type:"death",date:a.deathDate,day:d.day,month:d.month,isLunar:c,lunarDisplay:e})}}}),b.sort((a,b)=>a.day-b.day).slice(0,5)},[C]),Z=(0,y.useMemo)(()=>{let a=Object.values(C.members),b={};return a.forEach(a=>{a.ancestralHome&&(b[a.ancestralHome]||(b[a.ancestralHome]=[]),b[a.ancestralHome].push(a))}),Object.entries(b).sort((a,b)=>b[1].length-a[1].length)},[C]);return D||E?(0,b.jsxs)("div",{className:"flex h-screen flex-col bg-background font-sans overflow-hidden",children:[(0,b.jsx)(i.SiteHeader,{}),(0,b.jsxs)("main",{className:"flex-1 container mx-auto py-8 px-4 md:px-6 flex flex-col overflow-hidden",children:[(0,b.jsxs)("div",{className:"flex flex-col md:flex-row items-start md:items-center justify-between gap-4 mb-8 flex-shrink-0",children:[(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("h1",{className:"text-3xl font-serif font-bold text-foreground",children:E?.name||"家族族谱"}),E?.currentUserRole&&(0,b.jsx)("span",{className:`text-xs px-2 py-1 rounded-full border font-sans font-normal translate-y-[2px] ${"OWNER"===E.currentUserRole?"bg-purple-100 text-purple-700 border-purple-200":"EDITOR"===E.currentUserRole?"bg-blue-100 text-blue-700 border-blue-200":"bg-gray-100 text-gray-700 border-gray-200"}`,children:"OWNER"===E.currentUserRole?"所有者":"EDITOR"===E.currentUserRole?"编辑者":"查看者"})]}),(0,b.jsxs)("p",{className:"text-muted-foreground mt-1",children:[E?.description||"记录家族历史,传承家族文化",U.maxGeneration>0&&` \xb7 第 ${U.maxGeneration} 代传人`]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[G&&E?.ownerId===G.user?.id&&(0,b.jsx)(L,{}),M.permissions.canCreate(E?.currentUserRole)&&(0,b.jsx)(c.default,{href:E?.id?`/members/new?treeId=${E.id}`:"/members/new",children:(0,b.jsxs)(f.Button,{className:"gap-2 bg-primary text-primary-foreground hover:bg-primary/90",children:[(0,b.jsx)(l.UserPlus,{className:"h-4 w-4"}),"添加成员"]})})]})]}),(0,b.jsxs)(ah,{open:P,onOpenChange:Q,className:"mb-8 flex-shrink-0",children:[(0,b.jsx)("div",{className:"flex items-center justify-between mb-3",children:(0,b.jsx)(ai,{asChild:!0,children:(0,b.jsxs)(f.Button,{variant:"ghost",size:"sm",className:"gap-2 text-muted-foreground hover:text-foreground -ml-2",children:[P?(0,b.jsx)(w.default,{className:"h-4 w-4"}):(0,b.jsx)(v.ChevronDown,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"text-sm font-medium",children:"统计概览"})]})})}),(0,b.jsx)(aj,{className:"data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up",children:(0,b.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,b.jsx)(c.default,{href:E?.id?`/members?treeId=${E.id}`:"#",children:(0,b.jsx)(g.ChineseCard,{variant:"default",cornerOrnament:!0,className:"chinese-stat-card transition-all hover:shadow-lg group cursor-pointer h-full",children:(0,b.jsxs)(g.ChineseCardContent,{className:"p-5 pt-6",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("p",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"家族成员"}),(0,b.jsx)("div",{className:"chinese-seal chinese-seal-sm",children:(0,b.jsx)(n.Users,{className:"h-4 w-4"})})]}),(0,b.jsxs)("div",{className:"flex flex-col space-y-1.5",children:[(0,b.jsxs)("span",{className:"text-3xl font-serif font-bold text-foreground tracking-tight",children:[U.totalMembers," 人"]}),(0,b.jsx)(g.ChineseDivider,{variant:"simple",className:"my-2"}),(0,b.jsxs)("div",{className:"flex items-center gap-3 text-sm text-muted-foreground/80 font-medium",children:[(0,b.jsxs)("span",{className:"text-green-600",children:["在世 ",U.livingMembers]}),(0,b.jsx)("span",{className:"text-muted-foreground",children:"·"}),(0,b.jsxs)("span",{className:"text-gray-600",children:["已故 ",U.deceasedMembers]})]})]})]})})}),(0,b.jsx)(c.default,{href:E?.id?`/timeline?treeId=${E.id}`:"#",children:(0,b.jsx)(g.ChineseCard,{variant:"default",cornerOrnament:!0,className:"chinese-stat-card transition-all hover:shadow-lg group cursor-pointer h-full",children:(0,b.jsxs)(g.ChineseCardContent,{className:"p-5 pt-6",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("p",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"家族历史"}),(0,b.jsx)("div",{className:"chinese-seal chinese-seal-sm",children:(0,b.jsx)(p.Clock,{className:"h-4 w-4"})})]}),(0,b.jsxs)("div",{className:"flex flex-col space-y-1.5",children:[(0,b.jsxs)("span",{className:"text-3xl font-serif font-bold text-foreground tracking-tight",children:[U.maxGeneration," 代"]}),(0,b.jsx)(g.ChineseDivider,{variant:"simple",className:"my-2"}),(0,b.jsxs)("div",{className:"flex items-center gap-3 text-sm text-muted-foreground/80 font-medium",children:[(0,b.jsxs)("span",{children:["跨越 ",U.yearsSpan," 年"]}),(0,b.jsx)("span",{className:"text-muted-foreground",children:"·"}),(0,b.jsxs)("span",{children:["均寿 ",U.averageLifespan>0?`${U.averageLifespan}岁`:"-"]})]})]})]})})}),(0,b.jsx)(c.default,{href:E?.id?`/members?treeId=${E.id}`:"#",children:(0,b.jsx)(g.ChineseCard,{variant:"default",cornerOrnament:!0,className:"chinese-stat-card transition-all hover:shadow-lg group cursor-pointer h-full",children:(0,b.jsxs)(g.ChineseCardContent,{className:"p-5 pt-6",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("p",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wide",children:"性别比例"}),(0,b.jsx)("div",{className:"chinese-seal chinese-seal-sm",children:(0,b.jsx)(n.Users,{className:"h-4 w-4"})})]}),(0,b.jsxs)("div",{className:"flex flex-col space-y-1.5",children:[(0,b.jsxs)("div",{className:"flex items-center justify-center gap-2.5",children:[(0,b.jsx)("span",{className:"text-3xl font-serif font-bold text-primary tracking-tight",children:U.maleCount>0?"1":"0"}),(0,b.jsx)("span",{className:"text-2xl font-bold text-muted-foreground",children:":"}),(0,b.jsx)("span",{className:"text-3xl font-serif font-bold text-primary tracking-tight",children:U.maleCount>0?(U.femaleCount/U.maleCount).toFixed(2):"0"})]}),(0,b.jsx)(g.ChineseDivider,{variant:"simple",className:"my-2"}),(0,b.jsxs)("div",{className:"text-center text-sm text-muted-foreground/80 font-medium",children:["男性 ",U.maleCount," · 女性 ",U.femaleCount]})]})]})})})]})})]}),(0,b.jsxs)(k.Tabs,{defaultValue:"photos",className:"w-full flex-1 flex flex-col overflow-hidden",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[(0,b.jsxs)(k.TabsList,{className:"bg-muted/50",children:[(0,b.jsx)(k.TabsTrigger,{value:"photos",children:"照片展示"}),(0,b.jsx)(k.TabsTrigger,{value:"recent",children:"最近动态"}),(0,b.jsx)(k.TabsTrigger,{value:"statistics",children:"统计图表"}),(0,b.jsx)(k.TabsTrigger,{value:"migration",children:"籍贯记录"})]}),(0,b.jsx)(c.default,{href:E?.id?`/members?treeId=${E.id}`:"/members",children:(0,b.jsxs)(f.Button,{variant:"ghost",size:"sm",className:"text-muted-foreground gap-1",children:["查看全部 ",(0,b.jsx)(o.ArrowRight,{className:"h-3 w-3"})]})})]}),(0,b.jsx)(k.TabsContent,{value:"photos",className:"mt-0 flex-1 overflow-y-auto",children:(0,b.jsxs)(g.ChineseCard,{variant:"scroll",className:"shadow-sm",children:[(0,b.jsxs)(g.ChineseCardHeader,{className:"pt-6",children:[(0,b.jsxs)(g.ChineseCardTitle,{className:"flex items-center gap-2",children:[(0,b.jsx)(u.Images,{className:"h-5 w-5 text-primary"}),"家族影像"]}),(0,b.jsx)(g.ChineseCardDescription,{children:"珍藏的家族照片,记录美好时光"})]}),(0,b.jsx)(g.ChineseCardContent,{children:W.length>0?(0,b.jsx)("div",{className:"columns-2 md:columns-3 lg:columns-4 xl:columns-5 gap-4 space-y-4",children:W.map((a,d)=>(0,b.jsx)("div",{className:"break-inside-avoid group",children:(0,b.jsx)("div",{className:"rounded-lg overflow-hidden bg-card shadow-sm hover:shadow-lg transition-all duration-300 hover:-translate-y-1 border border-border/50",children:!1===a.adminVisibleOverride?(0,b.jsxs)("div",{className:"p-4 space-y-2",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-1.5 text-xs",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1 text-muted-foreground",children:[(0,b.jsx)("span",{children:"来自"}),(0,b.jsx)(c.default,{href:`/members/${a.memberId}${E?.id?`?treeId=${E.id}`:""}`,className:"hover:text-primary hover:underline",children:(0,b.jsx)(O.MemberNameWithStatus,{name:a.memberName,isDead:a.isDead,className:"text-foreground font-medium"})})]}),(0,b.jsx)("span",{className:"text-muted-foreground/70 text-[10px]",children:(0,A.format)(new Date(a.uploadedAt),"yyyy-MM-dd")})]}),V?(0,b.jsxs)("div",{className:"flex items-center justify-between gap-1.5 text-[11px] text-muted-foreground",children:[(0,b.jsx)("span",{children:"允许展示"}),(0,b.jsx)(ak.Switch,{checked:a.adminVisibleOverride??!0,onCheckedChange:b=>X(a.memberId,a.url,b),disabled:R===`${a.memberId}|${a.url}`})]}):(0,b.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"管理员已隐藏"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"relative cursor-zoom-in",onClick:()=>K(a.url),children:(0,b.jsx)("img",{src:a.url,alt:a.caption||`${a.memberName}的照片`,className:"w-full h-auto object-cover",loading:"lazy"})}),(0,b.jsxs)("div",{className:"px-3 py-2 bg-card border-t border-border/30 space-y-1",children:[(0,b.jsx)("div",{className:"text-xs line-clamp-2",children:a.caption?(0,b.jsx)("span",{className:"text-foreground",children:a.caption}):(0,b.jsx)("span",{className:"text-muted-foreground/70",children:"暂无说明"})}),(0,b.jsxs)("div",{className:"flex items-center justify-between gap-1.5 text-xs",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"来自"}),(0,b.jsx)(c.default,{href:`/members/${a.memberId}${E?.id?`?treeId=${E.id}`:""}`,className:"hover:text-primary hover:underline",children:(0,b.jsx)(O.MemberNameWithStatus,{name:a.memberName,isDead:a.isDead,className:"text-foreground font-medium"})})]}),(0,b.jsx)("span",{className:"text-muted-foreground/70 text-[10px]",children:(0,A.format)(new Date(a.uploadedAt),"yyyy-MM-dd")})]}),V&&(0,b.jsxs)("div",{className:"mt-2 flex items-center justify-between gap-1.5 text-[11px] text-muted-foreground",children:[(0,b.jsx)("span",{children:"允许展示"}),(0,b.jsx)(ak.Switch,{checked:a.adminVisibleOverride??!0,onCheckedChange:b=>X(a.memberId,a.url,b),disabled:R===`${a.memberId}|${a.url}`})]})]})]})})},`${a.memberId}-${d}`))}):(0,b.jsxs)("div",{className:"text-center py-16",children:[(0,b.jsx)(u.Images,{className:"h-12 w-12 mx-auto text-muted-foreground/30 mb-4"}),(0,b.jsx)("p",{className:"text-muted-foreground",children:"暂无照片"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground/70 mt-1",children:"在成员详情页可以添加照片"})]})})]})}),(0,b.jsx)(k.TabsContent,{value:"recent",className:"mt-0 flex-1 overflow-y-auto",children:(0,b.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsxs)(g.ChineseCard,{variant:"plaque",className:"shadow-sm",children:[(0,b.jsxs)(g.ChineseCardHeader,{children:[(0,b.jsxs)(g.ChineseCardTitle,{className:"flex items-center gap-2 text-primary",children:[(0,b.jsx)(m.Calendar,{className:"h-5 w-5"}),"本月祭祖/纪念"]}),(0,b.jsx)(g.ChineseCardDescription,{children:"本月需要纪念的家族成员生日与忌日"})]}),(0,b.jsx)(g.ChineseCardContent,{className:"grid gap-4",children:Y.length>0?Y.map((a,d)=>{let e=new Date().getFullYear()-new Date(a.date).getFullYear();return(0,b.jsx)(c.default,{href:`/members/${a.member.id}${E?.id?`?treeId=${E.id}`:""}`,children:(0,b.jsxs)("div",{className:"flex items-center gap-4 p-3 rounded-lg bg-background/60 border border-border/50 hover:bg-background transition-colors cursor-pointer",children:[a.isLunar&&a.lunarDisplay?(0,b.jsx)("div",{className:"flex flex-col items-center justify-center w-14 h-14 rounded-lg bg-gradient-to-br from-red-50 to-amber-50 border-2 border-red-200/50 text-red-800 font-serif shadow-sm",children:(0,b.jsx)("span",{className:"text-[10px] leading-tight text-center px-1",children:a.lunarDisplay.replace("月","")})}):(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center w-14 h-14 rounded-lg bg-gradient-to-br from-blue-50 to-sky-50 border-2 border-blue-200/50 text-blue-800 font-serif shadow-sm",children:[(0,b.jsxs)("span",{className:"text-xs font-medium",children:[a.month,"月"]}),(0,b.jsx)("span",{className:"font-bold text-xl leading-tight",children:a.day})]}),(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsxs)("p",{className:"font-medium flex items-center gap-2",children:[(0,b.jsx)(O.MemberNameWithStatus,{name:a.member.fullName,isDead:!!a.member.deathDate})," ","birth"===a.type?"诞辰":"忌日",a.isLunar&&(0,b.jsx)("span",{className:"text-[10px] text-amber-600 bg-amber-50 px-1.5 py-0.5 rounded border border-amber-200",children:"农历"})]}),(0,b.jsxs)("p",{className:"text-sm text-muted-foreground",children:["第 ",a.member.generation," 世 · 距今 ",e," 年","death"===a.type&&" · 已故",a.isLunar&&a.lunarDisplay&&(0,b.jsxs)("span",{className:"ml-1",children:["· ",a.lunarDisplay]})]})]})]})},`${a.member.id}-${a.type}`)}):(0,b.jsx)("div",{className:"text-center py-12",children:(0,b.jsx)("p",{className:"text-sm text-foreground font-light tracking-wide",children:"此月无忆"})})})]}),(0,b.jsxs)(g.ChineseCard,{variant:"scroll",className:"shadow-sm",children:[(0,b.jsxs)(g.ChineseCardHeader,{className:"pt-6",children:[(0,b.jsxs)(g.ChineseCardTitle,{className:"flex items-center gap-2",children:[(0,b.jsx)(p.Clock,{className:"h-5 w-5 text-primary"}),"未来三月纪念日"]}),(0,b.jsx)(g.ChineseCardDescription,{children:"即将到来的生日与忌日提醒"})]}),(0,b.jsx)(g.ChineseCardContent,{children:(0,b.jsx)("div",{className:"space-y-3",children:(e=new Date((a=new Date).getFullYear(),a.getMonth()+3,a.getDate()),r=Object.values(C.members),t=[],r.forEach(b=>{if(b.birthDate){let c,d,f=new Date(b.birthDate);if(b.isLunarDate){let b=(0,N.solar2lunar)(f);if(b){let e=(0,N.lunar2solar)(a.getFullYear(),b.lunarMonth,b.lunarDay,b.isLeap);e?(c=e,d=`${b.monthName}${b.dayName}`):c=new Date(a.getFullYear(),f.getMonth(),f.getDate())}else c=new Date(a.getFullYear(),f.getMonth(),f.getDate())}else c=new Date(a.getFullYear(),f.getMonth(),f.getDate());c>=a&&c<=e&&t.push({member:b,type:"birth",date:c,originalDate:b.birthDate,isLunar:b.isLunarDate||!1,lunarDisplay:d,month:c.getMonth()+1,day:c.getDate()})}if(b.deathDate){let c,d,f=new Date(b.deathDate);if(b.isLunarDate){let b=(0,N.solar2lunar)(f);if(b){let e=(0,N.lunar2solar)(a.getFullYear(),b.lunarMonth,b.lunarDay,b.isLeap);e?(c=e,d=`${b.monthName}${b.dayName}`):c=new Date(a.getFullYear(),f.getMonth(),f.getDate())}else c=new Date(a.getFullYear(),f.getMonth(),f.getDate())}else c=new Date(a.getFullYear(),f.getMonth(),f.getDate());c>=a&&c<=e&&t.push({member:b,type:"death",date:c,originalDate:b.deathDate,isLunar:b.isLunarDate||!1,lunarDisplay:d,month:c.getMonth()+1,day:c.getDate()})}}),t.sort((a,b)=>a.date.getTime()-b.date.getTime()),t.length>0?t.slice(0,5).map((d,e)=>{let f=a.getFullYear()-new Date(d.originalDate).getFullYear(),g=Math.ceil((d.date.getTime()-a.getTime())/864e5);return(0,b.jsx)(c.default,{href:`/members/${d.member.id}${E?.id?`?treeId=${E.id}`:""}`,children:(0,b.jsxs)("div",{className:"flex items-center gap-3 p-2 rounded-lg bg-background/60 border border-border/50 hover:bg-background transition-colors cursor-pointer",children:[d.isLunar&&d.lunarDisplay?(0,b.jsx)("div",{className:"flex flex-col items-center justify-center w-12 h-12 rounded-lg bg-gradient-to-br from-red-50 to-amber-50 border border-red-200/50 text-red-800 font-serif shadow-sm",children:(0,b.jsx)("span",{className:"text-[9px] leading-tight text-center px-1",children:d.lunarDisplay})}):(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center w-12 h-12 rounded-lg bg-gradient-to-br from-blue-50 to-sky-50 border border-blue-200/50 text-blue-800 font-serif shadow-sm",children:[(0,b.jsxs)("span",{className:"text-xs font-medium",children:[d.month,"月"]}),(0,b.jsx)("span",{className:"font-bold text-sm leading-tight",children:d.day})]}),(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsxs)("p",{className:"font-medium text-sm flex items-center gap-2",children:[(0,b.jsx)(O.MemberNameWithStatus,{name:d.member.fullName,isDead:!!d.member.deathDate})," ","birth"===d.type?"诞辰":"忌日",d.isLunar&&(0,b.jsx)("span",{className:"text-[10px] text-amber-600 bg-amber-50 px-1.5 py-0.5 rounded border border-amber-200",children:"农历"})]}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:["第 ",d.member.generation," 世 · ",f," 年","death"===d.type&&" · 已故",d.isLunar&&d.lunarDisplay&&(0,b.jsxs)("span",{className:"ml-1",children:["· ",d.lunarDisplay]}),(0,b.jsxs)("span",{className:"ml-1 text-primary",children:["· ",g,"天后"]})]})]})]})},`${d.member.id}-${d.type}-${e}`)}):(0,b.jsx)("div",{className:"text-center py-8",children:(0,b.jsx)("p",{className:"text-sm text-foreground font-light tracking-wide",children:"来日无期"})}))})})]})]}),(0,b.jsxs)(g.ChineseCard,{variant:"default",cornerOrnament:!0,className:"shadow-sm",children:[(0,b.jsxs)(g.ChineseCardHeader,{children:[(0,b.jsxs)(g.ChineseCardTitle,{className:"flex items-center gap-2",children:[(0,b.jsx)(s,{className:"h-5 w-5 text-primary"}),"近期修谱动态"]}),(0,b.jsx)(g.ChineseCardDescription,{children:"记录家族成员的最新变动与修订"})]}),(0,b.jsx)(g.ChineseCardContent,{children:(0,b.jsx)(j.ScrollArea,{className:"h-[600px] pr-4",children:(0,b.jsx)("div",{className:"space-y-4",children:H.length>0?H.map((a,d)=>{let e,f,g,h;return(0,b.jsxs)("div",{className:"flex gap-3 group hover:bg-muted/30 p-2 rounded-lg transition-colors",children:[(0,b.jsxs)("div",{className:"relative flex flex-col items-center",children:[(0,b.jsx)("div",{className:"h-full w-px bg-border group-last:hidden"}),(0,b.jsx)("div",{className:`absolute top-2 h-2 w-2 rounded-full ring-4 ring-background ${"CREATE"===a.action?"bg-green-500":"UPDATE"===a.action?"bg-blue-500":"DELETE"===a.action?"bg-red-500":"bg-purple-500"}`})]}),(0,b.jsxs)("div",{className:"pb-2 flex-1",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[(0,b.jsx)("span",{className:`text-xs px-2 py-0.5 rounded-full ${"CREATE"===a.action?"bg-green-100 text-green-700":"UPDATE"===a.action?"bg-blue-100 text-blue-700":"DELETE"===a.action?"bg-red-100 text-red-700":"bg-purple-100 text-purple-700"}`,children:"CREATE"===a.action?"创建":"UPDATE"===a.action?"更新":"DELETE"===a.action?"删除":"导入"}),a.entityId&&"MEMBER"===a.entityType?(e=C.members[a.entityId])?(0,b.jsx)(O.MemberNameWithStatus,{name:a.entityName||e.fullName||"未知",isDead:!!e.deathDate,memberId:a.entityId,treeId:E?.id,className:"font-medium"}):"DELETE"===a.action?(0,b.jsx)("span",{className:"font-medium",children:a.entityName||"未知"}):(0,b.jsx)(c.default,{href:`/members/${a.entityId}${E?.id?`?treeId=${E.id}`:""}`,className:"font-medium hover:text-primary hover:underline transition-colors",children:a.entityName||"未知"}):(0,b.jsx)("span",{className:"font-medium",children:a.entityName||"未知"}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:(0,A.format)(new Date(a.timestamp),"MM-dd HH:mm")})]}),"UPDATE"===a.action&&a.changes?(0,b.jsx)("div",{className:"text-xs text-muted-foreground space-y-0.5",children:(f=a.changes,g={fullName:"姓名",surname:"姓氏",givenName:"名字",gender:"性别",birthDate:"出生日期",deathDate:"去世日期",birthPlace:"出生地",ancestralHome:"祖籍",generation:"世代",generationName:"字辈",courtesyName:"字",artName:"号",posthumousName:"谥号",rank:"排行",bio:"简介",phone:"手机",telephone:"电话",email:"邮箱",address:"地址",photoIds:"照片",spouseIds:"配偶",childrenIds:"子女",motherId:"母亲",fatherId:"父亲",isFounder:"始祖",isLunarDate:"农历日期",burialPlace:"安葬地",tags:"标签"},(h=Object.entries(f).filter(([a])=>g[a]).slice(0,2)).length>0?(0,b.jsxs)(b.Fragment,{children:[h.map(([a])=>(0,b.jsxs)("div",{children:["• 修改了",g[a]]},a)),Object.keys(f).length>2&&(0,b.jsxs)("div",{className:"italic",children:["等 ",Object.keys(f).length," 项变更"]})]}):(0,b.jsx)("div",{children:"更新了成员"}))}):(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:["CREATE"===a.action&&"创建了成员","UPDATE"===a.action&&"更新了成员","DELETE"===a.action&&"删除了成员","IMPORT"===a.action&&"导入了数据"]})]})]},a.id)}):(0,b.jsx)("div",{className:"text-center py-12",children:(0,b.jsx)("p",{className:"text-sm text-foreground font-light tracking-wide",children:"静待修谱"})})})})})]})]})}),(0,b.jsx)(k.TabsContent,{value:"statistics",className:"mt-0 flex-1 overflow-y-auto",children:(0,b.jsx)(al,{members:Object.values(C.members)})}),(0,b.jsx)(k.TabsContent,{value:"migration",className:"mt-0 flex-1 overflow-y-auto",children:(0,b.jsxs)(g.ChineseCard,{variant:"bamboo",className:"shadow-sm",children:[(0,b.jsxs)(g.ChineseCardHeader,{children:[(0,b.jsx)(g.ChineseCardTitle,{children:"家族籍贯记录"}),(0,b.jsx)(g.ChineseCardDescription,{children:"记录家族成员的籍贯分布"})]}),(0,b.jsx)(g.ChineseCardContent,{children:(0,b.jsx)("div",{className:"space-y-6",children:Z.length>0?Z.map(([a,d])=>(0,b.jsxs)("div",{className:"border-l-4 border-primary pl-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h3",{className:"text-lg font-serif font-bold",children:a}),(0,b.jsxs)("span",{className:"text-sm text-muted-foreground",children:[d.length," 人"]})]}),(0,b.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-2",children:d.map(a=>(0,b.jsx)(c.default,{href:`/members/${a.id}${E?.id?`?treeId=${E.id}`:""}`,children:(0,b.jsxs)("div",{className:"px-3 py-2 bg-muted rounded hover:bg-muted/80 transition-colors",children:[(0,b.jsx)("p",{className:"text-sm font-medium truncate",children:a.fullName}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:["第 ",a.generation," 世"]})]})},a.id))})]},a)):(0,b.jsx)("div",{className:"text-center py-16",children:(0,b.jsx)("p",{className:"text-sm text-foreground font-light tracking-wide",children:"未有籍贯记录"})})})})]})})]}),(0,b.jsx)(h.Dialog,{open:!!J,onOpenChange:()=>K(null),children:(0,b.jsxs)(h.DialogContent,{className:"max-w-4xl p-0 bg-black/95 border-none",overlayClassName:"backdrop-blur-md bg-black/60","aria-describedby":void 0,children:[(0,b.jsx)(h.DialogTitle,{className:"sr-only",children:"照片预览"}),J&&(0,b.jsx)("img",{src:J,alt:"照片预览",className:"w-full h-auto max-h-[90vh] object-contain"})]})})]})]}):(0,b.jsxs)("div",{className:"flex min-h-screen flex-col bg-background font-sans",children:[(0,b.jsx)(i.SiteHeader,{}),(0,b.jsxs)("main",{className:"flex-1 flex items-center justify-center px-4 md:px-6 relative -mt-24",children:[(0,b.jsxs)("div",{className:"absolute inset-0 pointer-events-none overflow-hidden",children:[(0,b.jsx)("div",{className:"absolute left-32 top-[20%] w-[20rem] h-[20rem] opacity-20 rotate-3",children:(0,b.jsx)(d.default,{src:"/wxz.png",alt:"",fill:!0,className:"object-contain",priority:!0})}),(0,b.jsx)("div",{className:"absolute right-32 top-[20%] w-[20rem] h-[20rem] opacity-20 -rotate-3",children:(0,b.jsx)(d.default,{src:"/tree1.png",alt:"",fill:!0,className:"object-contain",priority:!0})}),(0,b.jsx)("div",{className:"absolute left-24 bottom-[8%] w-[28rem] h-[28rem] opacity-15 rotate-6",children:(0,b.jsx)(d.default,{src:"/building.png",alt:"",fill:!0,className:"object-contain",priority:!0})}),(0,b.jsx)("div",{className:"absolute right-24 bottom-[8%] w-[28rem] h-[28rem] opacity-15 -rotate-6",children:(0,b.jsx)(d.default,{src:"/tree.png",alt:"",fill:!0,className:"object-contain",priority:!0})})]}),(0,b.jsxs)("div",{className:"max-w-3xl mx-auto text-center space-y-12",children:[(0,b.jsx)("p",{className:"text-2xl md:text-3xl text-foreground font-serif font-medium tracking-wider",children:"传承千年文脉 · 记录家族荣光"}),(0,b.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 text-primary/20",children:(0,b.jsx)(q.BookOpen,{className:"h-16 w-16",strokeWidth:1})}),(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsx)("h1",{className:"text-4xl md:text-5xl font-serif font-light text-foreground tracking-wide",children:"华夏家谱"}),(0,b.jsx)("div",{className:"h-48 overflow-hidden relative",children:(0,b.jsxs)("div",{className:"space-y-8 text-muted-foreground antialiased animate-scroll",children:[(0,b.jsx)("p",{className:"text-lg md:text-xl font-serif font-normal leading-relaxed tracking-wide",children:"家族是根,文化是魂 · 记录过往,传承未来"}),(0,b.jsx)("p",{className:"text-base md:text-lg font-serif font-normal leading-relaxed opacity-85 tracking-wide",children:"让每一个故事都成为永恒 · 血脉相连,世代相传"}),(0,b.jsx)("p",{className:"text-base md:text-lg font-serif font-normal leading-relaxed opacity-70 tracking-wide",children:"铭记历史,启迪后人 · 家风永续,德泽绵长"}),(0,b.jsx)("p",{className:"text-lg md:text-xl font-serif font-normal leading-relaxed tracking-wide",children:"家族是根,文化是魂 · 记录过往,传承未来"}),(0,b.jsx)("p",{className:"text-base md:text-lg font-serif font-normal leading-relaxed opacity-85 tracking-wide",children:"让每一个故事都成为永恒 · 血脉相连,世代相传"}),(0,b.jsx)("p",{className:"text-base md:text-lg font-serif font-normal leading-relaxed opacity-70 tracking-wide",children:"铭记历史,启迪后人 · 家风永续,德泽绵长"})]})})]}),(0,b.jsx)("div",{className:"pt-8",children:(0,b.jsx)(c.default,{href:"/trees/new",children:(0,b.jsxs)(f.Button,{size:"lg",className:"gap-3 px-8 py-6 text-lg font-serif bg-primary text-primary-foreground hover:bg-primary/90 transition-all duration-300 shadow-lg hover:shadow-xl",children:["开始记录",(0,b.jsx)(o.ArrowRight,{className:"h-5 w-5"})]})})})]})]})]})}a.s(["default",()=>am],32216)}];
|
|
|
|
//# sourceMappingURL=Documents_go-new_chinese-family-tree_0a218095._.js.map
|