dsh-metaphysics 0.58.0 → 0.59.0

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,6 +1,6 @@
1
- window.__ModuleLoader__.load({id:"dsh-metaphysics",chunk:"client.fengshui.js",factory(nt){const _={};return _.fail=(function(){return{fail:(q,H)=>{const v=new Error(H);return v.code=q,v}}})(),_.diff=(function(){const R=new Set(["summary","interpret","castAt","asOf","precision","disclaimer","note","trueSolarText","civilText","offsetMinutes","input","jd","juMethod","juMethodNote","lateZiHourMode","leapPolicy","schools","bodyMasterSchool","bodyMasterNote","handle","handleError","revision"]),q=o=>o!==null&&typeof o=="object";function H(o,r,c="",u=[]){if(o===r)return u;if(!q(o)||!q(r))return u.push({path:c||"(root)",from:o,to:r}),u;const S=new Set([...Object.keys(o),...Object.keys(r)]);for(const M of S){if(R.has(M))continue;const A=c?`${c}.${M}`:M,oe=o[M],ie=r[M];q(oe)&&q(ie)?H(oe,ie,A,u):JSON.stringify(oe)!==JSON.stringify(ie)&&u.push({path:A,from:oe,to:ie})}return u}const v=[[/^pillars\.year\.ganzhi$/,"年柱"],[/^pillars\.month\.ganzhi$/,"月柱"],[/^pillars\.day\.ganzhi$/,"日柱"],[/^pillars\.hour\.ganzhi$/,"时柱"],[/^pillars\.\w+\.hidden/,"藏干"],[/^pillars\.\w+\.stemTenGod$/,"十神"],[/^pillars\.\w+\.kongwang/,"空亡"],[/^pillars\.\w+\.dishi$|^pillars\.\w+\.zizuo$/,"十二长生"],[/^pillars\.\w+\.nayin$/,"纳音"],[/^dayMaster\./,"日主"],[/^palaces\.(taiyuan|minggong|shengong)\./,"命身宫"],[/^palaces\.\d+\.(palace|branch|stem|ganzhi)$/,"宫位"],[/^palaces\.\d+\.stars\.\d+\.(name|brightness|type)$/,"星曜"],[/^palaces\.\d+\.shensha\./,"神煞"],[/^palaces\.\d+\.(daxian|xiaoxian)\./,"大限"],[/^palaces\.\d+\.sanfang\./,"三方四正"],[/^palaces\.\d+\./,"宫位"],[/^palaces\./,"命身宫"],[/^soul\./,"命宫"],[/^body\./,"身宫"],[/^doujun\./,"流年斗君"],[/^siZhu\.year$/,"年柱"],[/^siZhu\.month$/,"月柱"],[/^siZhu\.day$/,"日柱"],[/^siZhu\.time$/,"时柱"],[/^ju$|^juNumber$/,"局数"],[/^yuan$/,"三元"],[/^dun$/,"阴阳遁"],[/^daxian(List)?\./,"大限"],[/^fly(Chains|Composite)?\./,"飞星"],[/^pattern/,"格局"],[/^schools\./,"流派回显"],[/^dayun\.jiao\./,"起运"],[/^dayun\.toNextJieDays$/,"起运时间"],[/^dayun\.list\.(\d+)\.ganzhi$/,"大运干支"],[/^dayun\.startAge\./,"起运时间"],[/^dayun\./,"大运评分"],[/^liunian\./,"流年"],[/^jieqi\./,"节气边界"],[/^solarTime\./,"真太阳时"],[/^dayGanZhi$/,"日辰"],[/^hourZhi$/,"时支"],[/^yueJiang\./,"月将"],[/^xunKong$/,"旬空"],[/^lines\.(\d+)\./,"爻"],[/^shensha\./,"神煞"],[/^frame\./,"格局用神"],[/^strength\./,"旺衰"],[/^wuxing\./,"五行计数"],[/^relations\./,"干支关系"],[/^input\./,"输入回显"]],L=[[/^pillars\./,"四柱"],[/^shensha\./,"神煞"],[/^dayun\./,"大运"],[/^liunian\./,"流年"],[/^frame\./,"格局用神"],[/^strength\./,"旺衰"],[/^wuxing\./,"五行计数"],[/^dayMaster\./,"日主"],[/^relations\./,"干支关系"],[/^palaces\.(taiyuan|minggong|shengong)\./,"命身宫"],[/^palaces\.\d+\./,"宫位"],[/^palaces\./,"命身宫"],[/^soul\.|^body\.|^doujun\./,"命身宫"],[/^siZhu\./,"四柱"],[/^ju$|^juNumber$|^yuan$|^dun$/,"局数"],[/^daxian/,"大限"],[/^fly/,"飞星"],[/^pattern/,"格局"],[/^jieqi\./,"节气"],[/^solarTime\./,"真太阳时"],[/^input\./,"输入回显"],[/^lines\./,"爻"]],T=[[/^pillars\.(year|month|day|hour)\.ganzhi$/,"柱"],[/^palaces\.(minggong|shengong)\.ganzhi$/,"命身宫"],[/^soul\.ganzhi$/,"命宫"],[/^body\.branch$/,"身宫"],[/^siZhu\.(year|month|day|time)$/,"柱"],[/^dayun\.jiao\.at$/,"起运"],[/^dayGanZhi$/,"日辰"],[/^hourZhi$/,"时支"],[/^ju$|^juNumber$|^juName$/,"局数"],[/^dun$/,"阴阳遁"],[/^lines\.\d+\.(ganzhi|yinYang|name)$/,"爻"],[/^yueJiang\.(name|zhi)$/,"月将"]];function b(o){for(const[r,c]of v)if(r.test(o))return c;return G(o)||o}function G(o){for(const[r,c]of L)if(r.test(o))return c;return""}function h(o){for(const[r,c]of T)if(r.test(o))return c;return""}function m(o){return[...o].sort((r,c)=>r.path.localeCompare(c.path,"zh-Hans-CN",{numeric:!0}))}function g(o){if(!o.length)return"本盘不受此口径影响:所有字段一致。";const r=o.filter(M=>h(M.path)),c=[...new Set(o.map(M=>G(M.path)).filter(Boolean))],u=r.length?`根因 ${r.length} 处:`+r.slice(0,4).map(M=>`${b(M.path)} ${p(M.from)}→${p(M.to)}`).join("、")+(r.length>4?" 等":""):"无单一根因",S=c.length?`;连带影响 ${c.slice(0,6).join("、")}${c.length>6?" 等":""} ${c.length} 类,共 ${o.length} 处`:`;共 ${o.length} 处`;return u+S+"。"}const p=o=>o===void 0?"—":o===null?"null":typeof o=="string"?o:Array.isArray(o)?o.join("")||"[]":typeof o=="object"?JSON.stringify(o):String(o);function C(o,{title:r="",limit:c=12}={}){const u=[];if(r&&u.push(`【${r}】`),u.push(g(o)),!o.length)return u.join(`
1
+ window.__ModuleLoader__.load({id:"dsh-metaphysics",chunk:"client.fengshui.js",factory(at){const I={};return I.fail=(function(){return{fail:(q,H)=>{const v=new Error(H);return v.code=q,v}}})(),I.diff=(function(){const R=new Set(["summary","interpret","castAt","asOf","precision","disclaimer","note","trueSolarText","civilText","offsetMinutes","input","jd","juMethod","juMethodNote","lateZiHourMode","leapPolicy","schools","bodyMasterSchool","bodyMasterNote","handle","handleError","revision"]),q=o=>o!==null&&typeof o=="object";function H(o,r,c="",u=[]){if(o===r)return u;if(!q(o)||!q(r))return u.push({path:c||"(root)",from:o,to:r}),u;const S=new Set([...Object.keys(o),...Object.keys(r)]);for(const M of S){if(R.has(M))continue;const A=c?`${c}.${M}`:M,oe=o[M],ie=r[M];q(oe)&&q(ie)?H(oe,ie,A,u):JSON.stringify(oe)!==JSON.stringify(ie)&&u.push({path:A,from:oe,to:ie})}return u}const v=[[/^pillars\.year\.ganzhi$/,"年柱"],[/^pillars\.month\.ganzhi$/,"月柱"],[/^pillars\.day\.ganzhi$/,"日柱"],[/^pillars\.hour\.ganzhi$/,"时柱"],[/^pillars\.\w+\.hidden/,"藏干"],[/^pillars\.\w+\.stemTenGod$/,"十神"],[/^pillars\.\w+\.kongwang/,"空亡"],[/^pillars\.\w+\.dishi$|^pillars\.\w+\.zizuo$/,"十二长生"],[/^pillars\.\w+\.nayin$/,"纳音"],[/^dayMaster\./,"日主"],[/^palaces\.(taiyuan|minggong|shengong)\./,"命身宫"],[/^palaces\.\d+\.(palace|branch|stem|ganzhi)$/,"宫位"],[/^palaces\.\d+\.stars\.\d+\.(name|brightness|type)$/,"星曜"],[/^palaces\.\d+\.shensha\./,"神煞"],[/^palaces\.\d+\.(daxian|xiaoxian)\./,"大限"],[/^palaces\.\d+\.sanfang\./,"三方四正"],[/^palaces\.\d+\./,"宫位"],[/^palaces\./,"命身宫"],[/^soul\./,"命宫"],[/^body\./,"身宫"],[/^doujun\./,"流年斗君"],[/^siZhu\.year$/,"年柱"],[/^siZhu\.month$/,"月柱"],[/^siZhu\.day$/,"日柱"],[/^siZhu\.time$/,"时柱"],[/^ju$|^juNumber$/,"局数"],[/^yuan$/,"三元"],[/^dun$/,"阴阳遁"],[/^daxian(List)?\./,"大限"],[/^fly(Chains|Composite)?\./,"飞星"],[/^pattern/,"格局"],[/^schools\./,"流派回显"],[/^dayun\.jiao\./,"起运"],[/^dayun\.toNextJieDays$/,"起运时间"],[/^dayun\.list\.(\d+)\.ganzhi$/,"大运干支"],[/^dayun\.startAge\./,"起运时间"],[/^dayun\./,"大运评分"],[/^liunian\./,"流年"],[/^jieqi\./,"节气边界"],[/^solarTime\./,"真太阳时"],[/^dayGanZhi$/,"日辰"],[/^hourZhi$/,"时支"],[/^yueJiang\./,"月将"],[/^xunKong$/,"旬空"],[/^lines\.(\d+)\./,"爻"],[/^shensha\./,"神煞"],[/^frame\./,"格局用神"],[/^strength\./,"旺衰"],[/^wuxing\./,"五行计数"],[/^relations\./,"干支关系"],[/^input\./,"输入回显"]],L=[[/^pillars\./,"四柱"],[/^shensha\./,"神煞"],[/^dayun\./,"大运"],[/^liunian\./,"流年"],[/^frame\./,"格局用神"],[/^strength\./,"旺衰"],[/^wuxing\./,"五行计数"],[/^dayMaster\./,"日主"],[/^relations\./,"干支关系"],[/^palaces\.(taiyuan|minggong|shengong)\./,"命身宫"],[/^palaces\.\d+\./,"宫位"],[/^palaces\./,"命身宫"],[/^soul\.|^body\.|^doujun\./,"命身宫"],[/^siZhu\./,"四柱"],[/^ju$|^juNumber$|^yuan$|^dun$/,"局数"],[/^daxian/,"大限"],[/^fly/,"飞星"],[/^pattern/,"格局"],[/^jieqi\./,"节气"],[/^solarTime\./,"真太阳时"],[/^input\./,"输入回显"],[/^lines\./,"爻"]],T=[[/^pillars\.(year|month|day|hour)\.ganzhi$/,"柱"],[/^palaces\.(minggong|shengong)\.ganzhi$/,"命身宫"],[/^soul\.ganzhi$/,"命宫"],[/^body\.branch$/,"身宫"],[/^siZhu\.(year|month|day|time)$/,"柱"],[/^dayun\.jiao\.at$/,"起运"],[/^dayGanZhi$/,"日辰"],[/^hourZhi$/,"时支"],[/^ju$|^juNumber$|^juName$/,"局数"],[/^dun$/,"阴阳遁"],[/^lines\.\d+\.(ganzhi|yinYang|name)$/,"爻"],[/^yueJiang\.(name|zhi)$/,"月将"]];function b(o){for(const[r,c]of v)if(r.test(o))return c;return G(o)||o}function G(o){for(const[r,c]of L)if(r.test(o))return c;return""}function h(o){for(const[r,c]of T)if(r.test(o))return c;return""}function m(o){return[...o].sort((r,c)=>r.path.localeCompare(c.path,"zh-Hans-CN",{numeric:!0}))}function g(o){if(!o.length)return"本盘不受此口径影响:所有字段一致。";const r=o.filter(M=>h(M.path)),c=[...new Set(o.map(M=>G(M.path)).filter(Boolean))],u=r.length?`根因 ${r.length} 处:`+r.slice(0,4).map(M=>`${b(M.path)} ${p(M.from)}→${p(M.to)}`).join("、")+(r.length>4?" 等":""):"无单一根因",S=c.length?`;连带影响 ${c.slice(0,6).join("、")}${c.length>6?" 等":""} ${c.length} 类,共 ${o.length} 处`:`;共 ${o.length} 处`;return u+S+"。"}const p=o=>o===void 0?"—":o===null?"null":typeof o=="string"?o:Array.isArray(o)?o.join("")||"[]":typeof o=="object"?JSON.stringify(o):String(o);function C(o,{title:r="",limit:c=12}={}){const u=[];if(r&&u.push(`【${r}】`),u.push(g(o)),!o.length)return u.join(`
2
2
  `);const S=m(o.filter(A=>h(A.path))),M=m(o.filter(A=>!h(A.path)));if(S.length){u.push(""),u.push(" 根因(口径直接改动):");for(const A of S)u.push(` ${b(A.path).padEnd(6)} ${p(A.from)} → ${p(A.to)}`)}if(M.length){u.push(""),u.push(` 连带变化(${M.length} 处,展示前 ${Math.min(c,M.length)} 处):`);for(const A of M.slice(0,c))u.push(` ${b(A.path).padEnd(6)} ${p(A.from)} → ${p(A.to)}`);if(M.length>c){const A={};for(const oe of M.slice(c)){const ie=G(oe.path)||"其他";A[ie]=(A[ie]||0)+1}u.push(" 其余:"+Object.entries(A).map(([oe,ie])=>`${oe} ${ie} 处`).join("、"))}}return u.join(`
3
- `)}const U=(o,r,c,u,S,M)=>({key:o,title:r,short:c,read:A=>{const oe=A[o]!==void 0?A[o]:A.schools&&A.schools[o];return M[oe]?oe:u},alt:A=>A===S?u:S,label:A=>M[A]||A}),te={bazi:[{key:"lateZi",title:"晚子时:23:00 后是否换日",short:"晚子时",read:o=>o.lateZi!==!1,alt:o=>!o,label:o=>o?"换日":"不换日"},{key:"trueSolar",title:"真太阳时:是否按出生地经度修正",short:"真太阳时",read:o=>o.trueSolar!==!1,alt:o=>!o,label:o=>o?"修正":"不修正"}],ziwei:[{key:"leapMonth",title:"闰月归月:按日切分 / 整月归次月",short:"闰月归月",read:o=>o.leapMonth==="next"||o.leapMonth==="prev"?o.leapMonth:"split",alt:o=>o==="split"?"next":"split",label:o=>({split:"按日切分",next:"整月归次月",prev:"整月归本月"})[o]||o},{key:"trueSolar",title:"真太阳时:是否按出生地经度修正",short:"真太阳时",read:o=>o.trueSolar!==!1,alt:o=>!o,label:o=>o?"修正":"不修正"},U("brightnessSchool","亮度表:默认 / QS 七档","亮度表","default","QS",{default:"默认",QS:"QS(七档)",XD1:"XD1(七档)",ZZ:"ZZ(五档)",XD2:"XD2(五档)"}),U("gengYearSihua","庚干四化:阳武阴同 / 同科阴忌","庚干四化","GYWYT","GYWTY",{GYWYT:"阳武阴同",GYWTY:"同科阴忌",GYWFT:"府科同忌",GYWFX:"府科相忌",GYWTX:"同科相忌"}),U("tianmaSchool","天马:按年支 / 按生月","天马","year-branch","month-branch",{"year-branch":"年支","month-branch":"生月"}),U("tiankongSchool","天空:不排 / 年支顺行","天空","off","normal",{off:"不排",normal:"年支顺行","shun-jia-shi":"加生时"}),U("jiekongSchool","截空旬空:不排 / 正副双星","截空旬空","off","double",{off:"不排",single:"单星",double:"正副双星",zhanyan:"占验派"}),U("kuiyueSchool","魁钺:qs1 / qs2","魁钺","qs1","qs2",{qs1:"qs1",qs2:"qs2","zhong-yiming":"中一鸣",network:"网络"}),U("tianshiTianshang","天伤天使:常规 / 中州互换","天伤天使","normal","zhongzhou",{normal:"常规",zhongzhou:"中州(阴男阳女互换)"}),U("changshengSchool","长生:阴阳顺逆 / 火土起寅","长生","yin-yang-shun-ni","huo-tu",{"yin-yang-shun-ni":"阴阳顺逆","shui-tu":"水二","huo-tu":"火土(土五局起寅)"}),U("lateZishi","晚子时:归当日 / 归次日","晚子时","current-day","next-day",{"current-day":"归当日","next-day":"归次日","all-current":"全归当日","day-cur-time-next":"日归当日·时归次日"}),U("shenzhuSchool","身主:子午皆火星 / 子铃午火","身主","common","verse",{common:"子午皆火星",verse:"子铃午火(安身主诀逐字)"})],qimen:[{key:"juMethod",title:"取局流派:拆补 / 超神接气 / 置闰",short:"取局流派",read:o=>["chaibu","chaoshen","zhirun"].includes(o.juMethod)?o.juMethod:"chaibu",alt:o=>o==="chaibu"?"zhirun":"chaibu",label:o=>({chaibu:"拆补法",chaoshen:"超神接气",zhirun:"置闰法"})[o]||o},{key:"lateZiHourMode",title:"晚子时:23:00 后归当日 / 次日",short:"晚子时归日",read:o=>o.lateZiHourMode==="next-day"?"next-day":"same-day",alt:o=>o==="next-day"?"same-day":"next-day",label:o=>o==="next-day"?"归次日":"归当日"}]},y={bazi:[{path:"pillars.day.ganzhi",label:"日柱"},{path:"pillars.hour.ganzhi",label:"时柱"},{path:"strength.level",label:"旺衰"},{path:"frame.primaryName",label:"格局"},{path:"frame.yongshen.favor",label:"喜用"},{path:"dayun.jiao.at",label:"起运"}],ziwei:[{path:"soul.ganzhi",label:"命宫"},{path:"body.branch",label:"身宫支"},{path:"bureau.name",label:"五行局"},{path:"bodyMaster",label:"身主"},{path:"daxianList.0.ages",label:"起大限"}],qimen:[{path:"siZhu.day",label:"日柱"},{path:"ju",label:"局数"},{path:"zhiFu.star",label:"值符"},{path:"zhiShi.gate",label:"值使"}]};function N(o,r){let c=o;for(const u of String(r).split(".")){if(c==null)return;c=c[u]}return c}function l(o){return o==null?"—":Array.isArray(o)?o.join("、"):typeof o=="object"?"—":String(o)}function f(o,r,c){return(y[o]||[]).map(S=>{const M=l(N(r,S.path)),A=l(N(c,S.path));return{key:S.path,label:S.label,current:M,alt:A,changed:M!==A}})}return{diffObjects:H,labelOf:b,categoryOf:G,rootOf:h,sortDiffs:m,summarize:g,formatValue:p,renderDiff:C,CALIBER_SWITCHES:te,CALIBER_VIEWS:y,viewCell:l,viewRows:f}})(),_.fingerprint=(function(){const R="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function q(T){return JSON.stringify(H(T))}function H(T){if(T===null)return null;const b=typeof T;if(b==="string")return typeof T.normalize=="function"?T.normalize("NFC"):T;if(b==="number")return Number.isFinite(T)?Object.is(T,-0)?0:T:null;if(b==="boolean")return T;if(Array.isArray(T))return T.map(H);if(b==="object"){const G={};for(const h of Object.keys(T).sort()){const m=T[h];m===void 0||typeof m=="function"||typeof m=="symbol"||(G[h]=H(m))}return G}return null}function v(T){const b=String(T);let G=2166136261,h=2654435769;for(let p=0;p<b.length;p+=1){const C=b.charCodeAt(p);for(const U of[C&255,C>>>8])G=Math.imul(G^U,16777619),h=Math.imul(h^U,2246822507)}let m=(G>>>0)*8+(h>>>29),g="";for(let p=0;p<7;p+=1)g=R[m%32]+g,m=Math.floor(m/32);return g}function L(T={}){const b=String(T.system||""),G=String(T.version||"dev"),h=T.seed===void 0||T.seed===null||T.seed===""?null:Number(T.seed),m=T.asOf?String(T.asOf):null,g=T.params&&typeof T.params=="object"?T.params:{},p=q({system:b,params:g,seed:h,asOf:m}),C=q({base:p,version:G});return{id:`LY-${v(C)}`,baseId:`LY-${v(p)}`,version:G,system:b,payload:p}}return{canonicalJson:q,shortHash:v,fingerprintOf:L}})(),_.validate=(function(){const{fail:R}=_.fail||{},q=1600,H=2400;function v(h){return h%4===0&&h%100!==0||h%400===0}function L(h,m){return m===2?v(h)?29:28:[31,28,31,30,31,30,31,31,30,31,30,31][m-1]||0}const T=h=>typeof h=="string"?`「${h}」`:String(h),b="引擎只接受解析好的公历字段 { year, month, day, hour?, minute? };字符串请先交给宿主层的 parseDateTime 解析";function G(h,m=""){const g=m?`${m} 的`:"";if(!h||typeof h!="object"||Array.isArray(h)){const te=h===null?"null":Array.isArray(h)?"数组":typeof h;throw R("E_INPUT",`${g}入参必须是对象(收到 ${te});${b}`)}const p=h.hour===void 0?0:h.hour,C=h.minute===void 0?0:h.minute;for(const[te,y]of[["year",h.year],["month",h.month],["day",h.day],["hour",p],["minute",C]])if(!Number.isInteger(y))throw R("E_INPUT",`${g}${te} 必须是整数(收到 ${T(y)});${b}`);if(h.year<q||h.year>H)throw R("E_INPUT",`${g}year 超出支持范围 ${q}–${H}(收到 ${h.year});更早的年份时区与历法口径不可靠`);if(h.month<1||h.month>12)throw R("E_INPUT",`${g}month 超出范围 1–12(收到 ${h.month})`);const U=L(h.year,h.month);if(h.day<1||h.day>U)throw R("E_INPUT",`${g}日期不存在:${h.year}-${h.month}-${h.day}(${h.year} 年 ${h.month} 月只有 ${U} 天)`);if(p<0||p>23)throw R("E_INPUT",`${g}hour 超出范围 0–23(收到 ${p})`);if(C<0||C>59)throw R("E_INPUT",`${g}minute 超出范围 0–59(收到 ${C})`);return h}return{MIN_YEAR:q,MAX_YEAR:H,isLeapYear:v,daysInMonth:L,assertCivil:G}})(),_.lru=(function(){function R({max:q=64,ttlMs:H=0,name:v="lru",now:L=()=>Date.now()}={}){const T=new Map,b={name:v,hits:0,misses:0,evictions:0,expirations:0},G=h=>H>0&&L()-h.at>H;return{name:v,max:q,ttlMs:H,get(h){const m=T.get(h);if(!m||G(m)){m&&(T.delete(h),b.expirations+=1),b.misses+=1;return}return T.delete(h),T.set(h,m),b.hits+=1,m.value},set(h,m){for(T.has(h)&&T.delete(h),T.set(h,{value:m,at:L()});T.size>q;)T.delete(T.keys().next().value),b.evictions+=1;return m},has(h){const m=T.get(h);return m?G(m)?(T.delete(h),b.expirations+=1,!1):!0:!1},delete(h){return T.delete(h)},clear(){T.clear()},get size(){return T.size},stats(){const h=b.hits+b.misses;return{name:v,size:T.size,max:q,hits:b.hits,misses:b.misses,evictions:b.evictions,expirations:b.expirations,hitRate:h?b.hits/h:0}}}}return{createLru:R}})(),_.nayin=(function(){const R=["海中金","炉中火","大林木","路旁土","剑锋金","山头火","涧下水","城头土","白蜡金","杨柳木","泉中水","屋上土","霹雳火","松柏木","长流水","沙中金","山下火","平地木","壁上土","金箔金","覆灯火","天河水","大驿土","钗钏金","桑柘木","大溪水","沙中土","天上火","石榴木","大海水"];function q(H){const v=(Number(H)%60+60)%60,L=R[Math.floor(v/2)];return{name:L,element:L[2]}}return{NAYIN_NAMES:R,nayinOf:q}})(),_.sanhe=(function(){const R=[{branches:["申","子","辰"],element:"水"},{branches:["亥","卯","未"],element:"木"},{branches:["寅","午","戌"],element:"火"},{branches:["巳","酉","丑"],element:"金"}],q=Object.fromEntries(R.map(L=>[L.branches.join(""),L.element])),H=Object.fromEntries(R.flatMap(L=>L.branches.map(T=>[T,L.element])));function v(L){return R.find(T=>T.branches.includes(L))||null}return{SANHE_GROUPS:R,SANHE:q,SANHE_ELEMENT:H,sanheGroupOf:v}})(),_["vsop-earth"]=(function(){const R=[[1.75347045673,0,0],[.03341656453,4.66925680415,6283.0758499914],[.00034894275,4.62610242189,12566.1516999828],[3417572e-11,2.82886579754,3.523118349],[3497056e-11,2.74411783405,5753.3848848968],[3135899e-11,3.62767041756,77713.7714681205],[2676218e-11,4.41808345438,7860.4193924392],[2342691e-11,6.13516214446,3930.2096962196],[1273165e-11,2.03709657878,529.6909650946],[1324294e-11,.74246341673,11506.7697697936],[901854e-11,2.04505446477,26.2983197998],[1199167e-11,1.10962946234,1577.3435424478],[857223e-11,3.50849152283,398.1490034082],[779786e-11,1.17882681962,5223.6939198022],[99025e-10,5.23268072088,5884.9268465832],[753141e-11,2.53339052847,5507.5532386674],[505267e-11,4.58292599973,18849.2275499742],[492392e-11,4.20505711826,775.522611324],[356672e-11,2.91954114478,.0673103028],[284125e-11,1.89869240932,796.2980068164],[242879e-11,.34481445893,5486.777843175],[317087e-11,5.84901948512,11790.6290886588],[271112e-11,.31486255375,10977.078804699],[206217e-11,4.80646631478,2544.3144198834],[205478e-11,1.86953770281,5573.1428014331],[202318e-11,2.45767790232,6069.7767545534],[126225e-11,1.08295459501,20.7753954924],[155516e-11,.83306084617,213.299095438],[115132e-11,.64544911683,.9803210682],[102851e-11,.63599845579,4694.0029547076],[101724e-11,4.2667980198,7.1135470008],[99206e-11,6.20992926918,2146.1654164752],[132212e-11,3.41118292683,2942.4634232916],[97607e-11,.68101342359,155.4203994342],[85128e-11,1.29870764804,6275.9623029906],[74651e-11,1.755089133,5088.6288397668],[101895e-11,.97569280312,15720.8387848784],[84711e-11,3.67080093031,71430.69561812909],[73547e-11,4.67926633877,801.8209311238],[73874e-11,3.50319414955,3154.6870848956],[78757e-11,3.03697458703,12036.4607348882],[79637e-11,1.80791287082,17260.1546546904],[85803e-11,5.9832263126,161000.6857376741],[56963e-11,2.78430458592,6286.5989683404],[61148e-11,1.81839892984,7084.8967811152],[69627e-11,.83297621398,9437.762934887],[56116e-11,4.38694865354,14143.4952424306],[62449e-11,3.97763912806,8827.3902698748],[51145e-11,.28306832879,5856.4776591154],[55577e-11,3.47006059924,6279.5527316424],[41036e-11,5.36817592855,8429.2412664666],[51605e-11,1.33282739866,1748.016413067],[51992e-11,.18914947184,12139.5535091068],[49e-8,.48735014197,1194.4470102246],[392e-9,6.16833020996,10447.3878396044],[3557e-10,1.775968892,6812.766815086],[3677e-10,6.04133863162,10213.285546211],[36596e-11,2.56957481827,1059.3819301892],[33296e-11,.59310278598,17789.845619785],[35954e-11,1.70875808777,2352.8661537718],[40938e-11,2.39850938714,19651.048481098],[30047e-11,2.73975124088,1349.8674096588],[30412e-11,.44294464169,83996.84731811189],[23663e-11,.48473622521,8031.0922630584],[23574e-11,2.06528133162,3340.6124266998],[21089e-11,4.14825468851,951.7184062506],[24738e-11,.21484762138,3.5904286518],[25352e-11,3.16470891653,4690.4798363586],[22823e-11,5.22195230819,4705.7323075436],[21419e-11,1.42563910473,16730.4636895958],[21891e-11,5.55594302779,553.5694028424],[203e-9,.37133792946,283.8593188652]],q=[[6283.0758499914,0,0],[.00206058863,2.67823455808,6283.0758499914],[4303419e-11,2.63512233481,12566.1516999828],[425264e-11,1.59046982018,3.523118349],[109017e-11,2.96631010675,1577.3435424478],[93479e-11,2.59211109542,18849.2275499742],[119305e-11,5.79555765566,26.2983197998],[72121e-11,1.13840581212,529.6909650946],[67784e-11,1.87453300345,398.1490034082],[6735e-10,4.40932832004,5507.5532386674],[59045e-11,2.88815790631,5223.6939198022],[55976e-11,2.17471740035,155.4203994342],[45411e-11,.39799502896,796.2980068164],[36298e-11,.46875437227,775.522611324],[28962e-11,2.64732254645,7.1135470008],[20844e-11,5.34138275149,.9803210682]],H=[[8721859e-11,1.07253635559,6283.0758499914],[99099e-10,3.14159265359,0],[294833e-11,.43717350256,12566.1516999828],[27338e-11,.05295636147,3.523118349],[16333e-11,5.18820215724,26.2983197998],[15745e-11,3.68504712183,155.4203994342],[9425e-11,.29667114694,18849.2275499742],[8938e-11,2.05706319592,77713.7714681205],[694e-10,.82691541038,775.522611324],[5061e-11,4.6624323168,1577.3435424478]],v=[[289058e-11,5.84173149732,6283.0758499914],[20712e-11,6.0498393902,12566.1516999828],[2962e-11,5.1956057957,155.4203994342],[2527e-11,3.14159265359,0],[1288e-11,4.7219761197,3.523118349]],L=[[7714e-11,4.14117321449,6283.0758499914],[1016e-11,3.27573644241,12566.1516999828]];function T(b){let G=0;for(const[m,g,p]of R)G+=m*Math.cos(g+p*b);let h=1;for(const m of[q,H,v,L]){h*=b;for(const[g,p,C]of m)G+=g*h*Math.cos(p+C*b)}return G}return{earthL:T}})(),_.calendar=(function(){const{earthL:R}=_["vsop-earth"]||{},{createLru:q}=_.lru||{},H=["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"],v=["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"],L=["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"];function T(I){return(285+15*I)%360}function b(I,D,O){const Q=Math.floor((14-D)/12),K=I+4800-Q,re=D+12*Q-3;return O+Math.floor((153*re+2)/5)+365*K+Math.floor(K/4)-Math.floor(K/100)+Math.floor(K/400)-32045}function G(I){const D=I+32044,O=Math.floor((4*D+3)/146097),Q=D-Math.floor(146097*O/4),K=Math.floor((4*Q+3)/1461),re=Q-Math.floor(1461*K/4),he=Math.floor((5*re+2)/153);return{year:100*O+K-4800+Math.floor(he/10),month:he+3-12*Math.floor(he/10),day:re-Math.floor((153*he+2)/5)+1}}function h(I,D){for(let O=0;O<60;O++)if(O%10===I&&O%12===D)return O;return-1}function m(I){const D=(I%60+60)%60;return{index:D,stem:H[D%10],branch:v[D%12],name:H[D%10]+v[D%12]}}function g(I){return((I+49)%60+60)%60}function p(I){const D=I-2451545,O=D/36525,Q=D/365250;let K=R(Q)*180/Math.PI+180;K=(K%360+360)%360;const re=(5029.0966*O+1.11113*O*O-6e-6*O*O*O)/3600;K+=re,K-=.09033/3600;const he=(125.04452-1934.136261*O)*Math.PI/180,pe=(280.4665+36000.7698*O)*Math.PI/180,xe=(218.3165+481267.8813*O)*Math.PI/180,Ze=(-17.2*Math.sin(he)-1.32*Math.sin(2*pe)-.23*Math.sin(2*xe)+.21*Math.sin(2*he))/3600;K+=Ze;const Re=(357.52911+35999.05029*O-1537e-7*O*O)*Math.PI/180,De=.016708634-42037e-9*O-1267e-10*O*O,qe=1.000001018*(1-De*De)/(1+De*Math.cos(Re+(1.914602-.004817*O)*(Math.PI/180)*Math.sin(Re)));return K-=20.4898/3600/(qe||1),(K%360+360)%360}function C(I){const D=[[1900,-2.8],[1920,21.2],[1940,24.3],[1950,29.1],[1960,33.2],[1970,40.2],[1980,50.5],[1990,56.9],[2e3,63.8],[2010,66.1],[2020,69.4],[2030,72],[2050,80],[2100,110]];if(I<=D[0][0])return D[0][1];for(let O=1;O<D.length;O++)if(I<=D[O][0]){const[Q,K]=D[O-1],[re,he]=D[O];return K+(he-K)*(I-Q)/(re-Q)}return D[D.length-1][1]}const U=8/24,te=7.7611/24,y=2425612+4/24;function N(I){return I<y?te:U}const l=q({max:4096,name:"termInstant"}),f=1e-5,o=new Map,r=365.2422;function c(I,D){const O=T(D),Q=b(I,1,5)-.5+D*15.2184,K=o.get(D);let re=K!==void 0?K+r:Q;Math.abs(re-Q)>20&&(re=Q);for(let pe=0;pe<12;pe++){let xe=O-p(re);if(xe=((xe+180)%360+360)%360-180,re+=xe/.98564736,Math.abs(xe)<f)break}o.set(D,re);const he=re-C(I)/86400;return he+N(he)}function u(I,D){const O=I*24+D,Q=l.get(O);if(Q!==void 0)return Q;const K=c(I,D);return l.set(O,K),K}function S(I){const D=Math.floor(I+.5),O=I+.5-D,Q=Math.round(O*1440),{year:K,month:re,day:he}=G(D);return{year:K,month:re,day:he,hour:Math.floor(Q/60)%24,minute:Q%60}}function M({year:I,month:D,day:O,hour:Q=0,minute:K=0}){return b(I,D,O)-.5+(Q*60+K)/1440}function A(I,D,O){const Q=b(I,D,O)-b(I,1,1)+1,K=2*Math.PI*(Q-81)/364;return 9.87*Math.sin(2*K)-7.53*Math.cos(K)-1.5*Math.sin(K)}const oe=q({max:8,name:"termWindow"}),ie=q({max:32,name:"termYear"}),de=Array.from({length:24},(I,D)=>D),$e=de.filter(I=>I%2===0);function Ne(I,D){const O=D?`${I}|jie`:`${I}|all`,Q=ie.get(O);if(Q)return Q;if(D){const re=ie.get(`${I}|all`);if(re){const he=re.filter(pe=>pe.index%2===0);return ie.set(O,he),he}}const K=[];for(const re of D?$e:de)K.push({year:I,index:re,name:L[re],jd:u(I,re)});return K.sort((re,he)=>re.jd-he.jd),ie.set(O,K),K}function ge(I,D={}){const O=D.jieOnly===!0,Q=O?`${I}|jie`:I,K=oe.get(Q);if(K)return K;const re=[...Ne(I-1,O),...Ne(I,O),...Ne(I+1,O)];return re.sort((he,pe)=>he.jd-pe.jd),oe.set(Q,re),re}function we(I){if(typeof I!="string"||I.length<2)return[];const D=H.indexOf(I[0]),O=v.indexOf(I[1]);if(D<0||O<0)return[];const Q=h(D,O);if(Q<0)return[];const K=Math.floor(Q/10)*10;return[v[(K+10)%12],v[(K+11)%12]]}function Me(I,D){let O=null;for(const Q of I)if(Q.index%2===0)if(Q.jd<=D)O=Q;else break;return O}function Pe(I,D){for(const O of I)if(O.index%2===0&&O.jd>D)return O;return null}function _e(I){const D=S(I),O=Q=>String(Q).padStart(2,"0");return`${D.year}-${O(D.month)}-${O(D.day)} ${O(D.hour)}:${O(D.minute)}`}function ze(){return[l.stats(),ie.stats(),oe.stats()]}return{STEMS:H,BRANCHES:v,TERM_NAMES:L,termLongitude:T,toJDN:b,fromJDN:G,sexagenaryIndex:h,ganzhiName:m,dayGanzhiIndex:g,sunLongitude:p,deltaTSeconds:C,OFFSET_MODERN:U,OFFSET_BEIJING_LOCAL:te,CUTOVER_JD:y,localOffsetFor:N,termInstantJd:u,jdToParts:S,partsToJd:M,equationOfTime:A,termWindow:ge,xunKongOf:we,previousJie:Me,nextJie:Pe,formatJd:_e,cacheMetrics:ze}})(),_.lunar=(function(){const{toJDN:R,jdToParts:q,termInstantJd:H,deltaTSeconds:v,localOffsetFor:L,OFFSET_MODERN:T}=_.calendar||{},b=29.530588861,G=245155009766e-5,h=Math.PI/180;function m(N){const l=N/1236.85,f=G+b*N+15437e-8*l*l-15e-8*l*l*l+73e-11*l*l*l*l,o=1-.002516*l-74e-7*l*l,r=(2.5534+29.1053567*N-14e-7*l*l-11e-8*l*l*l)*h,c=(201.5643+385.81693528*N+.0107582*l*l+1238e-8*l*l*l-58e-9*l*l*l*l)*h,u=(160.7108+390.67050284*N-.0016118*l*l-227e-8*l*l*l+11e-9*l*l*l*l)*h,S=(124.7746-1.56375588*N+.0020672*l*l+215e-8*l*l*l)*h,M=-.4072*Math.sin(c)+.17241*o*Math.sin(r)+.01608*Math.sin(2*c)+.01039*Math.sin(2*u)+.00739*o*Math.sin(c-r)-.00514*o*Math.sin(c+r)+.00208*o*o*Math.sin(2*r)-.00111*Math.sin(c-2*u)-57e-5*Math.sin(c+2*u)+56e-5*o*Math.sin(2*c+r)-42e-5*Math.sin(3*c)+42e-5*o*Math.sin(r+2*u)+38e-5*o*Math.sin(r-2*u)-24e-5*o*Math.sin(2*c-r)-17e-5*Math.sin(S)-7e-5*Math.sin(c+2*r)+4e-5*Math.sin(2*c-2*u)+4e-5*Math.sin(3*r)+3e-5*Math.sin(c+r-2*u)+3e-5*Math.sin(2*c+2*u)-3e-5*Math.sin(c+r+2*u)+3e-5*Math.sin(c-r+2*u)-2e-5*Math.sin(c-r-2*u)-2e-5*Math.sin(3*c+r)+2e-5*Math.sin(4*c),A=f+M-v(2e3+l*100)/86400;return A+L(A)}function g(N){return Math.floor(N+.5)}function p(N){const l=N-T;return l+L(l)}function C(N){return Math.round((N+.5-G)/b)}function U(N,l,f){for(let o=N-1;o<=N+1;o++)for(let r=1;r<24;r+=2){const c=p(H(o,r)),u=g(c);if(u>=l&&u<f)return{index:r,jd:c}}return null}function te(N,l,f){const o=R(N,l,f),r=g(p(H(N,23))),c=o<r?N-1:N,u=g(p(H(c,23)));let S=C(u);for(;g(m(S))>u;)S--;for(;g(m(S+1))<=u;)S++;const M=g(p(H(c+1,23)));let A=S;for(;g(m(A+1))<=M;)A++;const oe=A-S;let ie=-1;if(oe===13)for(let ge=1;ge<=oe;ge++){const we=g(m(S+ge-1)),Me=g(m(S+ge));if(!U(c,we,Me)){ie=ge;break}}let de=11,$e=!1,Ne=g(m(S));for(let ge=1;ge<=15;ge++){const we=g(m(S+ge-1)),Me=g(m(S+ge)),Pe=U(c,we,Me),_e=ge===ie;if(o>=we&&o<Me){const ze=q(m(S+ge-1)),I=_e?(de+10)%12+1:de;return{year:c,lunarYear:$e?c+1:c,month:I,day:o-we+1,isLeap:_e,monthStart:`${ze.year}-${String(ze.month).padStart(2,"0")}-${String(ze.day).padStart(2,"0")}`,hasZhongQi:!!Pe}}_e||(de=de%12+1,de===1&&($e=!0)),Ne=Me}throw new Error(`农历换算失败:${N}-${l}-${f}`)}function y(N,l,f){return R(N,l,f)}return{SYNODIC:b,newMoonJd:m,dayNumberOf:g,solarToLunar:te,monthStartJd:y}})(),_.geo=(function(){const R=`
3
+ `)}const U=(o,r,c,u,S,M)=>({key:o,title:r,short:c,read:A=>{const oe=A[o]!==void 0?A[o]:A.schools&&A.schools[o];return M[oe]?oe:u},alt:A=>A===S?u:S,label:A=>M[A]||A}),te={bazi:[{key:"lateZi",title:"晚子时:23:00 后是否换日",short:"晚子时",read:o=>o.lateZi!==!1,alt:o=>!o,label:o=>o?"换日":"不换日"},{key:"trueSolar",title:"真太阳时:是否按出生地经度修正",short:"真太阳时",read:o=>o.trueSolar!==!1,alt:o=>!o,label:o=>o?"修正":"不修正"}],ziwei:[{key:"leapMonth",title:"闰月归月:按日切分 / 整月归次月",short:"闰月归月",read:o=>o.leapMonth==="next"||o.leapMonth==="prev"?o.leapMonth:"split",alt:o=>o==="split"?"next":"split",label:o=>({split:"按日切分",next:"整月归次月",prev:"整月归本月"})[o]||o},{key:"trueSolar",title:"真太阳时:是否按出生地经度修正",short:"真太阳时",read:o=>o.trueSolar!==!1,alt:o=>!o,label:o=>o?"修正":"不修正"},U("brightnessSchool","亮度表:默认 / QS 七档","亮度表","default","QS",{default:"默认",QS:"QS(七档)",XD1:"XD1(七档)",ZZ:"ZZ(五档)",XD2:"XD2(五档)"}),U("gengYearSihua","庚干四化:阳武阴同 / 同科阴忌","庚干四化","GYWYT","GYWTY",{GYWYT:"阳武阴同",GYWTY:"同科阴忌",GYWFT:"府科同忌",GYWFX:"府科相忌",GYWTX:"同科相忌"}),U("tianmaSchool","天马:按年支 / 按生月","天马","year-branch","month-branch",{"year-branch":"年支","month-branch":"生月"}),U("tiankongSchool","天空:不排 / 年支顺行","天空","off","normal",{off:"不排",normal:"年支顺行","shun-jia-shi":"加生时"}),U("jiekongSchool","截空旬空:不排 / 正副双星","截空旬空","off","double",{off:"不排",single:"单星",double:"正副双星",zhanyan:"占验派"}),U("kuiyueSchool","魁钺:qs1 / qs2","魁钺","qs1","qs2",{qs1:"qs1",qs2:"qs2","zhong-yiming":"中一鸣",network:"网络"}),U("tianshiTianshang","天伤天使:常规 / 中州互换","天伤天使","normal","zhongzhou",{normal:"常规",zhongzhou:"中州(阴男阳女互换)"}),U("changshengSchool","长生:阴阳顺逆 / 火土起寅","长生","yin-yang-shun-ni","huo-tu",{"yin-yang-shun-ni":"阴阳顺逆","shui-tu":"水二","huo-tu":"火土(土五局起寅)"}),U("lateZishi","晚子时:归当日 / 归次日","晚子时","current-day","next-day",{"current-day":"归当日","next-day":"归次日","all-current":"全归当日","day-cur-time-next":"日归当日·时归次日"}),U("shenzhuSchool","身主:子午皆火星 / 子铃午火","身主","common","verse",{common:"子午皆火星",verse:"子铃午火(安身主诀逐字)"})],qimen:[{key:"juMethod",title:"取局流派:拆补 / 超神接气 / 置闰",short:"取局流派",read:o=>["chaibu","chaoshen","zhirun"].includes(o.juMethod)?o.juMethod:"chaibu",alt:o=>o==="chaibu"?"zhirun":"chaibu",label:o=>({chaibu:"拆补法",chaoshen:"超神接气",zhirun:"置闰法"})[o]||o},{key:"lateZiHourMode",title:"晚子时:23:00 后归当日 / 次日",short:"晚子时归日",read:o=>o.lateZiHourMode==="next-day"?"next-day":"same-day",alt:o=>o==="next-day"?"same-day":"next-day",label:o=>o==="next-day"?"归次日":"归当日"}]},y={bazi:[{path:"pillars.day.ganzhi",label:"日柱"},{path:"pillars.hour.ganzhi",label:"时柱"},{path:"strength.level",label:"旺衰"},{path:"frame.primaryName",label:"格局"},{path:"frame.yongshen.favor",label:"喜用"},{path:"dayun.jiao.at",label:"起运"}],ziwei:[{path:"soul.ganzhi",label:"命宫"},{path:"body.branch",label:"身宫支"},{path:"bureau.name",label:"五行局"},{path:"bodyMaster",label:"身主"},{path:"daxianList.0.ages",label:"起大限"}],qimen:[{path:"siZhu.day",label:"日柱"},{path:"ju",label:"局数"},{path:"zhiFu.star",label:"值符"},{path:"zhiShi.gate",label:"值使"}]};function N(o,r){let c=o;for(const u of String(r).split(".")){if(c==null)return;c=c[u]}return c}function l(o){return o==null?"—":Array.isArray(o)?o.join("、"):typeof o=="object"?"—":String(o)}function f(o,r,c){return(y[o]||[]).map(S=>{const M=l(N(r,S.path)),A=l(N(c,S.path));return{key:S.path,label:S.label,current:M,alt:A,changed:M!==A}})}return{diffObjects:H,labelOf:b,categoryOf:G,rootOf:h,sortDiffs:m,summarize:g,formatValue:p,renderDiff:C,CALIBER_SWITCHES:te,CALIBER_VIEWS:y,viewCell:l,viewRows:f}})(),I.fingerprint=(function(){const R="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function q(T){return JSON.stringify(H(T))}function H(T){if(T===null)return null;const b=typeof T;if(b==="string")return typeof T.normalize=="function"?T.normalize("NFC"):T;if(b==="number")return Number.isFinite(T)?Object.is(T,-0)?0:T:null;if(b==="boolean")return T;if(Array.isArray(T))return T.map(H);if(b==="object"){const G={};for(const h of Object.keys(T).sort()){const m=T[h];m===void 0||typeof m=="function"||typeof m=="symbol"||(G[h]=H(m))}return G}return null}function v(T){const b=String(T);let G=2166136261,h=2654435769;for(let p=0;p<b.length;p+=1){const C=b.charCodeAt(p);for(const U of[C&255,C>>>8])G=Math.imul(G^U,16777619),h=Math.imul(h^U,2246822507)}let m=(G>>>0)*8+(h>>>29),g="";for(let p=0;p<7;p+=1)g=R[m%32]+g,m=Math.floor(m/32);return g}function L(T={}){const b=String(T.system||""),G=String(T.version||"dev"),h=T.seed===void 0||T.seed===null||T.seed===""?null:Number(T.seed),m=T.asOf?String(T.asOf):null,g=T.params&&typeof T.params=="object"?T.params:{},p=q({system:b,params:g,seed:h,asOf:m}),C=q({base:p,version:G});return{id:`LY-${v(C)}`,baseId:`LY-${v(p)}`,version:G,system:b,payload:p}}return{canonicalJson:q,shortHash:v,fingerprintOf:L}})(),I.validate=(function(){const{fail:R}=I.fail||{},q=1600,H=2400;function v(h){return h%4===0&&h%100!==0||h%400===0}function L(h,m){return m===2?v(h)?29:28:[31,28,31,30,31,30,31,31,30,31,30,31][m-1]||0}const T=h=>typeof h=="string"?`「${h}」`:String(h),b="引擎只接受解析好的公历字段 { year, month, day, hour?, minute? };字符串请先交给宿主层的 parseDateTime 解析";function G(h,m=""){const g=m?`${m} 的`:"";if(!h||typeof h!="object"||Array.isArray(h)){const te=h===null?"null":Array.isArray(h)?"数组":typeof h;throw R("E_INPUT",`${g}入参必须是对象(收到 ${te});${b}`)}const p=h.hour===void 0?0:h.hour,C=h.minute===void 0?0:h.minute;for(const[te,y]of[["year",h.year],["month",h.month],["day",h.day],["hour",p],["minute",C]])if(!Number.isInteger(y))throw R("E_INPUT",`${g}${te} 必须是整数(收到 ${T(y)});${b}`);if(h.year<q||h.year>H)throw R("E_INPUT",`${g}year 超出支持范围 ${q}–${H}(收到 ${h.year});更早的年份时区与历法口径不可靠`);if(h.month<1||h.month>12)throw R("E_INPUT",`${g}month 超出范围 1–12(收到 ${h.month})`);const U=L(h.year,h.month);if(h.day<1||h.day>U)throw R("E_INPUT",`${g}日期不存在:${h.year}-${h.month}-${h.day}(${h.year} 年 ${h.month} 月只有 ${U} 天)`);if(p<0||p>23)throw R("E_INPUT",`${g}hour 超出范围 0–23(收到 ${p})`);if(C<0||C>59)throw R("E_INPUT",`${g}minute 超出范围 0–59(收到 ${C})`);return h}return{MIN_YEAR:q,MAX_YEAR:H,isLeapYear:v,daysInMonth:L,assertCivil:G}})(),I.lru=(function(){function R({max:q=64,ttlMs:H=0,name:v="lru",now:L=()=>Date.now()}={}){const T=new Map,b={name:v,hits:0,misses:0,evictions:0,expirations:0},G=h=>H>0&&L()-h.at>H;return{name:v,max:q,ttlMs:H,get(h){const m=T.get(h);if(!m||G(m)){m&&(T.delete(h),b.expirations+=1),b.misses+=1;return}return T.delete(h),T.set(h,m),b.hits+=1,m.value},set(h,m){for(T.has(h)&&T.delete(h),T.set(h,{value:m,at:L()});T.size>q;)T.delete(T.keys().next().value),b.evictions+=1;return m},has(h){const m=T.get(h);return m?G(m)?(T.delete(h),b.expirations+=1,!1):!0:!1},delete(h){return T.delete(h)},clear(){T.clear()},get size(){return T.size},stats(){const h=b.hits+b.misses;return{name:v,size:T.size,max:q,hits:b.hits,misses:b.misses,evictions:b.evictions,expirations:b.expirations,hitRate:h?b.hits/h:0}}}}return{createLru:R}})(),I.nayin=(function(){const R=["海中金","炉中火","大林木","路旁土","剑锋金","山头火","涧下水","城头土","白蜡金","杨柳木","泉中水","屋上土","霹雳火","松柏木","长流水","沙中金","山下火","平地木","壁上土","金箔金","覆灯火","天河水","大驿土","钗钏金","桑柘木","大溪水","沙中土","天上火","石榴木","大海水"];function q(H){const v=(Number(H)%60+60)%60,L=R[Math.floor(v/2)];return{name:L,element:L[2]}}return{NAYIN_NAMES:R,nayinOf:q}})(),I.sanhe=(function(){const R=[{branches:["申","子","辰"],element:"水"},{branches:["亥","卯","未"],element:"木"},{branches:["寅","午","戌"],element:"火"},{branches:["巳","酉","丑"],element:"金"}],q=Object.fromEntries(R.map(L=>[L.branches.join(""),L.element])),H=Object.fromEntries(R.flatMap(L=>L.branches.map(T=>[T,L.element])));function v(L){return R.find(T=>T.branches.includes(L))||null}return{SANHE_GROUPS:R,SANHE:q,SANHE_ELEMENT:H,sanheGroupOf:v}})(),I["vsop-earth"]=(function(){const R=[[1.75347045673,0,0],[.03341656453,4.66925680415,6283.0758499914],[.00034894275,4.62610242189,12566.1516999828],[3417572e-11,2.82886579754,3.523118349],[3497056e-11,2.74411783405,5753.3848848968],[3135899e-11,3.62767041756,77713.7714681205],[2676218e-11,4.41808345438,7860.4193924392],[2342691e-11,6.13516214446,3930.2096962196],[1273165e-11,2.03709657878,529.6909650946],[1324294e-11,.74246341673,11506.7697697936],[901854e-11,2.04505446477,26.2983197998],[1199167e-11,1.10962946234,1577.3435424478],[857223e-11,3.50849152283,398.1490034082],[779786e-11,1.17882681962,5223.6939198022],[99025e-10,5.23268072088,5884.9268465832],[753141e-11,2.53339052847,5507.5532386674],[505267e-11,4.58292599973,18849.2275499742],[492392e-11,4.20505711826,775.522611324],[356672e-11,2.91954114478,.0673103028],[284125e-11,1.89869240932,796.2980068164],[242879e-11,.34481445893,5486.777843175],[317087e-11,5.84901948512,11790.6290886588],[271112e-11,.31486255375,10977.078804699],[206217e-11,4.80646631478,2544.3144198834],[205478e-11,1.86953770281,5573.1428014331],[202318e-11,2.45767790232,6069.7767545534],[126225e-11,1.08295459501,20.7753954924],[155516e-11,.83306084617,213.299095438],[115132e-11,.64544911683,.9803210682],[102851e-11,.63599845579,4694.0029547076],[101724e-11,4.2667980198,7.1135470008],[99206e-11,6.20992926918,2146.1654164752],[132212e-11,3.41118292683,2942.4634232916],[97607e-11,.68101342359,155.4203994342],[85128e-11,1.29870764804,6275.9623029906],[74651e-11,1.755089133,5088.6288397668],[101895e-11,.97569280312,15720.8387848784],[84711e-11,3.67080093031,71430.69561812909],[73547e-11,4.67926633877,801.8209311238],[73874e-11,3.50319414955,3154.6870848956],[78757e-11,3.03697458703,12036.4607348882],[79637e-11,1.80791287082,17260.1546546904],[85803e-11,5.9832263126,161000.6857376741],[56963e-11,2.78430458592,6286.5989683404],[61148e-11,1.81839892984,7084.8967811152],[69627e-11,.83297621398,9437.762934887],[56116e-11,4.38694865354,14143.4952424306],[62449e-11,3.97763912806,8827.3902698748],[51145e-11,.28306832879,5856.4776591154],[55577e-11,3.47006059924,6279.5527316424],[41036e-11,5.36817592855,8429.2412664666],[51605e-11,1.33282739866,1748.016413067],[51992e-11,.18914947184,12139.5535091068],[49e-8,.48735014197,1194.4470102246],[392e-9,6.16833020996,10447.3878396044],[3557e-10,1.775968892,6812.766815086],[3677e-10,6.04133863162,10213.285546211],[36596e-11,2.56957481827,1059.3819301892],[33296e-11,.59310278598,17789.845619785],[35954e-11,1.70875808777,2352.8661537718],[40938e-11,2.39850938714,19651.048481098],[30047e-11,2.73975124088,1349.8674096588],[30412e-11,.44294464169,83996.84731811189],[23663e-11,.48473622521,8031.0922630584],[23574e-11,2.06528133162,3340.6124266998],[21089e-11,4.14825468851,951.7184062506],[24738e-11,.21484762138,3.5904286518],[25352e-11,3.16470891653,4690.4798363586],[22823e-11,5.22195230819,4705.7323075436],[21419e-11,1.42563910473,16730.4636895958],[21891e-11,5.55594302779,553.5694028424],[203e-9,.37133792946,283.8593188652]],q=[[6283.0758499914,0,0],[.00206058863,2.67823455808,6283.0758499914],[4303419e-11,2.63512233481,12566.1516999828],[425264e-11,1.59046982018,3.523118349],[109017e-11,2.96631010675,1577.3435424478],[93479e-11,2.59211109542,18849.2275499742],[119305e-11,5.79555765566,26.2983197998],[72121e-11,1.13840581212,529.6909650946],[67784e-11,1.87453300345,398.1490034082],[6735e-10,4.40932832004,5507.5532386674],[59045e-11,2.88815790631,5223.6939198022],[55976e-11,2.17471740035,155.4203994342],[45411e-11,.39799502896,796.2980068164],[36298e-11,.46875437227,775.522611324],[28962e-11,2.64732254645,7.1135470008],[20844e-11,5.34138275149,.9803210682]],H=[[8721859e-11,1.07253635559,6283.0758499914],[99099e-10,3.14159265359,0],[294833e-11,.43717350256,12566.1516999828],[27338e-11,.05295636147,3.523118349],[16333e-11,5.18820215724,26.2983197998],[15745e-11,3.68504712183,155.4203994342],[9425e-11,.29667114694,18849.2275499742],[8938e-11,2.05706319592,77713.7714681205],[694e-10,.82691541038,775.522611324],[5061e-11,4.6624323168,1577.3435424478]],v=[[289058e-11,5.84173149732,6283.0758499914],[20712e-11,6.0498393902,12566.1516999828],[2962e-11,5.1956057957,155.4203994342],[2527e-11,3.14159265359,0],[1288e-11,4.7219761197,3.523118349]],L=[[7714e-11,4.14117321449,6283.0758499914],[1016e-11,3.27573644241,12566.1516999828]];function T(b){let G=0;for(const[m,g,p]of R)G+=m*Math.cos(g+p*b);let h=1;for(const m of[q,H,v,L]){h*=b;for(const[g,p,C]of m)G+=g*h*Math.cos(p+C*b)}return G}return{earthL:T}})(),I.calendar=(function(){const{earthL:R}=I["vsop-earth"]||{},{createLru:q}=I.lru||{},H=["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"],v=["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"],L=["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"];function T(_){return(285+15*_)%360}function b(_,D,O){const Q=Math.floor((14-D)/12),K=_+4800-Q,re=D+12*Q-3;return O+Math.floor((153*re+2)/5)+365*K+Math.floor(K/4)-Math.floor(K/100)+Math.floor(K/400)-32045}function G(_){const D=_+32044,O=Math.floor((4*D+3)/146097),Q=D-Math.floor(146097*O/4),K=Math.floor((4*Q+3)/1461),re=Q-Math.floor(1461*K/4),he=Math.floor((5*re+2)/153);return{year:100*O+K-4800+Math.floor(he/10),month:he+3-12*Math.floor(he/10),day:re-Math.floor((153*he+2)/5)+1}}function h(_,D){for(let O=0;O<60;O++)if(O%10===_&&O%12===D)return O;return-1}function m(_){const D=(_%60+60)%60;return{index:D,stem:H[D%10],branch:v[D%12],name:H[D%10]+v[D%12]}}function g(_){return((_+49)%60+60)%60}function p(_){const D=_-2451545,O=D/36525,Q=D/365250;let K=R(Q)*180/Math.PI+180;K=(K%360+360)%360;const re=(5029.0966*O+1.11113*O*O-6e-6*O*O*O)/3600;K+=re,K-=.09033/3600;const he=(125.04452-1934.136261*O)*Math.PI/180,pe=(280.4665+36000.7698*O)*Math.PI/180,xe=(218.3165+481267.8813*O)*Math.PI/180,Ze=(-17.2*Math.sin(he)-1.32*Math.sin(2*pe)-.23*Math.sin(2*xe)+.21*Math.sin(2*he))/3600;K+=Ze;const Re=(357.52911+35999.05029*O-1537e-7*O*O)*Math.PI/180,De=.016708634-42037e-9*O-1267e-10*O*O,qe=1.000001018*(1-De*De)/(1+De*Math.cos(Re+(1.914602-.004817*O)*(Math.PI/180)*Math.sin(Re)));return K-=20.4898/3600/(qe||1),(K%360+360)%360}function C(_){const D=[[1900,-2.8],[1920,21.2],[1940,24.3],[1950,29.1],[1960,33.2],[1970,40.2],[1980,50.5],[1990,56.9],[2e3,63.8],[2010,66.1],[2020,69.4],[2030,72],[2050,80],[2100,110]];if(_<=D[0][0])return D[0][1];for(let O=1;O<D.length;O++)if(_<=D[O][0]){const[Q,K]=D[O-1],[re,he]=D[O];return K+(he-K)*(_-Q)/(re-Q)}return D[D.length-1][1]}const U=8/24,te=7.7611/24,y=2425612+4/24;function N(_){return _<y?te:U}const l=q({max:4096,name:"termInstant"}),f=1e-5,o=new Map,r=365.2422;function c(_,D){const O=T(D),Q=b(_,1,5)-.5+D*15.2184,K=o.get(D);let re=K!==void 0?K+r:Q;Math.abs(re-Q)>20&&(re=Q);for(let pe=0;pe<12;pe++){let xe=O-p(re);if(xe=((xe+180)%360+360)%360-180,re+=xe/.98564736,Math.abs(xe)<f)break}o.set(D,re);const he=re-C(_)/86400;return he+N(he)}function u(_,D){const O=_*24+D,Q=l.get(O);if(Q!==void 0)return Q;const K=c(_,D);return l.set(O,K),K}function S(_){const D=Math.floor(_+.5),O=_+.5-D,Q=Math.round(O*1440),{year:K,month:re,day:he}=G(D);return{year:K,month:re,day:he,hour:Math.floor(Q/60)%24,minute:Q%60}}function M({year:_,month:D,day:O,hour:Q=0,minute:K=0}){return b(_,D,O)-.5+(Q*60+K)/1440}function A(_,D,O){const Q=b(_,D,O)-b(_,1,1)+1,K=2*Math.PI*(Q-81)/364;return 9.87*Math.sin(2*K)-7.53*Math.cos(K)-1.5*Math.sin(K)}const oe=q({max:8,name:"termWindow"}),ie=q({max:32,name:"termYear"}),de=Array.from({length:24},(_,D)=>D),$e=de.filter(_=>_%2===0);function Ne(_,D){const O=D?`${_}|jie`:`${_}|all`,Q=ie.get(O);if(Q)return Q;if(D){const re=ie.get(`${_}|all`);if(re){const he=re.filter(pe=>pe.index%2===0);return ie.set(O,he),he}}const K=[];for(const re of D?$e:de)K.push({year:_,index:re,name:L[re],jd:u(_,re)});return K.sort((re,he)=>re.jd-he.jd),ie.set(O,K),K}function ge(_,D={}){const O=D.jieOnly===!0,Q=O?`${_}|jie`:_,K=oe.get(Q);if(K)return K;const re=[...Ne(_-1,O),...Ne(_,O),...Ne(_+1,O)];return re.sort((he,pe)=>he.jd-pe.jd),oe.set(Q,re),re}function we(_){if(typeof _!="string"||_.length<2)return[];const D=H.indexOf(_[0]),O=v.indexOf(_[1]);if(D<0||O<0)return[];const Q=h(D,O);if(Q<0)return[];const K=Math.floor(Q/10)*10;return[v[(K+10)%12],v[(K+11)%12]]}function Me(_,D){let O=null;for(const Q of _)if(Q.index%2===0)if(Q.jd<=D)O=Q;else break;return O}function Pe(_,D){for(const O of _)if(O.index%2===0&&O.jd>D)return O;return null}function _e(_){const D=S(_),O=Q=>String(Q).padStart(2,"0");return`${D.year}-${O(D.month)}-${O(D.day)} ${O(D.hour)}:${O(D.minute)}`}function ze(){return[l.stats(),ie.stats(),oe.stats()]}return{STEMS:H,BRANCHES:v,TERM_NAMES:L,termLongitude:T,toJDN:b,fromJDN:G,sexagenaryIndex:h,ganzhiName:m,dayGanzhiIndex:g,sunLongitude:p,deltaTSeconds:C,OFFSET_MODERN:U,OFFSET_BEIJING_LOCAL:te,CUTOVER_JD:y,localOffsetFor:N,termInstantJd:u,jdToParts:S,partsToJd:M,equationOfTime:A,termWindow:ge,xunKongOf:we,previousJie:Me,nextJie:Pe,formatJd:_e,cacheMetrics:ze}})(),I.lunar=(function(){const{toJDN:R,jdToParts:q,termInstantJd:H,deltaTSeconds:v,localOffsetFor:L,OFFSET_MODERN:T}=I.calendar||{},b=29.530588861,G=245155009766e-5,h=Math.PI/180;function m(N){const l=N/1236.85,f=G+b*N+15437e-8*l*l-15e-8*l*l*l+73e-11*l*l*l*l,o=1-.002516*l-74e-7*l*l,r=(2.5534+29.1053567*N-14e-7*l*l-11e-8*l*l*l)*h,c=(201.5643+385.81693528*N+.0107582*l*l+1238e-8*l*l*l-58e-9*l*l*l*l)*h,u=(160.7108+390.67050284*N-.0016118*l*l-227e-8*l*l*l+11e-9*l*l*l*l)*h,S=(124.7746-1.56375588*N+.0020672*l*l+215e-8*l*l*l)*h,M=-.4072*Math.sin(c)+.17241*o*Math.sin(r)+.01608*Math.sin(2*c)+.01039*Math.sin(2*u)+.00739*o*Math.sin(c-r)-.00514*o*Math.sin(c+r)+.00208*o*o*Math.sin(2*r)-.00111*Math.sin(c-2*u)-57e-5*Math.sin(c+2*u)+56e-5*o*Math.sin(2*c+r)-42e-5*Math.sin(3*c)+42e-5*o*Math.sin(r+2*u)+38e-5*o*Math.sin(r-2*u)-24e-5*o*Math.sin(2*c-r)-17e-5*Math.sin(S)-7e-5*Math.sin(c+2*r)+4e-5*Math.sin(2*c-2*u)+4e-5*Math.sin(3*r)+3e-5*Math.sin(c+r-2*u)+3e-5*Math.sin(2*c+2*u)-3e-5*Math.sin(c+r+2*u)+3e-5*Math.sin(c-r+2*u)-2e-5*Math.sin(c-r-2*u)-2e-5*Math.sin(3*c+r)+2e-5*Math.sin(4*c),A=f+M-v(2e3+l*100)/86400;return A+L(A)}function g(N){return Math.floor(N+.5)}function p(N){const l=N-T;return l+L(l)}function C(N){return Math.round((N+.5-G)/b)}function U(N,l,f){for(let o=N-1;o<=N+1;o++)for(let r=1;r<24;r+=2){const c=p(H(o,r)),u=g(c);if(u>=l&&u<f)return{index:r,jd:c}}return null}function te(N,l,f){const o=R(N,l,f),r=g(p(H(N,23))),c=o<r?N-1:N,u=g(p(H(c,23)));let S=C(u);for(;g(m(S))>u;)S--;for(;g(m(S+1))<=u;)S++;const M=g(p(H(c+1,23)));let A=S;for(;g(m(A+1))<=M;)A++;const oe=A-S;let ie=-1;if(oe===13)for(let ge=1;ge<=oe;ge++){const we=g(m(S+ge-1)),Me=g(m(S+ge));if(!U(c,we,Me)){ie=ge;break}}let de=11,$e=!1,Ne=g(m(S));for(let ge=1;ge<=15;ge++){const we=g(m(S+ge-1)),Me=g(m(S+ge)),Pe=U(c,we,Me),_e=ge===ie;if(o>=we&&o<Me){const ze=q(m(S+ge-1)),_=_e?(de+10)%12+1:de;return{year:c,lunarYear:$e?c+1:c,month:_,day:o-we+1,isLeap:_e,monthStart:`${ze.year}-${String(ze.month).padStart(2,"0")}-${String(ze.day).padStart(2,"0")}`,hasZhongQi:!!Pe}}_e||(de=de%12+1,de===1&&($e=!0)),Ne=Me}throw new Error(`农历换算失败:${N}-${l}-${f}`)}function y(N,l,f){return R(N,l,f)}return{SYNODIC:b,newMoonJd:m,dayNumberOf:g,solarToLunar:te,monthStartJd:y}})(),I.geo=(function(){const R=`
4
4
  北京 116.41 39.90;上海 121.47 31.23;天津 117.20 39.13;重庆 106.55 29.56
5
5
  广州 113.26 23.13;深圳 114.06 22.55;珠海 113.58 22.27;东莞 113.75 23.02;佛山 113.12 23.02
6
6
  汕头 116.68 23.35;中山 113.39 22.52;惠州 114.42 23.11;江门 113.08 22.58;湛江 110.36 21.27
@@ -64,9 +64,9 @@ window.__ModuleLoader__.load({id:"dsh-metaphysics",chunk:"client.fengshui.js",fa
64
64
  海口 110.20 20.04;三亚 109.51 18.25;儋州 109.58 19.52;琼海 110.47 19.26
65
65
  香港 114.17 22.32;澳门 113.55 22.20;台北 121.52 25.03;高雄 120.31 22.63;台中 120.68 24.14
66
66
  `,q={河北:"石家庄",山西:"太原",内蒙古:"呼和浩特",辽宁:"沈阳",吉林:"长春",黑龙江:"哈尔滨",江苏:"南京",浙江:"杭州",安徽:"合肥",福建:"福州",江西:"南昌",山东:"济南",河南:"郑州",湖北:"武汉",湖南:"长沙",广东:"广州",广西:"南宁",海南:"海口",四川:"成都",贵州:"贵阳",云南:"昆明",西藏:"拉萨",陕西:"西安",甘肃:"兰州",青海:"西宁",宁夏:"银川",新疆:"乌鲁木齐",台湾:"台北"},H={石家庄:[114.51,38.04],太原:[112.55,37.87],沈阳:[123.43,41.8],长春:[125.32,43.82],哈尔滨:[126.53,45.8],南京:[118.8,32.06],杭州:[120.15,30.28],合肥:[117.23,31.82],福州:[119.3,26.08],南昌:[115.86,28.68],济南:[117,36.65],郑州:[113.62,34.75],武汉:[114.3,30.59],长沙:[112.94,28.23],广州:[113.26,23.13],南宁:[108.37,22.82],海口:[110.2,20.04],成都:[104.07,30.67],贵阳:[106.63,26.65],昆明:[102.83,24.88],拉萨:[91.13,29.65],西安:[108.94,34.34],兰州:[103.83,36.06],西宁:[101.78,36.62],银川:[106.23,38.49],乌鲁木齐:[87.62,43.82],台北:[121.52,25.03]},v=(()=>{const g={};for(const p of R.trim().split(`
67
- `))for(const C of p.split(";")){const U=C.trim().split(/\s+/);if(U.length!==3)continue;const[te,y,N]=U;g[te]={lon:Number(y),lat:Number(N)}}for(const[p,[C,U]]of Object.entries(H))g[p]||(g[p]={lon:C,lat:U});return g})(),L=/(省|市|地区|盟|自治州|自治县|自治区|特别行政区|县|区|镇|乡|街道|村|小区|社区)/g;function T(g){const p=String(g||"").trim();if(!p)return null;const C=Number(p);if(Number.isFinite(C)&&/^-?\d+(\.\d+)?$/.test(p)&&C>=60&&C<=150)return{lon:C,lat:null,matched:`${C}°E`,level:"经度",note:"按你输入的经度计算"};const U=p.replace(/\s/g,"").replace(L,""),te=Object.keys(v).sort((N,l)=>l.length-N.length);for(const N of te)if(U.includes(N)){const l=v[N];return{lon:l.lon,lat:l.lat,matched:N,level:"地级市",note:`按 ${N} 估算(约 ${l.lon}°E)`}}const y=p.replace(/\s/g,"");for(const[N,l]of Object.entries(q)){const f=y.indexOf(N);if(f<0)continue;const o=y.charAt(f+N.length);if(o==="区"||o==="县")continue;const r=v[l]||{lon:H[l][0],lat:H[l][1]};return{lon:r.lon,lat:r.lat,matched:l,level:"省会",note:`未匹配到具体城市,按 ${N} 省会 ${l} 估算(约 ${r.lon}°E)`}}return{lon:null,lat:null,matched:null,level:"未匹配",note:`没查到「${p}」,可改填经度(如 116.4)`}}const b=/(区|县|镇|乡|村|小区|街道|路|号|巷|弄|组|队)/,G="dsh-metaphysics/0.23.0 (+https://github.com/xuanfu-web/dsh-metaphysics)";async function h(g,{timeoutMs:p=2500}={}){if(typeof fetch!="function")return null;let C=null;try{const U=typeof AbortController=="function"?new AbortController:null;U&&(C=setTimeout(()=>U.abort(),p));const te="https://nominatim.openstreetmap.org/search?format=jsonv2&limit=1&accept-language=zh-CN&countrycodes=cn&q="+encodeURIComponent(g),y=await fetch(te,{signal:U?U.signal:void 0,headers:{"User-Agent":G}});if(!y||!y.ok)return null;const N=await y.json();if(!Array.isArray(N)||N.length===0)return null;const l=N[0],f=Number(l.lon),o=Number(l.lat);return Number.isFinite(f)?{lon:f,lat:o,matched:l.display_name,level:"在线",note:`在线解析:${l.display_name}`}:null}catch{return null}finally{C&&clearTimeout(C)}}async function m(g,p={}){const C=T(g),U=String(g||"").trim();if(!U||!(p.online===!0)||C&&typeof C.lon=="number"&&!b.test(U))return C;const y=await h(U,p);return y?{...y,local:C&&C.lon!=null?C:null}:C&&typeof C.lon=="number"?{...C,onlineFailed:!0,note:`${C.note}(联网解析失败或超时,已退回内置坐标表)`}:{...C,onlineFailed:!0}}return{CITIES:v,PROVINCES:q,resolveAddress:T,geocodeAddress:m}})(),_.random=(function(){function R(v){let L=Number(v)>>>0;return L||(L=2654435769),function(){L=L+1831565813>>>0;let b=L;return b=Math.imul(b^b>>>15,b|1),b^=b+Math.imul(b^b>>>7,b|61),((b^b>>>14)>>>0)/4294967296}}function q(v){if(v==null||v==="")return Math.random;const L=Number(v);return Number.isFinite(L)?R(L):Math.random}function H(v){return v==null||v===""?!0:Number.isFinite(Number(v))}return{mulberry32:R,randomOf:q,isSeed:H}})(),_.dst=(function(){const{daysInMonth:R}=_.validate||{},q={1986:["1986-05-04","1986-09-14"],1987:["1987-04-12","1987-09-13"],1988:["1988-04-10","1988-09-11"],1989:["1989-04-16","1989-09-17"],1990:["1990-04-15","1990-09-16"],1991:["1991-04-14","1991-09-15"]},H=(b,G,h)=>b*1e4+G*100+h;function v(b){const G=q[b.year];if(!G)return!1;const[h,m,g]=G[0].split("-").map(Number),[p,C,U]=G[1].split("-").map(Number),te=H(b.year,b.month,b.day);if(te<H(h,m,g)||te>H(p,C,U))return!1;const y=b.hour*60+(b.minute||0);return!(te===H(h,m,g)&&y<120||te===H(p,C,U)&&y>=120)}function L(b){const G=b.minute||0;if(!v(b))return{year:b.year,month:b.month,day:b.day,hour:b.hour,minute:G,applied:!1,note:null};let{year:h,month:m,day:g,hour:p}=b;return p-=1,p<0&&(p+=24,g-=1,g<1&&(m-=1,m<1&&(m=12,h-=1),g=R(h,m))),{year:h,month:m,day:g,hour:p,minute:G,applied:!0,note:`检出自 ${q[b.year][0]} 至 ${q[b.year][1]} 的中国夏令时:出生钟面时间已减 1 小时校正`}}function T(b,G){const h=Array.isArray(b)?b.slice():[];return G&&G.applied&&G.note&&h.push(G.note),h}return{DST_SPANS:q,inDstSpan:v,applyDst:L,withDstNote:T}})(),_.fengshui=(function(){const{partsToJd:R,termInstantJd:q,toJDN:H,dayGanzhiIndex:v,ganzhiName:L,termWindow:T,previousJie:b,BRANCHES:G}=_.calendar||{},{applyDst:h}=_.dst||{},{fail:m}=_.fail||{},g={1:{name:"一白",color:"白",element:"水",star:"贪狼",lucky:!0},2:{name:"二黑",color:"黑",element:"土",star:"巨门",lucky:!1},3:{name:"三碧",color:"碧",element:"木",star:"禄存",lucky:!1},4:{name:"四绿",color:"绿",element:"木",star:"文曲",lucky:!0},5:{name:"五黄",color:"黄",element:"土",star:"廉贞",lucky:!1},6:{name:"六白",color:"白",element:"金",star:"武曲",lucky:!0},7:{name:"七赤",color:"赤",element:"金",star:"破军",lucky:!1},8:{name:"八白",color:"白",element:"土",star:"左辅",lucky:!0},9:{name:"九紫",color:"紫",element:"火",star:"右弼",lucky:!0}},p={坎:"正北",艮:"东北",震:"正东",巽:"东南",离:"正南",坤:"西南",兑:"正西",乾:"西北"},C=["坎","艮","震","巽","离","坤","兑","乾"],U={乾:["六煞","天医","五鬼","祸害","绝命","延年","生气"],坎:["五鬼","天医","生气","延年","绝命","祸害","六煞"],艮:["六煞","绝命","祸害","生气","延年","天医","五鬼"],震:["延年","生气","祸害","绝命","五鬼","天医","六煞"],巽:["天医","五鬼","六煞","祸害","生气","绝命","延年"],离:["六煞","五鬼","绝命","延年","祸害","生气","天医"],坤:["天医","延年","绝命","生气","祸害","五鬼","六煞"],兑:["生气","祸害","延年","绝命","六煞","五鬼","天医"]},te=["生气","延年","天医","伏位"],y=["绝命","五鬼","六煞","祸害"],N=[{m:"壬",gua:"坎",deg:345},{m:"子",gua:"坎",deg:0},{m:"癸",gua:"坎",deg:15},{m:"丑",gua:"艮",deg:30},{m:"艮",gua:"艮",deg:45},{m:"寅",gua:"艮",deg:60},{m:"甲",gua:"震",deg:75},{m:"卯",gua:"震",deg:90},{m:"乙",gua:"震",deg:105},{m:"辰",gua:"巽",deg:120},{m:"巽",gua:"巽",deg:135},{m:"巳",gua:"巽",deg:150},{m:"丙",gua:"离",deg:165},{m:"午",gua:"离",deg:180},{m:"丁",gua:"离",deg:195},{m:"未",gua:"坤",deg:210},{m:"坤",gua:"坤",deg:225},{m:"申",gua:"坤",deg:240},{m:"庚",gua:"兑",deg:255},{m:"酉",gua:"兑",deg:270},{m:"辛",gua:"兑",deg:285},{m:"戌",gua:"乾",deg:300},{m:"乾",gua:"乾",deg:315},{m:"亥",gua:"乾",deg:330}],l=new Map(N.map((s,k)=>[s.m,k]));function f(s){const k=l.get(s);if(k===void 0)throw m("E_INPUT",`坐向必须是 24 山之一(${N.map(E=>E.m).join("")}),收到「${s}」——请按罗盘 24 山报坐或报向,不要自造方位词。`);return{...N[k],index:k}}function o(s){const E=(f(s).index+12)%24;return{...N[E],index:E}}const r=s=>["坎","离","震","巽"].includes(s)?"东四":"西四",c={生气:"大吉:最宜开门、主卧、灶口朝向",延年:"大吉:宜开门、主卧(利感情与人缘)",天医:"次吉:宜主卧、书房、老人房(利健康)",伏位:"次吉:宜卧室、神位(主平稳)",祸害:"小凶:宜厕所、储物间(宜静不宜动)",六煞:"次凶:宜厕所、储物间",五鬼:"大凶:宜厕所,或以灶坐压之(传统「火烧五鬼」说)",绝命:"最凶:宜灶坐压之、储物,忌门床"},u=["坎","坤","震","巽","中","乾","兑","艮","离"];function S(s,k){const E=(s%100+100)%100,x=s>=2e3?{male:99,female:3}:{male:100,female:4},Y=W=>{const P=(W%9+9)%9;return P===0?9:P};let F=Y(k==="male"?x.male-E:E-x.female);F===5&&(F=k==="male"?2:8);const Z=u[F-1];if(Z==="中")throw new Error("命卦计算异常:落中宫");return{num:F,gua:Z,direction:p[Z]}}function M(s){const k={伏位:{palace:s,direction:p[s]}},E=C.indexOf(s);for(let x=1;x<=7;x++){const Y=C[(E+x)%8];k[U[s][x-1]]={palace:Y,direction:p[Y]}}return k}function A(s,k,E){return R({year:s,month:k,day:E,hour:12,minute:0})<q(s,2)?s-1:s}function oe(s){const k=(1+(2026-s))%9;return k<=0?k+9:k}const ie=["坎","坤","震","巽","中","乾","兑","艮","离"],de=s=>{const k=(s%9+9)%9;return k===0?9:k};function $e(s,k=!0){const E=[];for(const x of ie){const Y=ie.indexOf(x)+1,F=de(Y-5+s),Z=g[F];E.push({palace:x,direction:x==="中"?"中宫":p[x],num:F,name:Z.name,star:Z.star,element:Z.element,lucky:Z.lucky})}return{center:s,centerName:g[s].name,forward:k,fly:k?"顺飞":"逆飞",palaces:E}}function Ne(s){return $e(oe(s),!0)}const ge={立春:1,惊蛰:2,清明:3,立夏:4,芒种:5,小暑:6,立秋:7,白露:8,寒露:9,立冬:10,大雪:11,小寒:12},we={四正:8,四墓:5,四生:2},Me={四正:1,四墓:7,四生:4},Pe={四正:9,四墓:3,四生:6},_e=s=>["子","午","卯","酉"].includes(s)?"四正":["辰","戌","丑","未"].includes(s)?"四墓":"四生",ze=s=>L(((s-4)%60+60)%60).branch;function I(s,k,E){let x=null;for(const Y of s){if(Y.jd>E)break;Y.name===k&&(x=Y)}return x}function D(s,k){const E=I(s,"冬至",k),x=I(s,"夏至",k);if(!!E&&(!x||E.jd>x.jd)){const W=I(s,"谷雨",k),P=I(s,"雨水",k);return W&&E&&W.jd>E.jd?{half:"阳遁",segment:"谷雨–夏至(下元)",offset:3,boundary:"冬至后阳遁,谷雨至上元转下元"}:P&&E&&P.jd>E.jd?{half:"阳遁",segment:"雨水–谷雨(中元)",offset:6,boundary:"冬至后阳遁,雨水至上元转中元"}:{half:"阳遁",segment:"冬至–雨水(上元)",offset:0,boundary:"冬至后阳遁上元"}}const F=I(s,"霜降",k),Z=I(s,"处暑",k);return F&&x&&F.jd>x.jd?{half:"阴遁",segment:"霜降–冬至(下元)",offset:3,boundary:"夏至后阴遁,霜降至上元转下元"}:Z&&x&&Z.jd>x.jd?{half:"阴遁",segment:"处暑–霜降(中元)",offset:6,boundary:"夏至后阴遁,处暑至上元转中元"}:{half:"阴遁",segment:"夏至–处暑(上元)",offset:0,boundary:"夏至后阴遁上元"}}function O(s){const k=Number(s.year),E=Number(s.month),x=Number(s.day),Y=Number.isInteger(s.hour)?s.hour:12,F=Number.isInteger(s.minute)?s.minute:0,Z=R({year:k,month:E,day:x,hour:Y,minute:F}),W=T(k),P=A(k,E,x),se=ze(P),ue=_e(se),fe=b(W,Z),le=ge[fe?fe.name:"立春"]||1,ce=D(W,Z),B=H(k,E,x)+(Y>=23?1:0),Se=v(B),Oe=L(Se).name,ve=L(Se).branch,ke=_e(ve),ye=Math.floor((Y+1)%24/2),Ce=oe(P),Ue=de(we[ue]-(le-1)),ne=de(Se+1+ce.offset),Te=ce.half==="阳遁"?ne:de(10-ne),fn=ce.half==="阳遁"?Me[ke]:Pe[ke],un=de(fn+(ce.half==="阳遁"?ye:-ye));return{year:{...$e(Ce,!0),basis:`${P} 年(立春界)年星 ${g[Ce].name} 入中顺飞`},month:{...$e(Ue,!0),basis:`${se}年(${ue})${fe?fe.name:"立春"}月,${le} 月 ${g[Ue].name} 入中顺飞`},day:{...$e(Te,ce.half==="阳遁"),basis:`${ce.half}·${ce.segment},${Oe}日第 ${Se+1} 位,${g[Te].name} 入中${ce.half==="阳遁"?"顺":"逆"}飞`},hour:{...$e(un,ce.half==="阳遁"),basis:`${ce.half}·${ce.segment},${ke}日 ${G[ye]}时,${g[un].name} 入中${ce.half==="阳遁"?"顺":"逆"}飞`},meta:{guaYear:P,yearBranch:se,yearGroup:ue,monthNum:le,monthJie:fe?fe.name:"立春",dayGanzhi:Oe,daySeq:Se+1,dayGroup:ke,hourBranch:G[ye],half:ce.half,segment:ce.segment,boundary:ce.boundary,note:"月按节气月(寅月为正月);日按公历日、23:00 后归次日;日/时星入中后的顺逆取「冬至顺、夏至逆」。另有「一律顺飞」与「月按农历月」派,本插件不合并,差异见本注。"}}}const Q=s=>String(s).padStart(2,"0");function K(s){const k=Math.floor((s-1864)/20),E=(k%9+9)%9+1,x=1864+20*k;return{period:E,start:x,end:x+19,label:`${E}运(${x}–${x+19})`}}const re=new Set(["乾","巽","艮","坤","甲","庚","壬","丙","寅","申","巳","亥"]),he=["地元","天元","人元"],pe={};N.forEach((s,k)=>{pe[s.m]={...s,yuan:he[k%3],yinYang:re.has(s.m)?"阳":"阴"}});const xe=["中","乾","兑","艮","离","坎","坤","震","巽"],Ze=["坎","坤","震","巽","中","乾","兑","艮","离"],Re={地元:0,天元:1,人元:2},De=s=>N.filter(k=>k.gua===s).map(k=>pe[k.m]);function qe(s,k){const E={};for(let x=0;x<9;x++){const Y=((s-1+(k?x:-x))%9+9)%9+1;E[xe[x]]=Y}return E}function Be(s,k){if(k===5)return{forward:s.yinYang==="阳",basis:`五黄入中,按${s.m}本山${s.yuan}${s.yinYang}论`};const E=Ze[k-1],x=De(E)[Re[s.yuan]];return{forward:x.yinYang==="阳",basis:`${k}${E}宫取${s.yuan}${x.m}(${x.yinYang})`}}const en="《沈氏玄空学》坤壬乙诀(子癸甲申一白、壬卯乙未坤二黑、乾亥辰巽巳戌六白、酉辛丑艮丙七赤、寅午庚丁九紫)",Ge=Object.freeze({子:1,癸:1,甲:1,申:1,壬:2,卯:2,乙:2,未:2,坤:2,乾:6,亥:6,辰:6,巽:6,巳:6,戌:6,酉:7,辛:7,丑:7,艮:7,丙:7,寅:9,午:9,庚:9,丁:9}),Ye=4.5;function Je(s,k=0){const E=Number(k)||0;if(Math.abs(E)<=Ye)return{active:!1,offset:E,threshold:Ye,sitting:s.m,jian:null,kind:null,sameYinYang:null,note:`坐山偏离中心 ${E}°,未超 ${Ye}°,按正向下卦排盘。`};const x=N.findIndex(P=>P.m===s.m),Y=N[(x+(E>0?1:-1)+24)%24],F=pe[s.m],Z=pe[Y.m],W=Y.gua===s.gua;return{active:!0,offset:E,threshold:Ye,sitting:s.m,jian:Y.m,side:E>0?"右":"左",kind:W?"同卦兼":"出卦兼",sameYinYang:Z.yinYang===F.yinYang,note:`坐山偏离中心 ${E}°,兼${Y.m}(${W?"同卦兼":"出卦兼"}${W&&Z.yinYang===F.yinYang?",同阴同阳":""});按沈氏替卦,山星以 ${Ge[s.m]} 入中。`}}const Xe={1:[],2:[["乾","巽"],["亥","巳"],["丑","未"]],3:[["卯","酉"],["乙","辛"],["辰","戌"]],4:[["艮","坤"],["寅","申"],["甲","庚"]],5:[["子","午"],["癸","丁"],["卯","酉"],["乙","辛"],["丑","未"],["辰","戌"]],6:[["艮","坤"],["寅","申"],["甲","庚"]],7:[["卯","酉"],["乙","辛"],["辰","戌"]],8:[["乾","巽"],["亥","巳"],["丑","未"]],9:[]},We=["三元九运(1864 年起一运、每运 20 年,九运 180 年一轮)","玄空下卦挨星(运盘顺飞;山盘/向盘以入中运星本宫同元龙阴阳定顺逆,五黄入中按本山阴阳)","兼向替卦:坐山偏离中心超 4.5° 用《沈氏玄空学》坤壬乙诀替星入中,顺逆按替星本宫同元龙","年月日时紫白(公式派:年逐年退一位;月按年支三组起 8/5/2;日按冬至夏至三段起 1/7/4 与 9/3/6;时按日支三组子时起 1/7/4 与 9/3/6)","二十四山旺山旺向通行表(每项含正反两向;一运、九运无局;只对正向下卦)"],nn="玄空排盘为传统通行口径的本地计算,属民俗参考,不构成现场勘舆结论,仅供娱乐;兼向超 4.5° 按沈氏替卦,年月日时紫白按公式派;各家另有异说,形峦与现场勘舆不在本工具范围内。";function tn(s,k,E,x={}){const Y=pe[k],F=pe[E],Z=Number(x.offset)||0,W=Je(Y,Z),P=qe(s,!0),se=W.active?Ge[Y.m]:P[Y.gua],ue=W.active?Ge[F.m]:P[F.gua],fe=Be(Y,se),le=Be(F,ue),ce=qe(se,fe.forward),B=qe(ue,le.forward),Se=ie.map((ne,Te)=>({palace:ne,direction:ne==="中"?"中宫":p[ne],luoshu:Te+1,yun:P[ne],shan:ce[ne],xiang:B[ne]})),Oe=ne=>ie.filter(Te=>ne[Te]===s),ve=Xe[s],ke=ve.find(([ne,Te])=>Y.m===ne&&F.m===Te||Y.m===Te&&F.m===ne),ye=ce[Y.gua]===s&&B[F.gua]===s,Ce={shan:W.active&&se!==P[Y.gua],xiang:W.active&&ue!==P[F.gua]},Ue=W.active?`替卦盘不套正向旺山旺向表;${ye?"本盘当运山星/向星仍到坐向。":"本盘当运山星/向星未同时到坐向。"}${!Ce.shan&&!Ce.xiang?"山向两替星均「用替而未替」,实际仍按原卦气。":""}`:ye&&ke?"盘面与表法一致:本局到山到向。":ye?"盘面到山到向,但不在通行表法所列之局(表法与盘面口径不同,并列不合并)。":ke?"通行表法列为旺山旺向,但本盘当运山星/向星未同时落坐向(表法与盘面口径不同,并列不合并)。":"本局既未到山到向,也不在表法旺山旺向之列。";return{palaces:Se,sitting:Y,facing:F,yun:P,shan:ce,xiang:B,yunCenter:s,jianXiang:W,shanCenter:{star:se,...fe,mode:W.active?"替卦":"下卦",original:P[Y.gua],replaced:Ce.shan},xiangCenter:{star:ue,...le,mode:W.active?"替卦":"下卦",original:P[F.gua],replaced:Ce.xiang},dangYun:{shan:Oe(ce),xiang:Oe(B)},heshi:{shan:ie.filter(ne=>ce[ne]+P[ne]===10),xiang:ie.filter(ne=>B[ne]+P[ne]===10)},wangShanWangXiang:{byChart:ye,byTable:W.active?null:!!ke,table:ve.map(([ne,Te])=>`${ne}${Te}`),note:Ue}}}function He(s){const k=s.dst===!1?{year:s.year,month:s.month,day:s.day,hour:0,minute:0,applied:!1,note:null}:h({year:s.year,month:s.month,day:s.day,hour:0,minute:0});return{year:k.year,month:k.month,day:k.day,dst:k}}const an=["大游年歌(八宅通行口径)","年家紫白飞星(纯公式:以 2026 丙午一白入中、逐年退一位、九年一轮;按立春换年)","24 山归属与度数(八宅通行口径,每山 15°)"],on="八宅与飞星为传统通行口径的本地计算,属民俗参考,不构成现场勘舆结论,仅供娱乐;实际户型以现场为准。";function sn(s){if(s.action==="advise")return Fe(s);if(s.action==="xuankong")return cn(s);const k=s.gender;if(k!=="male"&&k!=="female")throw m("E_INPUT","风水命卦需要性别:男女命卦算法不同,不可缺省");if(!Number.isInteger(s.year)||!Number.isInteger(s.month)||!Number.isInteger(s.day))throw m("E_INPUT","风水命卦需要完整出生年月日(公历)——只知道年份不够:命卦按立春界划分出生年");const E=He(s),x=A(E.year,E.month,E.day),{num:Y,gua:F,direction:Z}=S(x,k),W=M(F),P=["坎","离","震","巽"].includes(F),se=Number.isInteger(s.fortuneYear)?s.fortuneYear:null;return{system:"fengshui",meta:{birth:`${E.year}-${Q(E.month)}-${Q(E.day)}`,guaYear:x,gender:k==="male"?"男":"女",fortuneYear:se,...E.dst.applied?{dst:E.dst.note}:{},...se===null?{note:"未给流年:未算年紫白飞星(需要时补 fortuneYear)。"}:{},scope:"八宅命卦 + 大游年八星 + 年紫白;玄空飞星见 action=xuankong;不含形峦与现场勘舆。"},mingGua:{num:Y,gua:F,direction:Z,group:P?"东四命":"西四命",compatible:P?"宜东四宅(坐坎离震巽)":"宜西四宅(坐乾坤艮兑)"},luckyDirections:te.map(ue=>({star:ue,...W[ue]})),unluckyDirections:y.map(ue=>({star:ue,...W[ue]})),...se===null?{}:{yearlyFlying:Ne(se)},sources:an,disclaimer:on}}function Ke(s){const k=typeof s.sitting=="string"&&s.sitting.trim()!=="",E=typeof s.facing=="string"&&s.facing.trim()!=="";if(!k&&!E)throw m("E_INPUT","缺少坐向:sitting(坐山)或 facing(向山)至少给一个——按罗盘 24 山报坐或报向,例如「坐北朝南」对应坐子向午");if(k&&E){const F=f(s.sitting.trim()),Z=f(s.facing.trim());if((F.index+12)%24!==Z.index)throw m("E_INPUT",`坐向不自洽:坐${F.m}(${F.deg}°)与向${Z.m}(${Z.deg}°)不是对宫(相差应 180°,实测 ${(Z.deg-F.deg+360)%360}°)——请核对罗盘读数。`)}const x=k?f(s.sitting.trim()):o(s.facing.trim()),Y=N[(x.index+12)%24];return{sitting:x,facing:Y}}function Fe(s){const{sitting:k,facing:E}=Ke(s),x=k.gua,Y=M(x),F=te.map(le=>Y[le]),Z=y.map(le=>Y[le]),W=le=>`${le.direction}(${le.palace}宫)`,P=[...te,...y].map(le=>({star:le,lucky:te.includes(le),...Y[le],role:c[le]})),se={door:`门宜开于吉方:首选生气方 ${W(F[0])},次选延年方 ${W(F[1])}、天医方 ${W(F[2])}。`,stove:`灶宜「坐凶向吉」:灶身压凶方(首选绝命方 ${W(Z[0])}、五鬼方 ${W(Z[1])}),灶口朝吉方。`,bed:`主卧与床头宜安吉方:生气方 ${W(F[0])} 或延年方 ${W(F[1])};床头宜向吉方。`,toilet:`厕所宜压凶方:祸害方 ${W(Z[3])} 或六煞方 ${W(Z[2])}(污去凶气,宜静常闭)。`};let ue=null;const fe=Number.isInteger(s.year)&&Number.isInteger(s.month)&&Number.isInteger(s.day)&&(s.gender==="male"||s.gender==="female");if(fe){const le=He(s),ce=A(le.year,le.month,le.day),B=S(ce,s.gender),Se=r(B.gua),Oe=r(x),ve=Se===Oe,ke=te.map(ye=>`${ye}位${M(B.gua)[ye].direction}`).join("、");ue={birth:`${le.year}-${Q(le.month)}-${Q(le.day)}`,guaYear:ce,gender:s.gender==="male"?"男":"女",mingGua:{gua:B.gua,direction:B.direction,group:`${Se}命`},houseGua:{gua:x,group:`${Oe}宅`},sameGroup:ve,text:ve?`命宅相配(${Se}命住${Oe}宅):以宅之八星盘布局即可,个人吉方与宅吉方大体同向。`:`命宅不配(${Se}命住${Oe}宅):传统调停法——门与床以命卦吉方为先(此命四吉方:${ke}),灶仍按宅卦坐凶向吉,两盘各自取用。`}}return{system:"fengshui",meta:{action:"advise",...fe?{}:{birthNote:"未提供生辰:未做命宅配;如需按个人命卦调停门床,请补充出生年月日与性别。"},sitting:`${k.m}山(罗盘 ${k.deg}°)`,facing:`${E.m}山(罗盘 ${E.deg}°)`,houseGua:x,houseGroup:`${r(x)}宅`,scope:"门主灶厕走向按八宅通行口径给倾向,玄空飞星见 action=xuankong;不含形峦、不是现场勘舆结论。"},houseStars:P,layout:se,...ue?{mingMatch:ue}:{},sources:an,disclaimer:on}}function rn(s,k,E){const x=P=>P!=null&&P!=="",Y=(P,se)=>{if(typeof P!="number"||!Number.isFinite(P))throw m("E_INPUT",`${se} 必须是数字(度),收到「${P}」`);return P},F=(P,se,ue)=>{const fe=Y(P,ue);if(fe<0||fe>360)throw m("E_INPUT",`${ue} 必须在 0–360° 之间(罗盘度数),收到「${fe}」`);const le=(fe-se.deg+540)%360-180;if(Math.abs(le)>7.500000001)throw m("E_INPUT",`${ue} ${fe}° 不在${se.m}山范围内(${se.m}中心 ${se.deg}°,每山 15°),请核对坐向。`);return le},Z=[];if(x(s.sittingOffset)&&Z.push(Y(s.sittingOffset,"sittingOffset")),x(s.sittingDegree)&&Z.push(F(s.sittingDegree,k,"sittingDegree")),x(s.facingOffset)&&Z.push(Y(s.facingOffset,"facingOffset")),x(s.facingDegree)&&Z.push(F(s.facingDegree,E,"facingDegree")),!Z.length)return{offset:0,source:"未报兼向度数,按正向(0°)"};const W=Z[0];if(Z.some(P=>Math.abs(P-W)>1e-9))throw m("E_INPUT",`坐向兼度不一致:${Z.join("° / ")}°——坐与向应同向偏离,请只报一个偏移或核对度数。`);if(Math.abs(W)>7.5+1e-9)throw m("E_INPUT",`兼向偏移必须在 −7.5°–7.5°(相对本山中心),收到「${W}」——超过 7.5° 已进入下一山。`);return{offset:W,source:"按所报兼向度数"}}function ln(s){const k=fe=>fe!=null&&fe!=="";if(!k(s.fortuneDate))return null;if(typeof s.fortuneDate!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(s.fortuneDate))throw m("E_INPUT",`fortuneDate 需为 YYYY-MM-DD,收到「${s.fortuneDate}」`);const[E,x,Y]=s.fortuneDate.split("-").map(Number),F=new Date(Date.UTC(E,x-1,Y));if(F.getUTCFullYear()!==E||F.getUTCMonth()!==x-1||F.getUTCDate()!==Y)throw m("E_INPUT",`fortuneDate 不是有效日期:「${s.fortuneDate}」`);const Z=k(s.fortuneTime)?s.fortuneTime:"12:00";if(typeof Z!="string"||!/^\d{2}:\d{2}$/.test(Z))throw m("E_INPUT",`fortuneTime 需为 HH:MM,收到「${Z}」`);const[W,P]=Z.split(":").map(Number);if(W>23||P>59)throw m("E_INPUT",`fortuneTime 超出范围(HH:MM):「${Z}」`);const se=s.dst===!1?null:h({year:E,month:x,day:Y,hour:W,minute:P});return{at:se?{year:se.year,month:se.month,day:se.day,hour:se.hour,minute:se.minute}:{year:E,month:x,day:Y,hour:W,minute:P},dst:se}}function cn(s){const{sitting:k,facing:E}=Ke(s),x=rn(s,k,E),Y=ln(s);let F,Z=null,W;if(s.period!==void 0&&s.period!==null&&!Number.isInteger(s.period))throw m("E_INPUT",`运必须是 1–9 的整数(三元九运),收到「${s.period}」——一运 1864 起、九运 2024–2043。`);if(Number.isInteger(s.period)){if(s.period<1||s.period>9)throw m("E_INPUT",`运必须是 1–9 的整数(三元九运),收到「${s.period}」——一运 1864 起、九运 2024–2043。`);F=s.period}else Number.isInteger(s.fortuneYear)?(Z=K(s.fortuneYear),F=Z.period):Y?(Z=K(A(Y.at.year,Y.at.month,Y.at.day)),F=Z.period,W=`未显式给运:按飞星日期归入 ${Z.label}。`):(F=9,W="未给运:默认按九运(2024–2043)排盘;可传 period(1–9)或 fortuneYear 指定。");const P=tn(F,k.m,E.m,{offset:x.offset}),se=pe[k.m],ue=pe[E.m],fe=B=>({star:B.star,name:g[B.star].name,fly:B.forward?"顺飞":"逆飞",basis:B.basis,mode:B.mode,original:B.original,replaced:B.replaced}),le=B=>B.map(Se=>Se==="中"?"中宫":`${Se}宫${p[Se]}`).join("、")||"无";let ce=null;if(Y)ce=O(Y.at),Y.dst&&Y.dst.applied&&(ce.meta.dst=Y.dst.note);else if(Number.isInteger(s.fortuneYear)){const B=oe(s.fortuneYear);ce={year:{...$e(B,!0),basis:`${s.fortuneYear} 年紫白 ${g[B].name} 入中顺飞`},month:null,day:null,hour:null,meta:{guaYear:s.fortuneYear,note:"只给年份:已排年紫白;补 fortuneDate(YYYY-MM-DD)与 fortuneTime(HH:MM)可排月、日、时。"}}}return{system:"fengshui",meta:{action:"xuankong",period:F,periodLabel:Z?Z.label:`${F}运`,...Z?{year:s.fortuneYear||Y&&Y.at.year,periodStart:Z.start,periodEnd:Z.end}:{},sitting:`${k.m}山(罗盘 ${k.deg}°)`,facing:`${E.m}山(罗盘 ${E.deg}°)`,sittingGua:k.gua,facingGua:E.gua,sittingYuan:`${se.yuan}${se.yinYang}`,facingYuan:`${ue.yuan}${ue.yinYang}`,sittingOffset:x.offset,jianXiang:P.jianXiang,shanCenter:fe(P.shanCenter),xiangCenter:fe(P.xiangCenter),...W?{note:W}:{},scope:"玄空下卦/替卦:运盘 + 山盘 + 向盘 + 当运星 + 合十 + 表法旺山旺向;兼向超 4.5° 按沈氏替卦;年月日时紫白按公式派;不含形峦与现场勘舆。"},palaces:P.palaces,dangYun:{shan:{palaces:P.dangYun.shan,text:le(P.dangYun.shan)},xiang:{palaces:P.dangYun.xiang,text:le(P.dangYun.xiang)}},heshi:{shan:P.heshi.shan,xiang:P.heshi.xiang},wangShanWangXiang:P.wangShanWangXiang,...ce?{timeFlying:ce}:{},sources:We,disclaimer:nn}}return{NINE_STARS:g,PALACE_DIRECTION:p,DAYOUTIAN:U,LUCKY_STARS:te,UNLUCKY_STARS:y,MOUNTAINS_24:N,mountainInfo:f,sittingFromFacing:o,STAR_LAYOUT_ROLE:c,mingGua:S,eightStars:M,guaYearOf:A,yearZibaiStar:oe,yearlyFlying:Ne,timeFlyingOf:O,periodOfYear:K,MOUNTAIN_META:pe,TIGUA_SOURCE:en,TIGUA_TABLE:Ge,JIAN_XIANG_THRESHOLD:Ye,jianXiangOf:Je,WANG_SHAN_WANG_XIANG:Xe,XUANKONG_SOURCES:We,XUANKONG_DISCLAIMER:nn,xuankongChart:tn,buildFengshui:sn}})(),_.followup=(function(){const{ZIWEI_STARS:R}=_["interpret-data"]||{},q=[{key:"career",label:"事业",words:["事业","工作","跳槽","升职","创业","职业","岗位","离职","加薪","面试","offer"]},{key:"wealth",label:"财富",words:["财","钱","收入","投资","买房","存款","亏","赚","分红"]},{key:"love",label:"感情",words:["感情","婚","恋","对象","分手","复合","姻缘","结婚","桃花"]},{key:"health",label:"健康",words:["健康","病","身体","手术","失眠","体检","医院"]},{key:"study",label:"学业",words:["学业","考试","学习","考研","考公","证书","升学"]},{key:"travel",label:"出行",words:["出行","搬家","旅行","出国","迁","远行"]}],H={career:"官禄",wealth:"财帛",love:"夫妻",health:"疾厄",study:"官禄",travel:"迁移",overall:"命宫"},v=(y,N)=>{const l=String(y).match(/(20\d{2})\s*年?/);if(l)return Number(l[1]);const f=Array.isArray(N.liunian)&&N.liunian[0]?Number(N.liunian[0].year):null;return f?/明年/.test(y)?f+1:/后年/.test(y)?f+2:/去年/.test(y)?f-1:/今年|本年/.test(y)?f:null:null},L=y=>q.find(N=>N.words.some(l=>String(y).includes(l)))||null;function T(y,N){const l=v(N,y),f=L(N),o=Array.isArray(y.liunian)?y.liunian:[],r=Array.isArray(y.dayun?.list)?y.dayun.list:[],c=o.map(u=>u.year);if(l&&!o.some(u=>Number(u.year)===l))return{ok:!1,year:l,topic:f,answer:`这一盘已排的流年范围是 ${c[0]}–${c[c.length-1]},没有 ${l} 年。可以把问题改到范围内,或用 asOf 指定你想看的年份重新排盘。`,evidence:[`已排流年:${c.join("、")}`],confidence:"弱"};if(l){const u=o.find(de=>Number(de.year)===l),S=r.find(de=>Number(de.startAge)<=Number(u.age)&&Number(u.age)<=Number(de.startAge)+9)||null,M=u.luck?.tier||"平",A=(u.luck?.reasons||[]).slice(0,3),oe=(u.relations||[]).join("、"),ie=f?G(y,f.key):"";return{ok:!0,year:l,topic:f,answer:`${l} 年(${u.ganzhi})流年,十神为${u.stemTenGod||"—"},档位「${M}」;所行大运 ${S?`${S.ganzhi}(${S.luck?.tier||"平"})`:"未取到"}。${A.length?`理由:${A.join(",")}。`:""}${oe?`与该年地支相关的原局关系:${oe}。`:""}${ie}`,evidence:[`流年 ${u.year} ${u.ganzhi}·${u.stemTenGod||""}·${M}`,S?`大运 ${S.ganzhi}·${S.luck?.tier||"平"}`:"",oe?`原局关系 ${oe}`:"",f?`问题方向:${f.label}`:""].filter(Boolean),confidence:S&&A.length?"强":"中"}}if(f){const u={wealth:"overall",study:"work",travel:"overall"}[f.key]||f.key,S=(y.interpret?.dimensions||[]).find(M=>M.key===f.key||M.key===u);if(S){const M=y.frame&&y.frame.godStats&&y.frame.godStats.groups||{},A=f.key==="wealth"?` 财星权重 ${Number(M.财||0)}(只作结构参考,不含金额)。`:"";return{ok:!0,year:null,topic:f,answer:`按${f.label}这条线看:${S.text}${A}${S.advice?` 建议:${S.advice}`:""}`,evidence:(S.evidence||[]).slice(0,4),confidence:S.confidence||"中"}}}return{ok:!1,year:null,topic:f,answer:`这个问题里没有识别到具体的年份或方面。可以这样问:「2027 年事业怎么样」「财运如何」「感情在 2028 年」;已排流年是 ${c[0]}–${c[c.length-1]}。`,evidence:[`可问年份:${c.join("、")}`],confidence:"弱"}}function b(y,N){const l=v(N,y),f=L(N),o=Array.isArray(y.liunian)?y.liunian:[];if(l&&!o.some(r=>Number(r.year)===l))return{ok:!1,year:l,topic:f,answer:`这一盘的流年表覆盖 ${o[0]?.year}–${o[o.length-1]?.year},没有 ${l} 年;可以换一个年份,或用 asOf 指定起点重新排盘。`,evidence:[`流年表:${o.map(r=>r.year).join("、")}`],confidence:"弱"};if(l){const r=o.find(u=>Number(u.year)===l),c=r.daxian||{};return{ok:!0,year:l,topic:f,answer:`${l} 年(${r.ganzhi},${r.age} 岁)流年命宫落在「${r.lifePalace?r.lifePalace.palace:"—"}」,四化为 ${(r.mutagen||[]).join("、")||"不明显"};所行大限${c.palace?`在${c.palace}(${c.start}–${c.end} 岁)`:"未取到"}。${f?`与「${f.label}」对应的宫位信号见下条依据。`:""}`,evidence:[`流年命宫 ${r.lifePalace?r.lifePalace.palace:"—"}(${r.lifePalace?r.lifePalace.branch:"—"})`,`四化 ${(r.mutagen||[]).join("、")||"不明显"}`,c.palace?`大限 ${c.palace}·${c.start}–${c.end}岁`:""].filter(Boolean),confidence:(r.mutagen||[]).length>=3?"强":"中"}}if(f){const r=H[f.key]||"命宫",c=(y.palaces||[]).find(u=>u.palace===r);if(c){const u=(c.stars||[]).filter(M=>M.type==="主星").map(M=>M.name),S=u.map(M=>R[M]?.trait).filter(Boolean).slice(0,2).join(";");return{ok:!0,year:null,topic:f,answer:`「${f.label}」看${r}:主星${u.length?u.join("、"):"无正曜(借对宫)"}${S?`——${S}`:""}。宫支${c.branch},${c.stems,""}生年四化与煞星的影响需结合报告里的对应分节一起看。`,evidence:[`${r} ${c.branch}·${u.join("、")||"无正曜"}`,...(c.shensha||[]).slice(0,3)],confidence:u.length?"强":"弱"}}}return{ok:!1,year:null,topic:f,answer:"没有识别到具体年份或方面。可以问「2028 年事业」「感情怎么样」「财运在 2030 年」;也可以直接问某个宫位,如「夫妻宫」。",evidence:[],confidence:"弱"}}function G(y,N){return`这段时间可以重点对照报告里「${{career:"事业",wealth:"财富",love:"感情",health:"健康",study:"学业",travel:"出行"}[N]||"整体"}」一节看。`}function h(y,N){const l=L(N),f=Array.isArray(y.interpret?.sections)?y.interpret.sections:[],o=l?f.find(c=>c.label.includes(l.label)||c.text.includes(l.label)):null;if(o)return{ok:!0,year:null,topic:l,answer:o.text,evidence:[`引用分节:${o.label}`],confidence:"中"};const r=f[0];return{ok:!1,year:null,topic:l,answer:r?`这一盘的追问需要落到具体方面(事业 / 财富 / 感情 / 健康 / 学业 / 出行)。先看「${r.label}」这一节,或把问题说得更具体一点。`:"这一盘暂时没有可追问的分节;先看完整解析,再问具体方面。",evidence:[],confidence:"弱"}}function m(y,N){const l=String(N||"").trim(),f=y&&y.system==="bazi"?T(y,l):y&&y.system==="ziwei"?b(y,l):h(y,l);return{question:l,...f}}const g={bazi:"八字(四柱)",ziwei:"紫微斗数",liuyao:"六爻",meihua:"梅花易数",daliuren:"大六壬",qimen:"奇门遁甲",tarot:"塔罗",hepan:"合盘",chenggu:"称骨",almanac:"黄历",zeri:"择日",star:"星座",numerology:"生命数字",mbti:"十六型人格",trend:"人生 K 线",fengshui:"风水",name:"起名",convert:"公农历互转"},p=Object.freeze({bazi:["基本信息","四柱(日主/十神/藏干)","旺衰·格局·用神","合冲·神煞","起运·大运·流年","古籍依据"],ziwei:["基本信息","命宫/身宫与五行局","十二宫(主星/辅煞/四化)","格局与三方四正","大限/流年","古籍依据"],liuyao:["所问与用神","本卦/变卦(世应/动爻/六亲)","月建日辰(旺衰/空破)","应期线索","卦辞与依据"],meihua:["所问与体用","本卦/互卦/变卦","五行生克","应期与依据"],daliuren:["天地盘(月将/贵人)","四课","三传","课体与神将","依据"],qimen:["四柱与局数","九宫(星门神/天盘干)","用神落宫","门宫·干宫·十干克应","旺衰·击刑入墓","依据"],tarot:["问题与牌阵","逐牌(正逆/元素)","牌间关系","综合倾向","边界"],fengshui:["坐向与元运","运盘/山盘/向盘","旺山旺向","取象与边界"]}),C=Object.freeze(["基本信息","盘面事实","结构与关系","倾向","边界"]);function U(y){return p[y]||C}function te(y,N={}){const l=g[y&&y.system]||y&&y.system||"未知体系",o=String(N&&N.question||"").trim()||"请先用一句白话讲清这张盘的主线,再指出最值得注意的一两处,并说明每处的具体依据。",r=Number.isFinite(N&&N.maxChars)&&N.maxChars>=400?N.maxChars:3e3,c=String(y&&y.summary||"").trim(),u=c.length>r,S=u?`${c.slice(0,r)}…(摘要已截断)`:c,M=N&&typeof N.interpret=="object"&&N.interpret||y&&typeof y.interpret=="object"&&y.interpret||null,A=String(M&&M.answer||"").trim(),oe=String(M&&M.plain||"").trim(),ie=[];A&&ie.push(`直答:${A}`),oe&&ie.push(`说人话:${oe}`);const $e=["【命理追问】下面这张盘是命理插件刚排好的,请就着它回答我的问题;不用重新排盘,盘面字段已经够用。",`体系:${l}`,`所问:${o}`,"",...ie.length?["——开场结论(插件已按同一套规则算好,开场先沿用这句;措辞可改,口径别换)——",...ie,""]:[],"——盘面层次(从上到下读,别跳层)——",`${l}:${U(y&&y.system).join(" → ")}`,"先复述事实,再讲结构与时间;上一层没交代清楚,不要跳到下一层。","","——盘面摘要——",S||"(这张盘没有摘要字段,请先让我重新排一次。)","","——回答要求——","读者不懂命理。按下面的骨架答;任何一句他看不懂,就算没写完:",ie.length?"1) 开头一句结论:先沿用上面的「开场结论」,再用一句不用术语的话说清这张盘的主线——只读这一句也该有收获;":"1) 开头一句结论:不用术语,一句话说清这张盘的主线,只读这一句也该有收获;","2) 第二段只复述盘面骨架:按上面的层次用 2–4 行写事实(如四柱、格局、用神、大运),不掺倾向,让读者知道后面的判断从哪来;","3) 判断最多两条,按重要性排序,每条分四行写:"," 盘面|只引盘面已有的字(具体的柱、宫或爻、字段名),不掺解释;"," 白话|把上一行的术语当场翻成日常话——调候 / 化气 / 通关 / 空亡 / 争合 这类词必须落地,一个词只翻一次,不连续堆三个以上;"," 倾向|说「更可能……」,讲清它在现实里大概意味着什么,用概率语气;"," 边界|这条在什么情况下不成立;盘面没给的,直接写「这盘里看不出来」;","4) 收尾一句「如果只记一件事」:给一条能核对、能动手的观察点,并说明它出自上面哪条盘面依据;","5) 别把传统说法当成已证实的事实:不下绝对断言,也不用「肯定」「绝对」这类词,更不写「格局很好」「运程不顺」这种没有信息的空话。"].join(`
68
- `);return{text:$e,question:o,system:y&&y.system||"",label:l,chars:$e.length,truncated:u}}return{followup:m,READING_ORDERS:p,READING_ORDER_FALLBACK:C,readingOrderOf:U,askPrompt:te}})(),_.revise=(function(){const R=[{key:"ziwei",label:"紫微",re:/紫微|斗数/},{key:"bazi",label:"八字",re:/八字|四柱/},{key:"liuyao",label:"六爻",re:/六爻|摇卦/},{key:"qimen",label:"奇门",re:/奇门/},{key:"daliuren",label:"大六壬",re:/大六壬|六壬/},{key:"tarot",label:"塔罗",re:/塔罗|抽牌/},{key:"meihua",label:"梅花",re:/梅花/},{key:"hepan",label:"合盘",re:/合盘|合婚/},{key:"almanac",label:"黄历",re:/黄历|老黄历/},{key:"zeri",label:"择日",re:/择日|挑日子/},{key:"fengshui",label:"风水",re:/风水/},{key:"name",label:"起名",re:/起名|取名/},{key:"chenggu",label:"称骨",re:/称骨/},{key:"xiaoliuren",label:"小六壬",re:/小六壬/},{key:"star",label:"星座",re:/星座/},{key:"numerology",label:"生命数字",re:/生命数字|生命灵数/},{key:"mbti",label:"MBTI",re:/mbti|人格测试|十六型/i},{key:"trend",label:"人生 K 线",re:/k\s*线|人生曲线/i},{key:"convert",label:"公农历互转",re:/农历转公历|公历转农历|公农历/}],q=[{key:"love",label:"感情",re:/感情|婚姻|恋爱|对象|夫妻/},{key:"wealth",label:"财运",re:/财运|财富|赚钱|收入|破财/},{key:"career",label:"事业",re:/事业|工作|升职|跳槽/},{key:"health",label:"健康",re:/健康|身体|疾病|病/},{key:"study",label:"学业",re:/学业|考试|考研|升学|读书/},{key:"travel",label:"出行",re:/出行|搬家|迁移|旅行|外地/}],H=/换成|改成|改为|换到|改看|再看|再看一下|换一套|排一?张|用|按|看/,v=h=>String(h||"").replace(/(出生|出生地|所在地|人)$/,"").replace(/[的了].*$/,"").trim();function L(h){const m=String(h??"").trim(),g={},p=[],C=[];if(!m)return{text:"",patch:g,labels:p,ignored:C};if(H.test(m)){for(const y of R)if(y.re.test(m)){g.system=y.key,p.push({key:"system",label:"体系",value:y.key,display:y.label});break}}/女命|女性|换成女|改成女|女盘/.test(m)?(g.gender="female",p.push({key:"gender",label:"性别",value:"female",display:"女"})):/男命|男性|换成男|改成男|男盘/.test(m)&&(g.gender="male",p.push({key:"gender",label:"性别",value:"male",display:"男"})),/晚子时/.test(m)&&(/不换日|不换天|算当日|归当日|按当日|当天/.test(m)?(g.lateZi=!1,p.push({key:"lateZi",label:"晚子时",value:!1,display:"23:00 后仍算当日"})):/换日|算次日|归次日|按次日|第二天|次日/.test(m)&&(g.lateZi=!0,p.push({key:"lateZi",label:"晚子时",value:!0,display:"23:00 后算次日"}))),/真太阳时/.test(m)&&(/不用|不要|关闭|关掉|取消|不算/.test(m)?(g.trueSolar=!1,p.push({key:"trueSolar",label:"真太阳时",value:!1,display:"用东八区平太阳时"})):(g.trueSolar=!0,p.push({key:"trueSolar",label:"真太阳时",value:!0,display:"按出生地经度校正"}))),/夏令时/.test(m)&&(/不用|不要|关闭|关掉|取消|不校正/.test(m)?(g.dst=!1,p.push({key:"dst",label:"夏令时",value:!1,display:"不自动校正 1986–1991 夏令时"})):(g.dst=!0,p.push({key:"dst",label:"夏令时",value:!0,display:"自动校正 1986–1991 夏令时"})));const U=m.match(/出生在\s*([\u4e00-\u9fa5]{2,12})/)||m.match(/出生地(?:改成|改为|换成|换到|是|为)?\s*([\u4e00-\u9fa5]{2,12})/)||m.match(/改到\s*([\u4e00-\u9fa5]{2,12})\s*出生/);if(U){const y=v(U[1]);y.length>=2&&(g.address=y,p.push({key:"address",label:"出生地",value:y,display:y}))}const te=m.match(/(?:看|查|问|到|到了|临近)\s*((?:19|20)\d{2})\s*年/)||m.match(/((?:19|20)\d{2})\s*年(?:的)?(?:运势|怎么样|如何|会怎样|流年)/);if(te){const y=Number(te[1]);g.asOf=`${y}-01-01T00:00`,p.push({key:"asOf",label:"流年基准",value:g.asOf,display:`${y} 年`})}else/(出生|生年)/.test(m)&&/(19|20)\d{2}\s*年/.test(m)&&C.push("出生年份没改:一句话改不出日与时辰,请直接传 datetime(如 1993-04-08T06:20)");for(const y of q)if(y.re.test(m)){g.direction=y.key,p.push({key:"direction",label:"询问方向",value:y.key,display:y.label});break}return/解读|详解|详细说|说人话/.test(m)&&!/不要解读|不用解读|别解读/.test(m)&&(g.withInterpret=!0,p.push({key:"withInterpret",label:"解读",value:!0,display:"附解析与详解"})),{text:m,patch:g,labels:p,ignored:C}}const T=R,b=q;function G(h,m){if(m==null)return null;if(h==="system"){const g=R.find(p=>p.key===m);return g?g.label:String(m)}if(h==="gender")return m==="female"?"女":m==="male"?"男":String(m);if(h==="direction"){const g=q.find(p=>p.key===m);return g?g.label:String(m)}if(typeof m=="boolean")return m?"开":"关";if(h==="asOf"){const g=String(m).match(/^(\d{4})/);return g?`${g[1]} 年`:String(m)}return String(m)}return{parseRevision:L,REVISE_SYSTEMS:T,REVISE_DIRECTIONS:b,displayValue:G}})(),_.handle=(function(){const{fail:R}=_.fail||{},q="mc1.",H=new Set(["handle","trace","shadow","shadowVersion","diff","withInterpret","cross","verifyPast","rectify","events","ask","followup","question","geocode","caliber","revise"]),v=l=>l!==null&&typeof l=="object"&&!Array.isArray(l);function L(l){if(Array.isArray(l))return`[${l.map(o=>L(o===void 0?null:o)).join(",")}]`;if(v(l))return`{${Object.keys(l).filter(r=>l[r]!==void 0).sort().map(r=>`${JSON.stringify(r)}:${L(l[r])}`).join(",")}}`;const f=JSON.stringify(l===void 0?null:l);return f===void 0?"null":f}function T(l){let f=2166136261;for(let o=0;o<l.length;o++)f^=l.charCodeAt(o),f=Math.imul(f,16777619)>>>0;return f.toString(16).padStart(8,"0")}const b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function G(l){const f=[];for(const o of String(l)){let r=o.codePointAt(0);r<128?f.push(r):r<2048?f.push(192|r>>6,128|r&63):r<65536?f.push(224|r>>12,128|r>>6&63,128|r&63):f.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}return f}function h(l){let f="";for(let o=0;o<l.length;){const r=l[o];let c,u;r<128?(c=r,u=1):r<224?(c=r&31,u=2):r<240?(c=r&15,u=3):(c=r&7,u=4);for(let S=1;S<u;S++)c=c<<6|l[o+S]&63;o+=u,f+=String.fromCodePoint(c)}return f}function m(l){const f=G(l);let o="";for(let r=0;r<f.length;r+=3){const c=f[r],u=f[r+1],S=f[r+2];if(o+=b[c>>2],o+=b[(c&3)<<4|(u===void 0?0:u)>>4],u===void 0||(o+=b[(u&15)<<2|(S===void 0?0:S)>>6],S===void 0))break;o+=b[S&63]}return o}function g(l){const f=[];let o=0,r=0;for(const c of l){const u=b.indexOf(c);if(u<0)throw new Error(`不是 base64url 字符:${c}`);o=o<<6|u,r+=6,r>=8&&(r-=8,f.push(o>>r&255))}return h(f)}function p(l={}){const f={};for(const[o,r]of Object.entries(l||{}))H.has(o)||r===void 0||(f[o]=r);return f}function C(l={}){const f=p(l);if(!Object.keys(f).length)return"";const o=m(L(f));return`${q}${o}.${T(o)}`}function U(l){if(typeof l!="string"||!l.trim())throw R("E_HANDLE","handle 必须是非空字符串;没拿到句柄时照常传 system + datetime 等原始参数即可");const f=l.trim();if(!f.startsWith(q))throw R("E_HANDLE",`handle 前缀不对(应以 ${q} 开头):句柄来自旧版本或复制不全,重新排一次盘取新的 handle`);const o=f.slice(q.length),r=o.lastIndexOf(".");if(r<=0)throw R("E_HANDLE","handle 缺少校验位:复制时可能被截断,重新取一次");const c=o.slice(0,r),u=o.slice(r+1);if(T(c)!==u)throw R("E_HANDLE","handle 校验不通过:内容被改动或截断,重新排一次盘取新的 handle");let S;try{S=JSON.parse(g(c))}catch{throw R("E_HANDLE","handle 内容无法解析(不是本插件生成的句柄),重新排一次盘取新的 handle")}if(!v(S))throw R("E_HANDLE","handle 内容不是参数对象,重新排一次盘取新的 handle");return S}function te(l={}){if(!v(l))return l;const{handle:f,...o}=l;if(f==null||f==="")return{...o};const c={...U(f)};for(const[u,S]of Object.entries(o))S!==void 0&&(c[u]=S);return c}return{handlePayload:p,encodeHandle:C,decodeHandle:U,resolveHandle:te,HANDLE_PREFIX:q,handleChecksum:T}})(),_.bridge=(function(){const{encodeHandle:R,decodeHandle:q,HANDLE_PREFIX:H}=_.handle||{},{askPrompt:v}=_.followup||{},L=200,T=60,b={bazi:"八字",ziwei:"紫微",liuyao:"六爻",meihua:"梅花",daliuren:"大六壬",qimen:"奇门",hepan:"合盘",tarot:"塔罗",almanac:"黄历",zeri:"择日",chenggu:"称骨",xiaoliuren:"小六壬",star:"星座",numerology:"生命数字",mbti:"人格",trend:"人生K线",fengshui:"风水",name:"起名",convert:"农历"},G=f=>b[f]||f||"未知体系";function h(f){const o=String(f||""),r=o.indexOf("#");return r<0?o:o.slice(0,r)}function m(f){try{return encodeURIComponent(f)}catch{return""}}function g(f){try{return decodeURIComponent(f)}catch{return String(f||"")}}function p(f={},o={}){const r=o||{},u=String(r.handle||f&&f.handle||"").trim()||R(f||{});if(!u||!u.startsWith(H))return"";const S=String(r.question||"").trim().slice(0,L),M=[`mp=${u}`];return S&&M.push(`q=${m(S)}`),`${h(r.base)}#${M.join("&")}`}function C(f){const o=String(f||"").trim();if(!o)return{ok:!1,code:"E_LINK",message:"没有链接内容:请粘贴带 #mp= 的完整链接"};let r="";const c=o.indexOf("#");if(c>=0&&o.slice(c+1).trim())r=o.slice(c+1).trim();else{const A=o.indexOf("?");A>=0&&o.slice(A+1).trim()?r=o.slice(A+1).trim():/^mp=/.test(o)&&(r=o)}if(!r)return{ok:!1,code:"E_LINK",message:"链接里没有 #mp= 片段:这不是本插件生成的深链"};const u={};for(const A of r.split("&")){if(!A)continue;const oe=A.indexOf("=");if(oe<=0)continue;const ie=A.slice(0,oe),de=A.slice(oe+1);ie==="mp"?u.mp=de:ie==="q"&&(u.q=de)}if(!u.mp)return{ok:!1,code:"E_LINK",message:"链接里没有 mp 参数(只有问题没有盘):无法还原盘面"};let S;try{S=q(u.mp)}catch(A){return{ok:!1,code:A&&A.code||"E_HANDLE",message:A&&A.message||"句柄无法解析"}}const M=u.q?g(u.q).slice(0,L):"";return{ok:!0,handle:u.mp,args:S,question:M,system:S.system||"",label:G(S.system)}}const U=f=>{const o=/^(\d{4}-\d{1,2}-\d{1,2})[T ](\d{1,2}:\d{2})/.exec(String(f||"").trim());if(!o)return{date:"",time:""};const[r,c,u]=o[1].split("-");return{date:`${r}-${String(c).padStart(2,"0")}-${String(u).padStart(2,"0")}`,time:o[2].padStart(5,"0")}},te=["gender","address","trueSolar","lateZi","lines"];function y(f){const o=f&&f.ok?f:null,r=o&&o.args||{},c=U(r.datetime),u={tab:r.system||"",date:c.date,time:c.time,question:o&&o.question||"",restored:[],rest:{}};u.tab&&u.restored.push("system"),c.date&&u.restored.push("datetime");for(const S of te)r[S]===void 0||r[S]===null||(u[S]=r[S],u.restored.push(S));u.question&&u.restored.push("question");for(const[S,M]of Object.entries(r))S==="system"||S==="datetime"||te.includes(S)||(u.rest[S]=M);return u}function N(f){const o=Object.keys(f&&f.rest||{});return o.length?`链接里还有 ${o.length} 项没填回表单(${o.join("、")}):这些只在引擎调用里生效,页面上按默认值显示。`:""}function l(f,o={}){const r=o||{},c=f||{},u=c.system||"",S=G(u),M=String(r.question||"").trim(),A=String(c.handle||"").trim();let oe="";try{const we=v(c,{question:M,interpret:r.interpret});oe=we&&we.text||String(c.summary||"")}catch{oe=String(c.summary||"")}const ie=M?M.length>T?`${M.slice(0,T)}…`:M:"(未填问题:按摘要讲主线)",de=A?`【命理追问】${S}|${A}|问:${ie}`:`【命理追问】${S}|问:${ie}`,$e={};A&&($e.handle=A),u&&($e.system=u),M&&($e.question=M);const Ne=JSON.stringify({tool:"metaphysics",v:1,args:$e},null,2),ge=A?p({handle:A},{question:M,base:r.base}):"";return{system:u,label:S,handle:A,question:M,full:oe,brief:de,structured:Ne,link:ge}}return{LINK_MAX_QUESTION:L,askLink:p,parseAskLink:C,formOf:y,restNote:N,askPackages:l}})(),_.index=(function(){const{buildBazi:R}=_.bazi||{},{buildLiuyao:q,tossLines:H,bodyLabels:v,yongshenOf:L,yongshenStrength:T,fushenAccess:b,hexagramStrength:G,jinTuiPower:h,yingqiWindow:m}=_.liuyao||{},{buildZiwei:g,BRIGHTNESS:p,flowOf:C,asOfParts:U,ZIWEI_SCHOOL_DEFAULTS:te}=_.ziwei||{},{drawTarot:y}=_.tarot||{},{buildMeihua:N}=_.meihua||{},{buildDaliuren:l}=_.daliuren||{},{buildHepan:f,tripleOf:o}=_.hepan||{},{buildZiweiHepan:r}=_["ziwei-hepan"]||{},{buildQimen:c,buildSnapshot:u}=_.qimen||{},{geocodeAddress:S,resolveAddress:M}=_.geo||{},{toJDN:A,ganzhiName:oe,dayGanzhiIndex:ie}=_.calendar||{},{randomOf:de,isSeed:$e}=_.random||{},{encodeHandle:Ne,decodeHandle:ge,resolveHandle:we}=_.handle||{},{askLink:Me,parseAskLink:Pe,formOf:_e,restNote:ze,askPackages:I}=_.bridge||{},{parseRevision:D,displayValue:O}=_.revise||{},{interpret:Q,DIRECTIONS:K,DIRECTION_DEFAULT:re}=_.interpret||{},{followup:he,askPrompt:pe}=_.followup||{},{crossCheck:xe,crossText:Ze,crossSection:Re}=_.crosscheck||{},{pastSignals:De,verifyFit:qe}=_.verify||{},{rectifyBirth:Be}=_.rectify||{},{buildAlmanac:en}=_.almanac||{},{buildZeri:Ge}=_.zeri||{},{buildChenggu:Ye}=_.chenggu||{},{buildXiaoliuren:Je}=_.xiaoliuren||{},{buildStar:Xe}=_.star||{},{buildNumerology:We}=_.numerology||{},{buildMbti:nn,mbtiPaper:tn}=_.mbti||{},{buildConvert:He}=_.convert||{},{classicsFor:an,classicsText:on,suiyunClassicOf:sn,classicOf:Ke,CLASSIC_BOOKS:Fe}=_.classics||{},{diffObjects:rn,summarize:ln,sortDiffs:cn,labelOf:s,rootOf:k,categoryOf:E,formatValue:x,CALIBER_SWITCHES:Y,viewRows:F}=_.diff||{},{canonicalJson:Z,fingerprintOf:W}=_.fingerprint||{},{buildTrend:P}=_.trend||{},{buildFengshui:se}=_.fengshui||{},{buildName:ue}=_.name||{},{buildTrace:fe,traceMarkdown:le,SYSTEM_LABEL:ce}=_.trace||{},{fail:B}=_.fail||{},{assertCivil:Se}=_.validate||{},Oe=e=>String(e).padStart(2,"0"),ve=["male","female"];function ke(e,t){return t===2?e%4===0&&e%100!==0||e%400===0?29:28:[31,28,31,30,31,30,31,31,30,31,30,31][t-1]}function ye(e,t=""){if(ve.includes(e))return e;const a=e==null||e===""?"(未提供)":`「${e}」`;throw B("E_INPUT",`${t?t+"的":""}gender 必须是 male 或 female${a};性别决定大运/大限顺逆,不能靠默认值`)}const Ce=["brightnessSchool","gengYearSihua","tianmaSchool","tiankongSchool","jiekongSchool","kuiyueSchool","tianshiTianshang","changshengSchool","lateZishi","shenzhuSchool"];function Ue(e){const t={};for(const a of Ce)e[a]!==void 0&&(t[a]=e[a]);return e.schools&&typeof e.schools=="object"&&(t.schools=e.schools),t}function ne(e){if(typeof e!="string"||!e.trim())throw B("E_INPUT","缺少 datetime(公历日期时间),例如 1990-05-12T14:30");const t=e.trim().match(/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s](\d{1,2}):(\d{1,2})(?::(\d{1,2}))?)?$/);if(!t)throw B("E_INPUT",`无法解析 datetime:「${e}」,请用 1990-05-12T14:30 这种格式`);const a={year:Number(t[1]),month:Number(t[2]),day:Number(t[3]),hour:Number(t[4]??0),minute:Number(t[5]??0)};if(a.month<1||a.month>12)throw B("E_INPUT",`月份超出范围:${a.month}`);const n=ke(a.year,a.month);if(a.day<1||a.day>n)throw B("E_INPUT",`日期不存在:${a.year}-${a.month}-${a.day}(${a.year} 年 ${a.month} 月只有 ${n} 天)`);if(a.hour>23||a.minute>59)throw B("E_INPUT",`时间超出范围:${a.hour}:${a.minute}`);if(a.year<1600||a.year>2400)throw B("E_RANGE",`年份 ${a.year} 超出可计算范围(1600–2400)`);return(a.year<1900||a.year>2100)&&(a.precision={level:"approx",note:`ΔT 模型仅覆盖 1900–2100,${a.year} 年按端点值外推,节气与朔望时刻可能有分钟级偏差,月柱在交节前后需复核`}),a}function Te(e){const t=e.pillars,a=(ee,be)=>`${ee}:${be.ganzhi} ${be.stemTenGod?`十神 ${be.stemTenGod} `:""}藏干 ${be.hidden.map(Le=>`${Le.stem}(${Le.tenGod})`).join(" ")} 纳音 ${be.nayin} 地势 ${be.dishi} 自坐 ${be.zizuo} 空亡 ${be.kongwang.join("")}`+(be.shensha&&be.shensha.length?` 神煞 ${be.shensha.join("、")}`:""),n=Object.entries(e.wuxing).map(([ee,be])=>`${ee}${be}`).join(" "),i=e.palaces?`【胎元】${e.palaces.taiyuan.ganzhi} 胎息 ${e.palaces.taixi?e.palaces.taixi.ganzhi:"—"} 命宫 ${e.palaces.minggong.ganzhi} 身宫 ${e.palaces.shengong.ganzhi}`:"",d=e.dayun.list.slice(0,8).map(ee=>`${ee.startAge}岁 ${ee.ganzhi}(${ee.stemTenGod})${ee.luck?`·${ee.luck.tier}`:""}${ee.relations&&ee.relations.length?`[${ee.relations.join("")}]`:""}`).join(" "),$=e.dayun.jiao&&e.dayun.jiao.at?`;交运 ${e.dayun.jiao.at}(${e.dayun.jiao.frame},距${e.dayun.jiao.from.name} ${e.dayun.jiao.spanDays} 天,三日折一年)`:"",j=e.jieqi.nearBoundaryMinutes<20?`
69
- ⚠ 出生时刻距「节」仅 ${e.jieqi.nearBoundaryMinutes} 分钟,而节气时刻本身有最多约 14 分钟的偏差,月柱与年柱建议人工复核。`:"",X={year:"年",month:"月",day:"日",hour:"时"},ae=e.shensha&&e.shensha.groups&&e.shensha.groups.length?`神煞(${e.shensha.count} 见):`+e.shensha.groups.map(ee=>`${ee.cat}|`+ee.items.map(be=>`${be.name}(${be.pillars.map(Le=>X[Le]).join("")})`).join("、")).join(";"):"神煞:—",z=e.renyuan,V=Ke("smt-renyuan"),w=z?`人元:${z.month}月第${z.day}日,${z.active}${z.activeElement}司权(${z.segments.map(ee=>`${ee.stem}${ee.from}–${ee.to}`).join(" ")})${z.beyond?";已过 30 日表,按本气算":""}${V?`|原文见《${Fe[V.book].name}·${V.chapter}》`:""}`:"",J=e.frame&&e.frame.yongshen&&e.frame.yongshen.disputed||[],je=J.length?` 有争议:${J.map(ee=>`${ee.element}(${ee.favorRole};${ee.climate}盘调候忌${ee.element})`).join("、")}`:"",Ie=new Set(J.map(ee=>ee.element)),me=e.frame&&e.frame.yongshen&&e.frame.yongshen.neutral||[],Ee=me.length?` 中性偏忌:${me.map(ee=>`${ee.element} ${ee.weight} 分`).join("、")}(近零,不作实忌)`:"",Ve=e.frame?[`格局:${e.frame.primary?`${e.frame.primary.name}(${e.frame.primary.evidence})`:"—"}`,`   ${e.frame.geju.map(ee=>`${ee.name}[${ee.kind}${ee.status?`·${ee.status}`:""}]`).join(" ")}`,`用神:喜${e.frame.yongshen.favor.join("")}(${e.frame.yongshen.favorTenGods.join("、")}) 忌${e.frame.yongshen.avoid.join("")}(${e.frame.yongshen.avoidTenGods.join("、")})${je}${Ee} ${e.frame.yongshen.method}`,`   ${e.frame.yongshen.detail}`,`寒暖:${e.climate?`${e.climate.label}(${(e.climate.evidence||[]).join("、")})${e.climate.need?` 调候取${e.climate.need.stem}${e.climate.need.element} 忌${e.climate.avoidElement}${Ie.has(e.climate.avoidElement)?"(有争议)":""}`:""}`:"—"}`+(e.frame.yongshen.qt?` 穷通:${e.frame.yongshen.qt.month}${e.frame.yongshen.qt.stem}取${e.frame.yongshen.qt.yong.join("、")}(首取${e.frame.yongshen.qt.primary})`:""),`十神权重:${Object.entries(e.frame.godStats.groups).map(([ee,be])=>`${ee}${be}`).join(" ")}`]:[];return[`【四柱】${t.year.ganzhi} ${t.month.ganzhi} ${t.day.ganzhi} ${t.hour.ganzhi}`,`日主:${e.dayMaster.stem}${e.dayMaster.element}(${e.dayMaster.yinYang}) 空亡:${e.kongwang.join("")}`,a("年柱",t.year),a("月柱",t.month),a("日柱",t.day),a("时柱",t.hour),`五行:${n}`,...i?[i]:[],`日主强弱:${e.strength.level}(${e.strength.score}) ${e.strength.detail}`,...Ve,`天干关系:${e.relations&&e.relations.stems.length?e.relations.stems.join(" "):"—"}`,`地支关系:${e.relations&&e.relations.branches.length?e.relations.branches.join(" "):"—"}`,ae,`真太阳时:${e.solarTime.trueSolarText}(${e.input.geo?e.input.geo.note+";":""}${e.solarTime.note}) 晚子时:${e.input.lateZi?"23:00 后算次日":"23:00 后仍算当日"}`,`节气:上一节 ${e.jieqi.previous.name} ${e.jieqi.previous.time} 下一节 ${e.jieqi.next.name} ${e.jieqi.next.time}`,...w?[w]:[],`大运:${e.dayun.rule}(${e.dayun.direction}),${e.dayun.startAge.years}岁${e.dayun.startAge.months}个月起运${$}`,` ${d}`,`流年:${e.liunian.slice(0,10).map(ee=>`${ee.year}${ee.ganzhi}(${ee.stemTenGod})${ee.luck?`·${ee.luck.tier}`:""}`).join(" ")}`,(()=>{const ee=e.liunian.filter(Ae=>Ae.suiyun&&Ae.suiyun.signals&&Ae.suiyun.signals.length);if(!ee.length)return"岁运提示:近十年无岁运并临、运年反吟或大运/流年伏吟、反吟(只标干支,不判吉凶)";const be=Ae=>`${Ae.type}${(Ae.type.startsWith("流年")||Ae.type.startsWith("大运"))&&Ae.target?`(${Ae.target})`:""}`,Le=sn(e),et=Le?`|古籍见《${Fe[Le.book].name}·${Le.chapter}》`:"";return"岁运提示(只标干支变动,不判吉凶):"+ee.map(Ae=>`${Ae.year}${Ae.ganzhi} ${Ae.suiyun.signals.map(be).join("/")}`).join(";")+et})(),"(格局、用神、行运吉凶为扶抑+简化调候的量化提示,非断语。)"].join(`
67
+ `))for(const C of p.split(";")){const U=C.trim().split(/\s+/);if(U.length!==3)continue;const[te,y,N]=U;g[te]={lon:Number(y),lat:Number(N)}}for(const[p,[C,U]]of Object.entries(H))g[p]||(g[p]={lon:C,lat:U});return g})(),L=/(省|市|地区|盟|自治州|自治县|自治区|特别行政区|县|区|镇|乡|街道|村|小区|社区)/g;function T(g){const p=String(g||"").trim();if(!p)return null;const C=Number(p);if(Number.isFinite(C)&&/^-?\d+(\.\d+)?$/.test(p)&&C>=60&&C<=150)return{lon:C,lat:null,matched:`${C}°E`,level:"经度",note:"按你输入的经度计算"};const U=p.replace(/\s/g,"").replace(L,""),te=Object.keys(v).sort((N,l)=>l.length-N.length);for(const N of te)if(U.includes(N)){const l=v[N];return{lon:l.lon,lat:l.lat,matched:N,level:"地级市",note:`按 ${N} 估算(约 ${l.lon}°E)`}}const y=p.replace(/\s/g,"");for(const[N,l]of Object.entries(q)){const f=y.indexOf(N);if(f<0)continue;const o=y.charAt(f+N.length);if(o==="区"||o==="县")continue;const r=v[l]||{lon:H[l][0],lat:H[l][1]};return{lon:r.lon,lat:r.lat,matched:l,level:"省会",note:`未匹配到具体城市,按 ${N} 省会 ${l} 估算(约 ${r.lon}°E)`}}return{lon:null,lat:null,matched:null,level:"未匹配",note:`没查到「${p}」,可改填经度(如 116.4)`}}const b=/(区|县|镇|乡|村|小区|街道|路|号|巷|弄|组|队)/,G="dsh-metaphysics/0.23.0 (+https://github.com/xuanfu-web/dsh-metaphysics)";async function h(g,{timeoutMs:p=2500}={}){if(typeof fetch!="function")return null;let C=null;try{const U=typeof AbortController=="function"?new AbortController:null;U&&(C=setTimeout(()=>U.abort(),p));const te="https://nominatim.openstreetmap.org/search?format=jsonv2&limit=1&accept-language=zh-CN&countrycodes=cn&q="+encodeURIComponent(g),y=await fetch(te,{signal:U?U.signal:void 0,headers:{"User-Agent":G}});if(!y||!y.ok)return null;const N=await y.json();if(!Array.isArray(N)||N.length===0)return null;const l=N[0],f=Number(l.lon),o=Number(l.lat);return Number.isFinite(f)?{lon:f,lat:o,matched:l.display_name,level:"在线",note:`在线解析:${l.display_name}`}:null}catch{return null}finally{C&&clearTimeout(C)}}async function m(g,p={}){const C=T(g),U=String(g||"").trim();if(!U||!(p.online===!0)||C&&typeof C.lon=="number"&&!b.test(U))return C;const y=await h(U,p);return y?{...y,local:C&&C.lon!=null?C:null}:C&&typeof C.lon=="number"?{...C,onlineFailed:!0,note:`${C.note}(联网解析失败或超时,已退回内置坐标表)`}:{...C,onlineFailed:!0}}return{CITIES:v,PROVINCES:q,resolveAddress:T,geocodeAddress:m}})(),I.random=(function(){function R(v){let L=Number(v)>>>0;return L||(L=2654435769),function(){L=L+1831565813>>>0;let b=L;return b=Math.imul(b^b>>>15,b|1),b^=b+Math.imul(b^b>>>7,b|61),((b^b>>>14)>>>0)/4294967296}}function q(v){if(v==null||v==="")return Math.random;const L=Number(v);return Number.isFinite(L)?R(L):Math.random}function H(v){return v==null||v===""?!0:Number.isFinite(Number(v))}return{mulberry32:R,randomOf:q,isSeed:H}})(),I.dst=(function(){const{daysInMonth:R}=I.validate||{},q={1986:["1986-05-04","1986-09-14"],1987:["1987-04-12","1987-09-13"],1988:["1988-04-10","1988-09-11"],1989:["1989-04-16","1989-09-17"],1990:["1990-04-15","1990-09-16"],1991:["1991-04-14","1991-09-15"]},H=(b,G,h)=>b*1e4+G*100+h;function v(b){const G=q[b.year];if(!G)return!1;const[h,m,g]=G[0].split("-").map(Number),[p,C,U]=G[1].split("-").map(Number),te=H(b.year,b.month,b.day);if(te<H(h,m,g)||te>H(p,C,U))return!1;const y=b.hour*60+(b.minute||0);return!(te===H(h,m,g)&&y<120||te===H(p,C,U)&&y>=120)}function L(b){const G=b.minute||0;if(!v(b))return{year:b.year,month:b.month,day:b.day,hour:b.hour,minute:G,applied:!1,note:null};let{year:h,month:m,day:g,hour:p}=b;return p-=1,p<0&&(p+=24,g-=1,g<1&&(m-=1,m<1&&(m=12,h-=1),g=R(h,m))),{year:h,month:m,day:g,hour:p,minute:G,applied:!0,note:`检出自 ${q[b.year][0]} 至 ${q[b.year][1]} 的中国夏令时:出生钟面时间已减 1 小时校正`}}function T(b,G){const h=Array.isArray(b)?b.slice():[];return G&&G.applied&&G.note&&h.push(G.note),h}return{DST_SPANS:q,inDstSpan:v,applyDst:L,withDstNote:T}})(),I.fengshui=(function(){const{partsToJd:R,termInstantJd:q,toJDN:H,dayGanzhiIndex:v,ganzhiName:L,termWindow:T,previousJie:b,BRANCHES:G}=I.calendar||{},{applyDst:h}=I.dst||{},{fail:m}=I.fail||{},g={1:{name:"一白",color:"白",element:"水",star:"贪狼",lucky:!0},2:{name:"二黑",color:"黑",element:"土",star:"巨门",lucky:!1},3:{name:"三碧",color:"碧",element:"木",star:"禄存",lucky:!1},4:{name:"四绿",color:"绿",element:"木",star:"文曲",lucky:!0},5:{name:"五黄",color:"黄",element:"土",star:"廉贞",lucky:!1},6:{name:"六白",color:"白",element:"金",star:"武曲",lucky:!0},7:{name:"七赤",color:"赤",element:"金",star:"破军",lucky:!1},8:{name:"八白",color:"白",element:"土",star:"左辅",lucky:!0},9:{name:"九紫",color:"紫",element:"火",star:"右弼",lucky:!0}},p={坎:"正北",艮:"东北",震:"正东",巽:"东南",离:"正南",坤:"西南",兑:"正西",乾:"西北"},C=["坎","艮","震","巽","离","坤","兑","乾"],U={乾:["六煞","天医","五鬼","祸害","绝命","延年","生气"],坎:["五鬼","天医","生气","延年","绝命","祸害","六煞"],艮:["六煞","绝命","祸害","生气","延年","天医","五鬼"],震:["延年","生气","祸害","绝命","五鬼","天医","六煞"],巽:["天医","五鬼","六煞","祸害","生气","绝命","延年"],离:["六煞","五鬼","绝命","延年","祸害","生气","天医"],坤:["天医","延年","绝命","生气","祸害","五鬼","六煞"],兑:["生气","祸害","延年","绝命","六煞","五鬼","天医"]},te=["生气","延年","天医","伏位"],y=["绝命","五鬼","六煞","祸害"],N=[{m:"壬",gua:"坎",deg:345},{m:"子",gua:"坎",deg:0},{m:"癸",gua:"坎",deg:15},{m:"丑",gua:"艮",deg:30},{m:"艮",gua:"艮",deg:45},{m:"寅",gua:"艮",deg:60},{m:"甲",gua:"震",deg:75},{m:"卯",gua:"震",deg:90},{m:"乙",gua:"震",deg:105},{m:"辰",gua:"巽",deg:120},{m:"巽",gua:"巽",deg:135},{m:"巳",gua:"巽",deg:150},{m:"丙",gua:"离",deg:165},{m:"午",gua:"离",deg:180},{m:"丁",gua:"离",deg:195},{m:"未",gua:"坤",deg:210},{m:"坤",gua:"坤",deg:225},{m:"申",gua:"坤",deg:240},{m:"庚",gua:"兑",deg:255},{m:"酉",gua:"兑",deg:270},{m:"辛",gua:"兑",deg:285},{m:"戌",gua:"乾",deg:300},{m:"乾",gua:"乾",deg:315},{m:"亥",gua:"乾",deg:330}],l=new Map(N.map((s,k)=>[s.m,k]));function f(s){const k=l.get(s);if(k===void 0)throw m("E_INPUT",`坐向必须是 24 山之一(${N.map(E=>E.m).join("")}),收到「${s}」——请按罗盘 24 山报坐或报向,不要自造方位词。`);return{...N[k],index:k}}function o(s){const E=(f(s).index+12)%24;return{...N[E],index:E}}const r=s=>["坎","离","震","巽"].includes(s)?"东四":"西四",c={生气:"大吉:最宜开门、主卧、灶口朝向",延年:"大吉:宜开门、主卧(利感情与人缘)",天医:"次吉:宜主卧、书房、老人房(利健康)",伏位:"次吉:宜卧室、神位(主平稳)",祸害:"小凶:宜厕所、储物间(宜静不宜动)",六煞:"次凶:宜厕所、储物间",五鬼:"大凶:宜厕所,或以灶坐压之(传统「火烧五鬼」说)",绝命:"最凶:宜灶坐压之、储物,忌门床"},u=["坎","坤","震","巽","中","乾","兑","艮","离"];function S(s,k){const E=(s%100+100)%100,x=s>=2e3?{male:99,female:3}:{male:100,female:4},Y=W=>{const P=(W%9+9)%9;return P===0?9:P};let F=Y(k==="male"?x.male-E:E-x.female);F===5&&(F=k==="male"?2:8);const Z=u[F-1];if(Z==="中")throw new Error("命卦计算异常:落中宫");return{num:F,gua:Z,direction:p[Z]}}function M(s){const k={伏位:{palace:s,direction:p[s]}},E=C.indexOf(s);for(let x=1;x<=7;x++){const Y=C[(E+x)%8];k[U[s][x-1]]={palace:Y,direction:p[Y]}}return k}function A(s,k,E){return R({year:s,month:k,day:E,hour:12,minute:0})<q(s,2)?s-1:s}function oe(s){const k=(1+(2026-s))%9;return k<=0?k+9:k}const ie=["坎","坤","震","巽","中","乾","兑","艮","离"],de=s=>{const k=(s%9+9)%9;return k===0?9:k};function $e(s,k=!0){const E=[];for(const x of ie){const Y=ie.indexOf(x)+1,F=de(Y-5+s),Z=g[F];E.push({palace:x,direction:x==="中"?"中宫":p[x],num:F,name:Z.name,star:Z.star,element:Z.element,lucky:Z.lucky})}return{center:s,centerName:g[s].name,forward:k,fly:k?"顺飞":"逆飞",palaces:E}}function Ne(s){return $e(oe(s),!0)}const ge={立春:1,惊蛰:2,清明:3,立夏:4,芒种:5,小暑:6,立秋:7,白露:8,寒露:9,立冬:10,大雪:11,小寒:12},we={四正:8,四墓:5,四生:2},Me={四正:1,四墓:7,四生:4},Pe={四正:9,四墓:3,四生:6},_e=s=>["子","午","卯","酉"].includes(s)?"四正":["辰","戌","丑","未"].includes(s)?"四墓":"四生",ze=s=>L(((s-4)%60+60)%60).branch;function _(s,k,E){let x=null;for(const Y of s){if(Y.jd>E)break;Y.name===k&&(x=Y)}return x}function D(s,k){const E=_(s,"冬至",k),x=_(s,"夏至",k);if(!!E&&(!x||E.jd>x.jd)){const W=_(s,"谷雨",k),P=_(s,"雨水",k);return W&&E&&W.jd>E.jd?{half:"阳遁",segment:"谷雨–夏至(下元)",offset:3,boundary:"冬至后阳遁,谷雨至上元转下元"}:P&&E&&P.jd>E.jd?{half:"阳遁",segment:"雨水–谷雨(中元)",offset:6,boundary:"冬至后阳遁,雨水至上元转中元"}:{half:"阳遁",segment:"冬至–雨水(上元)",offset:0,boundary:"冬至后阳遁上元"}}const F=_(s,"霜降",k),Z=_(s,"处暑",k);return F&&x&&F.jd>x.jd?{half:"阴遁",segment:"霜降–冬至(下元)",offset:3,boundary:"夏至后阴遁,霜降至上元转下元"}:Z&&x&&Z.jd>x.jd?{half:"阴遁",segment:"处暑–霜降(中元)",offset:6,boundary:"夏至后阴遁,处暑至上元转中元"}:{half:"阴遁",segment:"夏至–处暑(上元)",offset:0,boundary:"夏至后阴遁上元"}}function O(s){const k=Number(s.year),E=Number(s.month),x=Number(s.day),Y=Number.isInteger(s.hour)?s.hour:12,F=Number.isInteger(s.minute)?s.minute:0,Z=R({year:k,month:E,day:x,hour:Y,minute:F}),W=T(k),P=A(k,E,x),se=ze(P),ue=_e(se),fe=b(W,Z),le=ge[fe?fe.name:"立春"]||1,ce=D(W,Z),B=H(k,E,x)+(Y>=23?1:0),Se=v(B),Oe=L(Se).name,ve=L(Se).branch,ke=_e(ve),ye=Math.floor((Y+1)%24/2),Ce=oe(P),Ue=de(we[ue]-(le-1)),ne=de(Se+1+ce.offset),Te=ce.half==="阳遁"?ne:de(10-ne),fn=ce.half==="阳遁"?Me[ke]:Pe[ke],un=de(fn+(ce.half==="阳遁"?ye:-ye));return{year:{...$e(Ce,!0),basis:`${P} 年(立春界)年星 ${g[Ce].name} 入中顺飞`},month:{...$e(Ue,!0),basis:`${se}年(${ue})${fe?fe.name:"立春"}月,${le} 月 ${g[Ue].name} 入中顺飞`},day:{...$e(Te,ce.half==="阳遁"),basis:`${ce.half}·${ce.segment},${Oe}日第 ${Se+1} 位,${g[Te].name} 入中${ce.half==="阳遁"?"顺":"逆"}飞`},hour:{...$e(un,ce.half==="阳遁"),basis:`${ce.half}·${ce.segment},${ke}日 ${G[ye]}时,${g[un].name} 入中${ce.half==="阳遁"?"顺":"逆"}飞`},meta:{guaYear:P,yearBranch:se,yearGroup:ue,monthNum:le,monthJie:fe?fe.name:"立春",dayGanzhi:Oe,daySeq:Se+1,dayGroup:ke,hourBranch:G[ye],half:ce.half,segment:ce.segment,boundary:ce.boundary,note:"月按节气月(寅月为正月);日按公历日、23:00 后归次日;日/时星入中后的顺逆取「冬至顺、夏至逆」。另有「一律顺飞」与「月按农历月」派,本插件不合并,差异见本注。"}}}const Q=s=>String(s).padStart(2,"0");function K(s){const k=Math.floor((s-1864)/20),E=(k%9+9)%9+1,x=1864+20*k;return{period:E,start:x,end:x+19,label:`${E}运(${x}–${x+19})`}}const re=new Set(["乾","巽","艮","坤","甲","庚","壬","丙","寅","申","巳","亥"]),he=["地元","天元","人元"],pe={};N.forEach((s,k)=>{pe[s.m]={...s,yuan:he[k%3],yinYang:re.has(s.m)?"阳":"阴"}});const xe=["中","乾","兑","艮","离","坎","坤","震","巽"],Ze=["坎","坤","震","巽","中","乾","兑","艮","离"],Re={地元:0,天元:1,人元:2},De=s=>N.filter(k=>k.gua===s).map(k=>pe[k.m]);function qe(s,k){const E={};for(let x=0;x<9;x++){const Y=((s-1+(k?x:-x))%9+9)%9+1;E[xe[x]]=Y}return E}function Be(s,k){if(k===5)return{forward:s.yinYang==="阳",basis:`五黄入中,按${s.m}本山${s.yuan}${s.yinYang}论`};const E=Ze[k-1],x=De(E)[Re[s.yuan]];return{forward:x.yinYang==="阳",basis:`${k}${E}宫取${s.yuan}${x.m}(${x.yinYang})`}}const en="《沈氏玄空学》坤壬乙诀(子癸甲申一白、壬卯乙未坤二黑、乾亥辰巽巳戌六白、酉辛丑艮丙七赤、寅午庚丁九紫)",Ge=Object.freeze({子:1,癸:1,甲:1,申:1,壬:2,卯:2,乙:2,未:2,坤:2,乾:6,亥:6,辰:6,巽:6,巳:6,戌:6,酉:7,辛:7,丑:7,艮:7,丙:7,寅:9,午:9,庚:9,丁:9}),Ye=4.5;function Je(s,k=0){const E=Number(k)||0;if(Math.abs(E)<=Ye)return{active:!1,offset:E,threshold:Ye,sitting:s.m,jian:null,kind:null,sameYinYang:null,note:`坐山偏离中心 ${E}°,未超 ${Ye}°,按正向下卦排盘。`};const x=N.findIndex(P=>P.m===s.m),Y=N[(x+(E>0?1:-1)+24)%24],F=pe[s.m],Z=pe[Y.m],W=Y.gua===s.gua;return{active:!0,offset:E,threshold:Ye,sitting:s.m,jian:Y.m,side:E>0?"右":"左",kind:W?"同卦兼":"出卦兼",sameYinYang:Z.yinYang===F.yinYang,note:`坐山偏离中心 ${E}°,兼${Y.m}(${W?"同卦兼":"出卦兼"}${W&&Z.yinYang===F.yinYang?",同阴同阳":""});按沈氏替卦,山星以 ${Ge[s.m]} 入中。`}}const Xe={1:[],2:[["乾","巽"],["亥","巳"],["丑","未"]],3:[["卯","酉"],["乙","辛"],["辰","戌"]],4:[["艮","坤"],["寅","申"],["甲","庚"]],5:[["子","午"],["癸","丁"],["卯","酉"],["乙","辛"],["丑","未"],["辰","戌"]],6:[["艮","坤"],["寅","申"],["甲","庚"]],7:[["卯","酉"],["乙","辛"],["辰","戌"]],8:[["乾","巽"],["亥","巳"],["丑","未"]],9:[]},We=["三元九运(1864 年起一运、每运 20 年,九运 180 年一轮)","玄空下卦挨星(运盘顺飞;山盘/向盘以入中运星本宫同元龙阴阳定顺逆,五黄入中按本山阴阳)","兼向替卦:坐山偏离中心超 4.5° 用《沈氏玄空学》坤壬乙诀替星入中,顺逆按替星本宫同元龙","年月日时紫白(公式派:年逐年退一位;月按年支三组起 8/5/2;日按冬至夏至三段起 1/7/4 与 9/3/6;时按日支三组子时起 1/7/4 与 9/3/6)","二十四山旺山旺向通行表(每项含正反两向;一运、九运无局;只对正向下卦)"],nn="玄空排盘为传统通行口径的本地计算,属民俗参考,不构成现场勘舆结论,仅供娱乐;兼向超 4.5° 按沈氏替卦,年月日时紫白按公式派;各家另有异说,形峦与现场勘舆不在本工具范围内。";function tn(s,k,E,x={}){const Y=pe[k],F=pe[E],Z=Number(x.offset)||0,W=Je(Y,Z),P=qe(s,!0),se=W.active?Ge[Y.m]:P[Y.gua],ue=W.active?Ge[F.m]:P[F.gua],fe=Be(Y,se),le=Be(F,ue),ce=qe(se,fe.forward),B=qe(ue,le.forward),Se=ie.map((ne,Te)=>({palace:ne,direction:ne==="中"?"中宫":p[ne],luoshu:Te+1,yun:P[ne],shan:ce[ne],xiang:B[ne]})),Oe=ne=>ie.filter(Te=>ne[Te]===s),ve=Xe[s],ke=ve.find(([ne,Te])=>Y.m===ne&&F.m===Te||Y.m===Te&&F.m===ne),ye=ce[Y.gua]===s&&B[F.gua]===s,Ce={shan:W.active&&se!==P[Y.gua],xiang:W.active&&ue!==P[F.gua]},Ue=W.active?`替卦盘不套正向旺山旺向表;${ye?"本盘当运山星/向星仍到坐向。":"本盘当运山星/向星未同时到坐向。"}${!Ce.shan&&!Ce.xiang?"山向两替星均「用替而未替」,实际仍按原卦气。":""}`:ye&&ke?"盘面与表法一致:本局到山到向。":ye?"盘面到山到向,但不在通行表法所列之局(表法与盘面口径不同,并列不合并)。":ke?"通行表法列为旺山旺向,但本盘当运山星/向星未同时落坐向(表法与盘面口径不同,并列不合并)。":"本局既未到山到向,也不在表法旺山旺向之列。";return{palaces:Se,sitting:Y,facing:F,yun:P,shan:ce,xiang:B,yunCenter:s,jianXiang:W,shanCenter:{star:se,...fe,mode:W.active?"替卦":"下卦",original:P[Y.gua],replaced:Ce.shan},xiangCenter:{star:ue,...le,mode:W.active?"替卦":"下卦",original:P[F.gua],replaced:Ce.xiang},dangYun:{shan:Oe(ce),xiang:Oe(B)},heshi:{shan:ie.filter(ne=>ce[ne]+P[ne]===10),xiang:ie.filter(ne=>B[ne]+P[ne]===10)},wangShanWangXiang:{byChart:ye,byTable:W.active?null:!!ke,table:ve.map(([ne,Te])=>`${ne}${Te}`),note:Ue}}}function He(s){const k=s.dst===!1?{year:s.year,month:s.month,day:s.day,hour:0,minute:0,applied:!1,note:null}:h({year:s.year,month:s.month,day:s.day,hour:0,minute:0});return{year:k.year,month:k.month,day:k.day,dst:k}}const an=["大游年歌(八宅通行口径)","年家紫白飞星(纯公式:以 2026 丙午一白入中、逐年退一位、九年一轮;按立春换年)","24 山归属与度数(八宅通行口径,每山 15°)"],on="八宅与飞星为传统通行口径的本地计算,属民俗参考,不构成现场勘舆结论,仅供娱乐;实际户型以现场为准。";function sn(s){if(s.action==="advise")return Fe(s);if(s.action==="xuankong")return cn(s);const k=s.gender;if(k!=="male"&&k!=="female")throw m("E_INPUT","风水命卦需要性别:男女命卦算法不同,不可缺省");if(!Number.isInteger(s.year)||!Number.isInteger(s.month)||!Number.isInteger(s.day))throw m("E_INPUT","风水命卦需要完整出生年月日(公历)——只知道年份不够:命卦按立春界划分出生年");const E=He(s),x=A(E.year,E.month,E.day),{num:Y,gua:F,direction:Z}=S(x,k),W=M(F),P=["坎","离","震","巽"].includes(F),se=Number.isInteger(s.fortuneYear)?s.fortuneYear:null;return{system:"fengshui",meta:{birth:`${E.year}-${Q(E.month)}-${Q(E.day)}`,guaYear:x,gender:k==="male"?"男":"女",fortuneYear:se,...E.dst.applied?{dst:E.dst.note}:{},...se===null?{note:"未给流年:未算年紫白飞星(需要时补 fortuneYear)。"}:{},scope:"八宅命卦 + 大游年八星 + 年紫白;玄空飞星见 action=xuankong;不含形峦与现场勘舆。"},mingGua:{num:Y,gua:F,direction:Z,group:P?"东四命":"西四命",compatible:P?"宜东四宅(坐坎离震巽)":"宜西四宅(坐乾坤艮兑)"},luckyDirections:te.map(ue=>({star:ue,...W[ue]})),unluckyDirections:y.map(ue=>({star:ue,...W[ue]})),...se===null?{}:{yearlyFlying:Ne(se)},sources:an,disclaimer:on}}function Ke(s){const k=typeof s.sitting=="string"&&s.sitting.trim()!=="",E=typeof s.facing=="string"&&s.facing.trim()!=="";if(!k&&!E)throw m("E_INPUT","缺少坐向:sitting(坐山)或 facing(向山)至少给一个——按罗盘 24 山报坐或报向,例如「坐北朝南」对应坐子向午");if(k&&E){const F=f(s.sitting.trim()),Z=f(s.facing.trim());if((F.index+12)%24!==Z.index)throw m("E_INPUT",`坐向不自洽:坐${F.m}(${F.deg}°)与向${Z.m}(${Z.deg}°)不是对宫(相差应 180°,实测 ${(Z.deg-F.deg+360)%360}°)——请核对罗盘读数。`)}const x=k?f(s.sitting.trim()):o(s.facing.trim()),Y=N[(x.index+12)%24];return{sitting:x,facing:Y}}function Fe(s){const{sitting:k,facing:E}=Ke(s),x=k.gua,Y=M(x),F=te.map(le=>Y[le]),Z=y.map(le=>Y[le]),W=le=>`${le.direction}(${le.palace}宫)`,P=[...te,...y].map(le=>({star:le,lucky:te.includes(le),...Y[le],role:c[le]})),se={door:`门宜开于吉方:首选生气方 ${W(F[0])},次选延年方 ${W(F[1])}、天医方 ${W(F[2])}。`,stove:`灶宜「坐凶向吉」:灶身压凶方(首选绝命方 ${W(Z[0])}、五鬼方 ${W(Z[1])}),灶口朝吉方。`,bed:`主卧与床头宜安吉方:生气方 ${W(F[0])} 或延年方 ${W(F[1])};床头宜向吉方。`,toilet:`厕所宜压凶方:祸害方 ${W(Z[3])} 或六煞方 ${W(Z[2])}(污去凶气,宜静常闭)。`};let ue=null;const fe=Number.isInteger(s.year)&&Number.isInteger(s.month)&&Number.isInteger(s.day)&&(s.gender==="male"||s.gender==="female");if(fe){const le=He(s),ce=A(le.year,le.month,le.day),B=S(ce,s.gender),Se=r(B.gua),Oe=r(x),ve=Se===Oe,ke=te.map(ye=>`${ye}位${M(B.gua)[ye].direction}`).join("、");ue={birth:`${le.year}-${Q(le.month)}-${Q(le.day)}`,guaYear:ce,gender:s.gender==="male"?"男":"女",mingGua:{gua:B.gua,direction:B.direction,group:`${Se}命`},houseGua:{gua:x,group:`${Oe}宅`},sameGroup:ve,text:ve?`命宅相配(${Se}命住${Oe}宅):以宅之八星盘布局即可,个人吉方与宅吉方大体同向。`:`命宅不配(${Se}命住${Oe}宅):传统调停法——门与床以命卦吉方为先(此命四吉方:${ke}),灶仍按宅卦坐凶向吉,两盘各自取用。`}}return{system:"fengshui",meta:{action:"advise",...fe?{}:{birthNote:"未提供生辰:未做命宅配;如需按个人命卦调停门床,请补充出生年月日与性别。"},sitting:`${k.m}山(罗盘 ${k.deg}°)`,facing:`${E.m}山(罗盘 ${E.deg}°)`,houseGua:x,houseGroup:`${r(x)}宅`,scope:"门主灶厕走向按八宅通行口径给倾向,玄空飞星见 action=xuankong;不含形峦、不是现场勘舆结论。"},houseStars:P,layout:se,...ue?{mingMatch:ue}:{},sources:an,disclaimer:on}}function rn(s,k,E){const x=P=>P!=null&&P!=="",Y=(P,se)=>{if(typeof P!="number"||!Number.isFinite(P))throw m("E_INPUT",`${se} 必须是数字(度),收到「${P}」`);return P},F=(P,se,ue)=>{const fe=Y(P,ue);if(fe<0||fe>360)throw m("E_INPUT",`${ue} 必须在 0–360° 之间(罗盘度数),收到「${fe}」`);const le=(fe-se.deg+540)%360-180;if(Math.abs(le)>7.500000001)throw m("E_INPUT",`${ue} ${fe}° 不在${se.m}山范围内(${se.m}中心 ${se.deg}°,每山 15°),请核对坐向。`);return le},Z=[];if(x(s.sittingOffset)&&Z.push(Y(s.sittingOffset,"sittingOffset")),x(s.sittingDegree)&&Z.push(F(s.sittingDegree,k,"sittingDegree")),x(s.facingOffset)&&Z.push(Y(s.facingOffset,"facingOffset")),x(s.facingDegree)&&Z.push(F(s.facingDegree,E,"facingDegree")),!Z.length)return{offset:0,source:"未报兼向度数,按正向(0°)"};const W=Z[0];if(Z.some(P=>Math.abs(P-W)>1e-9))throw m("E_INPUT",`坐向兼度不一致:${Z.join("° / ")}°——坐与向应同向偏离,请只报一个偏移或核对度数。`);if(Math.abs(W)>7.5+1e-9)throw m("E_INPUT",`兼向偏移必须在 −7.5°–7.5°(相对本山中心),收到「${W}」——超过 7.5° 已进入下一山。`);return{offset:W,source:"按所报兼向度数"}}function ln(s){const k=fe=>fe!=null&&fe!=="";if(!k(s.fortuneDate))return null;if(typeof s.fortuneDate!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(s.fortuneDate))throw m("E_INPUT",`fortuneDate 需为 YYYY-MM-DD,收到「${s.fortuneDate}」`);const[E,x,Y]=s.fortuneDate.split("-").map(Number),F=new Date(Date.UTC(E,x-1,Y));if(F.getUTCFullYear()!==E||F.getUTCMonth()!==x-1||F.getUTCDate()!==Y)throw m("E_INPUT",`fortuneDate 不是有效日期:「${s.fortuneDate}」`);const Z=k(s.fortuneTime)?s.fortuneTime:"12:00";if(typeof Z!="string"||!/^\d{2}:\d{2}$/.test(Z))throw m("E_INPUT",`fortuneTime 需为 HH:MM,收到「${Z}」`);const[W,P]=Z.split(":").map(Number);if(W>23||P>59)throw m("E_INPUT",`fortuneTime 超出范围(HH:MM):「${Z}」`);const se=s.dst===!1?null:h({year:E,month:x,day:Y,hour:W,minute:P});return{at:se?{year:se.year,month:se.month,day:se.day,hour:se.hour,minute:se.minute}:{year:E,month:x,day:Y,hour:W,minute:P},dst:se}}function cn(s){const{sitting:k,facing:E}=Ke(s),x=rn(s,k,E),Y=ln(s);let F,Z=null,W;if(s.period!==void 0&&s.period!==null&&!Number.isInteger(s.period))throw m("E_INPUT",`运必须是 1–9 的整数(三元九运),收到「${s.period}」——一运 1864 起、九运 2024–2043。`);if(Number.isInteger(s.period)){if(s.period<1||s.period>9)throw m("E_INPUT",`运必须是 1–9 的整数(三元九运),收到「${s.period}」——一运 1864 起、九运 2024–2043。`);F=s.period}else Number.isInteger(s.fortuneYear)?(Z=K(s.fortuneYear),F=Z.period):Y?(Z=K(A(Y.at.year,Y.at.month,Y.at.day)),F=Z.period,W=`未显式给运:按飞星日期归入 ${Z.label}。`):(F=9,W="未给运:默认按九运(2024–2043)排盘;可传 period(1–9)或 fortuneYear 指定。");const P=tn(F,k.m,E.m,{offset:x.offset}),se=pe[k.m],ue=pe[E.m],fe=B=>({star:B.star,name:g[B.star].name,fly:B.forward?"顺飞":"逆飞",basis:B.basis,mode:B.mode,original:B.original,replaced:B.replaced}),le=B=>B.map(Se=>Se==="中"?"中宫":`${Se}宫${p[Se]}`).join("、")||"无";let ce=null;if(Y)ce=O(Y.at),Y.dst&&Y.dst.applied&&(ce.meta.dst=Y.dst.note);else if(Number.isInteger(s.fortuneYear)){const B=oe(s.fortuneYear);ce={year:{...$e(B,!0),basis:`${s.fortuneYear} 年紫白 ${g[B].name} 入中顺飞`},month:null,day:null,hour:null,meta:{guaYear:s.fortuneYear,note:"只给年份:已排年紫白;补 fortuneDate(YYYY-MM-DD)与 fortuneTime(HH:MM)可排月、日、时。"}}}return{system:"fengshui",meta:{action:"xuankong",period:F,periodLabel:Z?Z.label:`${F}运`,...Z?{year:s.fortuneYear||Y&&Y.at.year,periodStart:Z.start,periodEnd:Z.end}:{},sitting:`${k.m}山(罗盘 ${k.deg}°)`,facing:`${E.m}山(罗盘 ${E.deg}°)`,sittingGua:k.gua,facingGua:E.gua,sittingYuan:`${se.yuan}${se.yinYang}`,facingYuan:`${ue.yuan}${ue.yinYang}`,sittingOffset:x.offset,jianXiang:P.jianXiang,shanCenter:fe(P.shanCenter),xiangCenter:fe(P.xiangCenter),...W?{note:W}:{},scope:"玄空下卦/替卦:运盘 + 山盘 + 向盘 + 当运星 + 合十 + 表法旺山旺向;兼向超 4.5° 按沈氏替卦;年月日时紫白按公式派;不含形峦与现场勘舆。"},palaces:P.palaces,dangYun:{shan:{palaces:P.dangYun.shan,text:le(P.dangYun.shan)},xiang:{palaces:P.dangYun.xiang,text:le(P.dangYun.xiang)}},heshi:{shan:P.heshi.shan,xiang:P.heshi.xiang},wangShanWangXiang:P.wangShanWangXiang,...ce?{timeFlying:ce}:{},sources:We,disclaimer:nn}}return{NINE_STARS:g,PALACE_DIRECTION:p,DAYOUTIAN:U,LUCKY_STARS:te,UNLUCKY_STARS:y,MOUNTAINS_24:N,mountainInfo:f,sittingFromFacing:o,STAR_LAYOUT_ROLE:c,mingGua:S,eightStars:M,guaYearOf:A,yearZibaiStar:oe,yearlyFlying:Ne,timeFlyingOf:O,periodOfYear:K,MOUNTAIN_META:pe,TIGUA_SOURCE:en,TIGUA_TABLE:Ge,JIAN_XIANG_THRESHOLD:Ye,jianXiangOf:Je,WANG_SHAN_WANG_XIANG:Xe,XUANKONG_SOURCES:We,XUANKONG_DISCLAIMER:nn,xuankongChart:tn,buildFengshui:sn}})(),I.followup=(function(){const{ZIWEI_STARS:R}=I["interpret-data"]||{},q=[{key:"career",label:"事业",words:["事业","工作","跳槽","升职","创业","职业","岗位","离职","加薪","面试","offer"]},{key:"wealth",label:"财富",words:["财","钱","收入","投资","买房","存款","亏","赚","分红"]},{key:"love",label:"感情",words:["感情","婚","恋","对象","分手","复合","姻缘","结婚","桃花"]},{key:"health",label:"健康",words:["健康","病","身体","手术","失眠","体检","医院"]},{key:"study",label:"学业",words:["学业","考试","学习","考研","考公","证书","升学"]},{key:"travel",label:"出行",words:["出行","搬家","旅行","出国","迁","远行"]}],H={career:"官禄",wealth:"财帛",love:"夫妻",health:"疾厄",study:"官禄",travel:"迁移",overall:"命宫"},v=(y,N)=>{const l=String(y).match(/(20\d{2})\s*年?/);if(l)return Number(l[1]);const f=Array.isArray(N.liunian)&&N.liunian[0]?Number(N.liunian[0].year):null;return f?/明年/.test(y)?f+1:/后年/.test(y)?f+2:/去年/.test(y)?f-1:/今年|本年/.test(y)?f:null:null},L=y=>q.find(N=>N.words.some(l=>String(y).includes(l)))||null;function T(y,N){const l=v(N,y),f=L(N),o=Array.isArray(y.liunian)?y.liunian:[],r=Array.isArray(y.dayun?.list)?y.dayun.list:[],c=o.map(u=>u.year);if(l&&!o.some(u=>Number(u.year)===l))return{ok:!1,year:l,topic:f,answer:`这一盘已排的流年范围是 ${c[0]}–${c[c.length-1]},没有 ${l} 年。可以把问题改到范围内,或用 asOf 指定你想看的年份重新排盘。`,evidence:[`已排流年:${c.join("、")}`],confidence:"弱"};if(l){const u=o.find(de=>Number(de.year)===l),S=r.find(de=>Number(de.startAge)<=Number(u.age)&&Number(u.age)<=Number(de.startAge)+9)||null,M=u.luck?.tier||"平",A=(u.luck?.reasons||[]).slice(0,3),oe=(u.relations||[]).join("、"),ie=f?G(y,f.key):"";return{ok:!0,year:l,topic:f,answer:`${l} 年(${u.ganzhi})流年,十神为${u.stemTenGod||"—"},档位「${M}」;所行大运 ${S?`${S.ganzhi}(${S.luck?.tier||"平"})`:"未取到"}。${A.length?`理由:${A.join(",")}。`:""}${oe?`与该年地支相关的原局关系:${oe}。`:""}${ie}`,evidence:[`流年 ${u.year} ${u.ganzhi}·${u.stemTenGod||""}·${M}`,S?`大运 ${S.ganzhi}·${S.luck?.tier||"平"}`:"",oe?`原局关系 ${oe}`:"",f?`问题方向:${f.label}`:""].filter(Boolean),confidence:S&&A.length?"强":"中"}}if(f){const u={wealth:"overall",study:"work",travel:"overall"}[f.key]||f.key,S=(y.interpret?.dimensions||[]).find(M=>M.key===f.key||M.key===u);if(S){const M=y.frame&&y.frame.godStats&&y.frame.godStats.groups||{},A=f.key==="wealth"?` 财星权重 ${Number(M.财||0)}(只作结构参考,不含金额)。`:"";return{ok:!0,year:null,topic:f,answer:`按${f.label}这条线看:${S.text}${A}${S.advice?` 建议:${S.advice}`:""}`,evidence:(S.evidence||[]).slice(0,4),confidence:S.confidence||"中"}}}return{ok:!1,year:null,topic:f,answer:`这个问题里没有识别到具体的年份或方面。可以这样问:「2027 年事业怎么样」「财运如何」「感情在 2028 年」;已排流年是 ${c[0]}–${c[c.length-1]}。`,evidence:[`可问年份:${c.join("、")}`],confidence:"弱"}}function b(y,N){const l=v(N,y),f=L(N),o=Array.isArray(y.liunian)?y.liunian:[];if(l&&!o.some(r=>Number(r.year)===l))return{ok:!1,year:l,topic:f,answer:`这一盘的流年表覆盖 ${o[0]?.year}–${o[o.length-1]?.year},没有 ${l} 年;可以换一个年份,或用 asOf 指定起点重新排盘。`,evidence:[`流年表:${o.map(r=>r.year).join("、")}`],confidence:"弱"};if(l){const r=o.find(u=>Number(u.year)===l),c=r.daxian||{};return{ok:!0,year:l,topic:f,answer:`${l} 年(${r.ganzhi},${r.age} 岁)流年命宫落在「${r.lifePalace?r.lifePalace.palace:"—"}」,四化为 ${(r.mutagen||[]).join("、")||"不明显"};所行大限${c.palace?`在${c.palace}(${c.start}–${c.end} 岁)`:"未取到"}。${f?`与「${f.label}」对应的宫位信号见下条依据。`:""}`,evidence:[`流年命宫 ${r.lifePalace?r.lifePalace.palace:"—"}(${r.lifePalace?r.lifePalace.branch:"—"})`,`四化 ${(r.mutagen||[]).join("、")||"不明显"}`,c.palace?`大限 ${c.palace}·${c.start}–${c.end}岁`:""].filter(Boolean),confidence:(r.mutagen||[]).length>=3?"强":"中"}}if(f){const r=H[f.key]||"命宫",c=(y.palaces||[]).find(u=>u.palace===r);if(c){const u=(c.stars||[]).filter(M=>M.type==="主星").map(M=>M.name),S=u.map(M=>R[M]?.trait).filter(Boolean).slice(0,2).join(";");return{ok:!0,year:null,topic:f,answer:`「${f.label}」看${r}:主星${u.length?u.join("、"):"无正曜(借对宫)"}${S?`——${S}`:""}。宫支${c.branch},${c.stems,""}生年四化与煞星的影响需结合报告里的对应分节一起看。`,evidence:[`${r} ${c.branch}·${u.join("、")||"无正曜"}`,...(c.shensha||[]).slice(0,3)],confidence:u.length?"强":"弱"}}}return{ok:!1,year:null,topic:f,answer:"没有识别到具体年份或方面。可以问「2028 年事业」「感情怎么样」「财运在 2030 年」;也可以直接问某个宫位,如「夫妻宫」。",evidence:[],confidence:"弱"}}function G(y,N){return`这段时间可以重点对照报告里「${{career:"事业",wealth:"财富",love:"感情",health:"健康",study:"学业",travel:"出行"}[N]||"整体"}」一节看。`}function h(y,N){const l=L(N),f=Array.isArray(y.interpret?.sections)?y.interpret.sections:[],o=l?f.find(c=>c.label.includes(l.label)||c.text.includes(l.label)):null;if(o)return{ok:!0,year:null,topic:l,answer:o.text,evidence:[`引用分节:${o.label}`],confidence:"中"};const r=f[0];return{ok:!1,year:null,topic:l,answer:r?`这一盘的追问需要落到具体方面(事业 / 财富 / 感情 / 健康 / 学业 / 出行)。先看「${r.label}」这一节,或把问题说得更具体一点。`:"这一盘暂时没有可追问的分节;先看完整解析,再问具体方面。",evidence:[],confidence:"弱"}}function m(y,N){const l=String(N||"").trim(),f=y&&y.system==="bazi"?T(y,l):y&&y.system==="ziwei"?b(y,l):h(y,l);return{question:l,...f}}const g={bazi:"八字(四柱)",ziwei:"紫微斗数",liuyao:"六爻",meihua:"梅花易数",daliuren:"大六壬",qimen:"奇门遁甲",tarot:"塔罗",hepan:"合盘",chenggu:"称骨",almanac:"黄历",zeri:"择日",star:"星座",numerology:"生命数字",mbti:"十六型人格",trend:"人生 K 线",fengshui:"风水",name:"起名",convert:"公农历互转"},p=Object.freeze({bazi:["基本信息","四柱(日主/十神/藏干)","旺衰·格局·用神","合冲·神煞","起运·大运·流年","古籍依据"],ziwei:["基本信息","命宫/身宫与五行局","十二宫(主星/辅煞/四化)","格局与三方四正","大限/流年","古籍依据"],liuyao:["所问与用神","本卦/变卦(世应/动爻/六亲)","月建日辰(旺衰/空破)","应期线索","卦辞与依据"],meihua:["所问与体用","本卦/互卦/变卦","五行生克","应期与依据"],daliuren:["天地盘(月将/贵人)","四课","三传","课体与神将","依据"],qimen:["四柱与局数","九宫(星门神/天盘干)","用神落宫","门宫·干宫·十干克应","旺衰·击刑入墓","依据"],tarot:["问题与牌阵","逐牌(正逆/元素)","牌间关系","综合倾向","边界"],fengshui:["坐向与元运","运盘/山盘/向盘","旺山旺向","取象与边界"]}),C=Object.freeze(["基本信息","盘面事实","结构与关系","倾向","边界"]);function U(y){return p[y]||C}function te(y,N={}){const l=g[y&&y.system]||y&&y.system||"未知体系",o=String(N&&N.question||"").trim()||"请先用一句白话讲清这张盘的主线,再指出最值得注意的一两处,并说明每处的具体依据。",r=Number.isFinite(N&&N.maxChars)&&N.maxChars>=400?N.maxChars:3e3,c=String(y&&y.summary||"").trim(),u=c.length>r,S=u?`${c.slice(0,r)}…(摘要已截断)`:c,M=N&&typeof N.interpret=="object"&&N.interpret||y&&typeof y.interpret=="object"&&y.interpret||null,A=String(M&&M.answer||"").trim(),oe=String(M&&M.plain||"").trim(),ie=[];A&&ie.push(`直答:${A}`),oe&&ie.push(`说人话:${oe}`);const $e=["【命理追问】下面这张盘是命理插件刚排好的,请就着它回答我的问题;不用重新排盘,盘面字段已经够用。",`体系:${l}`,`所问:${o}`,"",...ie.length?["——开场结论(插件已按同一套规则算好,开场先沿用这句;措辞可改,口径别换)——",...ie,""]:[],"——盘面层次(从上到下读,别跳层)——",`${l}:${U(y&&y.system).join(" → ")}`,"先复述事实,再讲结构与时间;上一层没交代清楚,不要跳到下一层。","","——盘面摘要——",S||"(这张盘没有摘要字段,请先让我重新排一次。)","","——回答要求——","读者不懂命理。按下面的骨架答;任何一句他看不懂,就算没写完:",ie.length?"1) 开头一句结论:先沿用上面的「开场结论」,再用一句不用术语的话说清这张盘的主线——只读这一句也该有收获;":"1) 开头一句结论:不用术语,一句话说清这张盘的主线,只读这一句也该有收获;","2) 第二段只复述盘面骨架:按上面的层次用 2–4 行写事实(如四柱、格局、用神、大运),不掺倾向,让读者知道后面的判断从哪来;","3) 判断最多两条,按重要性排序,每条分四行写:"," 盘面|只引盘面已有的字(具体的柱、宫或爻、字段名),不掺解释;"," 白话|把上一行的术语当场翻成日常话——调候 / 化气 / 通关 / 空亡 / 争合 这类词必须落地,一个词只翻一次,不连续堆三个以上;"," 倾向|说「更可能……」,讲清它在现实里大概意味着什么,用概率语气;"," 边界|这条在什么情况下不成立;盘面没给的,直接写「这盘里看不出来」;","4) 收尾一句「如果只记一件事」:给一条能核对、能动手的观察点,并说明它出自上面哪条盘面依据;","5) 别把传统说法当成已证实的事实:不下绝对断言,也不用「肯定」「绝对」这类词,更不写「格局很好」「运程不顺」这种没有信息的空话。"].join(`
68
+ `);return{text:$e,question:o,system:y&&y.system||"",label:l,chars:$e.length,truncated:u}}return{followup:m,READING_ORDERS:p,READING_ORDER_FALLBACK:C,readingOrderOf:U,askPrompt:te}})(),I.revise=(function(){const R=[{key:"ziwei",label:"紫微",re:/紫微|斗数/},{key:"bazi",label:"八字",re:/八字|四柱/},{key:"liuyao",label:"六爻",re:/六爻|摇卦/},{key:"qimen",label:"奇门",re:/奇门/},{key:"daliuren",label:"大六壬",re:/大六壬|六壬/},{key:"tarot",label:"塔罗",re:/塔罗|抽牌/},{key:"meihua",label:"梅花",re:/梅花/},{key:"hepan",label:"合盘",re:/合盘|合婚/},{key:"almanac",label:"黄历",re:/黄历|老黄历/},{key:"zeri",label:"择日",re:/择日|挑日子/},{key:"fengshui",label:"风水",re:/风水/},{key:"name",label:"起名",re:/起名|取名/},{key:"chenggu",label:"称骨",re:/称骨/},{key:"xiaoliuren",label:"小六壬",re:/小六壬/},{key:"star",label:"星座",re:/星座/},{key:"numerology",label:"生命数字",re:/生命数字|生命灵数/},{key:"mbti",label:"MBTI",re:/mbti|人格测试|十六型/i},{key:"trend",label:"人生 K 线",re:/k\s*线|人生曲线/i},{key:"convert",label:"公农历互转",re:/农历转公历|公历转农历|公农历/}],q=[{key:"love",label:"感情",re:/感情|婚姻|恋爱|对象|夫妻/},{key:"wealth",label:"财运",re:/财运|财富|赚钱|收入|破财/},{key:"career",label:"事业",re:/事业|工作|升职|跳槽/},{key:"health",label:"健康",re:/健康|身体|疾病|病/},{key:"study",label:"学业",re:/学业|考试|考研|升学|读书/},{key:"travel",label:"出行",re:/出行|搬家|迁移|旅行|外地/}],H=/换成|改成|改为|换到|改看|再看|再看一下|换一套|排一?张|用|按|看/,v=h=>String(h||"").replace(/(出生|出生地|所在地|人)$/,"").replace(/[的了].*$/,"").trim();function L(h){const m=String(h??"").trim(),g={},p=[],C=[];if(!m)return{text:"",patch:g,labels:p,ignored:C};if(H.test(m)){for(const y of R)if(y.re.test(m)){g.system=y.key,p.push({key:"system",label:"体系",value:y.key,display:y.label});break}}/女命|女性|换成女|改成女|女盘/.test(m)?(g.gender="female",p.push({key:"gender",label:"性别",value:"female",display:"女"})):/男命|男性|换成男|改成男|男盘/.test(m)&&(g.gender="male",p.push({key:"gender",label:"性别",value:"male",display:"男"})),/晚子时/.test(m)&&(/不换日|不换天|算当日|归当日|按当日|当天/.test(m)?(g.lateZi=!1,p.push({key:"lateZi",label:"晚子时",value:!1,display:"23:00 后仍算当日"})):/换日|算次日|归次日|按次日|第二天|次日/.test(m)&&(g.lateZi=!0,p.push({key:"lateZi",label:"晚子时",value:!0,display:"23:00 后算次日"}))),/真太阳时/.test(m)&&(/不用|不要|关闭|关掉|取消|不算/.test(m)?(g.trueSolar=!1,p.push({key:"trueSolar",label:"真太阳时",value:!1,display:"用东八区平太阳时"})):(g.trueSolar=!0,p.push({key:"trueSolar",label:"真太阳时",value:!0,display:"按出生地经度校正"}))),/夏令时/.test(m)&&(/不用|不要|关闭|关掉|取消|不校正/.test(m)?(g.dst=!1,p.push({key:"dst",label:"夏令时",value:!1,display:"不自动校正 1986–1991 夏令时"})):(g.dst=!0,p.push({key:"dst",label:"夏令时",value:!0,display:"自动校正 1986–1991 夏令时"})));const U=m.match(/出生在\s*([\u4e00-\u9fa5]{2,12})/)||m.match(/出生地(?:改成|改为|换成|换到|是|为)?\s*([\u4e00-\u9fa5]{2,12})/)||m.match(/改到\s*([\u4e00-\u9fa5]{2,12})\s*出生/);if(U){const y=v(U[1]);y.length>=2&&(g.address=y,p.push({key:"address",label:"出生地",value:y,display:y}))}const te=m.match(/(?:看|查|问|到|到了|临近)\s*((?:19|20)\d{2})\s*年/)||m.match(/((?:19|20)\d{2})\s*年(?:的)?(?:运势|怎么样|如何|会怎样|流年)/);if(te){const y=Number(te[1]);g.asOf=`${y}-01-01T00:00`,p.push({key:"asOf",label:"流年基准",value:g.asOf,display:`${y} 年`})}else/(出生|生年)/.test(m)&&/(19|20)\d{2}\s*年/.test(m)&&C.push("出生年份没改:一句话改不出日与时辰,请直接传 datetime(如 1993-04-08T06:20)");for(const y of q)if(y.re.test(m)){g.direction=y.key,p.push({key:"direction",label:"询问方向",value:y.key,display:y.label});break}return/解读|详解|详细说|说人话/.test(m)&&!/不要解读|不用解读|别解读/.test(m)&&(g.withInterpret=!0,p.push({key:"withInterpret",label:"解读",value:!0,display:"附解析与详解"})),{text:m,patch:g,labels:p,ignored:C}}const T=R,b=q;function G(h,m){if(m==null)return null;if(h==="system"){const g=R.find(p=>p.key===m);return g?g.label:String(m)}if(h==="gender")return m==="female"?"女":m==="male"?"男":String(m);if(h==="direction"){const g=q.find(p=>p.key===m);return g?g.label:String(m)}if(typeof m=="boolean")return m?"开":"关";if(h==="asOf"){const g=String(m).match(/^(\d{4})/);return g?`${g[1]} 年`:String(m)}return String(m)}return{parseRevision:L,REVISE_SYSTEMS:T,REVISE_DIRECTIONS:b,displayValue:G}})(),I.handle=(function(){const{fail:R}=I.fail||{},q="mc1.",H=new Set(["handle","trace","shadow","shadowVersion","diff","withInterpret","cross","verifyPast","rectify","events","ask","followup","question","geocode","caliber","revise"]),v=l=>l!==null&&typeof l=="object"&&!Array.isArray(l);function L(l){if(Array.isArray(l))return`[${l.map(o=>L(o===void 0?null:o)).join(",")}]`;if(v(l))return`{${Object.keys(l).filter(r=>l[r]!==void 0).sort().map(r=>`${JSON.stringify(r)}:${L(l[r])}`).join(",")}}`;const f=JSON.stringify(l===void 0?null:l);return f===void 0?"null":f}function T(l){let f=2166136261;for(let o=0;o<l.length;o++)f^=l.charCodeAt(o),f=Math.imul(f,16777619)>>>0;return f.toString(16).padStart(8,"0")}const b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function G(l){const f=[];for(const o of String(l)){let r=o.codePointAt(0);r<128?f.push(r):r<2048?f.push(192|r>>6,128|r&63):r<65536?f.push(224|r>>12,128|r>>6&63,128|r&63):f.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}return f}function h(l){let f="";for(let o=0;o<l.length;){const r=l[o];let c,u;r<128?(c=r,u=1):r<224?(c=r&31,u=2):r<240?(c=r&15,u=3):(c=r&7,u=4);for(let S=1;S<u;S++)c=c<<6|l[o+S]&63;o+=u,f+=String.fromCodePoint(c)}return f}function m(l){const f=G(l);let o="";for(let r=0;r<f.length;r+=3){const c=f[r],u=f[r+1],S=f[r+2];if(o+=b[c>>2],o+=b[(c&3)<<4|(u===void 0?0:u)>>4],u===void 0||(o+=b[(u&15)<<2|(S===void 0?0:S)>>6],S===void 0))break;o+=b[S&63]}return o}function g(l){const f=[];let o=0,r=0;for(const c of l){const u=b.indexOf(c);if(u<0)throw new Error(`不是 base64url 字符:${c}`);o=o<<6|u,r+=6,r>=8&&(r-=8,f.push(o>>r&255))}return h(f)}function p(l={}){const f={};for(const[o,r]of Object.entries(l||{}))H.has(o)||r===void 0||(f[o]=r);return f}function C(l={}){const f=p(l);if(!Object.keys(f).length)return"";const o=m(L(f));return`${q}${o}.${T(o)}`}function U(l){if(typeof l!="string"||!l.trim())throw R("E_HANDLE","handle 必须是非空字符串;没拿到句柄时照常传 system + datetime 等原始参数即可");const f=l.trim();if(!f.startsWith(q))throw R("E_HANDLE",`handle 前缀不对(应以 ${q} 开头):句柄来自旧版本或复制不全,重新排一次盘取新的 handle`);const o=f.slice(q.length),r=o.lastIndexOf(".");if(r<=0)throw R("E_HANDLE","handle 缺少校验位:复制时可能被截断,重新取一次");const c=o.slice(0,r),u=o.slice(r+1);if(T(c)!==u)throw R("E_HANDLE","handle 校验不通过:内容被改动或截断,重新排一次盘取新的 handle");let S;try{S=JSON.parse(g(c))}catch{throw R("E_HANDLE","handle 内容无法解析(不是本插件生成的句柄),重新排一次盘取新的 handle")}if(!v(S))throw R("E_HANDLE","handle 内容不是参数对象,重新排一次盘取新的 handle");return S}function te(l={}){if(!v(l))return l;const{handle:f,...o}=l;if(f==null||f==="")return{...o};const c={...U(f)};for(const[u,S]of Object.entries(o))S!==void 0&&(c[u]=S);return c}return{handlePayload:p,encodeHandle:C,decodeHandle:U,resolveHandle:te,HANDLE_PREFIX:q,handleChecksum:T}})(),I.bridge=(function(){const{encodeHandle:R,decodeHandle:q,HANDLE_PREFIX:H}=I.handle||{},{askPrompt:v}=I.followup||{},L=200,T=60,b={bazi:"八字",ziwei:"紫微",liuyao:"六爻",meihua:"梅花",daliuren:"大六壬",qimen:"奇门",hepan:"合盘",tarot:"塔罗",almanac:"黄历",zeri:"择日",chenggu:"称骨",xiaoliuren:"小六壬",star:"星座",numerology:"生命数字",mbti:"人格",trend:"人生K线",fengshui:"风水",name:"起名",convert:"农历"},G=f=>b[f]||f||"未知体系";function h(f){const o=String(f||""),r=o.indexOf("#");return r<0?o:o.slice(0,r)}function m(f){try{return encodeURIComponent(f)}catch{return""}}function g(f){try{return decodeURIComponent(f)}catch{return String(f||"")}}function p(f={},o={}){const r=o||{},u=String(r.handle||f&&f.handle||"").trim()||R(f||{});if(!u||!u.startsWith(H))return"";const S=String(r.question||"").trim().slice(0,L),M=[`mp=${u}`];return S&&M.push(`q=${m(S)}`),`${h(r.base)}#${M.join("&")}`}function C(f){const o=String(f||"").trim();if(!o)return{ok:!1,code:"E_LINK",message:"没有链接内容:请粘贴带 #mp= 的完整链接"};let r="";const c=o.indexOf("#");if(c>=0&&o.slice(c+1).trim())r=o.slice(c+1).trim();else{const A=o.indexOf("?");A>=0&&o.slice(A+1).trim()?r=o.slice(A+1).trim():/^mp=/.test(o)&&(r=o)}if(!r)return{ok:!1,code:"E_LINK",message:"链接里没有 #mp= 片段:这不是本插件生成的深链"};const u={};for(const A of r.split("&")){if(!A)continue;const oe=A.indexOf("=");if(oe<=0)continue;const ie=A.slice(0,oe),de=A.slice(oe+1);ie==="mp"?u.mp=de:ie==="q"&&(u.q=de)}if(!u.mp)return{ok:!1,code:"E_LINK",message:"链接里没有 mp 参数(只有问题没有盘):无法还原盘面"};let S;try{S=q(u.mp)}catch(A){return{ok:!1,code:A&&A.code||"E_HANDLE",message:A&&A.message||"句柄无法解析"}}const M=u.q?g(u.q).slice(0,L):"";return{ok:!0,handle:u.mp,args:S,question:M,system:S.system||"",label:G(S.system)}}const U=f=>{const o=/^(\d{4}-\d{1,2}-\d{1,2})[T ](\d{1,2}:\d{2})/.exec(String(f||"").trim());if(!o)return{date:"",time:""};const[r,c,u]=o[1].split("-");return{date:`${r}-${String(c).padStart(2,"0")}-${String(u).padStart(2,"0")}`,time:o[2].padStart(5,"0")}},te=["gender","address","trueSolar","lateZi","lines"];function y(f){const o=f&&f.ok?f:null,r=o&&o.args||{},c=U(r.datetime),u={tab:r.system||"",date:c.date,time:c.time,question:o&&o.question||"",restored:[],rest:{}};u.tab&&u.restored.push("system"),c.date&&u.restored.push("datetime");for(const S of te)r[S]===void 0||r[S]===null||(u[S]=r[S],u.restored.push(S));u.question&&u.restored.push("question");for(const[S,M]of Object.entries(r))S==="system"||S==="datetime"||te.includes(S)||(u.rest[S]=M);return u}function N(f){const o=Object.keys(f&&f.rest||{});return o.length?`链接里还有 ${o.length} 项没填回表单(${o.join("、")}):这些只在引擎调用里生效,页面上按默认值显示。`:""}function l(f,o={}){const r=o||{},c=f||{},u=c.system||"",S=G(u),M=String(r.question||"").trim(),A=String(c.handle||"").trim();let oe="";try{const we=v(c,{question:M,interpret:r.interpret});oe=we&&we.text||String(c.summary||"")}catch{oe=String(c.summary||"")}const ie=M?M.length>T?`${M.slice(0,T)}…`:M:"(未填问题:按摘要讲主线)",de=A?`【命理追问】${S}|${A}|问:${ie}`:`【命理追问】${S}|问:${ie}`,$e={};A&&($e.handle=A),u&&($e.system=u),M&&($e.question=M);const Ne=JSON.stringify({tool:"metaphysics",v:1,args:$e},null,2),ge=A?p({handle:A},{question:M,base:r.base}):"";return{system:u,label:S,handle:A,question:M,full:oe,brief:de,structured:Ne,link:ge}}return{LINK_MAX_QUESTION:L,askLink:p,parseAskLink:C,formOf:y,restNote:N,askPackages:l}})(),I.index=(function(){const{buildBazi:R}=I.bazi||{},{buildLiuyao:q,tossLines:H,bodyLabels:v,yongshenOf:L,yongshenStrength:T,fushenAccess:b,hexagramStrength:G,jinTuiPower:h,yingqiWindow:m}=I.liuyao||{},{buildZiwei:g,BRIGHTNESS:p,flowOf:C,asOfParts:U,ZIWEI_SCHOOL_DEFAULTS:te}=I.ziwei||{},{drawTarot:y}=I.tarot||{},{buildMeihua:N}=I.meihua||{},{buildDaliuren:l}=I.daliuren||{},{buildHepan:f,tripleOf:o}=I.hepan||{},{buildZiweiHepan:r}=I["ziwei-hepan"]||{},{buildQimen:c,buildSnapshot:u}=I.qimen||{},{geocodeAddress:S,resolveAddress:M}=I.geo||{},{toJDN:A,ganzhiName:oe,dayGanzhiIndex:ie}=I.calendar||{},{randomOf:de,isSeed:$e}=I.random||{},{encodeHandle:Ne,decodeHandle:ge,resolveHandle:we}=I.handle||{},{askLink:Me,parseAskLink:Pe,formOf:_e,restNote:ze,askPackages:_}=I.bridge||{},{parseRevision:D,displayValue:O}=I.revise||{},{interpret:Q,DIRECTIONS:K,DIRECTION_DEFAULT:re}=I.interpret||{},{followup:he,askPrompt:pe}=I.followup||{},{crossCheck:xe,crossText:Ze,crossSection:Re}=I.crosscheck||{},{pastSignals:De,verifyFit:qe}=I.verify||{},{rectifyBirth:Be}=I.rectify||{},{buildAlmanac:en}=I.almanac||{},{buildZeri:Ge}=I.zeri||{},{buildChenggu:Ye}=I.chenggu||{},{buildXiaoliuren:Je}=I.xiaoliuren||{},{buildStar:Xe}=I.star||{},{buildNumerology:We}=I.numerology||{},{buildMbti:nn,mbtiPaper:tn}=I.mbti||{},{buildConvert:He}=I.convert||{},{classicsFor:an,classicsText:on,suiyunClassicOf:sn,classicOf:Ke,CLASSIC_BOOKS:Fe}=I.classics||{},{diffObjects:rn,summarize:ln,sortDiffs:cn,labelOf:s,rootOf:k,categoryOf:E,formatValue:x,CALIBER_SWITCHES:Y,viewRows:F}=I.diff||{},{canonicalJson:Z,fingerprintOf:W}=I.fingerprint||{},{buildTrend:P}=I.trend||{},{buildFengshui:se}=I.fengshui||{},{buildName:ue}=I.name||{},{buildTrace:fe,traceMarkdown:le,SYSTEM_LABEL:ce}=I.trace||{},{fail:B}=I.fail||{},{assertCivil:Se}=I.validate||{},Oe=e=>String(e).padStart(2,"0"),ve=["male","female"];function ke(e,t){return t===2?e%4===0&&e%100!==0||e%400===0?29:28:[31,28,31,30,31,30,31,31,30,31,30,31][t-1]}function ye(e,t=""){if(ve.includes(e))return e;const a=e==null||e===""?"(未提供)":`「${e}」`;throw B("E_INPUT",`${t?t+"的":""}gender 必须是 male 或 female${a};性别决定大运/大限顺逆,不能靠默认值`)}const Ce=["brightnessSchool","gengYearSihua","tianmaSchool","tiankongSchool","jiekongSchool","kuiyueSchool","tianshiTianshang","changshengSchool","lateZishi","shenzhuSchool"];function Ue(e){const t={};for(const a of Ce)e[a]!==void 0&&(t[a]=e[a]);return e.schools&&typeof e.schools=="object"&&(t.schools=e.schools),t}function ne(e){if(typeof e!="string"||!e.trim())throw B("E_INPUT","缺少 datetime(公历日期时间),例如 1990-05-12T14:30");const t=e.trim().match(/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s](\d{1,2}):(\d{1,2})(?::(\d{1,2}))?)?$/);if(!t)throw B("E_INPUT",`无法解析 datetime:「${e}」,请用 1990-05-12T14:30 这种格式`);const a={year:Number(t[1]),month:Number(t[2]),day:Number(t[3]),hour:Number(t[4]??0),minute:Number(t[5]??0)};if(a.month<1||a.month>12)throw B("E_INPUT",`月份超出范围:${a.month}`);const n=ke(a.year,a.month);if(a.day<1||a.day>n)throw B("E_INPUT",`日期不存在:${a.year}-${a.month}-${a.day}(${a.year} 年 ${a.month} 月只有 ${n} 天)`);if(a.hour>23||a.minute>59)throw B("E_INPUT",`时间超出范围:${a.hour}:${a.minute}`);if(a.year<1600||a.year>2400)throw B("E_RANGE",`年份 ${a.year} 超出可计算范围(1600–2400)`);return(a.year<1900||a.year>2100)&&(a.precision={level:"approx",note:`ΔT 模型仅覆盖 1900–2100,${a.year} 年按端点值外推,节气与朔望时刻可能有分钟级偏差,月柱在交节前后需复核`}),a}function Te(e){const t=e.pillars,a=(ee,be)=>`${ee}:${be.ganzhi} ${be.stemTenGod?`十神 ${be.stemTenGod} `:""}藏干 ${be.hidden.map(Le=>`${Le.stem}(${Le.tenGod})`).join(" ")} 纳音 ${be.nayin} 地势 ${be.dishi} 自坐 ${be.zizuo} 空亡 ${be.kongwang.join("")}`+(be.shensha&&be.shensha.length?` 神煞 ${be.shensha.join("、")}`:""),n=Object.entries(e.wuxing).map(([ee,be])=>`${ee}${be}`).join(" "),i=e.palaces?`【胎元】${e.palaces.taiyuan.ganzhi} 胎息 ${e.palaces.taixi?e.palaces.taixi.ganzhi:"—"} 命宫 ${e.palaces.minggong.ganzhi} 身宫 ${e.palaces.shengong.ganzhi}`:"",d=e.dayun.list.slice(0,8).map(ee=>`${ee.startAge}岁 ${ee.ganzhi}(${ee.stemTenGod})${ee.luck?`·${ee.luck.tier}`:""}${ee.relations&&ee.relations.length?`[${ee.relations.join("")}]`:""}`).join(" "),$=e.dayun.jiao&&e.dayun.jiao.at?`;交运 ${e.dayun.jiao.at}(${e.dayun.jiao.frame},距${e.dayun.jiao.from.name} ${e.dayun.jiao.spanDays} 天,三日折一年)`:"",j=e.jieqi.nearBoundaryMinutes<20?`
69
+ ⚠ 出生时刻距「节」仅 ${e.jieqi.nearBoundaryMinutes} 分钟,而节气时刻本身有最多约 14 分钟的偏差,月柱与年柱建议人工复核。`:"",X={year:"年",month:"月",day:"日",hour:"时"},ae=e.shensha&&e.shensha.groups&&e.shensha.groups.length?`神煞(${e.shensha.count} 见):`+e.shensha.groups.map(ee=>`${ee.cat}|`+ee.items.map(be=>`${be.name}(${be.pillars.map(Le=>X[Le]).join("")})`).join("、")).join(";"):"神煞:—",z=e.renyuan,V=Ke("smt-renyuan"),w=z?`人元:${z.month}月第${z.day}日,${z.active}${z.activeElement}司权(${z.segments.map(ee=>`${ee.stem}${ee.from}–${ee.to}`).join(" ")})${z.beyond?";已过 30 日表,按本气算":""}${V?`|原文见《${Fe[V.book].name}·${V.chapter}》`:""}`:"",J=e.frame&&e.frame.yongshen&&e.frame.yongshen.disputed||[],je=J.length?` 有争议:${J.map(ee=>`${ee.element}(${ee.favorRole};${ee.climate}盘调候忌${ee.element})`).join("、")}`:"",Ie=new Set(J.map(ee=>ee.element)),me=e.frame&&e.frame.yongshen&&e.frame.yongshen.neutral||[],Ee=me.length?` 中性偏忌:${me.map(ee=>`${ee.element} ${ee.weight} 分`).join("、")}(近零,不作实忌)`:"",Ve=e.frame?[`格局:${e.frame.primary?`${e.frame.primary.name}(${e.frame.primary.evidence})`:"—"}`,`   ${e.frame.geju.map(ee=>`${ee.name}[${ee.kind}${ee.status?`·${ee.status}`:""}]`).join(" ")}`,`用神:喜${e.frame.yongshen.favor.join("")}(${e.frame.yongshen.favorTenGods.join("、")}) 忌${e.frame.yongshen.avoid.join("")}(${e.frame.yongshen.avoidTenGods.join("、")})${je}${Ee} ${e.frame.yongshen.method}`,`   ${e.frame.yongshen.detail}`,`寒暖:${e.climate?`${e.climate.label}(${(e.climate.evidence||[]).join("、")})${e.climate.need?` 调候取${e.climate.need.stem}${e.climate.need.element} 忌${e.climate.avoidElement}${Ie.has(e.climate.avoidElement)?"(有争议)":""}`:""}`:"—"}`+(e.frame.yongshen.qt?` 穷通:${e.frame.yongshen.qt.month}${e.frame.yongshen.qt.stem}取${e.frame.yongshen.qt.yong.join("、")}(首取${e.frame.yongshen.qt.primary})`:""),`十神权重:${Object.entries(e.frame.godStats.groups).map(([ee,be])=>`${ee}${be}`).join(" ")}`]:[];return[`【四柱】${t.year.ganzhi} ${t.month.ganzhi} ${t.day.ganzhi} ${t.hour.ganzhi}`,`日主:${e.dayMaster.stem}${e.dayMaster.element}(${e.dayMaster.yinYang}) 空亡:${e.kongwang.join("")}`,a("年柱",t.year),a("月柱",t.month),a("日柱",t.day),a("时柱",t.hour),`五行:${n}`,...i?[i]:[],`日主强弱:${e.strength.level}(${e.strength.score}) ${e.strength.detail}`,...Ve,`天干关系:${e.relations&&e.relations.stems.length?e.relations.stems.join(" "):"—"}`,`地支关系:${e.relations&&e.relations.branches.length?e.relations.branches.join(" "):"—"}`,ae,`真太阳时:${e.solarTime.trueSolarText}(${e.input.geo?e.input.geo.note+";":""}${e.solarTime.note}) 晚子时:${e.input.lateZi?"23:00 后算次日":"23:00 后仍算当日"}`,`节气:上一节 ${e.jieqi.previous.name} ${e.jieqi.previous.time} 下一节 ${e.jieqi.next.name} ${e.jieqi.next.time}`,...w?[w]:[],`大运:${e.dayun.rule}(${e.dayun.direction}),${e.dayun.startAge.years}岁${e.dayun.startAge.months}个月起运${$}`,` ${d}`,`流年:${e.liunian.slice(0,10).map(ee=>`${ee.year}${ee.ganzhi}(${ee.stemTenGod})${ee.luck?`·${ee.luck.tier}`:""}`).join(" ")}`,(()=>{const ee=e.liunian.filter(Ae=>Ae.suiyun&&Ae.suiyun.signals&&Ae.suiyun.signals.length);if(!ee.length)return"岁运提示:近十年无岁运并临、运年反吟或大运/流年伏吟、反吟(只标干支,不判吉凶)";const be=Ae=>`${Ae.type}${(Ae.type.startsWith("流年")||Ae.type.startsWith("大运"))&&Ae.target?`(${Ae.target})`:""}`,Le=sn(e),tt=Le?`|古籍见《${Fe[Le.book].name}·${Le.chapter}》`:"";return"岁运提示(只标干支变动,不判吉凶):"+ee.map(Ae=>`${Ae.year}${Ae.ganzhi} ${Ae.suiyun.signals.map(be).join("/")}`).join(";")+tt})(),"(格局、用神、行运吉凶为扶抑+简化调候的量化提示,非断语。)"].join(`
70
70
  `)+j}function fn(e){const t=e.lunar.monthRaw||e.lunar.month,a=`${e.lunar.year}年${e.lunar.isLeap?`闰${t}`:e.lunar.month}月${e.lunar.day}日`+(e.lunar.isLeap&&e.lunar.month!==t?`(按${e.lunar.month}月起盘)`:""),n=(()=>{if(!e.schools)return"";const J=Object.entries({brightnessSchool:"亮度",gengYearSihua:"庚干四化",tianmaSchool:"天马",tiankongSchool:"天空",jiekongSchool:"截空",kuiyueSchool:"魁钺",tianshiTianshang:"天伤天使",changshengSchool:"长生",lateZishi:"晚子时",shenzhuSchool:"身主"}).filter(([je])=>e.schools[je]&&e.schools[je]!==te[je]).map(([je,Ie])=>`${Ie} ${e.schools[je]}`);return J.length?`【流派】${J.join(" ")}`:""})(),i=w=>w.length?w.map(J=>`${J.name}${J.mutagen?`化${J.mutagen}`:""}`).join(" "):"—",d=w=>`神煞:长生(${w.changsheng}) 博士(${w.boshi}) 将前(${w.jiangqian}) 岁前(${w.suiqi})`,$=[];for(const w of e.palaces){const J=w.isSoul?"【命】":w.isBody?"【身】":"  ";$.push(` ${w.palace} ${w.branch} ${w.ganzhi} ${J} 大限${String(w.daxian.start).padStart(2)}-${w.daxian.end} 小限${String(w.xiaoxian.age).padStart(2)} ${i(w.stars)}`),$.push(` ${d(w.shensha)}`)}const j=(e.liunian??[]).slice(0,6).map(w=>` ${w.year} ${w.ganzhi} ${String(w.age).padStart(2)}岁 命宫${w.lifePalace.branch}(${w.lifePalace.palace}) 流禄${w.liulu} 流羊${w.liuyang} 流陀${w.liutuo} | ${w.mutagen.map(J=>J.replace("化","")).join(" ")}`+(w.mutagenHits?` 四化落宫 ${w.mutagenHits.map(J=>`${J.star}${J.type}→${J.palace||"未上盘"}`).join("、")}`:"")+(w.sanfangMainStars?` 三方主星 ${w.sanfangMainStars.join("")}`:"")),X=(e.patterns??[]).length?e.patterns.map(w=>`${w.name}(${w.tone==="good"?"吉格":w.tone==="bad"?"忌格":"中"}:${w.evidence})`).join(";"):"无明显格局(按内置规则)",ae=(e.daxianList??[]).slice(0,8).map(w=>` ${w.branch}宫(${w.palace})${w.ages[0]}-${w.ages[1]}岁 ${w.ganzhi} 会${w.mainStars.join("")||"—"} 化 ${w.mutagenHits.map(J=>`${J.star}${J.type}→${J.palace||"未上盘"}`).join("、")}`),z=(()=>{const w=e.flyChains;if(!w)return"";const J=Ie=>{const me=w[Ie];return!me||!me.steps.length?"":`${Ie}:${me.path.join("→")}${me.closed?"(成环)":""}`},je=["禄","权","科","忌"].map(J).filter(Boolean).join(" ");return je?`【命宫飞星】${je}`:""})(),V=(()=>{const w=e.flyComposite;if(!w||!Array.isArray(w.sources)||!w.sources.length)return"";const J=w.labels.length?w.labels.join(" · "):"无同宫会聚",je=["禄","权","科","忌"].map(Ie=>{const me=(w.byType&&w.byType[Ie]||[]).filter(Ve=>!Ve.self),Ee=[...new Set(me.map(Ve=>String(Ve.to).replace(/宫$/,"")))];return Ee.length?`${Ie}→${Ee.join("/")}`:""}).filter(Boolean).join(" ");return`【三方四正飞化】${w.sanfang.join("·")}:${J}${je?` ${je}`:""}`})();return[`【农历】${a}(月首 ${e.lunar.monthStart}) 时支:${e.hourBranch} 年干支:${e.yearGanzhi}`,`【时刻】${e.solarTime?`${e.solarTime.civilText} → 真太阳时 ${e.solarTime.trueSolarText}${e.input.geo?"("+e.input.geo.note+")":""}`:""}`,`【命宫】${e.soul.branch}(${e.soul.ganzhi}·${e.soul.nayin}) 【身宫】${e.body.branch}(落${e.body.lands}) 【五行局】${e.bureau.name}`,`【紫微】${e.ziwei} 【天府】${e.tianfu} 【命主】${e.lifeMaster} 【身主】${e.bodyMaster}${e.bodyMasterNote?`(${e.bodyMasterSchool==="common"?"子午皆火星":"子铃午火"})`:""}`,`【大限】${e.daxian.rule},${e.daxian.startAge}岁起 【小限】${e.xiaoxianRule.direction}`,n,`【昌曲】文昌${e.changqu.wenchang.branch}(${e.changqu.wenchang.palace}${e.changqu.wenchang.mutagen?"·化"+e.changqu.wenchang.mutagen:""}) 文曲${e.changqu.wenqu.branch}(${e.changqu.wenqu.palace}${e.changqu.wenqu.mutagen?"·化"+e.changqu.wenqu.mutagen:""})`,`   ${e.changqu.relation} 入命三方:${e.changqu.inSoulSanfang?"是":"否"} 吸收面:${e.changqu.absorb.label}(${e.changqu.absorb.reason})`,z,V,"十二宫:",...$,"大限(按起运年龄排序,前 8 限,宫干四化落宫):",...ae,"流年(前 6 年,完整 12 年在结构化数据里):",...j,`【格局】${X}`,e.patternSummary?`【结构统计】吉格 ${e.patternSummary.good.length}、中性 ${e.patternSummary.neutral.length}、忌格 ${e.patternSummary.bad.length}${e.patternSummary.broken.length?`、破格 ${e.patternSummary.broken.length}(${e.patternSummary.broken.join("、")})`:""};${e.patternSummary.note}`:"",e.lunar.note?`注:${e.lunar.note}`:""].filter(Boolean).join(`
71
71
  `)}const un=["旺","相","休","囚","死"];function jn(e){const t=e.states,a=e.month;if(!t||!a)return"无月令数据";const n=i=>un.filter(d=>i&&Array.isArray(i[d])&&i[d].length).map(d=>`${d} ${i[d].join("/")}`).join(" ");return`月令 ${a.branch}(${a.element}) 门 ${n(t.gate)||"—"} 星 ${n(t.star)||"—"} 干 ${n(t.stem)||"—"}`}function wn(e){const t=e.palaces,a=n=>`${n.palace}宫 ${n.star||"—"}/${n.gate||"—"}/${n.god||"—"}${n.kong?" 空":""}${n.ma?" 马":""}`;return[`【四柱】${e.siZhu.year} ${e.siZhu.month} ${e.siZhu.day} ${e.siZhu.time}`,`【局数】${e.ju} 节气 ${e.jieqi}(${e.jieqiTime})`,`【值符】${e.zhiFu.star}(${e.zhiFu.gong}宫) 【值使】${e.zhiShi.gate}(${e.zhiShi.gong}宫) 旬首 ${e.xunshou}`,`【空亡】${e.kongWang.join("")||"—"} 驿马 ${e.ma.zhi||"—"}(${e.ma.gong||"—"}宫)`,`【宫位条件】击刑 ${(e.conditions&&e.conditions.jiXing||[]).map(n=>`${n.palace}宫${n.stem}`).join("、")||"无"} 三奇入墓 ${(e.conditions&&e.conditions.ruMu||[]).map(n=>`${n.palace}宫${n.stem}`).join("、")||"无"} 六仪入墓 ${(e.conditions&&e.conditions.liuYiRuMu||[]).map(n=>`${n.palace}宫${n.stem}`).join("、")||"无"}`,`【十干克应】${[...t,e.centerPalace].filter(n=>n&&n.ganYing).map(n=>`${n.palace}宫 ${n.ganYing.tian}加${n.ganYing.di} ${n.ganYing.name}`).join(" ")||"—"}`,`【旺衰】${jn(e)}`,`【九宫】${t.map(a).join(" ")}`,`※ 晚子时:${e.lateZiHourMode==="next-day"?"23:00 后归次日":"23:00 后仍归当日"}(可用 lateZiHourMode / lateZi 指定)`,`※ ${e.rules[e.rules.length-1]}`].join(`
72
72
  `)}function gn(e){if(!e||!Array.isArray(e.pairs)||!e.pairs.length)return[];const t=["【三方合盘】三对两两并列,不合成「三人总分」",...e.pairs.map(a=>`· ${a.a}–${a.b}:${a.level||"—"}(${a.total==null?"—":`${a.total}/100`})`)];return e.best&&(e.spread>=3?t.push(` 最顺:${e.best.a}–${e.best.b}(${e.best.total}/100)`+(e.hardest?`;最需磨合:${e.hardest.a}–${e.hardest.b}(${e.hardest.total}/100)`:"")):t.push(` 三对分数接近(最高与最低相差 ${e.spread} 分),不排名`)),e.focus&&e.focus.spread>=3&&t.push(` 差异最大的一维:${e.focus.label}(三对相差 ${e.focus.spread} 分)`),e.note&&t.push(`※ ${e.note}`),t}function Nn(e){if(e.chart==="ziwei"){const n=i=>`${i.label}:${i.score>=0?"+":""}${i.score} ${i.text}`;return[`【紫微合盘】${e.score.level}(${e.score.total}/100)`,`你 命宫 ${e.a.soul.branch}(${e.a.soulStars.join("、")||"无主星"}) 夫妻 ${e.a.spouseStars.join("、")||"无主星"} ${e.a.bureau}`,`对方 命宫 ${e.b.soul.branch}(${e.b.soulStars.join("、")||"无主星"}) 夫妻 ${e.b.spouseStars.join("、")||"无主星"} ${e.b.bureau}`,...e.dimensions.map(n),...e.interactions.map(i=>` · ${i.text}`),...gn(e.triple),...e.notes.map(i=>`※ ${i}`)].join(`
@@ -83,7 +83,8 @@ ${n.summary}`),n&&(n.system==="bazi"||n.system==="ziwei")&&n.input&&n.input.long
83
83
  ${n.summary}`),t.withInterpret&&(n.interpret=Q(n,{question:typeof t.question=="string"?t.question:"",direction:typeof t.direction=="string"?t.direction:"general"})),t.cross===!0&&(n.system==="bazi"||n.system==="ziwei")){const d={...ne(t.datetime),gender:ye(t.gender),longitude:typeof t.longitude=="number"?t.longitude:void 0,address:typeof t.address=="string"?t.address:void 0,geo:t.geo&&typeof t.geo=="object"?t.geo:void 0,trueSolar:t.trueSolar!==!1,dst:t.dst!==!1},$=Qe(t.asOf),j=n.system==="bazi"?g({...d,leapMonth:t.leapMonth,leapAsNext:t.leapAsNext===!0,...Ue(t),asOf:$}):R({...d,lateZi:t.lateZi!==!1,nowYear:$?$.year:void 0});n.cross=xe(n.system==="bazi"?n:j,n.system==="ziwei"?n:j),n.interpret&&n.interpret.sections.push(Re(n.cross))}if(Number.isInteger(t.verifyPast)&&t.verifyPast>0&&n.system==="bazi"){const i=Math.min(Math.max(t.verifyPast,1),10),d=Number(n.liunianFrom)-i,$=R({...ne(t.datetime),gender:ye(t.gender),lateZi:t.lateZi!==!1,trueSolar:t.trueSolar!==!1,longitude:typeof t.longitude=="number"?t.longitude:void 0,address:typeof t.address=="string"?t.address:void 0,geo:t.geo&&typeof t.geo=="object"?t.geo:void 0,dst:t.dst!==!1,nowYear:d});n.past={rows:De($,Number(n.liunianFrom)-1),years:i,until:Number(n.liunianFrom)-1}}if(t.rectify===!0&&n.system==="bazi"){const i=ne(t.datetime);n.rectify=Be({base:{year:i.year,month:i.month,day:i.day,minute:i.minute},gender:ye(t.gender),events:Array.isArray(t.events)?t.events:[],hours:Array.isArray(t.rectifyHours)?t.rectifyHours:void 0,lateZi:t.lateZi!==!1,trueSolar:t.trueSolar!==!1,dst:t.dst!==!1,longitude:typeof t.longitude=="number"?t.longitude:void 0,address:typeof t.address=="string"?t.address:void 0,geo:t.geo&&typeof t.geo=="object"?t.geo:void 0})}if(typeof t.ask=="string"&&t.ask.trim()&&(n.followup=he(n,t.ask)),t.trace===!0)try{const i=fe(n,{direction:t.direction,gender:t.gender});i&&(n.trace=i,n.traceText=le(i,{system:n.system}))}catch(i){n.traceError=String(i&&i.message||i)}if(t.shadow===!0)try{n.shadow=pn(t,{result:n,version:t.shadowVersion})}catch(i){n.shadow={error:String(i&&i.message||i)}}try{const i=Ne(t);i&&(n.handle=i)}catch(i){n.handleError=String(i&&i.message||i)}return n}function Sn(e){if(!e)return"";const t=[`【${e.title||"解析与详解"}】${e.ask&&e.ask.echo?e.ask.echo:""}`];e.answer&&t.push(`▶ ${e.ask&&e.ask.question?"先答所问":"先看结论"}:${e.answer}`),e.plain&&t.push(`▶ 说人话:${e.plain}`),e.lead&&t.push(e.lead),Array.isArray(e.outline)&&e.outline.length&&t.push("一页读懂:"+e.outline.map(a=>`${a.label}·${a.text}`).join(" ")),e.error&&t.push(`⚠ 解析生成失败:${e.error}(上方盘面数据本身可用)`);for(const a of e.dimensions||[]){const n=Array.isArray(a.evidence)&&a.evidence.length?`
84
84
   依据:${a.evidence.join(";")}${a.confidence?` 置信度:${a.confidence}`:""}`:"",i=a.plain?`(${a.plain})`:"",d=(a.knowledge||[]).map($=>`
85
85
   规则·${$.gist}〔${$.statusLabel}〕${$.detail} 出处:${$.source}${$.note?` 注:${$.note}`:""}`).join("");t.push(`${a.label}:${i}${a.text}${a.advice?` 建议:${a.advice}`:""}${n}${d}`)}for(const a of e.sections||[])t.push(`${a.label}:${a.text}`);for(const a of e.tables||[])!Array.isArray(a.rows)||!a.rows.length||(t.push(`【${a.title}】`),t.push([a.columns.join(" | "),...a.rows.map(n=>n.join(" | "))].join(`
86
- `)));return Array.isArray(e.followups)&&e.followups.length&&t.push("还可以这样追问:"+e.followups.map(a=>`「${a}」`).join(" ")),Array.isArray(e.glossary)&&e.glossary.length&&t.push("名词解释:"+e.glossary.map(a=>`${a.term}=${a.plain}`).join(" ")),e.disclaimer&&t.push(e.disclaimer),t.join(`
86
+ `)));return Array.isArray(e.followups)&&e.followups.length&&t.push("还可以这样追问:"+e.followups.map(a=>`「${a}」`).join(" ")),Array.isArray(e.glossary)&&e.glossary.length&&t.push("名词解释:"+e.glossary.map(a=>`${a.term}=${a.plain}`).join(" ")),Array.isArray(e.limits)&&e.limits.length&&t.push("【本插件不回答什么】"+e.limits.map(a=>`${a.title}——${a.text}`).join(`
87
+ `)),e.disclaimer&&t.push(e.disclaimer),t.join(`
87
88
  `)}const Dn=["cross","verifyPast","withInterpret","question","direction","ask","geocode","rectify","events","shadow","trace"];function Yn(e={},t={}){const a=t.system||e.system,n=t.switches||Y[a]||[];if(!n.length)return{system:a,switches:[],affected:0,total:0};const i={...e};for(const $ of Dn)delete i[$];const d=n.map($=>{const j=$.read(i),X=$.alt(j);let ae=[],z="",V=null,w=null;try{V=$n({...i,[$.key]:j}),w=$n({...i,[$.key]:X}),ae=rn(V,w)}catch(me){z=me&&me.message||String(me)}const J=cn(ae.filter(me=>k(me.path))).map(me=>({path:me.path,label:s(me.path),from:x(me.from),to:x(me.to)})),je=new Map;for(const me of ae){const Ee=E(me.path)||"其他";je.set(Ee,(je.get(Ee)||0)+1)}const Ie=[...je.entries()].map(([me,Ee])=>({name:me,count:Ee})).sort((me,Ee)=>Ee.count-me.count||me.name.localeCompare(Ee.name,"zh-Hans-CN"));return{key:$.key,title:$.title,short:$.short,current:j,alt:X,currentLabel:$.label(j),altLabel:$.label(X),total:ae.length,summary:z?"":ln(ae),views:z?[]:F(a,V,w),roots:J,categories:Ie,error:z}});return{system:a,switches:d,affected:d.filter($=>!$.error&&$.total>0).length,total:d.reduce(($,j)=>$+j.total,0)}}const Ln=["chaibu","chaoshen","zhirun"],Pn=[1,3,5],Rn=["same-day","next-day"];function Qe(e){if(e==null||e==="")return;const t=U(e);if(!t)throw B("E_ASOF",`无法解析 asOf:「${e}」,请用 2026-10-22T16:00 这种格式`);const{year:a,month:n,day:i}=t;if(!(n>=1&&n<=12)||!(i>=1&&i<=ke(a,n)))throw B("E_ASOF",`asOf 指向的日期不存在:${e}`);return t}function qn(e={}){const t=e.system;if(t==="bazi"){const a=ne(e.datetime),n=Qe(e.asOf),i=R({...a,gender:ye(e.gender),longitude:typeof e.longitude=="number"?e.longitude:void 0,address:typeof e.address=="string"?e.address:void 0,geo:e.geo&&typeof e.geo=="object"?e.geo:void 0,lateZi:e.lateZi!==!1,trueSolar:e.trueSolar!==!1,dst:e.dst!==!1,nowYear:n?n.year:void 0});return{...i,...n?{asOf:n}:{},precision:a.precision,summary:Te(i)}}if(t==="ziwei"){const a=ne(e.datetime),n=Qe(e.asOf),i=g({...a,gender:ye(e.gender),leapMonth:e.leapMonth,leapAsNext:e.leapAsNext===!0,...Ue(e),longitude:typeof e.longitude=="number"?e.longitude:void 0,address:typeof e.address=="string"?e.address:void 0,geo:e.geo&&typeof e.geo=="object"?e.geo:void 0,trueSolar:e.trueSolar,dst:e.dst!==!1,asOf:n});return{...i,precision:a.precision,summary:fn(i)}}if(t==="tarot"){const a=e.count===void 0||e.count===null||e.count===""?3:Number(e.count);if(!Pn.includes(a))throw B("E_COUNT",`塔罗张数只能是 1 / 3 / 5,收到「${e.count}」`);if(!$e(e.seed))throw B("E_INPUT",`seed 必须是数字,收到「${e.seed}」`);const n=Qe(e.asOf),i=y({count:a,question:e.question,at:e.asOf,random:de(e.seed)});return e.seed!==void 0&&e.seed!==null&&e.seed!==""&&(i.seed=Number(e.seed)),{...i,...n?{asOf:n}:{},summary:An(i)}}if(t==="daliuren"){const a=ne(e.datetime),n=e.lateZi!==!1,i=l({...a,lateZi:n});return i.lateZi=n,{...i,precision:a.precision,summary:kn(i)}}if(t==="qimen"){const a=ne(e.datetime);if(e.juMethod!==void 0&&!Ln.includes(e.juMethod))throw B("E_INPUT",`juMethod 只能是 chaibu / chaoshen / zhirun,收到「${e.juMethod}」`);const n=e.lateZiHourMode!==void 0?e.lateZiHourMode:e.lateZi===!0?"next-day":e.lateZi===!1?"same-day":void 0;if(n!==void 0&&!Rn.includes(n))throw B("E_INPUT",`lateZiHourMode 只能是 same-day / next-day,收到「${n}」`);const i=n==="next-day"?"next-day":"same-day",d=c({...a,lateZiHourMode:i,juMethod:e.juMethod});return d.lateZiHourMode=i,{...d,summary:wn(d)}}if(t==="hepan"){const a=e.partner;if(!a||typeof a!="object")throw B("E_PARTNER","合盘需要 partner:{ datetime, gender, address? },其中 partner.datetime 是对方的公历出生时间");if(!a.datetime)throw B("E_PARTNER",'缺少 partner.datetime(对方的公历出生时间),例如 partner: {"datetime":"1992-03-03T10:00","gender":"female"}');const n=e.partner2;if(n!=null){if(typeof n!="object"||Array.isArray(n))throw B("E_PARTNER","partner2 需要 { datetime, gender, address? };不想看三方就整段省略(null 视同未传)");if(!n.datetime)throw B("E_PARTNER",'缺少 partner2.datetime(第三方的公历出生时间),例如 partner2: {"datetime":"1988-09-09T08:00","gender":"male"}')}const i=e.chart==="ziwei"?"ziwei":"bazi",d=(z,V)=>({...ne(z.datetime),gender:ye(z.gender,V),trueSolar:z.trueSolar,lateZi:z.lateZi,dst:z.dst!==!1,address:typeof z.address=="string"?z.address:void 0,longitude:typeof z.longitude=="number"?z.longitude:void 0,geo:z.geo&&typeof z.geo=="object"?z.geo:void 0}),$=d(e,"你(主方)"),j=d(a,"对方"),X=(z,V)=>i==="ziwei"?r({a:z,b:V}):f({a:z,b:V}),ae=X($,j);if(n){const z=d(n,"第三方");ae.triple=o([{key:"a-b",a:"你",b:"对方",result:ae},{key:"a-c",a:"你",b:"第三方",result:X($,z)},{key:"b-c",a:"对方",b:"第三方",result:X(j,z)}])}return{...ae,summary:Nn(ae)}}if(t==="meihua"){let a;try{a=N({mode:e.mode==="number"?"number":"time",datetime:e.datetime,upper:e.upper,lower:e.lower,changing:e.changing})}catch(n){throw B("E_INPUT",`梅花起卦参数不完整:${n&&n.message?n.message:n}`)}return{...a,summary:Tn(a)}}if(t==="liuyao"){if(!$e(e.seed))throw B("E_INPUT",`seed 必须是数字,收到「${e.seed}」`);let a;if(e.lines===void 0||e.lines===null)a=H(de(e.seed));else{if(!Array.isArray(e.lines))throw B("E_LINES","lines 必须是数组:自下而上 6 个爻值(6 老阴 / 7 少阳 / 8 少阴 / 9 老阳)");if(e.lines.length!==6)throw B("E_LINES",`六爻需要正好 6 个爻值(自下而上),收到 ${e.lines.length} 个;留空则由引擎随机摇卦`);a=e.lines.map(Number)}let n,i=null;const d=e.datetime?ne(e.datetime):Qe(e.asOf);if(d){e.datetime||(i=d);const V=oe(ie(A(d.year,d.month,d.day)));n={stem:V.stem,branch:V.branch,name:V.name}}let $;try{$=q({lines:a,question:e.question,dayGanZhi:n})}catch(V){throw B("E_LINES",V&&V.message?V.message:V)}const j=L($,{direction:e.direction,gender:e.gender});j.liuqin&&($.useGod=j);let X=null;if(d)try{X=(u({year:d.year,month:d.month,day:d.day,hour:d.hour,minute:d.minute}).monthGanZhi||"")[1]||null}catch{X=null}const ae=G($,{monthBranch:X,dayBranch:$.dayGanZhi.branch});ae&&($.hexStrength=ae);const z=h($,{monthBranch:X,dayBranch:$.dayGanZhi.branch});if(z&&($.jinTuiPower=z),j.liuqin){const V=T($,j,{monthBranch:X,dayBranch:$.dayGanZhi.branch});V&&($.useGodStrength=V);const w=b($,j,{monthBranch:X,dayBranch:$.dayGanZhi.branch});w&&($.fushenAccess=w);const J=m($,j,{monthBranch:X});J&&($.yingqi=J)}return e.seed!==void 0&&e.seed!==null&&e.seed!==""&&($.seed=Number(e.seed)),{...$,...i?{asOf:i}:{},summary:En($)}}if(t==="almanac"){const a=ne(e.datetime),n=en({year:a.year,month:a.month,day:a.day});return{...n,summary:Gn(n)}}if(t==="zeri"){if(!(e.candidates!==void 0&&e.candidates!==null)&&(typeof e.startDate!="string"||!e.startDate.trim()))throw B("E_INPUT",'择日需要 startDate(公历 YYYY-MM-DD,起算日);可另给 days(1–60,默认 30)与 shengXiao(当事人属相)。只想比几天,改给 candidates: ["2026-12-01","2026-12-08"]');let n;try{n=Ge({task:e.task,startDate:e.startDate,days:e.days,shengXiao:e.shengXiao,candidates:e.candidates})}catch(i){throw B("E_INPUT",i&&i.message||String(i))}return{...n,summary:Un(n)}}if(t==="chenggu"){const a=ne(e.datetime),n=/[T\s]\d{1,2}:\d{1,2}/.test(String(e.datetime)),i=Number.isInteger(e.hour)?e.hour:n?a.hour:null;if(i===null||i<0||i>23)throw B("E_INPUT","称骨必须给时辰:datetime 带时分(如 1990-08-15T10:00),或额外给 hour(0–23)——缺时辰四柱不齐");const d=Ye({year:a.year,month:a.month,day:a.day,hour:i,minute:n?a.minute:0});return{...d,summary:Zn(d)}}if(t==="convert"){const a=e.mode==="lunar2solar"?"lunar2solar":"solar2lunar";let n;if(a==="lunar2solar"){if(e.lunarYear==null||e.lunarMonth==null||e.lunarDay==null)throw B("E_INPUT","农历转公历需要 lunarYear / lunarMonth / lunarDay(闰月另加 isLeapMonth: true)");n=He({mode:a,lunarYear:Number(e.lunarYear),lunarMonth:Number(e.lunarMonth),lunarDay:Number(e.lunarDay),isLeapMonth:e.isLeapMonth===!0})}else{const i=ne(e.datetime);n=He({mode:a,year:i.year,month:i.month,day:i.day})}return{...n,summary:Bn(n)}}if(t==="xiaoliuren"){const a=e.datetime?ne(e.datetime):null,n=Je({mode:e.mode==="number"?"number":"time",date:typeof e.date=="string"&&e.date.trim()?e.date:a?`${a.year}-${a.month}-${a.day}`:void 0,hour:Number.isInteger(e.hour)?e.hour:a&&/[T\s]\d{1,2}:\d{1,2}/.test(String(e.datetime))?a.hour:void 0,num1:e.num1,num2:e.num2,num3:e.num3,question:e.question});return{...n,summary:Hn(n)}}if(t==="star"){const a=ne(e.datetime),n=Xe({year:a.year,month:a.month,day:a.day});return{...n,summary:Fn(n)}}if(t==="numerology"){const a=ne(e.datetime),n=We({year:a.year,month:a.month,day:a.day});return{...n,summary:Jn(n)}}if(t==="mbti"){if(e.answers===void 0||e.answers===null){const n=tn();return{...n,summary:Wn(n)}}const a=nn({answers:e.answers});return{...a,summary:Xn(a)}}if(t==="trend"){const a=ne(e.datetime),n=P({...a,gender:ye(e.gender),toAge:e.toAge,lateZi:e.lateZi!==!1,trueSolar:e.trueSolar!==!1,dst:e.dst!==!1,longitude:typeof e.longitude=="number"?e.longitude:void 0,address:typeof e.address=="string"?e.address:void 0,geo:e.geo&&typeof e.geo=="object"?e.geo:void 0});return{...n,precision:a.precision,summary:Kn(n)}}if(t==="fengshui"){const a=e.action==="advise"?"advise":e.action==="xuankong"?"xuankong":"natal";if(a==="xuankong"){const d=se({action:a,sitting:e.sitting,facing:e.facing,...e.period!==void 0?{period:e.period}:{},...Number.isInteger(e.fortuneYear)?{fortuneYear:e.fortuneYear}:{},...typeof e.sittingOffset=="number"?{sittingOffset:e.sittingOffset}:{},...typeof e.sittingDegree=="number"?{sittingDegree:e.sittingDegree}:{},...typeof e.facingOffset=="number"?{facingOffset:e.facingOffset}:{},...typeof e.facingDegree=="number"?{facingDegree:e.facingDegree}:{},...typeof e.fortuneDate=="string"?{fortuneDate:e.fortuneDate}:{},...typeof e.fortuneTime=="string"?{fortuneTime:e.fortuneTime}:{},dst:e.dst!==!1});return{...d,summary:yn(d)}}if(a==="advise"){const d=se({action:a,sitting:e.sitting,facing:e.facing,...e.datetime?ne(e.datetime):{},...e.gender==="male"||e.gender==="female"?{gender:e.gender}:{},dst:e.dst!==!1});return{...d,summary:yn(d)}}const n=ne(e.datetime),i=se({action:"natal",year:n.year,month:n.month,day:n.day,gender:ye(e.gender),fortuneYear:Number.isInteger(e.fortuneYear)?e.fortuneYear:void 0,dst:e.dst!==!1});return{...i,summary:yn(i)}}if(t==="name"){const a=e.action==="generate"?"generate":"assess",n=e.datetime?ne(e.datetime):Number.isInteger(e.year)&&Number.isInteger(e.month)&&Number.isInteger(e.day)?{year:e.year,month:e.month,day:e.day,...Number.isInteger(e.hour)?{hour:e.hour}:{},...Number.isInteger(e.minute)?{minute:e.minute}:{}}:{},i=ue({action:a,surname:e.surname,givenName:e.givenName,limit:e.limit,charElements:e.charElements&&typeof e.charElements=="object"?e.charElements:void 0,strokeOverrides:e.strokeOverrides&&typeof e.strokeOverrides=="object"?e.strokeOverrides:void 0,surnameStrokes:e.surnameStrokes&&typeof e.surnameStrokes=="object"?e.surnameStrokes:void 0,...n,...e.gender==="male"||e.gender==="female"?{gender:e.gender}:{},...e.datetime?{lateZi:e.lateZi!==!1,trueSolar:e.trueSolar!==!1,dst:e.dst!==!1,longitude:typeof e.longitude=="number"?e.longitude:void 0,address:typeof e.address=="string"?e.address:void 0,geo:e.geo&&typeof e.geo=="object"?e.geo:void 0}:{}});return{...i,summary:Qn(i)}}throw t?B("E_SYSTEM",`未知体系「${t}」,可选:bazi(四柱八字)、ziwei(紫微斗数)、liuyao(六爻)、meihua(梅花易数)、daliuren(大六壬)、qimen(奇门遁甲)、hepan(合盘)、tarot(塔罗)、almanac(黄历)、zeri(择日)、chenggu(称骨)、xiaoliuren(小六壬)、star(星座)、numerology(生命数字)、mbti(十六型人格问卷)、trend(人生 K 线)、fengshui(风水)、name(起名)、convert(公农历互转)。`):B("E_INPUT","缺少 system,可选:bazi(四柱八字)、ziwei(紫微斗数)、liuyao(六爻)、meihua(梅花易数)、daliuren(大六壬)、qimen(奇门遁甲)、hepan(合盘)、tarot(塔罗)、almanac(黄历)、zeri(择日)、chenggu(称骨)、xiaoliuren(小六壬)、star(星座)、numerology(生命数字)、mbti(十六型人格问卷)、trend(人生 K 线)、fengshui(风水)、name(起名)、convert(公农历互转)。")}function Gn(e){const t=e.ganzhi,a=e.jieQi&&e.jieQi.next?` 下一节:${e.jieQi.next.name} ${e.jieQi.next.date}`:"",n=e.dayGod?`值日:${e.dayGod.name}(${e.dayGod.type}·${e.dayGod.luck})`:"",i=e.xiu?`二十八宿:${e.xiu.name}宿(${e.xiu.luck}·${e.xiu.zheng}·${e.xiu.animal})`:"",d=e.taiShen?`胎神:${e.taiShen}`:"",$=e.positions?`吉神方位:喜神${e.positions.xiShen||"—"} 财神${e.positions.caiShen||"—"} 福神${e.positions.fuShen?e.positions.fuShen.dir:"—"} 阳贵${e.positions.yangGui?e.positions.yangGui.dir:"—"} 阴贵${e.positions.yinGui?e.positions.yinGui.dir:"—"}`:"",j=e.lucky?`吉配生肖:六合${e.lucky.liuhe||"—"} 三合${(e.lucky.sanhe||[]).join("、")||"—"}`:"",X=e.nayin&&e.nayin.day?`日柱纳音:${e.nayin.day.name}`:"",ae=(e.hours||[]).map(z=>`${z.zhi}${z.ganZhi.slice(0,1)}·${z.shen}${z.luck==="吉"?"吉":"凶"}`).join(" ");return[`【黄历】${e.meta.date} ${e.meta.weekday} ${e.lunar.text}`,`干支:${t.year}年 ${t.month}月 ${t.day}日 属${t.shengXiao}`,...e.meta.boundaryNote?[` ${e.meta.boundaryNote}`]:[],`建除:${e.zhiXing}日 冲:${e.chong.text}${e.chong.sha?`(${e.chong.sha})`:""} ${n}`,[i,X,d].filter(Boolean).join(" "),`宜:${e.yi.join("、")}`,`忌:${e.ji.join("、")}`,$,j,ae?`时辰吉凶:${ae}`:"",`节气:上一节 ${e.jieQi.prev?`${e.jieQi.prev.name} ${e.jieQi.prev.date}`:"—"}${a}`,e.dailyHexagram?`每日一卦:${e.dailyHexagram.name} ${e.dailyHexagram.meaning||""}`:"",`口径:${e.meta.scope}`].filter(Boolean).join(`
88
89
  `)}function Un(e){const t=e.compare&&e.compare.mode==="candidates",a=t?`【择日·${e.meta.task}】候选 ${e.meta.days} 天:${e.meta.candidates.join("、")}${e.meta.shengXiao?` 当事人属${e.meta.shengXiao}`:"(未给属相,未做冲煞排除)"}`:`【择日·${e.meta.task}】${e.meta.startDate} 起 ${e.meta.days} 天${e.meta.shengXiao?` 当事人属${e.meta.shengXiao}`:"(未给属相,未做冲煞排除)"}`,n=e.days.slice().sort((d,$)=>$.score-d.score).slice(0,t?12:5).map(d=>`· ${d.date} ${d.weekday} ${d.verdict}(${d.score}分) 宜${d.yi.slice(0,3).join("/")} ${d.reasons.join(";")||"无特别加减分"}`),i=t?e.compare.best?`这一组里最优:${e.compare.best.date}(${e.compare.best.score}分,${e.compare.best.verdict})`+(e.compare.best.ties.length>1?`;同分:${e.compare.best.ties.filter(d=>d!==e.compare.best.date).join("、")}`:""):"这一组都因冲属相被排除,没有可用的日子":`推荐日:${e.best.length?e.best.join("、"):"本期无(都不够推荐分)"}`;return[a,i,`推荐日:${e.best.length?e.best.join("、"):"无"}`,`可用日:${e.usable.length?e.usable.join("、"):"无"}`,`回避日:${e.avoid.length?e.avoid.slice(0,6).join("、"):"无"}`,t?"候选日逐日:":"逐日排序:",...n,...t?[`比较口径:${e.compare.note}`]:[],`口径:${e.meta.scope}`].join(`
89
90
  `)}function Zn(e){const t=e.song||{};return[`【称骨】${e.input.solar} ${e.lunar.text}`,`四项:${e.weights.year.label} ${e.weights.month.label} ${e.weights.day.label} ${e.weights.hour.label}`,`合计:${e.total.label}(${e.verdict.band})`,`歌诀(${e.total.label}):${t.text||"—"}`,`释义:${t.plain||"—"}`,`分档白话:${e.verdict.text}`,"口径:骨重与歌诀为通行本口径(各版本歌诀有异文),释义为白话自撰,属民俗娱乐参考。"].join(`
@@ -130,4 +131,4 @@ ${n.answer}${n.evidence&&n.evidence.length?`
130
131
  `)+`
131
132
  ${n.note}`)}return a.filter(Boolean).join(`
132
133
 
133
- `)}return{interpret:Q,DIRECTIONS:K,DIRECTION_DEFAULT:re,BRIGHTNESS:p,flowOf:C,geocodeAddress:S,resolveAddress:M,buildBazi:R,buildLiuyao:q,tossLines:H,followup:he,askPrompt:pe,pastSignals:De,verifyFit:qe,rectifyBirth:Be,crossCheck:xe,crossText:Ze,crossSection:Re,buildAlmanac:en,buildZeri:Ge,buildChenggu:Ye,buildXiaoliuren:Je,buildStar:Xe,buildNumerology:We,buildConvert:He,buildTrend:P,buildFengshui:se,buildName:ue,buildTrace:fe,traceMarkdown:le,encodeHandle:Ne,decodeHandle:ge,resolveHandle:we,askLink:Me,parseAskLink:Pe,formOf:_e,restNote:ze,askPackages:I,parseDateTime:ne,chartFingerprint:pn,shadowSnapshot:vn,shadowDiff:Cn,compute:$n,interpretText:Sn,caliberCompare:Yn,renderText:Vn}})(),{Engine:_.index}}});
134
+ `)}const{buildEventPrompt:et,ASK_KINDS:nt}=I["event-prompt"]||{};return{interpret:Q,DIRECTIONS:K,DIRECTION_DEFAULT:re,BRIGHTNESS:p,flowOf:C,geocodeAddress:S,resolveAddress:M,buildBazi:R,buildLiuyao:q,tossLines:H,followup:he,askPrompt:pe,pastSignals:De,verifyFit:qe,rectifyBirth:Be,crossCheck:xe,crossText:Ze,crossSection:Re,buildAlmanac:en,buildZeri:Ge,buildChenggu:Ye,buildXiaoliuren:Je,buildStar:Xe,buildNumerology:We,buildConvert:He,buildTrend:P,buildFengshui:se,buildName:ue,buildTrace:fe,traceMarkdown:le,encodeHandle:Ne,decodeHandle:ge,resolveHandle:we,askLink:Me,parseAskLink:Pe,formOf:_e,restNote:ze,askPackages:_,buildEventPrompt:et,ASK_KINDS:nt,parseDateTime:ne,chartFingerprint:pn,shadowSnapshot:vn,shadowDiff:Cn,compute:$n,interpretText:Sn,caliberCompare:Yn,renderText:Vn}})(),{Engine:I.index}}});