1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="344e3471-ce58-48fe-b39e-d929842ceb41",e._sentryDebugIdIdentifier="sentry-dbid-344e3471-ce58-48fe-b39e-d929842ceb41")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6271],{36271:(e,t,i)=>{i.r(t),i.d(t,{default:()=>P});var o=i(69006),l=i(83853),n=i(94887),s=i(1982),a=i(24018),r=i(43011),c=i(11403),h=i(1412),d=i(90867),f=i(40472),g=i(81028),m=i(43041),u=i(41229),b=i(44821),x=i(4914),p=i(8571),_=i(54260),k=i(79012),v=i(8466),w=i(20259),y=i(82997),j=i(86851),N=i(15945),S=i(88904),I=i(44250),F=i(66249),A=i(1457),D=i(71087),C=i(67255),E=i(30142),O=i(71491),L=i(8516),B=i(5911),z=i(65156),M=i(80489),T=i(35576);let R={ä½è´¨åºå è§£ç :"health-constitution",å¥åº·è¿å¿æ¶é´è½´:"health-timeline",äºèææåæ:"organ-vulnerability",å¿çå¥åº·ä¸åå:"mental-health",ç¡ç ä¸ç²¾å管ç:"sleep-energy",饮é£ä¸è¥å
»æå:"diet-nutrition",è¿å¨ä¸ä½è½å»ºè®®:"exercise-fitness",æ
¢æ§ç
é£é©é¢è¦:"chronic-risk",åå£å
»çæ¹æ¡:"seasonal-health",æè¡°ä¸é¿å¯¿è·¯å¾:"aging-longevity",çè²ä¸çæ®å¥åº·:"fertility-reproductive",æå¤ä¼¤å®³é¢é²:"accident-prevention",å¥åº·è´µäººä¸å»ç¼:"health-benefactor"};function P(){var e;let{t,language:i}=(0,T.ok)(),[P,G]=(0,s.useState)(!1),[Y,U]=(0,s.useState)(""),[Z,H]=(0,s.use
1State)(!1),[J,Q]=(0,s.useState)(new Set),[q,K]=(0,s.useState)(new Set),[V,X]=(0,s.useState)({}),[$,W]=(0,s.useState)({}),[ee,et]=(0,s.useState)(new Set),[ei,eo]=(0,s.useState)(""),[el,en]=(0,s.useState)({}),[es,ea]=(0,s.useState)(!1),[er,ec]=(0,s.useState)(0),eh=(0,s.useRef)(null),[ed,ef]=(0,s.useState)(null),eg=(0,s.useRef)(null),em=e=>{ef(e),eg.current=e},eu=(0,s.useRef)(!1),eb=(0,s.useRef)(null),{user:ex,refreshProfile:ep,refreshCoinBalance:e_,coinBalance:ek,setCoinBalance:ev,singleSectionCost:ew}=(0,M.A)();(0,s.useEffect)(()=>{if(!(null==ex?void 0:ex.id)||!ed)return void K(new Set);(0,z.apiGet)("/api/life-book/ownership?scene=health&recordId=".concat(ed)).then(e=>{(null==e?void 0:e.accessibleSections)&&e.accessibleSections.length>0&&(console.log("\uD83D\uDCB0 å·²è´ä¹°æ ç®:",e.accessibleSections),K(new Set(e.accessibleSections)))}).catch(e=>{console.error("æ£æ¥è´ä¹°æé失败:",e)})},[null==ex?void 0:ex.id,ed]);let{savedLifeBooks:ey,currentLifeBookId:ej,birthInfo:eN,baziChart:eS,comprehensiveAnalysis:eI,setBirthInfo:eF,setBaziChart:eA,setComprehensiveAnalysis:eD,loadLifeBook:eC,handleSaveLifeBook:eE,handleDeleteLifeBook:eO,handleUpdateLifeBook:eL}=(0,E.c)(),eB=(0,s.useMemo)(()=>{if(!eS)return null;try{let e=new Date,i=(0,B.V)(eS,e.getFullYear(),e.getMonth()+1),o="life_book.time_context.health.".concat(i.tenGod),l=t(o);return l!==o?l:null}catch(e){return null}},[eS,t]),[ez,eM]=(0,s.useState)(!1);(0,s.useEffect)(()=>{eb.current=null},[null==ex?void 0:ex.id,ej]);let eT=[{id:"health-timeline",icon:a.A,title:t("life_book.health.section.timeline.title"),description:t("life_book.health.section.timeline.description"),highlights:[t("life_book.health.section.timeline.highlight1"),t("life_book.health.section.timeline.highlight2"),t("life_book.health.section.timeline.highlight3"),t("life_book.health.section.timeline.highlight4")],isFree:!1},{id:"organ-vulnerability",icon:r.A,title:t("life_book.health.section.organ.title"),description:t("life_book.health.section.organ.description"),highlights:[t("life_book.health.section.organ.highlight1"),t("life_book.health.section.organ.highlight2"),t("life_book.health.section.organ.highlight3"),t("life_book.health.section.organ.highlight4")],isFree:!1},{id:"mental-health",icon:c.A,title:t("life_book.health.section.mental.title"),description:t("life_book.health.section.mental.description"),highlights:[t("life_book.health.section.mental.highlight1"),t("life_book.health.section.mental.highlight2"),t("life_book.health.section.mental.highlight3"),t("life_book.health.section.mental.highlight4")],isFree:!1},{id:"sleep-energy",icon:h.A,title:t("life_book.health.section.sleep.title"),description:t("life_book.health.section.sleep.description"),highlights:[t("life_book.health.section.sleep.highlight1"),t("life_book.health.section.sleep.highlight2"),t("life_book.health.section.sleep.highlight3"),t("life_book.health.section.sleep.highlight4")],isFree:!1},{id:"diet-nutrition",icon:d.A,title:t("life_book.health.section.diet.title"),description:t("life_book.health.section.diet.description"),highlights:[t("life_book.health.section.diet.highlight1"),t("life_book.health.section.diet.highlight2"),t("life_book.health.section.diet.highlight3"),t("life_book.health.section.diet.highlight4")],isFree:!1},{id:"exercise-fitness",icon:f.A,title:t("life_book.health.section.exercise.title"),description:t("life_book.health.section.exercise.description"),highlights:[t("life_book.health.section.exercise.highlight1"),t("life_book.health.section.exercise.highlight2"),t("life_book.health.section.exercise.highlight3"),t("life_book.health.section.exercise.highlight4")],isFree:!1},{id:"chronic-risk",icon:g.A,title:t("life_book.health.section.chronic.title"),description:t("life_book.health.section.chronic.description"),highlights:[t("life_book.health.section.chronic.highlight1"),t("life_book.health.section.chronic.highlight2"),t("life_book.health.section.chronic.highlight3"),t("life_book.health.section.chronic.highlight4")],isFree:!1},{id:"seasonal-health",icon:m.A,title:t("life_book.health.section.seasonal.title"),description:t("life_book.health.section.seasonal.description"),highlights:[t("life_book.health.section.seasonal.highlight1"),t("life_book.health.section.seasonal.highlight2"),t("life_book.health.section.seasonal.highlight3"),t("life_book.health.section.seasonal.highlight4")],isFree:!1},{id:"aging-longevity",icon:u.A,title:t("life_book.health.section.aging.title"),description:t("life_book.health.section.aging.description"),highlights:[t("life_book.health.section.aging.highlight1"),t("life_book.health.section.aging.highlight2"),t("life_book.health.section.aging.highlight3"),t("life_book.health.section.aging.highlight4")],isFree:!1},{id:"fertility-reproductive",icon:b.A,title:t("life_book.health.section.fertility.title"),description:t("life_book.health.section.fertility.description"),highlights:[t("life_book.health.section.fertility.highlight1"),t("life_book.health.section.fertility.highlight2"),t("life_book.health.section.fertility.highlight3"),t("life_book.health.section.fertility.highlight4")],isFree:!1},{id:"accident-prevention",icon:x.A,title:t("life_book.health.section.accident.title"),description:t("life_book.health.section.accident.description"),highlights:[t("life_book.health.section.accident.highlight1"),t("life_book.health.section.accident.highlight2"),t("life_book.health.section.accident.highlight3"),t("life_book.health.section.accident.highlight4")],isFree:!1},{id:"health-benefactor",icon:p.A,title:t("life_book.health.section.benefactor.title"),description:t("life_book.health.section.benefactor.description"),highlights:[t("life_book.health.section.benefactor.highlight1"),t("life_book.health.section.benefactor.highlight2"),t("life_book.health.section.benefactor.highlight3"),t("life_book.health.section.benefactor.highlight4")],isFree:!1}],eR=[{id:"health-constitution",icon:_.A,title:t("life_book.health.section.constitution.title"),description:t("life_book.health.section.constitution.description"),highlights:[t("life_book.health.section.constitution.highlight1"),t("life_book.health.section.constitution.highlight2"),t("life_book.health.section.constitution.highlight3"),t("life_book.health.section.constitution.highlight4")],isFree:!0},...eT],eP=eR[er],eG=eP.isFree||!1,eY=J.has(eP.id)||J.has(eP.title)||q.has(eP.title)||eG,eU=ee.has(eP.id),eZ=V[eP.id];(0,s.useEffect)(()=>{let e=()=>{G(!0),H(!1)};return window.addEventListener("createNewLifeBook",e),()=>window.removeEventListener("createNewLifeBook",e)},[]),(0,s.useEffect)(()=>
1{if(Q(new Set),X({}),eo(""),!ej)return void em(null);let e=ey.find(e=>e.id===ej);if(!e)return void em(null);if("health"===e.scene){console.log("â
å½åå½ä¹¦å°±æ¯å¥åº·è®°å½:",ej),em(ej);return}let t=e.birthInfoId;if(t){let e=ey.find(e=>"health"===e.scene&&e.birthInfoId===t);if(e){console.log("â
æ birthInfoId æ¾å°å¥åº·è®°å½:",e.id),em(e.id);return}}let i=e.name,o=i.match(/^(.+?)ç/);o&&(i=o[1]);let l=ey.find(e=>{if("health"!==e.scene)return!1;let t=e.name,o=t.match(/^(.+?)ç/);return o&&(t=o[1]),t===i});l?(console.log("â
æ¾å°ååå¥åº·è®°å½:",l.id),em(l.id)):(console.log("â¹ï¸ æªæ¾å°å¥åº·è®°å½ï¼é¦æ¬¡ä½¿ç¨æ¶ä¼èªå¨å建"),em(null))},[ej,ey]),(0,s.useEffect)(()=>{let e=!1;return(async()=>{if(!eS||!eI||!ej||!(null==ex?void 0:ex.id))return;let t="lifebook_health_".concat(ex.id,"_").concat(ej);try{ea(!0);let i=z.apiCache.get(t,!0);if(i&&(e||(console.log("â¡ ç«å³æ¾ç¤ºç¼åç解读 (å½ä¹¦:",ej,")"),X(e=>({...e,...i.analysis})),Q(new Set(i.titles)),i.timestamps&&W(e=>({...e,...i.timestamps})),ea(!1),!z.apiCache.isStale(t))))return;console.log("\uD83D\uDD0D æ¥è¯¢å½åå½ä¹¦çå¥åº·è®°å½...");let o=ey.find(e=>e.id===ej),l=eb.current||await (0,z.apiGet)("/api/life-book/records?userId=".concat(ex.id));if(e)return;eb.current||(eb.current=l);let n=null==o?void 0:o.birthInfoId,s=(l||[]).filter(e=>"health"===e.analysis_type);console.log("\uD83D\uDD0D è°è¯:",{totalRecords:null==l?void 0:l.length,healthRecords:s.length,healthIds:s.map(e=>e.id),currentLifeBookId:ej,currentBirthInfoId:n,currentBookName:null==o?void 0:o.name});let a=null;if(n&&(a=null==l?void 0:l.find(e=>"health"===e.analysis_type&&e.birth_info_id===n)),a||(a=null==l?void 0:l.find(e=>e.id===ej&&"health"===e.analysis_type)),!a&&o){let e=o.name,t=e.match(/^(.+?)ç/);t&&(e=t[1]),a=null==l?void 0:l.find(t=>{if("health"!==t.analysis_type)return!1;let i=t.title||"",o=i.match(/^(.+?)ç/);return o&&(i=o[1]),i===e})}if(!a&&eg.current&&(a=null==l?void 0:l.find(e=>e.id===eg.current)),a||(a=s.sort((e,t)=>new Date(t.updated_at||t.created_at).getTime()-new Date(e.updated_at||e.created_at).getTime())[0]||null),!a){console.log("\uD83D\uDCED å½åå½ä¹¦ææ å¥åº·è®°å½"),ea(!1);return}if(a.id!==eg.current&&em(a.id),console.log("\uD83D\uDCE6 æ¾å°å½åå½ä¹¦çå¥åº·è®°å½:",a.id),!a.ai_content)return void ea(!1);let r="string"==typeof a.ai_content?JSON.parse(a.ai_content):a.ai_content;if((null==r?void 0:r.sections)&&"object"==typeof r.sections){let i={},o=[];for(let[e,t]of Object.entries(r.sections)){let l=R[e]||e;i[l]=t.content||"",o.push(l)}if(e)return;X(e=>({...e,...i}));let l={},n=a.updated_at||a.created_at||new Date().toISOString();for(let[e,t]of Object.entries(r.sections))l[R[e]||e]=t.generated_at||n;W(e=>({...e,...l})),Q(new Set(o)),z.apiCache.set(t,{analysis:i,titles:o,timestamps:l},36e5),console.log("â
åå²è§£è¯»å è½½å®æ (å½ä¹¦:",ej,", æ ç®æ°:",o.length,")")}}catch(e){console.warn("Failed to load sections from database:",e)}finally{ea(!1)}})(),()=>{e=!0}},[eS,eI,ej,null==ex?void 0:ex.id]);let eH=async e=>{try{U("");let t=new Date(e.birth_datetime),i={year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:t.getHours(),minute:t.getMinutes(),isLunar:"lunar"===e.calendar_type,isLeapMonth:e.is_leap_month||!1,gender:e.gender||"male",cityName:e.birth_place,longitude:e.longitude||116.4074,latitude:e.latitude||39.9042,useTrueSolarTime:e.use_true_solar_time||!1},o=(0,L.dX)(i);eA(o);let l=(0,L.SA)(o,e.gender||"male");eD(l),Z&&ej?await eL(ej,{birthInfo:i,chart:o,analysis:l}):await eE(e.name,o,l,"health",i,!0,e.id),G(!1),H(!1)}catch(e){U(e instanceof Error?e.message:t("life_book.error.calc_failed"))}},eJ=e=>{eh.current&&eh.current.scrollTo({left:376*e,behavior:"smooth"})},eQ=async()=>{if(eg.current)return eg.current;if(!ej||!(null==ex?void 0:ex.id))return console.warn("â ï¸ ç¼ºå°å¿
è¦ä¿¡æ¯"),null;let e=ey.find(e=>e.id===ej);if(!e)return console.warn("â ï¸ æ¾ä¸å°å½åå½ä¹¦"),null;let t=e.name,i=t.match(/^(.+?)ç/);i&&(t=i[1]);let o=ey.find(e=>{if("health"!==e.scene)return!1;let i=e.name,o=i.match(/^(.+?)ç/);return o&&(i=o[1]),i===t});if(o)return console.log("â
ä» savedLifeBooks 䏿¾å°å¥åº·è®°å½:",o.id
1),em(o.id),o.id;if(eu.current){console.log("â³ è®°å½å建ä¸ï¼çå¾
宿...");let e=0;for(;!eg.current&&eu.current&&e<30;)await new Promise(e=>setTimeout(e,100)),e++;return eg.current}eu.current=!0;try{if(!e.chart||!e.analysis)return console.warn("â ï¸ ç¼ºå°å
«åæ°æ®ï¼æ æ³å建记å½"),null;console.log("\uD83D\uDD28 æªæ¾å°å¥åº·è®°å½ï¼ç«å³å建...");let t=await eE(e.name,e.chart,e.analysis,"health",e.birthInfo,!1,e.birthInfoId);if(null==t?void 0:t.id)return console.log("â
å¥åº·è®°å½å建æå:",t.id),em(t.id),eb.current=null,t.id;return null}catch(e){return console.error("â ç¡®ä¿è®°å½å¤±è´¥:",e),null}finally{eu.current=!1}},eq=async(e,t)=>{if(J.has(e)||J.has(t))return;if(es)return void console.warn("â³ æ£å¨å è½½åå²è§£è¯»ï¼è¯·ç¨å...");let i=eR.find(i=>i.id===e||i.title===t),o=(null==i?void 0:i.isFree)||!1;await eK(e,t,o)},eK=async(e,o,l)=>{var n,s,a,r,c,h,d;et(t=>new Set([...t,e])),en(t=>{let i={...t};return delete i[e],i});let f=0,g="";try{let c=eg.current;if(!c){if(console.log("â³ recordId æªåå§åï¼èªå¨å建记å½..."),!(c=await eQ()))throw Error(t("life_book.error.health_init_failed"));console.log("â
è®°å½å·²å建:",c)}if(!l){console.log("\uD83D\uDCB0 å¼å§æ£å¸ï¼æ ç®:",o),g="".concat(c,"-").concat(o,"-").concat(Date.now());let e=await (0,z.apiPost)("/api/coins/service-pay",{serviceKey:"bazi_single",referenceId:g});if(!e.success){let i=e.error||t("life_book.error.insufficient_coins");throw Error(i)}f=e.cost||0,ev(e.newBalance||0),null==e_||e_(),console.log("â
æ£çµå¼æåï¼å©ä½:",e.newBalance,"çµå¼")}let h=ey.find(e=>e.id===ej),d=null==h?void 0:h.birthInfoId,m=await (0,z.apiPost)("/api/life-book/health-analysis",{baziChart:eS,section:e,birthInfo:eN,birthInfoId:d,language:i});if(console.log("â
AIè§£è¯»çææå:",o,"é¿åº¦:",null==(n=m.analysis)?void 0:n.length),!m.anal
1ysis||"string"!=typeof m.analysis||m.analysis.trim().length<100)throw console.error("â AIååºæ ææå
容è¿ç:",o,"é¿åº¦:",null==(s=m.analysis)?void 0:s.length),Error(t("life_book.error.ai_response_invalid")||"AIååºæ æï¼è¯·éè¯");X(t=>({...t,[e]:m.analysis})),W(t=>({...t,[e]:new Date().toISOString()})),Q(t=>new Set([...t,e]));try{console.log("\uD83D\uDCBE å¼å§ä¿åå°æ°æ®åº, recordId:",c);let e=await (0,z.apiGet)("/api/life-book/records/".concat(c));if(!e)throw console.error("â è®°å½ä¸åå¨:",c),Error(t("life_book.error.health_not_found"));console.log("\uD83D\uDCC4 å½åè®°å½:",e.id,"type:",e.analysis_type);let i={sections:{},metadata:{}};(null==e?void 0:e.ai_content)&&(i="string"==typeof e.ai_content?JSON.parse(e.ai_content):e.ai_content),i.sections||(i.sections={}),i.sections[o]={title:o,content:m.analysis,generated_at:new Date().toISOString(),tokens_used:m.tokensUsed||0,word_count:(null==(a=m.analysis)?void 0:a.length)||0};let l=i.sections,n=Object.keys(l),s=n.reduce((e,t)=>e+(l[t].word_count||0),0),h=n.reduce((e,t)=>e+(l[t].tokens_used||0),0);if(i.metadata={total_sections:13,completed_sections:n.length,total_words:s,total_tokens:h,first_generated_at:(null==(r=i.metadata)?void 0:r.first_generated_at)||new Date().toISOString(),last_updated_at:new Date().toISOString()},await (0,z.apiPatch)("/api/life-book/records/".concat(c),{ai_content:JSON.stringify(i)}),console.log("â
AI解读已ä¿åå°æ°æ®åº:",o,"æ»æ ç®æ°:",n.length),(null==ex?void 0:ex.id)&&ej){let e="lifebook_health_".concat(ex.id,"_").concat(ej),t={},i={};for(let e of n)t[e]=l[e].content||"",i[e]=l[e].generated_at||new Date().toISOString();z.apiCache.set(e,{analysis:t,titles:n,timestamps:i},36e5),console.log("â
å·²æ´æ°ç¼å (å½ä¹¦:",ej,", æ ç®æ°:",n.length,")")}z.apiCache.delete("lifebook_record_".concat(c)),eb.current=null}catch(e){console.error("â æ°æ®åºä¿å失败:",e)}}catch(o){if(console.error("Failed to generate analysis:",o),f>0&&g){console.log("\uD83D\uDCB8 AI失败ï¼åèµ·éæ¬¾:",f,"çµå¼, referenceId:",g);try{let e=await (0,z.apiPost)("/api/coins/refund",{referenceId:g,amount:f,reason:"AI解读失败èªå¨é款"});e.success?(console.log("â
鿬¾æåï¼æ°ä½é¢:",e.newBalance),ev(e.newBalance)):console.error("â 鿬¾å¤±è´¥:",e.error)}catch(e){console.error("â 鿬¾è¯·æ±å¤±è´¥:",e)}}let i=t("life_book.error.generate_failed");(null==o?void 0:o.status)===422||(null==o||null==(c=o.response)?void 0:c.status)===422?i=(null==o?void 0:o.message)||(null==o||null==(d=o.response)||null==(h=d.data)?void 0:h.message)||t("life_book.error.ai_invalid"):(null==o?void 0:o.message)&&(i=o.message),en(t=>({...t,[e]:i})),Q(t=>new Set([...t,e]))}finally{et(t=>{let i=new Set(t);return i.delete(e),i})}},eV=async(e,t)=>{let i="health_analysis_".concat(ed,"_").concat(e);localStorage.removeItem(i),en(t=>{let i={...t};return delete i[e],i}),X(t=>{let i={...t};return delete i[e],i}),Q(t=>{let i=new Set(t);return i.delete(e),i}),await eK(e,t,!1)};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"pb-12 md:pb-20 px-3 md:px-4 lg:px-4",children:(0,o.jsxs)("div",{className:"max-w-[38rem] md:max-w-2xl lg:max-w-5xl xl:max-w-6xl mx-auto space-y-6 md:space-y-8 pt-6 md:pt-8",children:[(0,o.jsxs)("div",{className:"text-center space-y-2 md:space-y-3",children:[(0,o.jsx)("h1",{className:"text-2xl md:text-3xl font-semibold tracking-tight text-balance",style:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif'},children:t("life_book.health.title")}),(0,o.jsx)("p",{className:"text-xs md:text-sm text-muted-foreground text-balance leading-relaxed",children:t("life_book.health.subtitle")})]}),eS&&eI?(0,o.jsxs)("div",{className:"space-y-8 md:space-y-10",children:[(0,o.jsxs)("div",{className:"relative group",children:[(0,o.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-foreground
1/[0.02] to-foreground/[0.01] rounded-xl"}),(0,o.jsx)("div",{className:"relative border border-foreground/10 rounded-xl p-5 md:p-6 backdrop-blur-sm",children:(0,o.jsxs)("div",{className:"flex items-start gap-4",children:[(0,o.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:(0,o.jsx)("div",{className:"h-8 w-8 rounded-full bg-foreground/5 flex items-center justify-center group-hover:bg-foreground/10 transition-colors",children:(0,o.jsx)(k.A,{className:"h-4 w-4 text-foreground/60"})})}),(0,o.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,o.jsx)("p",{className:"text-sm font-medium text-foreground/90 leading-relaxed",children:t("life_book.common.start_free_tip")}),(0,o.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed",children:t("life_book.health.free_tip")})]})]})})]}),ei&&(0,o.jsx)(n.Zp,{className:"p-4 border-red-500/50 bg-red-500/5",children:(0,o.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:ei})}),(0,o.jsxs)("div",{className:"relative",children:[(0,o.jsx)("button",{onClick:()=>{er>0&&(ec(er-1),eJ(er-1))},className:"hidden md:flex absolute left-0 top-1/2 -translate-y-1/2 -translate-x-4 z-10 h-10 w-10 items-center justify-center rounded-full bg-background border-2 border-border shadow-lg hover:bg-muted transition-colors","aria-label":t("life_book.common.scroll_left"),children:(0,o.jsx)(v.A,{className:"h-5 w-5"})}),(0,o.jsx)("button",{onClick:()=>{er<eR.length-1&&(ec(er+1),eJ(er+1))},className:"hidden md:flex absolute right-0 top-1/2 -translate-y-1/2 translate-x-4 z-10 h-10 w-10 items-center justify-center rounded-full bg-background border-2 border-border shadow-lg hover:bg-muted transition-colors","aria-label":t("life_book.common.scroll_right"),children:(0,o.jsx)(w.A,{className:"h-5 w-5"})}),(0,o.jsx)("div",{ref:eh,className:"overflow-x-auto scrollbar-hide snap-x snap-mandatory",children:(0,o.jsx)("div",{className:"flex gap-4 pb-4 px-1",children:eR.map((e,i)=>(0,o.jsx)("button",{onClick:()=>ec(i),className:"flex-shrink-0 w-[280px] sm:w-[320px] md:w-[360px] snap-center transition-all duration-300 ".concat(er===i?"scale-100 opacity-100":"scale-95 opacity-60 hover:opacity-80"),children:(0,o.jsxs)(n.Zp,{className:"h-full transition-all duration-300 ".concat(e.isFree?"border-2 border-transparent":er===i?"border-2 border-foreground
1/30 shadow-lg":"border-2 border-border hover:border-foreground/20"," ").concat(e.isFree&&er===i?"shadow-lg":""," ").concat(e.isFree?"hover:rotate-2":""),style:e.isFree?{background:"linear-gradient(hsl(var(--card)), hsl(var(--card))) padding-box, linear-gradient(145deg, transparent 35%, #e81cff, #40c9ff) border-box"}:void 0,children:[(0,o.jsxs)("div",{className:"absolute top-3 right-3 flex items-center gap-2",children:[(0,o.jsx)("div",{className:"px-2 py-0.5 rounded-md bg-foreground/10 text-foreground text-xs font-mono font-semibold",children:String(i+1).padStart(2,"0")}),e.isFree&&(0,o.jsx)("div",{className:"px-2.5 py-0.5 rounded-full bg-gradient-to-r from-[#e81cff] to-[#40c9ff] text-white text-xs font-bold shadow-md",children:t("life_book.common.free")})]}),(0,o.jsxs)("div",{className:"p-5 space-y-4",children:[(0,o.jsxs)("div",{className:"flex items-start gap-3",children:[(0,o.jsx)("div",{className:"p-2.5 rounded-lg flex-shrink-0 transition-colors duration-300 ".concat(e.isFree?"bg-gradient-to-br from-[#e81cff]/10 to-[#40c9ff]/10":er===i?"bg-foreground
1/10":"bg-foreground/5"),children:(0,o.jsx)(e.icon,{className:"h-5 w-5 ".concat(e.isFree?"text-[#e81cff]":"text-foreground")})}),(0,o.jsxs)("div",{className:"space-y-1 flex-1 min-w-0 text-left",children:[(0,o.jsx)("h3",{className:"text-base font-semibold leading-tight text-balance",children:e.title}),(0,o.jsx)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:e.isFree?J.has(e.id)||J.has(e.title)?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(y.A,{className:"h-3 w-3 text-[#e81cff]"}),(0,o.jsx)("span",{className:"text-[#e81cff] font-medium",children:t("life_book.common.unlocked")})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(k.A,{className:"h-3 w-3 text-[#e81cff]"}),(0,o.jsx)("span",{className:"text-[#e81cff] font-medium",children:t("life_book.common.view_now")})]}):J.has(e.id)||J.has(e.title)||q.has(e.title)||q.has(e.id)?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(y.A,{className:"h-3 w-3 text-[#e81cff]"}),(0,o.jsx)("span",{className:"text-[#e81cff] font-medium",children:t("life_book.common.unlocked")})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(k.A,{className:"h-3 w-3"}),(0,o.jsx)("span",{children:t("life_book.common.view_now")})]})})]})]}),(0,o.jsx)("p",{className:"text-xs text-muted-foreground leading-relaxed text-pretty text-left line-clamp-2",children:e.description}),(0,o.jsxs)("div",{className:"space-y-2 pt-1",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2 text-xs font-medium text-foreground/70",children:[(0,o.jsx)(k.A,{className:"h-3 w-3"}),(0,o.jsx)("span",{children:t("life_book.common.includes")})]}),(0,o.jsx)("div",{className:"space-y-1.5",children:e.highlights.slice(0,3).map((e,t)=>(0,o.jsxs)("div",{className:"flex items-start gap-2 text-xs",children:[(0,o.jsx)("div",{className:"mt-1 h-1 w-1 rounded-full bg-foreground
1/40 flex-shrink-0"}),(0,o.jsx)("span",{className:"text-muted-foreground leading-relaxed text-pretty flex-1 line-clamp-1 text-left",children:e})]},t))})]})]})]})},i))})}),(0,o.jsx)("div",{className:"flex justify-center gap-1.5 mt-4",children:eR.map((e,i)=>(0,o.jsx)("button",{onClick:()=>ec(i),className:"h-1.5 rounded-full transition-all duration-300 ".concat(er===i?"w-8 bg-foreground":"w-1.5 bg-foreground/20"),"aria-label":t("life_book.common.jump_to_section",{index:i+1})},i))})]}),(0,o.jsx)("div",{className:"max-w-4xl mx-auto",children:eG?eU?(0,o.jsx)(I.x,{icon:eP.icon,title:eP.title,content:"",isLoading:!0,error:el[eP.id]||null,onRegenerate:()=>eV(eP.id,eP.title),timeContext:eB,onAiQuestion:()=>eM(!0),generatedAt:$[eP.id]||$[eP.title],regenerateCost:ew,isTimeSensitive:(0,F.tn)(eP.id),balance:ek}):eZ?(0,o.jsxs)(n.Zp,{className:"relative overflow-hidden border-2 border-transparent shadow-sm",style:{background:"linear-gradient(hsl(var(--card)), hsl(var(--card))) padding-box, linear-gradient(145deg, transparent 35%, #e81cff, #40c9ff) border-box"},children:[(0,o.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-[#e81cff]/[0.03] via-trans
1parent to-[#40c9ff]/[0.03]"}),(0,o.jsxs)("div",{className:"relative p-6 md:p-8 space-y-6",children:[(0,o.jsxs)("div",{className:"flex items-start gap-4",children:[(0,o.jsx)("div",{className:"p-3 rounded-lg bg-gradient-to-br from-[#e81cff]/10 to-[#40c9ff]/10 flex-shrink-0 border border-[#e81cff]/20",children:(0,o.jsx)(_.A,{className:"h-6 w-6 md:h-7 md:w-7 text-[#e81cff]"})}),(0,o.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,o.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,o.jsx)("h2",{className:"text-xl md:text-2xl font-bold",children:t("life_book.health.section.constitution.title")}),(0,o.jsx)("span",{className:"px-2.5 py-0.5 rounded-full bg-gradient-to-r from-[#e81cff] to-[#40c9ff] text-white text-xs font-bold shadow-md",children:t("life_book.common.free")})]}),(0,o.jsx)("p",{className:"text-sm text-muted-foreground",children:t("life_book.health.section.constitution.description")}),($[eP.id]||$[eP.title])&&(0,o.jsx)("p",{className:"text-[11px] text-muted-foreground/60",children:t("life_book.section.generated_time",{time:new Date($[eP.id]||$[eP.title]).toLocaleString()})})]})]}),(()=>{let e=$[eP.id];if(e){let t=new Date(e),i=new Date;if(t.getFullYear()===i.getFullYear()&&t.getMonth()===i.getMonth()&&t.getDate()===i.getDate())return null}let i="number"==typeof ek&&"number"==typeof ew&&ek<ew;return(0,o.jsxs)("div",{className:"rounded-xl bg-gradient-to-r from-amber-50/80 to-orange-50/50 border border-amber-100/60 p-4 space-y-3",children:[(0,o.jsx)("p",{className:"text-sm text-amber-800/80 leading-relaxed",children:e?t("life_book.section.reanalyze_desc_with_date",{date:new Date(e).toLocaleDateString()}):t("life_book.section.reanalyze_desc")}),(0,o.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,o.jsx)("button",{onClick:i?void 0:()=>eV(eP.id,eP.title),disabled:i,className:"text-sm font-medium px-4 py-2 rounded-lg shadow-sm transition-all ".concat(i?"bg-muted text-muted-foreground cursor-not-allowed":"text-white bg-gradient-to-r from-amber-500 to-orange-500 hover:from-amber-600 hover:to-orange-600"),children:t("life_book.section.reanalyze_btn_cost",{cost:ew})}),"number"==typeof ek&&(0,o.jsx)("span",{className:"text-xs ".concat(i?"text-destructive":"text-muted-foreground"),children:i?t("life_book.section.insufficient_balance",{balance:ek}):t("life_book.section.current_balance",{balance:ek})})]})]})})(),(0,o.jsx)("div",{className:"mb-2",children:(0,o.jsx)(D.u,{text:eZ,comingSoon:!0})}),(0,o.jsx)("div",{className:"prose prose-sm md:prose-base max-w-none dark:prose-invert prose-headings:text-foreground prose-p:text-muted-foreground prose-strong:text-foreground prose-li:text-muted-foreground",children:(0,o.jsx)(A.oz,{remarkPlugins:[C.A],components:{h1:e=>{let{children:t}=e;return(0,o.jsx)("h3",{className:"text-lg md:text-xl font-bold mt-6 mb-3 text-foreground",children:t})},h2:e=>{let{children:t}=e;return(0,o.jsx)("h4",{className:"text-base md:text-lg font-semibold mt-5 mb-2 text-foreground",children:t})},h3:e=>{let{children:t}=e;return(0,o.jsx)("h5",{className:"text-sm md:text-base font-semibold mt-4 mb-2 text-foreground",children:t})},p:e=>{let{children:t}=e;return(0,o.jsx)("p",{className:"text-sm md:text-base text-muted-foreground leading-relaxed mb-4 text-pretty",children:t})},ul:e=>{let{children:t}=e;return(0,o.jsx)("ul",{className:"list-disc list-inside space-y-2 mb-4 ml-2",children:t})},ol:e=>{let{children:t}=e;return(0,o.jsx)("ol",{className:"list-decimal list-inside space-y-2 mb-4 ml-2",children:t})},li:e=>{let{children:t}=e;return(0,o.jsx)("li",{className:"text-sm md:text-base text-muted-foreground leading-relaxed",children:t})},strong:e=>{let{children:t}=e;return(0,o.jsx)("strong",{className:"font-semibold text-foreground",children:t})}},children:eZ})}),(0,o.jsxs)("div",{className:"pt-4 border-t border-border/30 space-y-1.5",children:[(0,o.jsx)("div",{className:"flex justify-center",children:(0,o.jsx)("button",{onClick:()=>eM(!0),className:"relative group px-6 py-2 overflow-hidden rounded-xl bg-emerald-500/10 hover:bg-emerald-500/20 border border-emerald-500/20 hover:border-emerald-500/30 transition-all duration-300",children:(0,o.jsx)("span",{className:"flex items-center gap-2 font-medium text-sm text-emerald-600",children:t("life_book.section.ai_followup")})})}
1),(0,o.jsx)("p",{className:"text-[10px] text-muted-foreground/40 text-center",children:t("life_book.section.followup_cost_hint")})]})]})]}):(0,o.jsx)(S.i,{icon:eP.icon,title:eP.title,description:eP.description,highlights:eP.highlights,onUnlock:()=>eq(eP.id,eP.title),isFree:!0}):(0,o.jsx)(o.Fragment,{children:eY||eU?(0,o.jsx)(I.x,{icon:eP.icon,title:eP.title,content:eZ||"",isLoading:eU,error:el[eP.id]||null,onRegenerate:()=>eV(eP.id,eP.title),timeContext:eB,onAiQuestion:()=>eM(!0),regenerateCost:ew,isTimeSensitive:(0,F.tn)(eP.id),balance:ek,generatedAt:$[eP.id]||$[eP.title]}):(0,o.jsx)(S.i,{icon:eP.icon,title:eP.title,description:eP.description,highlights:eP.highlights,onUnlock:()=>eq(eP.id,eP.title),cost:ew,balance:ek})})})]}):(0,o.jsx)(n.Zp,{className:"p-6 md:p-12 text-center border border-border",children:(0,o.jsxs)("div",{className:"space-y-4",children:[(0,o.jsx)(j.A,{className:"h-10 w-10 md:h-16 md:w-16 mx-auto text-muted-foreground"}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)("h3",{className:"text-base md:text-xl font-semibold",children:t("common.birth_info_required")}),(0,o.jsx)("p",{className:"text-xs md:text-base text-muted-foreground",children:t("life_book.common.birth_info_hint")})]}),(0,o.jsx)(l.$,{onClick:()=>{G(!0),H(!1)},size:"lg",className:"w-full sm:w-auto",children:t("life_book.common.start_analysis")})]})})]})}),P&&(0,o.jsx)(N.d,{isOpen:P,onClose:()=>{G(!1),U(""),H(!1)},birthInfo:Z&&ej?{...null==(e=ey.find(e=>e.id===ej))?void 0:e.birthInfo,id:ej,birth_datetime:"".concat(eN.year,"-").concat(String(eN.month).padStart(2,"0"),"-").concat(String(eN.day).padStart(2,"0")," ").concat(String(eN.hour).padStart(2,"0"),":").concat(String(eN.minute).padStart(2,"0"),":00"),birth_place:eN.cityName,calendar_type:eN.isLunar?"lunar":"solar"}:null,onSuccess:eH,existingBirthInfos:[]}),ez&&ej&&(0,o.jsx)("div",{className:"fixed bottom-2 sm:bottom-4 right-2 sm:right-4 w-[calc(100vw-1rem)] sm:w-96 z-50 animate-in slide-in-from-bottom-4 duration-300",children:(0,o.jsx)(O.s,{parentId:ej,module:"bazi",onClose:()=>eM(!1),title:t("life_book.section.ai_followup"),introTitle:t("life_book.section.followup_intro"),introMessage:t("life_book.section.followup_hint",{section:eP.title})})})]})}},66249:(e,t,i)=>{i.d(t,{tn:()=>l});let o=new Set(["dating-timeline","confession-success","milestone-timeline","ex-reconciliation","career-timeline","job-hunting","promotion-salary","job-change","entrepreneurship","wealth-timeline","overnight-wealth","investment-fortune","bankruptcy-warning","health-timeline","seasonal-health","accident-prevention"]);function l(e){return o.has(e)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.