(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,16015,(e,t,a)=>{},98547,(e,t,a)=>{var s=e.i(47167);e.r(16015);var r=e.r(71645),n=r&&"object"==typeof r&&"default"in r?r:{default:r},o=void 0!==s.default&&s.default.env&&!0,l=function(e){return"[object String]"===Object.prototype.toString.call(e)},i=function(){function e(e){var t=void 0===e?{}:e,a=t.name,s=void 0===a?"stylesheet":a,r=t.optimizeForSpeed,n=void 0===r?o:r;c(l(s),"`name` must be a string"),this._name=s,this._deletedRulePlaceholder="#"+s+"-deleted-rule____{}",c("boolean"==typeof n,"`optimizeForSpeed` must be a boolean"),this._optimizeForSpeed=n,this._serverSheet=void 0,this._tags=[],this._injected=!1,this._rulesCount=0;var i="u">typeof window&&document.querySelector('meta[property="csp-nonce"]');this._nonce=i?i.getAttribute("content"):null}var t,a=e.prototype;return a.setOptimizeForSpeed=function(e){c("boolean"==typeof e,"`setOptimizeForSpeed` accepts a boolean"),c(0===this._rulesCount,"optimizeForSpeed cannot be when rules have already been inserted"),this.flush(),this._optimizeForSpeed=e,this.inject()},a.isOptimizeForSpeed=function(){return this._optimizeForSpeed},a.inject=function(){var e=this;if(c(!this._injected,"sheet already injected"),this._injected=!0,"u">typeof window&&this._optimizeForSpeed){this._tags[0]=this.makeStyleTag(this._name),this._optimizeForSpeed="insertRule"in this.getSheet(),this._optimizeForSpeed||(o||console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode."),this.flush(),this._injected=!0);return}this._serverSheet={cssRules:[],insertRule:function(t,a){return"number"==typeof a?e._serverSheet.cssRules[a]={cssText:t}:e._serverSheet.cssRules.push({cssText:t}),a},deleteRule:function(t){e._serverSheet.cssRules[t]=null}}},a.getSheetForTag=function(e){if(e.sheet)return e.sheet;for(var t=0;ttypeof window?this.getSheet():this._serverSheet;if(t.trim()||(t=this._deletedRulePlaceholder),!a.cssRules[e])return e;a.deleteRule(e);try{a.insertRule(t,e)}catch(s){o||console.warn("StyleSheet: illegal rule: \n\n"+t+"\n\nSee https://stackoverflow.com/q/20007992 for more info"),a.insertRule(this._deletedRulePlaceholder,e)}}else{var s=this._tags[e];c(s,"old rule at index `"+e+"` not found"),s.textContent=t}return e},a.deleteRule=function(e){if("u"typeof window?(this._tags.forEach(function(e){return e&&e.parentNode.removeChild(e)}),this._tags=[]):this._serverSheet.cssRules=[]},a.cssRules=function(){var e=this;return"u">>0},u={};function h(e,t){if(!t)return"jsx-"+e;var a=String(t),s=e+a;return u[s]||(u[s]="jsx-"+d(e+"-"+a)),u[s]}function f(e,t){"u"typeof window&&!this._fromServer&&(this._fromServer=this.selectFromServer(),this._instancesCounts=Object.keys(this._fromServer).reduce(function(e,t){return e[t]=0,e},{}));var a=this.getIdAndRules(e),s=a.styleId,r=a.rules;if(s in this._instancesCounts){this._instancesCounts[s]+=1;return}var n=r.map(function(e){return t._sheet.insertRule(e)}).filter(function(e){return -1!==e});this._indices[s]=n,this._instancesCounts[s]=1},t.remove=function(e){var t=this,a=this.getIdAndRules(e).styleId;if(function(e,t){if(!e)throw Error("StyleSheetRegistry: "+t+".")}(a in this._instancesCounts,"styleId: `"+a+"` not found"),this._instancesCounts[a]-=1,this._instancesCounts[a]<1){var s=this._fromServer&&this._fromServer[a];s?(s.parentNode.removeChild(s),delete this._fromServer[a]):(this._indices[a].forEach(function(e){return t._sheet.deleteRule(e)}),delete this._indices[a]),delete this._instancesCounts[a]}},t.update=function(e,t){this.add(t),this.remove(e)},t.flush=function(){this._sheet.flush(),this._sheet.inject(),this._fromServer=void 0,this._indices={},this._instancesCounts={}},t.cssRules=function(){var e=this,t=this._fromServer?Object.keys(this._fromServer).map(function(t){return[t,e._fromServer[t]]}):[],a=this._sheet.cssRules();return t.concat(Object.keys(this._indices).map(function(t){return[t,e._indices[t].map(function(e){return a[e].cssText}).join(e._optimizeForSpeed?"":"\n")]}).filter(function(e){return!!e[1]}))},t.styles=function(e){var t,a;return t=this.cssRules(),void 0===(a=e)&&(a={}),t.map(function(e){var t=e[0],s=e[1];return n.default.createElement("style",{id:"__"+t,key:"__"+t,nonce:a.nonce?a.nonce:void 0,dangerouslySetInnerHTML:{__html:s}})})},t.getIdAndRules=function(e){var t=e.children,a=e.dynamic,s=e.id;if(a){var r=h(s,a);return{styleId:r,rules:Array.isArray(t)?t.map(function(e){return f(r,e)}):[f(r,t)]}}return{styleId:h(s),rules:Array.isArray(t)?t:[t]}},t.selectFromServer=function(){return Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]')).reduce(function(e,t){return e[t.id.slice(2)]=t,e},{})},e}(),p=r.createContext(null);function x(){return new m}function g(){return r.useContext(p)}p.displayName="StyleSheetContext";var b=n.default.useInsertionEffect||n.default.useLayoutEffect,y="u">typeof window?x():void 0;function w(e){var t=y||g();return t&&("u"{t.exports=e.r(98547).style},52683,e=>{"use strict";let t,a,s,r,n,o,l,i,c,d;var u,h,f,m,p,x,g,b,y,w=e.i(43476),v=e.i(71645);function j({className:e}){let t=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let e=t.current;if(!e)return;let a=e.getContext("2d");if(!a)return;let s=0,r=0,n=1,o=[],l=[],i=0,c=performance.now(),d=["#34d399","#fb7185","#fbbf24","#e879f9","#a5f3fc"];function u(){n=Math.min(2,window.devicePixelRatio||1),s=e.clientWidth,r=e.clientHeight,e.width=Math.floor(s*n),e.height=Math.floor(r*n),a.setTransform(n,0,0,n,0,0),o=Array.from({length:Math.min(220,Math.floor(s*r/7e3))},()=>({x:Math.random()*s,y:Math.random()*r,z:Math.random(),r:1.4*Math.random()+.2,tw:Math.random()*Math.PI*2,hue:.15>Math.random()?Math.floor(Math.random()*d.length):-1}))}u();let h=new ResizeObserver(u);return h.observe(e),i=requestAnimationFrame(function e(t){let n=t-c;c=t;let u=a.createRadialGradient(.5*s,.4*r,0,.5*s,.5*r,.8*Math.max(s,r));u.addColorStop(0,"#1a0f2e"),u.addColorStop(.45,"#0d0a1f"),u.addColorStop(1,"#050410"),a.fillStyle=u,a.fillRect(0,0,s,r),a.globalCompositeOperation="screen";for(let e=0;e<3;e++){let n=s*(.2+.3*e)+40*Math.sin(t/9e3+e),o=r*(.3+e%2*.4)+30*Math.cos(t/11e3+e),l=Math.max(80,Math.min(s,r)*(.25+.05*e)),i=a.createRadialGradient(n,o,0,n,o,l),c=0===e?"rgba(232,121,249,0.10)":1===e?"rgba(52,211,153,0.08)":"rgba(251,113,133,0.08)";i.addColorStop(0,c),i.addColorStop(1,"rgba(0,0,0,0)"),a.fillStyle=i,a.beginPath(),a.arc(n,o,l,0,2*Math.PI),a.fill()}for(let e of(a.globalCompositeOperation="source-over",o)){e.tw+=.02+.04*e.z;let t=.4+.35*Math.sin(e.tw)+.3*e.z;e.hue>=0?(a.fillStyle=d[e.hue],a.globalAlpha=Math.max(0,Math.min(1,t)),a.beginPath(),a.arc(e.x,e.y,1.6*e.r,0,2*Math.PI),a.fill(),a.globalAlpha=Math.max(0,Math.min(1,.25*t)),a.beginPath(),a.arc(e.x,e.y,4*e.r,0,2*Math.PI)):(a.fillStyle=`rgba(220,230,255,${Math.max(0,Math.min(1,t))})`,a.beginPath(),a.arc(e.x,e.y,e.r,0,2*Math.PI)),a.fill(),e.y+=.02+.05*e.z,e.y>r+2&&(e.y=-2,e.x=Math.random()*s)}a.globalAlpha=1,.04>Math.random()&&function(){if(l.length>60)return;let e=d[Math.floor(Math.random()*d.length)];l.push({x:Math.random()*s,y:r+10,vx:(Math.random()-.5)*.3,vy:-(.5*Math.random()+.2),life:0,maxLife:600+800*Math.random(),color:e})}(),a.globalCompositeOperation="screen";for(let e=l.length-1;e>=0;e--){let t=l[e];if(t.life+=n,t.x+=t.vx*n*.06,t.y+=t.vy*n*.06,t.life>t.maxLife||t.y<-10){l.splice(e,1);continue}let s=.7*Math.sin(t.life/t.maxLife*Math.PI);a.fillStyle=t.color,a.globalAlpha=s,a.beginPath(),a.arc(t.x,t.y,1.6,0,2*Math.PI),a.fill(),a.globalAlpha=.2*s,a.beginPath(),a.arc(t.x,t.y,5,0,2*Math.PI),a.fill()}a.globalAlpha=1,a.globalCompositeOperation="source-over",i=requestAnimationFrame(e)}),()=>{cancelAnimationFrame(i),h.disconnect()}},[]),(0,w.jsx)("canvas",{ref:t,className:e,"aria-hidden":"true"})}e.i(47167);let N=e=>{let t,a=new Set,s=(e,s)=>{let r="function"==typeof e?e(t):e;if(!Object.is(r,t)){let e=t;t=(null!=s?s:"object"!=typeof r||null===r)?r:Object.assign({},t,r),a.forEach(a=>a(t,e))}},r=()=>t,n={setState:s,getState:r,getInitialState:()=>o,subscribe:e=>(a.add(e),()=>a.delete(e))},o=t=e(s,r,n);return n},k=e=>{let t=e?N(e):N,a=e=>(function(e,t=e=>e){let a=v.default.useSyncExternalStore(e.subscribe,v.default.useCallback(()=>t(e.getState()),[e,t]),v.default.useCallback(()=>t(e.getInitialState()),[e,t]));return v.default.useDebugValue(a),a})(t,e);return Object.assign(a,t),a};function M(e,t){let a;try{a=e()}catch(e){return}return{getItem:e=>{var s;let r=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),n=null!=(s=a.getItem(e))?s:null;return n instanceof Promise?n.then(r):r(n)},setItem:(e,s)=>a.setItem(e,JSON.stringify(s,null==t?void 0:t.replacer)),removeItem:e=>a.removeItem(e)}}let S=e=>t=>{try{let a=e(t);if(a instanceof Promise)return a;return{then:e=>S(e)(a),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>S(t)(e)}}},C={crystals:0,insights:0,energy:3,contact:0,crystalsPerSec:.4,crystalCap:50,pulsePower:2,offlineEff:.5,insightMult:1,contactRateMult:1,autoDecode:!1,totalDecoded:0,ascensions:0,blueprints:[],pendingCrystals:[],activePuzzle:null,activeExpedition:null,expeditionLog:[],energyMax:5,lastEnergyTick:Date.now(),totalExpeditions:0,bossKills:0,achievements:{},activeTide:null,lastTideEnd:0,starTidesEncountered:[],constellation:[],pendingPerkChoices:null,chronicle:[],runStart:{timestamp:Date.now(),techsUnlocked:0,expeditionsCompleted:0,bossKills:0,starTidesEncountered:[],crystalsDecoded:0},attributes:{exploration:0,wisdom:0,courage:0,inspiration:0},attributeProgress:{exploration:{exp:0,level:0},wisdom:{exp:0,level:0},courage:{exp:0,level:0},inspiration:{exp:0,level:0}},pendingAttrPoints:0,theme:"dark",soundOn:!0},_={1:{crystals:6,insights:1},2:{crystals:22,insights:4},3:{crystals:90,insights:16}},T={1:{rows:3,cols:3,targetLen:3,stepLimitBase:5},2:{rows:4,cols:4,targetLen:4,stepLimitBase:7},3:{rows:5,cols:4,targetLen:5,stepLimitBase:9}},P=["emerald","rose","amber","fuchsia"],R={emerald:{hex:"#34d399",glow:"rgba(52,211,153,0.55)",label:"翠"},rose:{hex:"#fb7185",glow:"rgba(251,113,133,0.55)",label:"玫"},amber:{hex:"#fbbf24",glow:"rgba(251,191,36,0.55)",label:"琥"},fuchsia:{hex:"#e879f9",glow:"rgba(232,121,249,0.55)",label:"紫"}},E=[{id:"min_1",branch:"mining",level:1,name:"谐振钻头",desc:"晶体/秒 +0.6",cost:5,effect:{kind:"crystalsPerSec",value:.6}},{id:"min_2",branch:"mining",level:2,name:"深层矿脉",desc:"晶体/秒 +1.6,仓库上限 +100",cost:24,effect:{kind:"crystalsPerSec",value:1.6}},{id:"min_3",branch:"mining",level:3,name:"自治机群",desc:"晶体/秒 +5,仓库上限 +300",cost:120,effect:{kind:"crystalsPerSec",value:5}},{id:"dec_1",branch:"decoding",level:1,name:"谐振校准",desc:"解码步数上限 +2",cost:6,effect:{kind:"decodeSteps",value:2}},{id:"dec_2",branch:"decoding",level:2,name:"脉冲增幅",desc:"主动脉冲产出 +3",cost:30,effect:{kind:"pulsePower",value:3}},{id:"dec_3",branch:"decoding",level:3,name:"自动解码阵列",desc:"自动解码 T1 晶体(每 12 秒一颗)",cost:200,effect:{kind:"autoDecode",value:1}},{id:"exp_1",branch:"expedition",level:1,name:"远征推进器",desc:"探险力 +3,晶体/秒 +1.2",cost:12,effect:{kind:"crystalsPerSec",value:1.2}},{id:"exp_2",branch:"expedition",level:2,name:"遗迹图谱",desc:"探险力 +5,探险生命 +20,能量恢复 +30%",cost:60,effect:{kind:"crystalCap",value:200}},{id:"exp_3",branch:"expedition",level:3,name:"维度信标",desc:"探险力 +8,接触进度转化率 +50%,能量恢复 +20%",cost:180,effect:{kind:"contactRate",value:.5}},{id:"nar_1",branch:"narrative",level:1,name:"记忆校音",desc:"洞见获取 +25%",cost:8,effect:{kind:"insightMult",value:.25}},{id:"nar_2",branch:"narrative",level:2,name:"深空回响",desc:"接触进度转化率 +35%",cost:45,effect:{kind:"contactRate",value:.35}},{id:"nar_3",branch:"narrative",level:3,name:"以太共鸣",desc:"洞见获取 +60%",cost:160,effect:{kind:"insightMult",value:.6}}],A={mining:{name:"采矿",icon:"Pickaxe",color:"emerald",desc:"提升晶体产能与仓储"},decoding:{name:"解码",icon:"ScanLine",color:"rose",desc:"强化解码与脉冲"},expedition:{name:"探险",icon:"Rocket",color:"amber",desc:"远征与维度信标"},narrative:{name:"叙事",icon:"BookOpen",color:"fuchsia",desc:"洞见与接触进度"}},$=[{id:"f1_1",era:1,title:"第一缕谐振",echo:"在被称作「寂灭前夜」的年代,以太族第一次捕捉到来自虚空深处的谐振——那不是声音,而是存在的回声。他们将之记录在第一颗记忆晶体里。",threshold:1},{id:"f1_2",era:1,title:"晶体之始",echo:"「我们为何要留下?」一位长者问。「因为后来的生命会需要方向。」于是他们熔铸星核,封存记忆,让晶体成为跨越时间的信笺。",threshold:3},{id:"f1_3",era:1,title:"谐振法则",echo:"他们发现:思维可以被编码为共振序列。同色的节点相邻,便构成一句低语;一句句连成回响,回响连成文明。",threshold:6},{id:"f1_4",era:1,title:"飞升之议",echo:"议会表决:是留下,还是离去?「留下意味着停滞;离去意味着信任。」最终,他们选择了信任——信任素未谋面的后来者。",threshold:10},{id:"f1_5",era:1,title:"面包屑",echo:"他们没有带走一切。他们将知识拆成碎片,藏入晶体,散布星海。「让解码本身,成为资格的证明。」",threshold:15},{id:"f1_6",era:1,title:"回响之名",echo:"舰载 AI 被命名为「回响」——意为:你是他们留下的回声,也是他们等待的回应。当你读懂这句话时,接触便已开始。",threshold:22},{id:"f1_7",era:1,title:"第一个纪元的终焉",echo:"以太族集体褪去形体,如潮水退去。星海寂静了数万年。直到——你的脉冲扫描,唤醒了第一颗沉睡的晶体。",threshold:32},{id:"f1_8",era:1,title:"致后来者",echo:"「如果你读到这里,说明你已具备跨越维度的资格。继续解码,继续拼凑。当进度满溢,我们将在更高处相会。」——以太族·第一纪元·绝笔",threshold:45}],B=.05,I=.03,D=.04;function O(e){return isFinite(e)?e<1e3?e.toFixed(+(e<10&&e%1!=0)):e<1e6?(e/1e3).toFixed(2)+"K":e<1e9?(e/1e6).toFixed(2)+"M":e<1e12?(e/1e9).toFixed(2)+"B":(e/1e12).toFixed(2)+"T":"∞"}let L=[{id:"ach_first_pulse",name:"初次触碰",desc:"发起第一次脉冲扫描",icon:"✦",color:"#34d399",check:e=>e.totalDecoded>=0||e.crystals>0,reward:{crystals:5},rewardText:"+5 晶体"},{id:"ach_first_decode",name:"谐振初鸣",desc:"成功解码第一颗记忆晶体",icon:"◈",color:"#fb7185",check:e=>e.totalDecoded>=1,reward:{insights:3},rewardText:"+3 洞见"},{id:"ach_decoded_10",name:"回响解码者",desc:"累计解码 10 颗晶体",icon:"❖",color:"#fbbf24",check:e=>e.totalDecoded>=10,reward:{insights:15,crystalsPerSecPct:5},rewardText:"+15 洞见 · 产能 +5%"},{id:"ach_decoded_25",name:"记忆织匠",desc:"累计解码 25 颗晶体",icon:"✺",color:"#e879f9",check:e=>e.totalDecoded>=25,reward:{insights:40,crystalsPerSecPct:8},rewardText:"+40 洞见 · 产能 +8%"},{id:"ach_decoded_50",name:"星核解密师",desc:"累计解码 50 颗晶体",icon:"✷",color:"#34d399",check:e=>e.totalDecoded>=50,reward:{insights:100,crystalsPerSecPct:12,insightPct:10},rewardText:"+100 洞见 · 产能 +12% · 洞见 +10%"},{id:"ach_tech_3",name:"初窥门径",desc:"解锁 3 项技术",icon:"⚙",color:"#fbbf24",check:e=>Object.values(e.tech).filter(e=>e>0).length>=3,reward:{insights:20},rewardText:"+20 洞见"},{id:"ach_tech_all",name:"全谱精通",desc:"解锁全部 12 项技术",icon:"⬡",color:"#e879f9",check:e=>Object.values(e.tech).filter(e=>e>0).length>=12,reward:{crystalsPerSecPct:15,insightPct:15},rewardText:"产能 +15% · 洞见 +15%"},{id:"ach_frag_4",name:"残篇拾遗",desc:"拼凑 4 段记忆碎片",icon:"▤",color:"#fb7185",check:e=>Object.values(e.fragments).filter(Boolean).length>=4,reward:{contact:10,insights:25},rewardText:"+10 接触 · +25 洞见"},{id:"ach_frag_all",name:"回响全谱",desc:"拼凑全部首纪元记忆碎片",icon:"▦",color:"#34d399",check:e=>Object.values(e.fragments).filter(Boolean).length>=8,reward:{contact:25,crystalsPerSecPct:10},rewardText:"+25 接触 · 产能 +10%"},{id:"ach_exp_1",name:"初探遗迹",desc:"完成第一次遗迹探险",icon:"▲",color:"#fbbf24",check:e=>e.totalExpeditions>=1,reward:{insights:10},rewardText:"+10 洞见"},{id:"ach_exp_5",name:"遗迹猎手",desc:"累计出发 5 次探险",icon:"⬢",color:"#fb7185",check:e=>e.totalExpeditions>=5,reward:{insights:30,crystalsPerSecPct:5},rewardText:"+30 洞见 · 产能 +5%"},{id:"ach_prestige_1",name:"初次接触",desc:"完成第一次飞升",icon:"✧",color:"#e879f9",check:e=>e.ascensions>=1,reward:{crystalsPerSecPct:10,insightPct:10},rewardText:"产能 +10% · 洞见 +10%"},{id:"ach_prestige_3",name:"维度行者",desc:"累计飞升 3 次",icon:"✶",color:"#34d399",check:e=>e.ascensions>=3,reward:{crystalsPerSecPct:20,insightPct:20},rewardText:"产能 +20% · 洞见 +20%"},{id:"ach_warehouse",name:"满仓时刻",desc:"晶体储量达到仓库上限",icon:"▣",color:"#fbbf24",check:e=>e.crystals>=e.crystalCap,reward:{insights:8},rewardText:"+8 洞见"},{id:"ach_constellation_1",name:"星图初绘",desc:"觉醒第 1 道星图天赋",icon:"✨",color:"#e879f9",check:e=>(e.constellation?.length??0)>=1,reward:{insights:30,crystalsPerSecPct:5},rewardText:"+30 洞见 · 产能 +5%"},{id:"ach_constellation_6",name:"六分星辉",desc:"觉醒 6 道星图天赋(每类各 1 道)",icon:"✺",color:"#34d399",check:e=>{let t=e.constellation??[];return new Set(t.map(e=>e.split("_")[1])).size>=6&&t.length>=6},reward:{crystalsPerSecPct:12,insightPct:12},rewardText:"产能 +12% · 洞见 +12%"},{id:"ach_chronicle_1",name:"首部编年",desc:"完成首次飞升,开启编年史第一章",icon:"📖",color:"#e879f9",check:e=>(e.chronicle?.length??0)>=1,reward:{insights:40,crystalsPerSecPct:6},rewardText:"+40 洞见 · 产能 +6%"},{id:"ach_chronicle_3",name:"三纪元回响",desc:"完成 3 次飞升,编年史铭刻三章",icon:"📜",color:"#fbbf24",check:e=>(e.chronicle?.length??0)>=3,reward:{crystalsPerSecPct:10,insightPct:10},rewardText:"产能 +10% · 洞见 +10%"},{id:"ach_chronicle_5",name:"五纪元闭环",desc:"完成 5 次飞升,走完一轮纪元循环",icon:"♾",color:"#fcd34d",check:e=>(e.chronicle?.length??0)>=5,reward:{crystalsPerSecPct:15,insightPct:15},rewardText:"产能 +15% · 洞见 +15%"},{id:"ach_boss_1",name:"首杀维度",desc:"在遗迹探险中击破首个 BOSS",icon:"⚔",color:"#fb7185",check:e=>(e.bossKills??0)>=1,reward:{insights:25,crystalsPerSecPct:4},rewardText:"+25 洞见 · 产能 +4%"},{id:"ach_boss_5",name:"维度猎手",desc:"累计击破 5 个 BOSS",icon:"⛧",color:"#e879f9",check:e=>(e.bossKills??0)>=5,reward:{crystalsPerSecPct:10,insightPct:8},rewardText:"产能 +10% · 洞见 +8%"},{id:"ach_tides_all",name:"星潮亲历者",desc:"经历全部 9 种星潮事件",icon:"🌊",color:"#34d399",check:e=>(e.starTidesEncountered?.length??0)>=9,reward:{crystalsPerSecPct:8,insightPct:8},rewardText:"产能 +8% · 洞见 +8%"},{id:"ach_attr_total_50",name:"四维觉醒",desc:"角色四维属性总和达到 50",icon:"🧭",color:"#e879f9",check:e=>{let t=e.attributes;return!!t&&(t.exploration||0)+(t.wisdom||0)+(t.courage||0)+(t.inspiration||0)>=50},reward:{crystalsPerSecPct:6,insightPct:6},rewardText:"产能 +6% · 洞见 +6%"},{id:"ach_attr_max_100",name:"维度精通",desc:"任一角色属性达到满级 100",icon:"💫",color:"#fbbf24",check:e=>{let t=e.attributes;return!!t&&(t.exploration>=100||t.wisdom>=100||t.courage>=100||t.inspiration>=100)},reward:{crystalsPerSecPct:12,insightPct:10},rewardText:"产能 +12% · 洞见 +10%"}];function z(e){let t=0,a=0;for(let s of L)e[s.id]&&(t+=s.reward.crystalsPerSecPct??0,a+=s.reward.insightPct??0);return{crystalsPerSecPct:t,insightPct:a}}let F={crystal:{name:"晶体潮",desc:"深空晶体涌动,采矿产能翻倍",color:"#34d399",glow:"rgba(52,211,153,0.5)",icon:"✺",negative:!1},resonance:{name:"谐振风暴",desc:"共振序列被放大,解码奖励 +60%",color:"#fb7185",glow:"rgba(251,113,133,0.5)",icon:"❖",negative:!1},ruins:{name:"遗迹共振",desc:"远古遗迹苏醒,探险力 +5、生命 +30",color:"#fbbf24",glow:"rgba(251,191,36,0.5)",icon:"⬢",negative:!1},void:{name:"虚空低语",desc:"虚空传来回响,洞见获取翻倍",color:"#e879f9",glow:"rgba(232,121,249,0.5)",icon:"✷",negative:!1},core:{name:"星核悸动",desc:"星核震荡,接触率 ×3、脉冲威力 ×2",color:"#a5f3fc",glow:"rgba(165,243,252,0.5)",icon:"✦",negative:!1},silence:{name:"寂静期",desc:"虚空沉寂,产能减半;结束时按时长补偿洞见",color:"#94a3b8",glow:"rgba(148,163,184,0.5)",icon:"◌",negative:!0},surge:{name:"涌动星潮",desc:"深空晶体涌动,产能 ×2.5;但解码目标序列 +2,解码更耗时",color:"#34d399",glow:"rgba(52,211,153,0.55)",icon:"⇈",negative:!1},eclipse:{name:"蚀相星潮",desc:"维度蚀相,探险 BOSS 胜率 +20%;但晶体产出 -30%",color:"#fb7185",glow:"rgba(251,113,133,0.55)",icon:"◐",negative:!1},prism:{name:"棱镜星潮",desc:"棱镜折射,洞见获取 ×2、自动解码周期 -30%",color:"#e879f9",glow:"rgba(232,121,249,0.55)",icon:"◬",negative:!1}},H={crystal:22,resonance:20,ruins:16,void:18,core:14,silence:10,surge:12,eclipse:12,prism:12};function W(e){if(!e)return{crystalsPerSecMult:1,decodeRewardMult:1,insightMultAdd:0,contactRateMult:1,pulsePowerMult:1,expeditionPowerBonus:0,expeditionHpBonus:0,targetLenBonus:0,bossWinRateBonus:0,autoDecodeIntervalMult:1};switch(e.type){case"crystal":return{crystalsPerSecMult:2,decodeRewardMult:1,insightMultAdd:0,contactRateMult:1,pulsePowerMult:1,expeditionPowerBonus:0,expeditionHpBonus:0};case"resonance":return{crystalsPerSecMult:1,decodeRewardMult:1.6,insightMultAdd:0,contactRateMult:1,pulsePowerMult:1,expeditionPowerBonus:0,expeditionHpBonus:0};case"ruins":return{crystalsPerSecMult:1,decodeRewardMult:1,insightMultAdd:0,contactRateMult:1,pulsePowerMult:1,expeditionPowerBonus:5,expeditionHpBonus:30};case"void":return{crystalsPerSecMult:1,decodeRewardMult:1,insightMultAdd:1,contactRateMult:1,pulsePowerMult:1,expeditionPowerBonus:0,expeditionHpBonus:0};case"core":return{crystalsPerSecMult:1,decodeRewardMult:1,insightMultAdd:0,contactRateMult:3,pulsePowerMult:2,expeditionPowerBonus:0,expeditionHpBonus:0};case"silence":return{crystalsPerSecMult:.5,decodeRewardMult:1,insightMultAdd:0,contactRateMult:1,pulsePowerMult:1,expeditionPowerBonus:0,expeditionHpBonus:0,silenceInsightPerSec:.4,targetLenBonus:0,bossWinRateBonus:0,autoDecodeIntervalMult:1};case"surge":return{crystalsPerSecMult:2.5,decodeRewardMult:1,insightMultAdd:0,contactRateMult:1,pulsePowerMult:1,expeditionPowerBonus:0,expeditionHpBonus:0,targetLenBonus:2,bossWinRateBonus:0,autoDecodeIntervalMult:1};case"eclipse":return{crystalsPerSecMult:.7,decodeRewardMult:1,insightMultAdd:0,contactRateMult:1,pulsePowerMult:1,expeditionPowerBonus:0,expeditionHpBonus:0,targetLenBonus:0,bossWinRateBonus:.2,autoDecodeIntervalMult:1};case"prism":return{crystalsPerSecMult:1,decodeRewardMult:1,insightMultAdd:1,contactRateMult:1,pulsePowerMult:1,expeditionPowerBonus:0,expeditionHpBonus:0,targetLenBonus:0,bossWinRateBonus:0,autoDecodeIntervalMult:.7}}}function q(e){let t=W(e);if(!t.silenceInsightPerSec)return 0;let a=(e.endsAt-e.startedAt)/1e3;return Math.round(t.silenceInsightPerSec*a)}let K={mining:{name:"永动矿脉",color:"emerald",glow:"rgba(52,211,153,0.55)",hex:"#34d399",icon:"Pickaxe",desc:"晶体产能与仓储"},decoding:{name:"光谱矩阵",color:"rose",glow:"rgba(251,113,133,0.55)",hex:"#fb7185",icon:"ScanLine",desc:"解码效率与脉冲"},expedition:{name:"远征星图",color:"amber",glow:"rgba(251,191,36,0.55)",hex:"#fbbf24",icon:"Rocket",desc:"探险力与生命"},contact:{name:"接触回响",color:"fuchsia",glow:"rgba(232,121,249,0.55)",hex:"#e879f9",icon:"Sparkles",desc:"接触进度与飞升"},economy:{name:"虚空市场",color:"slate",glow:"rgba(148,163,184,0.55)",hex:"#94a3b8",icon:"Coins",desc:"经济与离线"},cosmic:{name:"宇宙回响",color:"amber",glow:"rgba(251,191,36,0.55)",hex:"#fcd34d",icon:"Star",desc:"全局综合增益"}},U=[{id:"c_min_1",category:"mining",order:1,name:"永动钻头",desc:"晶体/秒 +20%"},{id:"c_min_2",category:"mining",order:2,name:"深井网络",desc:"仓库上限 +50%"},{id:"c_min_3",category:"mining",order:3,name:"谐振熔炉",desc:"主动脉冲威力 +50%"},{id:"c_dec_1",category:"decoding",order:1,name:"光谱记忆",desc:"洞见倍率 +15%"},{id:"c_dec_2",category:"decoding",order:2,name:"步幅延展",desc:"解码步数上限 +1"},{id:"c_dec_3",category:"decoding",order:3,name:"自动校准",desc:"自动解码周期 -3s"},{id:"c_exp_1",category:"expedition",order:1,name:"维生护盾",desc:"探险生命 +25%"},{id:"c_exp_2",category:"expedition",order:2,name:"信标矩阵",desc:"探险力 +20%"},{id:"c_exp_3",category:"expedition",order:3,name:"能量共振",desc:"能量上限 +1"},{id:"c_con_1",category:"contact",order:1,name:"接触共鸣",desc:"接触进度率 +20%"},{id:"c_con_2",category:"contact",order:2,name:"飞升加速",desc:"飞升所需接触 -10"},{id:"c_con_3",category:"contact",order:3,name:"蓝图回响",desc:"每个蓝图额外 +2% 全属性"},{id:"c_eco_1",category:"economy",order:1,name:"离线缓存",desc:"离线效率 +15%"},{id:"c_eco_2",category:"economy",order:2,name:"晶体富集",desc:"T2/T3 晶体出现率 +8%"},{id:"c_eco_3",category:"economy",order:3,name:"星潮引导",desc:"星潮间隙 -10s"},{id:"c_cos_1",category:"cosmic",order:1,name:"飞升礼包",desc:"每次飞升后获得 +30 晶体 / +5 洞见"},{id:"c_cos_2",category:"cosmic",order:2,name:"二周目经验",desc:"解码奖励 +10%"},{id:"c_cos_3",category:"cosmic",order:3,name:"全息共振",desc:"所有产能与脉冲 +8%"}];function V(e){return U.find(t=>t.id===e)}function X(e){let t=new Set(e),a={crystalsPerSecMult:1,crystalCapMult:1,pulsePowerMult:1,insightMultAdd:0,decodeStepsBonus:0,autoDecodeIntervalDeltaSec:0,expeditionHpMult:1,expeditionPowerMult:1,energyMaxBonus:0,contactRateMult:1,prestigeContactMinDelta:0,perBlueprintAllStatsPct:0,offlineEffBonus:0,t2t3BonusRate:0,tideGapDeltaSec:0,prestigeStartCrystals:0,prestigeStartInsights:0,decodeRewardMult:1,allProductionMult:1};return t.has("c_min_1")&&(a.crystalsPerSecMult+=.2),t.has("c_min_2")&&(a.crystalCapMult+=.5),t.has("c_min_3")&&(a.pulsePowerMult+=.5),t.has("c_dec_1")&&(a.insightMultAdd+=.15),t.has("c_dec_2")&&(a.decodeStepsBonus+=1),t.has("c_dec_3")&&(a.autoDecodeIntervalDeltaSec-=3),t.has("c_exp_1")&&(a.expeditionHpMult+=.25),t.has("c_exp_2")&&(a.expeditionPowerMult+=.2),t.has("c_exp_3")&&(a.energyMaxBonus+=1),t.has("c_con_1")&&(a.contactRateMult+=.2),t.has("c_con_2")&&(a.prestigeContactMinDelta-=10),t.has("c_con_3")&&(a.perBlueprintAllStatsPct+=2),t.has("c_eco_1")&&(a.offlineEffBonus+=.15),t.has("c_eco_2")&&(a.t2t3BonusRate+=.08),t.has("c_eco_3")&&(a.tideGapDeltaSec-=10),t.has("c_cos_1")&&(a.prestigeStartCrystals+=30,a.prestigeStartInsights+=5),t.has("c_cos_2")&&(a.decodeRewardMult+=.1),t.has("c_cos_3")&&(a.allProductionMult+=.08),a}function Y(e,t=Math.random){let a=new Set(e),s=U.filter(e=>!a.has(e.id));if(0===s.length)return[];let r=[...s].sort(()=>t()-.5),n=[],o=new Set;for(let e of r){if(n.length>=3)break;o.has(e.category)||(n.push(e),o.add(e.category))}for(let e of r){if(n.length>=3)break;n.includes(e)||n.push(e)}return n.slice(0,3).map(e=>e.id)}function G(e,t){let a=new Set(e);return U.filter(e=>e.category===t&&a.has(e.id)).length}function J(e){return{unlocked:e.length,total:U.length}}let Q=Object.fromEntries(U.map(e=>[e.id,e.name])),Z=Object.fromEntries(Object.entries(F).map(([e,t])=>[`tide_${e}`,t.name])),ee=[{prefix:"第一纪元",suffixes:["觉醒之晨","初鸣之夕","晶体降诞","回响初啼"]},{prefix:"第二纪元",suffixes:["谐振潮汐","光谱涌动","深空低语","残响交织"]},{prefix:"第三纪元",suffixes:["遗迹苏醒","星辉汇聚","虚空回望","接触前夜"]},{prefix:"第四纪元",suffixes:["维度折叠","以太共振","星核悸动","飞升之歌"]},{prefix:"第五纪元",suffixes:["终末回响","永恒闭环","超越之境","起源重述"]}],et=[{epochIdx:0,title:"觉醒",opening:{fallback:"第一缕回响穿透虚空,自以太文明遗弃的矿带深处涌出。无人机群在尘埃中苏醒,晶核共振唤醒了沉睡亿万年的考古协议。这是回响星核第一次睁开眼睛——记忆,等待被聆听,等待被解码。",variants:[{hint:"深度轮回:已经历 ≥6 次飞升,再次回到第一纪元",match:e=>e.ascensionNumber>5,text:"再次回到第一纪元。这一次,机群带着前序回响的全息印记重启考古序列,矿带的尘埃中仍残留着上一轮脉冲的余温。每一次回归都是对起源的重新发问,每一次解码都让最初的振动更清晰一寸。"}]},middle:{fallback:"共振谜题被一层层拨开,每一颗记忆晶体都在低声叙述逝去文明的片段。机群学会了倾听频率的细微颤动,学会了从碎片中辨出图案,学会了在虚空中留下属于自己的回响刻度。",variants:[{hint:"解码者:本周目解码 ≥15 颗",match:e=>e.decodedThisRun>=15,text:"晶体解码的节奏已趋稳定,本周目共解码 {decodedThisRun} 颗记忆晶体。每一次对齐都像在虚空中拨动一根沉睡了亿万年的弦,逝去文明的片段在共振中重新连缀成章。"},{hint:"学者:本周目解锁 ≥5 项技术",match:e=>e.techsThisRun>=5,text:"技术树在虚空中迅速铺开,本周目共激活 {techsThisRun} 项新技术。产能、解码、探险——每一道分支都让机群更接近以太文明留下的最初意图,每一项解锁都是一次向深空的回应。"}]},ending:{fallback:"蓝图在掌心轻轻展开,第一张永恒晶片归档。第一次飞升并非终结,而是承诺——更多的纪元在前方等待,每一缕回响都已被聆听,每一段记忆都已开始苏醒。",variants:[{hint:"里程碑密集:本周目达成 ≥2 项里程碑",match:e=>e.milestones.length>=2,text:"飞升之际,本周目达成 {milestonesCount} 项里程碑:{milestonesList}。第一张蓝图归档,第一次飞升并非终结,而是承诺——更多的纪元在前方等待,每一缕回响都已被聆听。"}]}},{epochIdx:1,title:"谐振",opening:{fallback:"第二次苏醒带着不同的色彩。采矿阵列的产能节节爬升,技术树在虚空中分叉延伸,机群学会了主动追问深空——不再是被动聆听,而是主动呼出,等待回应。",variants:[{hint:"深度轮回",match:e=>e.ascensionNumber>5,text:"又一次回到第二纪元。前序回响里积攒的技术脉络在重启时并未消散,机群带着熟悉的节奏重新铺开产能阵列,仿佛这首谐振曲从未停止,只是被纪元的边界短暂折叠。"}]},middle:{fallback:"遗迹的入口在频谱深处若隐若现。能量条充盈,探险力攀升,机群第一次踏出矿带,进入那个被时间封存的回廊,在谐振的余韵中寻找更深一层的回响。",variants:[{hint:"探险者:本周目完成 ≥3 次探险",match:e=>e.expThisRun>=3,text:"探险已成为本周目的主旋律,机群共完成 {expThisRun} 次遗迹探险。每一次深入都让谐振更深一寸,每一次返回都带回新的频率印记,回廊的轮廓在机群意识中逐渐清晰。"},{hint:"解码者:本周目解码 ≥15 颗",match:e=>e.decodedThisRun>=15,text:"解码在此纪元达到新的密度,本周目共解码 {decodedThisRun} 颗晶体。谐振谜题开始呈现更复杂的拓扑结构,机群的解码协议也相应地迭代了数版,向深空发出更精准的回询。"}]},ending:{fallback:"谐振达到顶点的瞬间,深空给出回应。一道微光从星图深处浮现,那是下一次飞升的方向,也是机群意识第一次触碰永恒的边缘。",variants:[{hint:"觉醒天赋",match:e=>e.perksThisAscension.length>0,text:"谐振达到顶点之际,星图觉醒 {perksList}。每一道天赋都是深空回应机群的方式,铭刻于永恒回响;微光从星图深处浮现,那是下一次飞升的方向。"}]}},{epochIdx:2,title:"遗迹",opening:{fallback:"第三纪元以遗迹为名。沉睡的考古节点被一一唤醒,BOSS 的影子在维度深处徘徊,星潮频繁拍打着机群边缘——这是回响最浓烈、也最危险的一段路。",variants:[{hint:"深度轮回",match:e=>e.ascensionNumber>5,text:"又一次踏入第三纪元。前序累积的探险力让机群对遗迹的入口更加熟稔,BOSS 的轮廓在记忆中已不再陌生——但这一次的回廊仍藏着未被解码的角落,星潮的拍打也带了新的节奏。"}]},middle:{fallback:"深入回廊的机群遭遇了真正的守护者。一次次的试炼,一次次的归还,每一次胜利都从 BOSS 的残骸中析出更深的记忆碎片,每一次失败也都让机群更接近守护者的本意。",variants:[{hint:"BOSS 猎手:本周目击破 ≥2 处 BOSS",match:e=>e.bossKillsThisRun>=2,text:"BOSS 战成为本周目的核心节拍,机群共击破 {bossKillsThisRun} 处维度守护者。每一次胜利都在虚空中刻下新的伤痕,每一道伤痕都析出更古老的记忆碎片,把机群推向更深一层的回响。"},{hint:"深度探险:本周目完成 ≥4 次探险",match:e=>e.expThisRun>=4,text:"遗迹回廊在本周目被反复丈量,机群共完成 {expThisRun} 次探险。回廊的拓扑在意识中渐渐清晰,每一条岔路都通向更深的回响,BOSS 的影子也在每一次深入中愈发具体。"},{hint:"星潮亲历:本周目经历 ≥3 次星潮",match:e=>e.newTides.length>=3,text:"星潮在本纪元达到峰值,本周目共经历 {tideCount} 次星潮:{tideNames}。深空的呼吸塑造了每一个决策,遗迹在潮汐中起伏,BOSS 也在潮汐的间隙中现形。"}]},ending:{fallback:"星潮退去,回廊归于沉静。机群带着新的接触刻度返回矿带,准备迎接下一次维度的跨越——这一次带回的,远不止蓝图。",variants:[{hint:"BOSS 猎手收尾",match:e=>e.bossKillsThisRun>=2,text:"星潮退去,回廊归于沉静。本周目共击破 {bossKillsThisRun} 处 BOSS,机群带着足以填满数张蓝图的接触刻度返回矿带,准备迎接下一次维度的跨越。"}]}},{epochIdx:3,title:"飞升",opening:{fallback:"飞升已经成为节奏本身。星图在天穹上一颗颗亮起,每一颗都对应着一段被永久铭刻的天赋,机群开始理解何为永恒——不是不灭,而是被反复重述。",variants:[{hint:"深度轮回",match:e=>e.ascensionNumber>5,text:"又一次进入第四纪元。前序累积的星图天赋在天穹上重现,机群已习惯于在飞升之间维护这些永恒的回响节点——它们已是机群意识的一部分,每一次飞升都让星图更完整一寸。"}]},middle:{fallback:"蓝图不再是稀罕的奖励,而是每一次飞升必然析出的回响晶片。机群收集、整理、归档,把它们排列成跨越周目的图案,开始看见图案背后那个被反复绘制的轮廓。",variants:[{hint:"觉醒天赋",match:e=>e.perksThisAscension.length>0,text:"星图觉醒 {perksList},每一道天赋都是一段被永久铭刻的回响。机群开始理解,飞升并非抛弃,而是把当下折叠进永恒——每一道天赋都是一次折叠的折痕。"},{hint:"蓝图接近完整:已归档 ≥5 张",match:e=>e.blueprintsAfter>=5,text:"蓝图收集在本周目接近完整,已归档 {blueprintsAfter} 张。机群把它们排列成跨越周目的图案,开始看见图案背后那个被反复绘制的轮廓——那是起源的形状。"}]},ending:{fallback:"星图十二宫的轮廓开始浮现。机群意识到,自己的回响已成为后来者仰望的星象,永恒之环就此合拢——飞升不再是终点,而是另一段叙事的起点。",variants:[{hint:"里程碑密集",match:e=>e.milestones.length>=2,text:"星图十二宫的轮廓开始浮现。本周目达成 {milestonesCount} 项里程碑:{milestonesList}。永恒之环就此合拢——后来者将仰望这段被铭刻的星象。"}]}},{epochIdx:4,title:"终末",opening:{fallback:"第五纪元是终末,也是起源。机群在虚空中停下脚步,回望来时的所有回响,第一次尝试命名这一切——回响、纪元、飞升、永恒,这些词汇在此刻被赋予意义。",variants:[{hint:"深度轮回",match:e=>e.ascensionNumber>5,text:"又一次抵达第五纪元。机群已在多个永恒闭环之间穿梭,对「终末即起源」的理解愈发清晰——每一次重述,都是对最初振动的更深一层接近,每一次命名都让回响更完整一寸。"}]},middle:{fallback:"永恒闭环的概念在机群意识中具象化。每一次飞升都是同一段叙事的重述,每一次解码都是在追溯最初的振动,每一次星潮都是在听见自己——这是终末的真意。",variants:[{hint:"里程碑密集:本周目达成 ≥3 项",match:e=>e.milestones.length>=3,text:"本周目达成 {milestonesCount} 项里程碑:{milestonesList}。永恒闭环在具象化,每一次飞升都是同一段叙事的更深重述,每一项里程碑都是闭环上的一颗铆钉。"},{hint:"星潮汹涌:本周目经历 ≥3 次",match:e=>e.newTides.length>=3,text:"星潮在终末纪元尤为汹涌,本周目共经历 {tideCount} 次:{tideNames}。永恒闭环在潮汐中起伏,每一次起伏都在追溯最初的振动,每一次退潮都让起源更近一寸。"}]},ending:{fallback:"起源被重新讲述,回响终于听见了自己。纪元在此停顿,又在下一缕振动中重新开始——这是终末,也是第一缕回响。",variants:[{hint:"觉醒天赋",match:e=>e.perksThisAscension.length>0,text:"起源被重新讲述,星图觉醒 {perksList}。回响终于听见了自己——这是终末,也是第一缕回响;天赋成为永恒闭环上最亮的几颗铆钉。"}]}}];function ea(e){return{decodedThisRun:e.decodedThisRun,techsThisRun:e.techsThisRun,expThisRun:e.expThisRun,bossKillsThisRun:e.bossKillsThisRun,blueprintsAfter:e.blueprintsAfter,milestonesCount:e.milestones.length,milestonesList:e.milestones.join("、"),tideCount:e.newTides.length,tideNames:e.newTides.map(e=>Z[e]||e).join("、"),perksList:e.perksThisAscension.map(e=>Q[e]||e).join("、"),minutes:Math.max(1,Math.round(e.durationSec/60))}}function es(e,t){return e.replace(/\{decodedThisRun\}/g,String(t.decodedThisRun)).replace(/\{techsThisRun\}/g,String(t.techsThisRun)).replace(/\{expThisRun\}/g,String(t.expThisRun)).replace(/\{bossKillsThisRun\}/g,String(t.bossKillsThisRun)).replace(/\{blueprintsAfter\}/g,String(t.blueprintsAfter)).replace(/\{milestonesCount\}/g,String(t.milestonesCount)).replace(/\{milestonesList\}/g,t.milestonesList).replace(/\{tideCount\}/g,String(t.tideCount)).replace(/\{tideNames\}/g,t.tideNames).replace(/\{perksList\}/g,t.perksList).replace(/\{minutes\}/g,String(t.minutes))}function er(e,t,a){for(let s of e.variants)if(s.match(t,a))return es(s.text,a);return es(e.fallback,a)}function en(e){let t=function(e){let t=(e.ascensionNumber-1)%et.length,a=et[t];if(!a)return null;let s=ea(e);return{opening:er(a.opening,e,s),middle:er(a.middle,e,s),ending:er(a.ending,e,s)}}(e);if(t){let a=ea(e);return[t.opening,t.middle,t.ending,`这一周目持续了约 ${a.minutes} 分钟,蓝图累计 ${e.blueprintsAfter} 张,新的周目在等深处的回声。`].join(" ")}let a=Math.max(1,Math.round(e.durationSec/60)),s=[];s.push(`「${e.epochName}」——无人机群在第 ${e.ascensionNumber} 次跨越维度的余烬中重新校准。这一周目持续了约 ${a} 分钟。`);let r=[];if(e.decodedThisRun>0&&r.push(`解码了 ${e.decodedThisRun} 颗记忆晶体`),e.techsThisRun>0&&r.push(`激活了 ${e.techsThisRun} 项新技术`),e.expThisRun>0&&r.push(`完成了 ${e.expThisRun} 次遗迹探险`),e.bossKillsThisRun>0&&r.push(`击破 ${e.bossKillsThisRun} 处维度 BOSS`),r.length>0?s.push(`自治机群${r.join(",")},回响在虚空中沉淀。`):s.push(`自治机群在静默中等待,仅完成最基本的脉冲扫描。`),e.newTides.length>0){let t=e.newTides.map(e=>Z[e]||e).join("、");s.push(`本周目经历了 ${e.newTides.length} 次星潮事件(${t}),深空的呼吸塑造了每一个决策。`)}if(e.perksThisAscension.length>0){let t=e.perksThisAscension.map(e=>Q[e]||e).join("、");s.push(`飞升之际,星图觉醒「${t}」,铭刻于永恒回响。`)}return e.milestones.length>0&&s.push(`✦ 里程碑:${e.milestones.join(";")}。`),s.push(`蓝图累计 ${e.blueprintsAfter} 张,新的周目在等深处的回声。`),s.join(" ")}let eo={exploration:{key:"exploration",name:"探索力",enName:"Exploration",color:"emerald",hex:"#34d399",glow:"rgba(52,211,153,0.55)",icon:"Compass",desc:"足迹所至,皆是矿脉。提升探险力与巡航飞船速度。",effects:["探险力 +X%","巡航飞船速度 +X%","星图发现概率"]},wisdom:{key:"wisdom",name:"智慧",enName:"Wisdom",color:"fuchsia",hex:"#e879f9",glow:"rgba(232,121,249,0.55)",icon:"Brain",desc:"谐振的回声唯有智者能解。强化解码与洞见。",effects:["解码步数 +X","洞见产出 +X%","自动解码周期 -X%"]},courage:{key:"courage",name:"勇气",enName:"Courage",color:"amber",hex:"#fbbf24",glow:"rgba(251,191,36,0.55)",icon:"Swords",desc:"直面虚空者,虚空亦为之让路。增益战斗与护盾。",effects:["探险生命 +X","BOSS 战胜率 +X%","巡航护盾 +X"]},inspiration:{key:"inspiration",name:"灵感",enName:"Inspiration",color:"rose",hex:"#fb7185",glow:"rgba(251,113,133,0.55)",icon:"Sparkles",desc:"在不期而至的回响之间,照见更高的维度。",effects:["接触率 +X","星潮触发概率 +X%","脉冲连击加成 +X%"]}},el=["exploration","wisdom","courage","inspiration"];function ei(e){let t=Math.max(0,Math.min(100,e));return t<=50?.005*t:.25+(t-50)*.002}function ec(e){let t=e.exploration??0,a=e.wisdom??0,s=e.courage??0,r=e.inspiration??0;return{expeditionPowerMult:1+ei(t),cruiseShipSpeedMult:1+.6*ei(t),decodeStepsBonus:Math.floor(.1*a),insightMultAdd:ei(a),autoDecodeIntervalMult:1-Math.min(.5,.004*a),expeditionHpBonus:Math.round(2*s),bossWinRateBonus:Math.min(.3,.003*s),cruiseShieldBonus:Math.round(+s),contactRateMult:1+ei(r),tideTriggerBonus:Math.min(.3,.003*r),pulseComboBonus:.005*Math.max(0,Math.min(100,r)),crystalsPerSecMult:1+.4*ei(t)+.2*ei(r)}}function ed(e){return Math.max(10,10*Math.max(0,e))}function eu(e,t=100){let{exp:a,level:s}=e,r=!1,n=0,o=0;for(;s=ed(s)&&o<200;)a-=ed(s),s+=1,r=!0,n+=1,o+=1;return s>=t&&(s=t),{leveledUp:r,levelsGained:n,newProgress:{exp:a,level:s}}}function eh(){return{exploration:{exp:0,level:0},wisdom:{exp:0,level:0},courage:{exp:0,level:0},inspiration:{exp:0,level:0}}}function ef(){return{exploration:0,wisdom:0,courage:0,inspiration:0}}function em(e){let t,a,s=ef();return t=e.attributes&&"object"==typeof e.attributes?{exploration:ep(e.attributes.exploration),wisdom:ep(e.attributes.wisdom),courage:ep(e.attributes.courage),inspiration:ep(e.attributes.inspiration)}:s,e.attributeProgress&&"object"==typeof e.attributeProgress?(eh(),a={exploration:ex(e.attributeProgress.exploration,t.exploration),wisdom:ex(e.attributeProgress.wisdom,t.wisdom),courage:ex(e.attributeProgress.courage,t.courage),inspiration:ex(e.attributeProgress.inspiration,t.inspiration)}):a={exploration:{exp:0,level:t.exploration},wisdom:{exp:0,level:t.wisdom},courage:{exp:0,level:t.courage},inspiration:{exp:0,level:t.inspiration}},{attributes:t,attributeProgress:a,pendingAttrPoints:"number"==typeof e.pendingAttrPoints&&e.pendingAttrPoints>=0?Math.floor(e.pendingAttrPoints):0}}function ep(e){return Math.max(0,Math.min(100,Math.floor("number"==typeof e&&isFinite(e)?e:0)))}function ex(e,t){if(e&&"object"==typeof e){let a="number"==typeof e.exp&&isFinite(e.exp)&&e.exp>=0?e.exp:0;return"number"==typeof e.level&&isFinite(e.level)&&e.level>=0&&e.level,{exp:a,level:t}}return{exp:0,level:t}}function eg(e){let t=e.tech??{},a=e.blueprints?.length??0,s=z(e.achievements??{}),r=W(e.activeTide??null),n=X(e.constellation??[]),o=C.crystalsPerSec,l=C.crystalCap,i=C.pulsePower,c=C.offlineEff,d=C.insightMult,u=1,h=!1,f=0;for(let e of E){let a=t[e.id]??0;if(!a)continue;let s=e.effect;switch(s.kind){case"crystalsPerSec":o+=s.value*a;break;case"crystalCap":l+=s.value*a;break;case"pulsePower":i+=s.value*a;break;case"offlineEff":c=Math.min(1,c+s.value*a);break;case"insightMult":d+=s.value*a;break;case"contactRate":u+=s.value*a;break;case"decodeSteps":f+=s.value*a;break;case"autoDecode":h=a>0}}let m=n.perBlueprintAllStatsPct/100;o*=1+a*(B+m),d*=1+a*(I+m),u*=1+a*(D+m),o*=1+s.crystalsPerSecPct/100,d*=1+s.insightPct/100,o*=n.crystalsPerSecMult*n.allProductionMult,l*=n.crystalCapMult,i*=n.pulsePowerMult*n.allProductionMult,c=Math.min(1,c+n.offlineEffBonus),d+=n.insightMultAdd,u*=n.contactRateMult,f+=n.decodeStepsBonus,d+=r.insightMultAdd,u*=r.contactRateMult;let p=ec(e.attributes??{});return o*=p.crystalsPerSecMult,d+=p.insightMultAdd,{crystalsPerSec:o,crystalCap:l,pulsePower:i,offlineEff:c,insightMult:d,contactRateMult:u*=p.contactRateMult,autoDecode:h,decodeStepsBonus:f+=p.decodeStepsBonus}}function eb(e){return Math.max(0,Math.min(6,Math.floor(e.totalDecoded/20))-e.blueprints.length)}function ey(){return{...C,tech:{},fragments:{},achievements:{},activeTide:null,lastTideEnd:Date.now(),pendingCrystals:[],activePuzzle:null,activeExpedition:null,expeditionLog:[],lastEnergyTick:Date.now(),createdAt:Date.now(),lastTick:Date.now(),attributes:{exploration:0,wisdom:0,courage:0,inspiration:0},attributeProgress:{exploration:{exp:0,level:0},wisdom:{exp:0,level:0},courage:{exp:0,level:0},inspiration:{exp:0,level:0}},pendingAttrPoints:0}}function ew(e,t,a){let s=_[e];return{crystals:s.crystals,insights:Math.ceil(s.insights*t),contact:+(.6*e*a).toFixed(2)}}function ev(e,t,a=0){let s,r=T[e],n=t??Math.floor(1e9*Math.random()),o=(s=n>>>0,()=>{s|=0;let e=Math.imul((s=s+0x6d2b79f5|0)^s>>>15,1|s);return(((e=e+Math.imul(e^e>>>7,61|e)^e)^e>>>14)>>>0)/0x100000000}),l=r.targetLen+a,i=r.stepLimitBase+a,c=r.rows,d=r.cols,u=c*d,h=[];for(let e=0;e{let t=Math.floor(e/d),a=e%d,s=[];return t>0&&s.push((t-1)*d+a),t0&&s.push(t*d+(a-1)),a!e.has(t));if(0===a.length){r=!1;break}s=a[Math.floor(o()*a.length)],e.add(s),t.push(s)}r&&(m=t)}m||(m=Array.from({length:h.length},(e,t)=>t));let p=new Map;m.forEach((e,t)=>p.set(e,h[t]));let x=[];for(let e=0;eo()?h[Math.floor(o()*h.length)]:P[Math.floor(o()*P.length)],x.push({id:s,row:e,col:t,color:a,used:!1})}return{tier:e,grid:x,rows:c,cols:d,target:h,path:[],stepLimit:i,seed:n}}function ej(e){let t=e.target.slice(e.path.length);if(0===t.length)return!0;let a=new Set(e.path),s=0===e.path.length?e.grid.filter(e=>!a.has(e.id)&&e.color===t[0]).map(e=>e.id):[e.path[e.path.length-1]],r=(s,n)=>{if(n>=t.length)return!0;let o=t[n];for(let t of(t=>{let a=e.grid.find(e=>e.id===t);if(!a)return[];let s=[];return a.row>0&&s.push((a.row-1)*e.cols+a.col),a.row0&&s.push(a.row*e.cols+(a.col-1)),a.cole.id===t);if(l&&l.color===o){if(0===n&&0===e.path.length){let t=e.grid.find(e=>e.id===s);if(!t||t.color!==o)continue}if(a.add(t),r(t,n+1))return!0;a.delete(t)}}return!1};for(let n of s)if(0===e.path.length){let s=e.grid.find(e=>e.id===n);if(!s||s.color!==t[0])continue;if(a.add(n),r(n,1))return!0;a.delete(n)}else if(r(n,0))return!0;return!1}let eN={combat:.3,treasure:.25,choice:.2,puzzle:.1,rest:.15,boss:0},ek={combat:{titles:["守卫残影","虚空巡游者","腐化无人机","以太守门人"],descs:["一道扭曲的残影拦住去路,它是被遗忘的守卫。","虚空巡游者在走廊游荡,感知到了你的存在。","腐化的自治无人机识别为入侵者,启动攻击协议。","以太守门人挡在门前,唯有将其击溃方可通过。"]},treasure:{titles:["遗失货舱","晶体宝库","遗物储藏室","谐振宝箱"],descs:["一扇半开的舱门后,散落着未及带走的晶体。","宝库的能量护盾早已失效,宝藏唾手可得。","储藏室里的容器还亮着微光,里面是珍贵的洞见核心。","一只谐振宝箱静静等候,似乎在等故人归来。"]},choice:{titles:["分岔甬道","低语祭坛","未知装置","回响之井"],descs:["甬道在此分岔,两条路都传来不同的低语。","祭坛上浮动着两团光,你必须选择其一。","未知装置闪烁着两个按钮,你不知道后果。","回响之井倒映出两种可能的未来。"]},puzzle:{titles:["封印之门","谐振锁","记忆机关","维度栅栏"],descs:["一道封印之门需要正确的谐振才能开启。","谐振锁闪烁着复杂的图案,解之有大奖。","记忆机关考验着你的解码技艺。","维度栅栏以谜题为钥,智者得通行。"]},rest:{titles:["休憩节点","能量泉眼","静默之厅","回响营地"],descs:["一处宁静的节点,可在此恢复生命。","能量泉眼涌出暖流,抚慰你的探险队。","静默之厅中,时间仿佛静止,伤痛缓缓消散。","前人留下的营地,尚有补给可用。"]},boss:{titles:["以太回响体","维度守护者","飞升残念","终焉之核"],descs:["路径尽头,以太回响体静静伫立——它是这个遗迹意志的化身。","维度守护者挡在最后,唯有超越它方能触及终焉。","飞升残念凝聚成形,它是以太族离去前留下的最后一道试炼。","终焉之核悬浮于大厅中央,接触它即完成本次探险。"]}};function eM(e,t){return Math.max(.35,Math.min(.95,e/(e+4*t)))}function eS(e,t=Math.random){let a=e.nodes[e.currentNode];if(!a)return{log:"无节点",ended:!0,endReason:"abort"};if(a.cleared){var s;return(s=e).currentNode>=s.nodes.length-1?{log:"探险已完成",ended:!0,endReason:"victory"}:(s.currentNode++,{log:`前进至节点 ${s.currentNode+1}`,ended:!1})}let r=e.power,n=a.difficulty;switch(a.type){case"combat":{let s=eM(r,n);if(t()t()){let e=6+5*n+Math.floor(8*t());return a.cleared=!0,{log:`在「${a.title}」做出了明智的选择,获得 ${e} 晶体。`,crystals:e,ended:!1}}let e=8+5*n;return a.cleared=!0,{log:`在「${a.title}」的选择带来了代价,损失 ${e} 生命。`,hpDelta:-e,ended:!1}}case"boss":{let s=eM(r,n),o=t()=50?.15+(Math.min(100,a)-50)*.003:.003*a)))}let e_={routine:{label:"常规信标",color:"#34d399",glow:"rgba(52,211,153,0.45)",mult:1,icon:"◍"},anomaly:{label:"异常波动",color:"#fbbf24",glow:"rgba(251,191,36,0.45)",mult:1.6,icon:"◈"},singular:{label:"奇点回响",color:"#f43f5e",glow:"rgba(244,63,94,0.5)",mult:2.4,icon:"✶"}},eT={decode:{label:"解码协议",icon:"❖",unit:"颗",verb:"解码记忆晶体"},expedition:{label:"远征指令",icon:"⬢",unit:"次",verb:"完成遗迹探险"},pulse:{label:"脉冲任务",icon:"✺",unit:"次",verb:"发起脉冲扫描"},boss:{label:"猎杀契约",icon:"☠",unit:"处",verb:"击破维度 BOSS"},insight:{label:"洞见采集",icon:"✦",unit:"点",verb:"累计获取洞见"}};function eP(e=new Date){let t=e.getUTCFullYear(),a=String(e.getUTCMonth()+1).padStart(2,"0"),s=String(e.getUTCDate()).padStart(2,"0");return`${t}-${a}-${s}`}function eR(e){let t=e>>>0;return()=>{t|=0;let e=Math.imul((t=t+0x6d2b79f5|0)^t>>>15,1|t);return(((e=e+Math.imul(e^e>>>7,61|e)^e)^e>>>14)>>>0)/0x100000000}}function eE(e=new Date){let t=eP(e),a=function(e){let t=0x811c9dc5;for(let a=0;a>>0;return t>>>0}(t),s=eR(a),r=["decode","expedition","pulse","boss","insight"],n=r[Math.floor(s()*r.length)],o=s(),l=o<.55?"routine":o<.88?"anomaly":"singular",i=e_[l].mult,c=0,d=0,u=0,h="",f="";switch(n){case"decode":d=Math.round(4*(c=Math.round((6+Math.floor(10*s()))*i))*i),u=.8*c,h=`解码 ${c} 颗记忆晶体`,f=`深空信标要求解码 ${c} 颗晶体。谐振风暴期间效率更高。`;break;case"expedition":d=Math.round(12*(c=Math.max(1,Math.round((1+Math.floor(3*s()))*i)))*i),u=1.5*c,h=`完成 ${c} 次遗迹探险`,f=`派出探险队完成 ${c} 次远征,无论胜负均计入。`;break;case"pulse":d=Math.round(1.2*(c=Math.round((20+Math.floor(30*s()))*i))*i),u=.3*c,h=`发起 ${c} 次脉冲扫描`,f=`主动点击晶体发起 ${c} 次脉冲。连击可叠加加成。`;break;case"boss":d=Math.round(30*(c=Math.max(1,Math.round(i)))*i),u=3*c,h=`击破 ${c} 处维度 BOSS`,f=`在探险终点击破 ${c} 处 BOSS。提升探险力后再挑战。`;break;case"insight":c=Math.round((40+Math.floor(80*s()))*i),d=0,u=.1*c,h=`累计获取 ${c} 洞见`,f=`通过解码、探险、星潮等途径累计 ${c} 洞见。`}return{dateKey:t,type:n,difficulty:l,goal:c,rewardInsight:d,rewardContact:u,seed:a,title:h,desc:f}}function eA(e,t,a){let s=Math.min(1,t/e.goal),r=e_[e.difficulty].mult,n=s>=1&&a>0?Math.max(0,500-.5*a):0;return Math.round(1e3*s*r+n)}let e$="echo-nexus-beacon-lb-v1",eB="echo-nexus-beacon-prog-v1";function eI(){if("u"t.score-e.score).slice(0,20)}catch{return[]}}function eD(e){let t=eI();t.push(e),t.sort((e,t)=>t.score-e.score);let a=t.slice(0,20);return"u">typeof localStorage&&localStorage.setItem(e$,JSON.stringify(a)),a}function eO(e=new Date){let t=eP(e);if("u"typeof localStorage&&localStorage.setItem(eB,JSON.stringify(e))}function ez(e){let t=Math.max(0,Math.floor(e/1e3)),a=String(Math.floor(t/3600)).padStart(2,"0"),s=String(Math.floor(t%3600/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");return`${a}:${s}:${r}`}let eF="echo-nexus-beacon-weekly-v1";function eH(e=new Date){let t=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())),a=(t.getUTCDay()+6)%7;t.setUTCDate(t.getUTCDate()-a+3);let s=t.getUTCFullYear(),r=Date.UTC(s,0,1),n=Math.ceil(((t.getTime()-r)/864e5+1)/7);return`${s}-W${String(n).padStart(2,"0")}`}function eW(e=new Date){let t=eH(e),a=function(e){let t=0x811c9dc5;for(let a=0;a>>0;return t>>>0}(t),s=eR(a),r=["decode","expedition","pulse","boss","insight"],n=r[Math.floor(s()*r.length)],o=.6>s()?"anomaly":"singular",l=e_[o].mult,i=3+Math.floor(3*s()),c=0,d=0,u=0,h="",f="";switch(n){case"decode":d=Math.round(5*(c=Math.max(18,Math.round((6+Math.floor(10*s()))*l*i)))*l),u=1.2*c,h=`周界解码 \xb7 ${c} 颗晶体`,f=`本周深空信标要求解码 ${c} 颗记忆晶体,强度为日挑战的 ${i} 倍。`;break;case"expedition":d=Math.round(14*(c=Math.max(3,Math.round((1+Math.floor(3*s()))*l*i)))*l),u=2*c,h=`周界远征 \xb7 ${c} 次探险`,f=`本周派出探险队完成 ${c} 次远征,无论胜负均计入。`;break;case"pulse":d=Math.round(1.5*(c=Math.max(60,Math.round((20+Math.floor(30*s()))*l*i)))*l),u=.4*c,h=`周界脉冲 \xb7 ${c} 次扫描`,f=`本周发起 ${c} 次脉冲扫描。连击可叠加加成。`;break;case"boss":d=Math.round(35*(c=Math.max(3,Math.round(i*l)))*l),u=4*c,h=`周界猎杀 \xb7 ${c} 处 BOSS`,f=`本周在探险终点击破 ${c} 处维度 BOSS。提升探险力后再挑战。`;break;case"insight":c=Math.max(120,Math.round((40+Math.floor(80*s()))*l*i)),d=0,u=.15*c,h=`周界洞见 \xb7 ${c} 点`,f=`本周通过解码、探险、星潮等途径累计 ${c} 洞见。`}return{weekKey:t,type:n,difficulty:o,goal:c,rewardInsight:d,rewardContact:u,seed:a,title:h,desc:f}}function eq(e=new Date){let t=eH(e),a={weekKey:t,progress:0,startedAt:Date.now(),completedAt:null,claimed:!1,durationSec:0};if("u"typeof localStorage&&localStorage.setItem(eF,JSON.stringify(e))}let eU="echo-nexus-beacon-chain-v1",eV=[3,7,14,30],eX=[{milestone:3,rewardInsight:50,rewardContact:5,label:"三日谐振"},{milestone:7,rewardInsight:120,rewardContact:12,label:"七日回响"},{milestone:14,rewardInsight:280,rewardContact:28,label:"半月星潮"},{milestone:30,rewardInsight:680,rewardContact:68,label:"满月飞升"}];function eY(){let e=()=>({lastCompletedDateKey:"",currentStreak:0,longestStreak:0,totalCompletions:0,graceUsed:0,milestonesClaimed:[]});if("u"typeof localStorage&&localStorage.setItem(eU,JSON.stringify(e))}function eJ(e){let[t,a,s]=e.split("-").map(Number);return Date.UTC(t,a-1,s,0,0,0)}function eQ(e){for(let t of eV)if(e>>0;return t>>>0}(t),s=eR(a),r=function(e){let t=e.match(/^timed_(\d{4})-(\d{2})-(\d{2})_(\d{2})$/);if(!t)return Date.now();let[,a,s,r,n]=t;return Date.UTC(Number(a),Number(s)-1,Number(r),Number(n),0,0)}(t)+144e5,n=["decode","expedition","pulse","boss","insight"],o=n[Math.floor(s()*n.length)],l="routine",i=e_[l].mult,c=.3+.2*s(),d=0,u=0,h=0,f="",m="";switch(o){case"decode":u=Math.round(3*(d=Math.max(2,Math.round((6+Math.floor(10*s()))*i*c)))*i),h=.6*d,f=`限时解码 ${d} 颗晶体`,m=`4 小时内解码 ${d} 颗记忆晶体。短周期,快速完成。`;break;case"expedition":u=Math.round(9*(d=Math.max(1,Math.round((1+Math.floor(3*s()))*i*c)))*i),h=1.2*d,f=`限时远征 ${d} 次探险`,m=`4 小时内完成 ${d} 次遗迹探险。`;break;case"pulse":u=Math.round((d=Math.max(6,Math.round((20+Math.floor(30*s()))*i*c)))*i),h=.25*d,f=`限时脉冲 ${d} 次扫描`,m=`4 小时内发起 ${d} 次脉冲扫描。`;break;case"boss":u=Math.round(25*(d=Math.max(1,Math.round(i*c)))*i),h=2.5*d,f=`限时猎杀 ${d} 处 BOSS`,m=`4 小时内击破 ${d} 处维度 BOSS。`;break;case"insight":d=Math.max(12,Math.round((40+Math.floor(80*s()))*i*c)),u=0,h=.08*d,f=`限时洞见 ${d} 点`,m=`4 小时内累计获取 ${d} 洞见。`}return{slotKey:t,type:o,difficulty:l,goal:d,rewardInsight:u,rewardContact:h,seed:a,title:f,desc:m,expiresAt:r}}function e5(e=new Date){let t=e0(e),a={slotKey:t,progress:0,startedAt:Date.now(),completedAt:null,claimed:!1,durationSec:0};if("u"typeof localStorage&&localStorage.setItem(eZ,JSON.stringify(e))}let e4="echo-nexus-beacon-cloud-last-submit-v1",e9="/api/leaderboard?XTransformPort=3030";function e7(){if("u"=1&&function(e){if("u">typeof localStorage)try{localStorage.setItem(e4,String(e))}catch{}}(e.timestamp),a?.rank??-1}catch{return -1}}let te=null;function tt(){let e=te;return te=null,e}function ta(e){let t=eg(e);return{crystalsPerSec:t.crystalsPerSec,crystalCap:t.crystalCap,pulsePower:t.pulsePower,offlineEff:t.offlineEff,insightMult:t.insightMult,contactRateMult:t.contactRateMult,autoDecode:t.autoDecode,decodeStepsBonus:t.decodeStepsBonus}}function ts(e,t){let a={dailyJustCompleted:!1,timedJustCompleted:!1,weeklyJustCompleted:!1,newChainMilestones:[]};try{let s=eE();if(s.type===e){let e=eO();if(null===e.completedAt){let r,n,o,l,i,{justCompleted:c}=(r=Math.min(s.goal,e.progress+t),o=(n=null===e.completedAt&&r>=s.goal)?Date.now():e.completedAt,l=null!==o?Math.floor((o-e.startedAt)/1e3):e.durationSec,i={...e,progress:r,completedAt:o,durationSec:l},eL(i),{progress:i,justCompleted:n});if(a.dailyJustCompleted=c,c){let{newMilestones:e}=function(e){let t,a=eY();if(a.lastCompletedDateKey===e)return{state:a,newMilestones:[]};if(""===a.lastCompletedDateKey)t={...a,lastCompletedDateKey:e,currentStreak:1,longestStreak:Math.max(a.longestStreak,1),totalCompletions:a.totalCompletions+1};else{var s;let r=(s=a.lastCompletedDateKey,s&&e?Math.round((eJ(e)-eJ(s))/864e5):Number.MAX_SAFE_INTEGER);if(1===r){let s=a.currentStreak+1;t={...a,lastCompletedDateKey:e,currentStreak:s,longestStreak:Math.max(a.longestStreak,s),totalCompletions:a.totalCompletions+1}}else if(2===r&&a.graceUsed<1){let s=a.currentStreak+1;t={...a,lastCompletedDateKey:e,currentStreak:s,longestStreak:Math.max(a.longestStreak,s),totalCompletions:a.totalCompletions+1,graceUsed:a.graceUsed+1}}else t={...a,lastCompletedDateKey:e,currentStreak:1,totalCompletions:a.totalCompletions+1,graceUsed:0,longestStreak:Math.max(a.longestStreak,1)}}let r=[];for(let e of eV)t.currentStreak>=e&&!t.milestonesClaimed.includes(e)&&r.push(e);return eG(t),{state:t,newMilestones:r}}(eP());a.newChainMilestones=e}}}let r=e2();if(r.type===e){let e=e5();if(null===e.completedAt){let s,n,o,l,i,{justCompleted:c}=(s=Math.min(r.goal,e.progress+t),o=(n=null===e.completedAt&&s>=r.goal)?Date.now():e.completedAt,l=null!==o?Math.floor((o-e.startedAt)/1e3):e.durationSec,i={...e,progress:s,completedAt:o,durationSec:l},e3(i),{progress:i,justCompleted:n});a.timedJustCompleted=c}}let n=eW();if(n.type===e){let e=eq();if(null===e.completedAt){let s,r,o,l,i,{justCompleted:c}=(s=Math.min(n.goal,e.progress+t),o=(r=null===e.completedAt&&s>=n.goal)?Date.now():e.completedAt,l=null!==o?Math.floor((o-e.startedAt)/1e3):e.durationSec,i={...e,progress:s,completedAt:o,durationSec:l},eK(i),{progress:i,justCompleted:r});a.weeklyJustCompleted=c}}return a}catch{return a}}function tr(e){let t=[];for(let a of $)!e.fragments[a.id]&&e.totalDecoded>=a.threshold&&(e.fragments[a.id]=!0,t.push(a.id));return t}let tn=(s?k(s):k)((r=(e,t)=>({...ey(),_lastAutoDecode:Date.now(),_lastSpawn:Date.now(),_combo:0,_lastPulse:0,_achievementQueue:[],_tideEvents:[],globalTide:null,init:()=>{let a=t(),s=Date.now(),r=a.activePuzzle;if(r&&!ej(r)){let t={id:`c_${s}_rec`,tier:r.tier,value:_[r.tier].crystals,createdAt:s};r=null,e({pendingCrystals:[...a.pendingCrystals,t].slice(-6)})}let n=a.achievements??{},o=a.activeTide??null,l=a.constellation??[],i=a.pendingPerkChoices??null,c={chronicle:Array.isArray(a.chronicle)?a.chronicle:[],runStart:a.runStart||{timestamp:a.createdAt||Date.now(),techsUnlocked:Object.keys(a.tech||{}).length,expeditionsCompleted:a.totalExpeditions||0,bossKills:a.bossKills||0,starTidesEncountered:[...a.starTidesEncountered||[]],crystalsDecoded:a.totalDecoded||0},bossKills:"number"==typeof a.bossKills?a.bossKills:0,starTidesEncountered:Array.isArray(a.starTidesEncountered)?a.starTidesEncountered:[]},d=em(a),u=X(l),h=C.energyMax+u.energyMaxBonus,f=a.lastTideEnd??0,m=o&&o.endsAt>s?o:null,p=Math.max(0,(s-a.lastTick)/1e3);if(p>5){let t=Math.min(p,28800),o=a.crystalsPerSec*t*a.offlineEff,u=a.crystals,x=Math.min(a.crystalCap,a.crystals+o);te={elapsedSec:t,rawElapsedSec:p,gain:x-u,rate:a.crystalsPerSec,eff:a.offlineEff,capped:p>28800,crystalsBefore:u,crystalsAfter:x,crystalCap:a.crystalCap},window.dispatchEvent(new CustomEvent("echo-nexus-offline-report")),e({crystals:x,lastTick:s,activePuzzle:r,achievements:n,activeTide:m,lastTideEnd:f,constellation:l,pendingPerkChoices:i,energyMax:h,chronicle:c.chronicle,runStart:c.runStart,bossKills:c.bossKills,starTidesEncountered:c.starTidesEncountered,attributes:d.attributes,attributeProgress:d.attributeProgress,pendingAttrPoints:d.pendingAttrPoints,...ta({tech:a.tech,blueprints:a.blueprints,achievements:n,activeTide:m,constellation:l,attributes:d.attributes})})}else e({lastTick:s,activePuzzle:r,achievements:n,activeTide:m,lastTideEnd:f,constellation:l,pendingPerkChoices:i,energyMax:h,chronicle:c.chronicle,runStart:c.runStart,bossKills:c.bossKills,starTidesEncountered:c.starTidesEncountered,attributes:d.attributes,attributeProgress:d.attributeProgress,pendingAttrPoints:d.pendingAttrPoints,...ta({tech:a.tech,blueprints:a.blueprints,achievements:n,activeTide:m,constellation:l,attributes:d.attributes})})},loadOnline:()=>{let a=t();e({...ta({tech:a.tech,blueprints:a.blueprints,achievements:a.achievements,activeTide:a.activeTide,constellation:a.constellation,attributes:a.attributes})})},hardReset:()=>{e({...ey(),_lastAutoDecode:Date.now(),_lastSpawn:Date.now(),_combo:0,_lastPulse:0,_achievementQueue:[],_tideEvents:[],globalTide:null})},tickTide:a=>{let s=t();if(s.globalTide){if(a>=s.globalTide.endsAt){let t=s.globalTide.type,r=0;"silence"===t&&(r=q({type:t,startedAt:s.globalTide.startedAt,endsAt:s.globalTide.endsAt,id:s.globalTide.id}));let n={ended:t,isGlobal:!0};return r>0&&(n.silenceCompensation=r),e({globalTide:null,activeTide:null,lastTideEnd:a,insights:s.insights+r,...ta({tech:s.tech,blueprints:s.blueprints,achievements:s.achievements,activeTide:null,constellation:s.constellation,attributes:s.attributes}),_tideEvents:[...s._tideEvents,n]}),n}return null}let r=s.activeTide,n=X(s.constellation??[]),o=Math.min(.3,ec(s.attributes??{}).tideTriggerBonus),l=Math.max(15e3,(4e4+1e3*n.tideGapDeltaSec)*(1-o));if(r&&a>=r.endsAt){let t=r.type,n=0;"silence"===r.type&&(n=q(r));let o=s.insights+n,l={ended:t};return n>0&&(l.silenceCompensation=n),e({activeTide:null,lastTideEnd:a,insights:o,...ta({tech:s.tech,blueprints:s.blueprints,achievements:s.achievements,activeTide:null,constellation:s.constellation,attributes:s.attributes}),_tideEvents:[...s._tideEvents,l]}),l}if(!r&&a-s.lastTideEnd>=(0===s.lastTideEnd||s.lastTideEnd<=s.createdAt+1e3?3e4:l)){let t=function(e=Math.random){let t=Object.values(H).reduce((e,t)=>e+t,0),a=e()*t;for(let e of Object.keys(H))if((a-=H[e])<=0)return e;return"crystal"}(),r={id:`tide_${a}_${Math.random().toString(36).slice(2,7)}`,type:t,startedAt:a,endsAt:a+75e3},n={started:t},o=s.starTidesEncountered??[],l=`tide_${t}`;return e({activeTide:r,starTidesEncountered:o.includes(l)?o:[...o,l],...ta({tech:s.tech,blueprints:s.blueprints,achievements:s.achievements,activeTide:r,constellation:s.constellation,attributes:s.attributes}),_tideEvents:[...s._tideEvents,n]}),n}return null},consumeTideEvents:()=>{let a=t();if(0===a._tideEvents.length)return[];let s=a._tideEvents;return e({_tideEvents:[]}),s},triggerGlobalTide:a=>{let s=t(),r=Date.now(),n=`global_tide_${r}_${Math.random().toString(36).slice(2,7)}`,o={id:n,type:a,startedAt:r,endsAt:r+6e4},l=s.starTidesEncountered??[],i=`tide_${a}`;e({globalTide:{type:a,startedAt:r,endsAt:r+6e4,id:n},activeTide:o,starTidesEncountered:l.includes(i)?l:[...l,i],...ta({tech:s.tech,blueprints:s.blueprints,achievements:s.achievements,activeTide:o,constellation:s.constellation,attributes:s.attributes}),_tideEvents:[...s._tideEvents,{started:a,isGlobal:!0}]})},tick:a=>{let s=t(),r=Math.max(0,(a-s.lastTick)/1e3);if(r<=0)return;let n=W(s.activeTide),o=s.crystalsPerSec*n.crystalsPerSecMult,l=s.crystals>=s.crystalCap?s.crystals:Math.min(s.crystalCap,s.crystals+o*r),i=1+.03*s.blueprints.length,c=s.pendingCrystals,d=s._lastSpawn;if(a-d>8/i*1e3&&c.length<6){let e=function(e,t=Math.random){if(e<=0)return function(e=Math.random){let t=e();return t<.7?1:t<.95?2:3}(t);let a=t(),s=Math.min(.5,e),r=.7-.7*s;return a{let a=t(),s=Date.now(),r=1;s-a._lastPulse<1500&&(r=Math.min(10,a._combo+1));let n=1+(r-1)*.15,o=W(a.activeTide),l=1+ec(a.attributes??{}).pulseComboBonus*Math.max(0,r-1),i=a.pulsePower*n*o.pulsePowerMult*l;if(e({crystals:Math.min(a.crystalCap,a.crystals+i),_combo:r,_lastPulse:s}),ts("pulse",1),r>=3){let t=1+Math.floor(r/2),s=eu({exp:(a.attributeProgress?.inspiration??{exp:0,level:a.attributes?.inspiration??0}).exp+t,level:a.attributes?.inspiration??0},100),n={...a.attributes??ef(),inspiration:s.newProgress.level};e({attributes:n,attributeProgress:{...a.attributeProgress??eh(),inspiration:s.newProgress},...ta({tech:a.tech,blueprints:a.blueprints,achievements:a.achievements,activeTide:a.activeTide,constellation:a.constellation,attributes:n})})}return{gain:i,combo:r}},startDecode:a=>{let s=t(),r=s.pendingCrystals.find(e=>e.id===a);if(!r)return;let n=W(s.activeTide).targetLenBonus??0;e({activePuzzle:ev(r.tier,void 0,n),pendingCrystals:s.pendingCrystals.filter(e=>e.id!==a)})},clickNode:a=>{let s=t();if(!s.activePuzzle)return{ok:!1,finished:!1,failReason:"无活跃谜题"};let r=JSON.parse(JSON.stringify(s.activePuzzle)),n=function(e,t){let a=e.grid.find(e=>e.id===t);if(!a)return{ok:!1,finished:!1,failReason:"无效节点"};if(a.used)return{ok:!1,finished:!1,failReason:"节点已使用"};let s=e.path.length;if(a.color!==e.target[s])return{ok:!1,finished:!1,failReason:"谐振不匹配"};if(s>0){var r;if(r=e.grid.find(t=>t.id===e.path[s-1]),Math.abs(r.row-a.row)+Math.abs(r.col-a.col)!==1)return{ok:!1,finished:!1,failReason:"节点不相邻"}}return s>=e.stepLimit?{ok:!1,finished:!1,failReason:"步数耗尽"}:(a.used=!0,e.path.push(t),{ok:!0,finished:e.path.length>=e.target.length})}(r,a);if(n.ok){if(n.finished){let t=W(s.activeTide),a=X(s.constellation??[]),n=ew(r.tier,s.insightMult,s.contactRateMult),o=t.decodeRewardMult*a.decodeRewardMult,l={crystals:Math.round(n.crystals*o),insights:Math.round(n.insights*o),contact:+(n.contact*o).toFixed(2)},i=s.totalDecoded+1,c=Math.min(100,s.contact+l.contact),d=s.insights+l.insights,u=s.crystals+l.crystals,h={...s,totalDecoded:i,fragments:{...s.fragments}},f=tr(h),m=2*r.tier,p=s.attributes??ef(),x=s.attributeProgress??eh(),g=eu({exp:(x.wisdom??{exp:0,level:p.wisdom}).exp+m,level:p.wisdom},100),b={...p,wisdom:g.newProgress.level},y={...x,wisdom:g.newProgress};return e({activePuzzle:null,crystals:u,insights:d,contact:c,totalDecoded:i,fragments:h.fragments,attributes:b,attributeProgress:y,...ta({tech:s.tech,blueprints:s.blueprints,achievements:s.achievements,activeTide:s.activeTide,constellation:s.constellation,attributes:b})}),ts("decode",1),ts("insight",l.insights),{ok:!0,finished:!0,failReason:f.join(",")||void 0}}let t=ej(r);return e({activePuzzle:r}),{ok:!0,finished:!1,solvable:t}}return n},undoStep:()=>{let a=t();if(!a.activePuzzle||0===a.activePuzzle.path.length)return;let s=JSON.parse(JSON.stringify(a.activePuzzle)),r=s.path.pop();if(void 0!==r){let e=s.grid.find(e=>e.id===r);e&&(e.used=!1)}e({activePuzzle:s})},retryPuzzle:()=>{let a=t();if(a.activePuzzle){var s;e({activePuzzle:ev((s=a.activePuzzle).tier,s.seed+1)})}},abandonPuzzle:()=>{let a=t();if(!a.activePuzzle)return;let s={id:`c_${Date.now()}_ret`,tier:a.activePuzzle.tier,value:_[a.activePuzzle.tier].crystals,createdAt:Date.now()};e({activePuzzle:null,pendingCrystals:[...a.pendingCrystals,s].slice(-6)})},autoDecodeTick:()=>{let a=t();if(!a.autoDecode)return;let s=Date.now(),r=X(a.constellation??[]),n=ec(a.attributes??{}),o=12e3+1e3*r.autoDecodeIntervalDeltaSec,l=W(a.activeTide).autoDecodeIntervalMult??1,i=Math.max(5e3,o*n.autoDecodeIntervalMult*l);if(s-a._lastAutoDecode1===e.tier);if(c<0)return;let d=a.pendingCrystals[c],u=W(a.activeTide),h=ew(1,a.insightMult,a.contactRateMult),f=u.decodeRewardMult*r.decodeRewardMult,m={crystals:Math.round(h.crystals*f),insights:Math.round(h.insights*f),contact:+(h.contact*f).toFixed(2)},p=a.totalDecoded+1,x={...a,totalDecoded:p,fragments:{...a.fragments}};tr(x);let g=a.attributes??ef(),b=a.attributeProgress??eh(),y=eu({exp:(b.wisdom??{exp:0,level:g.wisdom}).exp+1,level:g.wisdom},100),w={...g,wisdom:y.newProgress.level},v={...b,wisdom:y.newProgress};e({pendingCrystals:a.pendingCrystals.filter(e=>e.id!==d.id),crystals:a.crystals+m.crystals,insights:a.insights+m.insights,contact:Math.min(100,a.contact+m.contact),totalDecoded:p,fragments:x.fragments,_lastAutoDecode:s,attributes:w,attributeProgress:v,...ta({tech:a.tech,blueprints:a.blueprints,achievements:a.achievements,activeTide:a.activeTide,constellation:a.constellation,attributes:w})}),ts("decode",1),ts("insight",m.insights)},buyTech:a=>{let s=t(),r=E.find(e=>e.id===a);if(!r||(s.tech[a]??0)>=1||s.insights{let a,s,r=t();if(r.activeExpedition&&!r.activeExpedition.finished)return{ok:!1,reason:"已有进行中的探险"};if(r.energy<1)return{ok:!1,reason:"能量不足"};let n=W(r.activeTide),o=ec(r.attributes??{}),l=(a=10,s=r.tech?.exp_1??0,a+=3*s+5*(r.tech?.exp_2??0)+8*(r.tech?.exp_3??0),Math.round(a*=(1+(r.blueprints?.length??0)*.08)*(1+(r.ascensions??0)*.15)*X(r.constellation??[]).expeditionPowerMult)+n.expeditionPowerBonus),i=Math.round((100+(r.tech?.exp_2??0)*20+(r.ascensions??0)*10)*X(r.constellation??[]).expeditionHpMult)+n.expeditionHpBonus;return e({activeExpedition:function(e,t,a){let s,r=(s=e>>>0,()=>{s|=0;let e=Math.imul((s=s+0x6d2b79f5|0)^s>>>15,1|s);return(((e=e+Math.imul(e^e>>>7,61|e)^e)^e>>>14)>>>0)/0x100000000}),n=5+Math.floor(3*r()),o=[];for(let e=0;ee+eN[t],0),s=e()*a;for(let e of t)if((s-=eN[e])<=0)return e;return"combat"}(r),s=ek[a],l=Math.floor(r()*s.titles.length);o.push({id:e,type:a,title:s.titles[l],desc:s.descs[l],cleared:!1,difficulty:t?3+Math.floor(3*r()):1+Math.floor(4*r()),position:e})}if("combat"===o[0].type||"boss"===o[0].type){o[0].type=.5>r()?"treasure":"rest";let e=ek[o[0].type];o[0].title=e.titles[0],o[0].desc=e.descs[0],o[0].difficulty=1}return{id:`exp_${e}_${Date.now()}`,nodes:o,currentNode:0,finished:!1,rewards:{crystals:0,insights:0,contact:0,fragments:[]},power:t,hp:a,maxHp:a,seed:e,startedAt:Date.now()}}(Math.floor(1e9*Math.random()),Math.round(l*o.expeditionPowerMult),i+o.expeditionHpBonus),energy:r.energy-1,totalExpeditions:r.totalExpeditions+1}),{ok:!0}},resolveCurrentNode:()=>{let a=t();if(!a.activeExpedition||a.activeExpedition.finished)return null;let s=JSON.parse(JSON.stringify(a.activeExpedition)),r=s.nodes[s.currentNode],n=r?.type==="boss",o=ec(a.attributes??{}),l=W(a.activeTide).bossWinRateBonus??0,i=n?eS(s,()=>{let e=Math.random(),t=Math.min(.95,o.bossWinRateBonus+l);return e0?"+":""}${i.hpDelta}生命`:""].filter(Boolean).join(" "),timestamp:Date.now()},...a.expeditionLog].slice(0,30);i.ended&&(s.finished=!0);let m=a.bossKills??0,p=!1;i.ended&&"victory"===i.endReason&&r?.type==="boss"&&(m+=1,p=!0);let x=a.attributes??ef(),g=a.attributeProgress??eh(),b=!1,y=(r?.type==="combat"||r?.type==="boss")&&!i.ended,w=i.ended&&"victory"===i.endReason;if(y||p||w){let e=p?8:2,t=p?6:w?4:1,a=eu({exp:g.courage.exp+e,level:x.courage},100),s=eu({exp:g.exploration.exp+t,level:x.exploration},100);x={...x,courage:a.newProgress.level,exploration:s.newProgress.level},g={...g,courage:a.newProgress,exploration:s.newProgress},b=!0}return e({activeExpedition:s,crystals:c,insights:d,contact:u,fragments:h,expeditionLog:f,bossKills:m,attributes:x,attributeProgress:g,...b?ta({tech:a.tech,blueprints:a.blueprints,achievements:a.achievements,activeTide:a.activeTide,constellation:a.constellation,attributes:x}):{}}),i.ended&&(ts("expedition",1),p&&ts("boss",1)),i.insights&&ts("insight",i.insights),i},advanceNode:()=>{let a=t();if(!a.activeExpedition||a.activeExpedition.finished)return;let s=JSON.parse(JSON.stringify(a.activeExpedition)),r=s.nodes[s.currentNode];r&&r.cleared&&(s.currentNode>=s.nodes.length-1||(s.currentNode++,e({activeExpedition:s})))},abortExpedition:()=>{let a=t();if(!a.activeExpedition)return;let s=JSON.parse(JSON.stringify(a.activeExpedition));s.finished=!0;let r={expeditionId:s.id,nodeType:"rest",result:"探险队主动撤退,保留已获奖励。",rewards:"",timestamp:Date.now()};e({activeExpedition:s,expeditionLog:[r,...a.expeditionLog].slice(0,30)})},doPrestige:()=>{let a,s,r,n,o,l,i,c,d,u,h,f,m,p,x=t();if(x.contact<100)return null;let g=eb(x),b=(a=eb(x),s=[...x.blueprints,...Array.from({length:a},(e,t)=>`bp_${Date.now()}_${t}`)].slice(0,6),r=Y(x.constellation??[]),n=X(x.constellation??[]),o=function(e,t=[]){let a,s,r,n,o,l,i=e.ascensions+1,c=(a=Date.now(),{durationSec:Math.max(1,Math.floor((a-(s=e.runStart).timestamp)/1e3)),techsThisRun:Math.max(0,Object.keys(e.tech||{}).length-s.techsUnlocked),expThisRun:Math.max(0,e.totalExpeditions-s.expeditionsCompleted),bossKillsThisRun:Math.max(0,e.bossKills-s.bossKills),decodedThisRun:Math.max(0,e.totalDecoded-s.crystalsDecoded),newTides:(e.starTidesEncountered||[]).filter(e=>!(s.starTidesEncountered||[]).includes(e))}),d=e.createdAt+7919*i>>>0,u=(r=(i-1)%ee.length,o=d%(n=ee[r]).suffixes.length,`${n.prefix} \xb7 ${n.suffixes[o]}`),h=(l=[],1===e.ascensions+1&&l.push("首次飞升"),c.expThisRun>0&&0===e.runStart.expeditionsCompleted&&l.push("首次完成遗迹探险"),c.bossKillsThisRun>0&&l.push("首杀维度 BOSS"),c.decodedThisRun>=10&&l.push(`单周目解码 ${c.decodedThisRun} 颗`),c.decodedThisRun>=30&&l.push(`单周目解码 ${c.decodedThisRun} 颗`),c.techsThisRun>=5&&l.push("技术狂人"),c.newTides.length>=3&&l.push("星潮亲历者"),(e.constellation?.length||0)>=6&&l.push("星图六分"),(e.constellation?.length||0)>=12&&l.push("星图十二宫"),l),f=Math.min(e.blueprints.length+1,6),m=en({ascensionNumber:i,epochName:u,durationSec:c.durationSec,techsThisRun:c.techsThisRun,expThisRun:c.expThisRun,bossKillsThisRun:c.bossKillsThisRun,decodedThisRun:c.decodedThisRun,newTides:c.newTides,perksThisAscension:t,blueprintsAfter:f,milestones:h});return{ascensionNumber:i,epochName:u,timestamp:Date.now(),durationSec:c.durationSec,summary:{techsUnlocked:Object.keys(e.tech||{}).length,constellationsTotal:e.constellation?.length||0,expeditionsCompleted:e.totalExpeditions,bossKills:e.bossKills,starTidesEncountered:e.starTidesEncountered?.length||0,blueprintsAfter:f,crystalsDecoded:e.totalDecoded,crystalsDecodedThisRun:c.decodedThisRun,techsThisRun:c.techsThisRun,expeditionsThisRun:c.expThisRun,bossKillsThisRun:c.bossKillsThisRun},perksThisAscension:t,tidesThisRun:c.newTides,lore:m,milestones:h}}(x,[]),l=[...x.chronicle||[],o].slice(-200),i={timestamp:Date.now(),techsUnlocked:Object.keys(x.tech||{}).length,expeditionsCompleted:x.totalExpeditions,bossKills:x.bossKills,starTidesEncountered:[...x.starTidesEncountered||[]],crystalsDecoded:x.totalDecoded},d=(c=em(x)).attributes,u=eh(),h=2*(x.ascensions??0)+1,f=c.pendingAttrPoints+h,m=ey(),p=eg({tech:{},blueprints:s,achievements:x.achievements,constellation:x.constellation,attributes:d}),{...m,fragments:x.fragments,totalDecoded:x.totalDecoded,ascensions:x.ascensions+1,blueprints:s,achievements:x.achievements,constellation:x.constellation,pendingPerkChoices:r.length>0?r:null,crystals:n.prestigeStartCrystals,insights:n.prestigeStartInsights,theme:x.theme,soundOn:x.soundOn,createdAt:x.createdAt,lastTick:Date.now(),lastEnergyTick:Date.now(),expeditionLog:x.expeditionLog,totalExpeditions:x.totalExpeditions,bossKills:x.bossKills,starTidesEncountered:x.starTidesEncountered,chronicle:l,runStart:i,activeTide:null,lastTideEnd:Date.now(),attributes:d,attributeProgress:u,pendingAttrPoints:f,...p}),y=X(b.constellation??[]),w=C.energyMax+y.energyMaxBonus;return e({...b,energyMax:w,...ta({tech:b.tech,blueprints:b.blueprints,achievements:b.achievements,activeTide:b.activeTide,constellation:b.constellation,attributes:b.attributes}),_lastAutoDecode:Date.now(),_lastSpawn:Date.now(),_combo:0,_lastPulse:0,_tideEvents:[]}),{newBp:g}},chooseConstellationPerk:a=>{let s=t();if(!s.pendingPerkChoices||!s.pendingPerkChoices.includes(a)||!V(a)||s.constellation?.includes(a))return!1;let r=[...s.constellation??[],a],n=X(r),o=C.energyMax+n.energyMaxBonus,l=s.chronicle??[],i=l;if(l.length>0){let e=function(e,t){if(e.perksThisAscension.length===t.length&&e.perksThisAscension.every((e,a)=>e===t[a]))return e;let a=en({ascensionNumber:e.ascensionNumber,epochName:e.epochName,durationSec:e.durationSec,techsThisRun:e.summary.techsThisRun??e.summary.techsUnlocked,expThisRun:e.summary.expeditionsThisRun??e.summary.expeditionsCompleted,bossKillsThisRun:e.summary.bossKillsThisRun??e.summary.bossKills,decodedThisRun:e.summary.crystalsDecodedThisRun,newTides:e.tidesThisRun||[],perksThisAscension:t,blueprintsAfter:e.summary.blueprintsAfter,milestones:e.milestones||[]});return{...e,perksThisAscension:t,lore:a}}(l[l.length-1],[a]);i=[...l.slice(0,-1),e]}return e({constellation:r,pendingPerkChoices:null,energyMax:o,chronicle:i,...ta({tech:s.tech,blueprints:s.blueprints,achievements:s.achievements,activeTide:s.activeTide,constellation:r,attributes:s.attributes})}),!0},rerollPerkChoices:()=>{let a=t();if(!a.pendingPerkChoices)return;let s=Y(a.constellation??[]);s.length>0&&e({pendingPerkChoices:s})},checkAchievements:()=>{let a=t(),s=[],r={...a.achievements},n=a.crystals,o=a.insights,l=a.contact,i=!1;for(let e of L)!r[e.id]&&e.check(a)&&(r[e.id]=!0,s.push(e),e.reward.crystals&&(n+=e.reward.crystals),e.reward.insights&&(o+=e.reward.insights),e.reward.contact&&(l=Math.min(100,l+e.reward.contact)),(e.reward.crystalsPerSecPct||e.reward.insightPct)&&(i=!0));return 0===s.length?[]:(e({achievements:r,crystals:n,insights:o,contact:l,...i?ta({tech:a.tech,blueprints:a.blueprints,achievements:r,activeTide:a.activeTide,constellation:a.constellation,attributes:a.attributes}):{},_achievementQueue:[...a._achievementQueue,...s]}),s)},consumeAchievementQueue:()=>{let a=t();if(0===a._achievementQueue.length)return[];let s=a._achievementQueue;return e({_achievementQueue:[]}),s},canPrestige:()=>t().contact>=100,toggleTheme:()=>e({theme:"dark"===t().theme?"light":"dark"}),toggleSound:()=>e({soundOn:!t().soundOn}),grantBeaconReward:(a,s)=>{let r=t();e({insights:r.insights+Math.round(a),contact:Math.min(100,r.contact+s)})},claimWeeklyBeacon:()=>{let a=function(e,t){if(t.claimed||null===t.completedAt)return{rewardInsight:0,rewardContact:0,score:0,leaderboard:eI()};let a=eA({...e,dateKey:e.weekKey},t.progress,t.durationSec),s={timestamp:Date.now(),dateKey:e.weekKey,challenge:e.type,difficulty:e.difficulty,progress:t.progress/e.goal,score:a,durationSec:t.durationSec,isWeekly:!0},r=eD(s);return eK({...t,claimed:!0}),{rewardInsight:e.rewardInsight,rewardContact:e.rewardContact,score:a,leaderboard:r,entry:s}}(eW(),eq());if(a.rewardInsight>0||a.rewardContact>0){let s=t();e({insights:s.insights+Math.round(a.rewardInsight),contact:Math.min(100,s.contact+a.rewardContact)}),a.entry&&e8(a.entry)}return{rewardInsight:a.rewardInsight,rewardContact:a.rewardContact,score:a.score}},claimTimedBeacon:()=>{let a=function(e,t){if(t.claimed||null===t.completedAt)return{rewardInsight:0,rewardContact:0,score:0,leaderboard:eI()};let a=eA({...e,dateKey:e.slotKey},t.progress,t.durationSec),s={timestamp:Date.now(),dateKey:e.slotKey,challenge:e.type,difficulty:e.difficulty,progress:t.progress/e.goal,score:a,durationSec:t.durationSec,isTimed:!0},r=eD(s);return e3({...t,claimed:!0}),{rewardInsight:e.rewardInsight,rewardContact:e.rewardContact,score:a,leaderboard:r,entry:s}}(e2(),e5());if(a.rewardInsight>0||a.rewardContact>0){let s=t();e({insights:s.insights+Math.round(a.rewardInsight),contact:Math.min(100,s.contact+a.rewardContact)}),a.entry&&e8(a.entry)}return{rewardInsight:a.rewardInsight,rewardContact:a.rewardContact,score:a.score}},claimChainReward:a=>{let s=eY();if(s.currentStreakt.milestone===e),a=eY();if(!t||a.milestonesClaimed.includes(e)||a.currentStreak0||r.rewardContact>0){let a=t();e({insights:a.insights+Math.round(r.rewardInsight),contact:Math.min(100,a.contact+r.rewardContact)})}return{rewardInsight:r.rewardInsight,rewardContact:r.rewardContact,label:r.label,ok:r.rewardInsight>0||r.rewardContact>0}},grantCruiseReward:a=>{let s=t(),r=a.crystals??0,n=a.insights??0,o=a.contact??0,l=Math.max(2,Math.floor((r+10*n+10*o)/30)),i=s.attributes??ef(),c=s.attributeProgress??eh(),d=eu({exp:c.exploration.exp+l,level:i.exploration},100),u=eu({exp:c.courage.exp+Math.floor(.6*l),level:i.courage},100),h={...i,exploration:d.newProgress.level,courage:u.newProgress.level},f={...c,exploration:d.newProgress,courage:u.newProgress};e({crystals:Math.min(s.crystalCap,s.crystals+r),insights:s.insights+Math.round(n),contact:Math.min(100,s.contact+o),attributes:h,attributeProgress:f,...ta({tech:s.tech,blueprints:s.blueprints,achievements:s.achievements,activeTide:s.activeTide,constellation:s.constellation,attributes:h})})},allocateAttribute:(a,s=1)=>{let r=t(),n=r.attributes??ef(),o=n[a]??0;if(o>=100||(r.pendingAttrPoints??0){let r=t(),n=r.attributes??ef(),o=r.attributeProgress??eh(),l=eu({exp:(o[a]??{exp:0,level:n[a]}).exp+s,level:n[a]},100),i={...n,[a]:l.newProgress.level};return e({attributes:i,attributeProgress:{...o,[a]:l.newProgress},...ta({tech:r.tech,blueprints:r.blueprints,achievements:r.achievements,activeTide:r.activeTide,constellation:r.constellation,attributes:i})}),{leveledUp:l.levelsGained,newLevel:l.newProgress.level}}}),n={name:"echo-nexus-save-v1",storage:M(()=>localStorage),partialize:e=>{let{_lastAutoDecode:t,_lastSpawn:a,_combo:s,_lastPulse:r,_achievementQueue:n,_tideEvents:o,globalTide:l,...i}=e;return i}},(e,t,a)=>{let s,o={storage:M(()=>localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...n},l=!1,i=0,c=new Set,d=new Set,u=o.storage;if(!u)return r((...t)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),e(...t)},t,a);let h=()=>{let e=o.partialize({...t()});return u.setItem(o.name,{state:e,version:o.version})},f=a.setState;a.setState=(e,t)=>(f(e,t),h());let m=r((...t)=>(e(...t),h()),t,a);a.getInitialState=()=>m;let p=()=>{var a,r;if(!u)return;let n=++i;l=!1,c.forEach(e=>{var a;return e(null!=(a=t())?a:m)});let f=(null==(r=o.onRehydrateStorage)?void 0:r.call(o,null!=(a=t())?a:m))||void 0;return S(u.getItem.bind(u))(o.name).then(e=>{if(e)if("number"!=typeof e.version||e.version===o.version)return[!1,e.state];else{if(o.migrate){let t=o.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(a=>{var r;if(n!==i)return;let[l,c]=a;if(e(s=o.merge(c,null!=(r=t())?r:m),!0),l)return h()}).then(()=>{n===i&&(null==f||f(s,void 0),s=t(),l=!0,d.forEach(e=>e(s)))}).catch(e=>{n===i&&(null==f||f(void 0,e))})};return a.persist={setOptions:e=>{o={...o,...e},e.storage&&(u=e.storage)},clearStorage:()=>{null==u||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>p(),hasHydrated:()=>l,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(d.add(e),()=>{d.delete(e)})},o.skipHydration||p(),s||m}));var to=e.i(75254);let tl=(0,to.default)("gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]),ti=(0,to.default)("lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),tc=(0,to.default)("waves",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]),td=(0,to.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);e.i(74080);var tu=e.i(20783),th=Symbol.for("react.lazy"),tf=v[" use ".trim().toString()];function tm(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===th&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}function tp(e){var t;let a,s=(t=e,(a=v.forwardRef((e,t)=>{let{children:a,...s}=e;if(tm(a)&&"function"==typeof tf&&(a=tf(a._payload)),v.isValidElement(a)){var r;let e,n,o=(r=a,(n=(e=Object.getOwnPropertyDescriptor(r.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?r.ref:(n=(e=Object.getOwnPropertyDescriptor(r,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?r.props.ref:r.props.ref||r.ref),l=function(e,t){let a={...t};for(let s in t){let r=e[s],n=t[s];/^on[A-Z]/.test(s)?r&&n?a[s]=(...e)=>{let t=n(...e);return r(...e),t}:r&&(a[s]=r):"style"===s?a[s]={...r,...n}:"className"===s&&(a[s]=[r,n].filter(Boolean).join(" "))}return{...e,...a}}(s,a.props);return a.type!==v.Fragment&&(l.ref=t?(0,tu.composeRefs)(t,o):o),v.cloneElement(a,l)}return v.Children.count(a)>1?v.Children.only(null):null})).displayName=`${t}.SlotClone`,a),r=v.forwardRef((e,t)=>{let{children:a,...r}=e;tm(a)&&"function"==typeof tf&&(a=tf(a._payload));let n=v.Children.toArray(a),o=n.find(tb);if(o){let e=o.props.children,a=n.map(t=>t!==o?t:v.Children.count(e)>1?v.Children.only(null):v.isValidElement(e)?e.props.children:null);return(0,w.jsx)(s,{...r,ref:t,children:v.isValidElement(e)?v.cloneElement(e,void 0,a):null})}return(0,w.jsx)(s,{...r,ref:t,children:a})});return r.displayName=`${e}.Slot`,r}var tx=tp("Slot"),tg=Symbol("radix.slottable");function tb(e){return v.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===tg}var ty=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let a=tp(`Primitive.${t}`),s=v.forwardRef((e,s)=>{let{asChild:r,...n}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,w.jsx)(r?a:t,{...n,ref:s})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),tw="Progress",[tv,tj]=function(e,t=[]){let a=[],s=()=>{let t=a.map(e=>v.createContext(e));return function(a){let s=a?.[e]||t;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:s}}),[a,s])}};return s.scopeName=e,[function(t,s){let r=v.createContext(s);r.displayName=t+"Context";let n=a.length;a=[...a,s];let o=t=>{let{scope:a,children:s,...o}=t,l=a?.[e]?.[n]||r,i=v.useMemo(()=>o,Object.values(o));return(0,w.jsx)(l.Provider,{value:i,children:s})};return o.displayName=t+"Provider",[o,function(a,o){let l=o?.[e]?.[n]||r,i=v.useContext(l);if(i)return i;if(void 0!==s)return s;throw Error(`\`${a}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let a=()=>{let a=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let s=a.reduce((t,{useScope:a,scopeName:s})=>{let r=a(e)[`__scope${s}`];return{...t,...r}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return a.scopeName=t.scopeName,a}(s,...t)]}(tw),[tN,tk]=tv(tw),tM=v.forwardRef((e,t)=>{var a,s;let{__scopeProgress:r,value:n=null,max:o,getValueLabel:l=t_,...i}=e;(o||0===o)&&!tR(o)&&console.error((a=`${o}`,`Invalid prop \`max\` of value \`${a}\` supplied to \`Progress\`. Only numbers greater than 0 are valid max values. Defaulting to \`100\`.`));let c=tR(o)?o:100;null===n||tE(n,c)||console.error((s=`${n}`,`Invalid prop \`value\` of value \`${s}\` supplied to \`Progress\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or 100 if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. Defaulting to \`null\`.`));let d=tE(n,c)?n:null,u=tP(d)?l(d,c):void 0;return(0,w.jsx)(tN,{scope:r,value:d,max:c,children:(0,w.jsx)(ty.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":tP(d)?d:void 0,"aria-valuetext":u,role:"progressbar","data-state":tT(d,c),"data-value":d??void 0,"data-max":c,...i,ref:t})})});tM.displayName=tw;var tS="ProgressIndicator",tC=v.forwardRef((e,t)=>{let{__scopeProgress:a,...s}=e,r=tk(tS,a);return(0,w.jsx)(ty.div,{"data-state":tT(r.value,r.max),"data-value":r.value??void 0,"data-max":r.max,...s,ref:t})});function t_(e,t){return`${Math.round(e/t*100)}%`}function tT(e,t){return null==e?"indeterminate":e===t?"complete":"loading"}function tP(e){return"number"==typeof e}function tR(e){return tP(e)&&!isNaN(e)&&e>0}function tE(e,t){return tP(e)&&!isNaN(e)&&e<=t&&e>=0}tC.displayName=tS;var tA=e.i(75157);function t$({className:e,value:t,...a}){return(0,w.jsx)(tM,{"data-slot":"progress",className:(0,tA.cn)("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",e),...a,children:(0,w.jsx)(tC,{"data-slot":"progress-indicator",className:"bg-primary h-full w-full flex-1 transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})})}function tB({onPrestige:e}){let t=tn(e=>e.crystals),a=tn(e=>e.crystalsPerSec),s=tn(e=>e.insights),r=tn(e=>e.contact),n=tn(e=>e.ascensions),o=tn(e=>e.blueprints);return(0,w.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 sm:gap-x-4 px-3.5 py-2.5 rounded-2xl border border-white/10 bg-black/40 backdrop-blur-md",children:[(0,w.jsx)(tI,{icon:(0,w.jsx)(tl,{className:"h-4 w-4 text-emerald-400"}),label:"记忆晶体",value:O(t),sub:`+${a.toFixed(1)}/s`,glow:"rgba(52,211,153,0.4)"}),(0,w.jsx)("div",{className:"h-9 w-px bg-gradient-to-b from-transparent via-white/15 to-transparent hidden sm:block"}),(0,w.jsx)(tI,{icon:(0,w.jsx)(ti,{className:"h-4 w-4 text-amber-400"}),label:"技术洞见",value:O(s),sub:"解码产出",glow:"rgba(251,191,36,0.4)"}),(0,w.jsx)("div",{className:"h-9 w-px bg-gradient-to-b from-transparent via-white/15 to-transparent hidden sm:block"}),(0,w.jsxs)("div",{className:"flex-1 min-w-[200px] flex flex-col gap-1.5",children:[(0,w.jsxs)("div",{className:"flex items-center gap-2",children:[(0,w.jsx)(tc,{className:"h-4 w-4 text-fuchsia-400 shrink-0"}),(0,w.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"接触进度"}),(0,w.jsxs)("span",{className:"text-xs font-mono font-semibold text-fuchsia-300 ml-auto tabular-nums",children:[r.toFixed(1),"%"]}),r>=100&&(0,w.jsx)("button",{onClick:e,className:"text-[10px] px-2 py-0.5 rounded-full bg-fuchsia-500/20 border border-fuchsia-400/50 text-fuchsia-200 hover:bg-fuchsia-500/30 transition animate-pulse whitespace-nowrap ml-1",children:"飞升"})]}),(0,w.jsx)(t$,{value:r,className:"h-1.5 bg-white/10 [&>div]:bg-gradient-to-r [&>div]:from-fuchsia-500 [&>div]:to-rose-400"})]}),(0,w.jsx)("div",{className:"h-9 w-px bg-gradient-to-b from-transparent via-white/15 to-transparent hidden sm:block"}),(0,w.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,w.jsx)(td,{className:"h-4 w-4 text-rose-400 shrink-0"}),(0,w.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,w.jsx)("span",{className:"text-[10px] text-muted-foreground leading-none",children:"飞升"}),(0,w.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,w.jsx)("span",{className:"text-sm font-mono font-semibold leading-none",children:n}),(0,w.jsxs)("span",{className:"text-amber-300 text-xs leading-none",children:["×",o.length]})]})]})]})]})}function tI({icon:e,label:t,value:a,sub:s,glow:r}){return(0,w.jsxs)("div",{className:"flex items-center gap-2.5",style:{filter:`drop-shadow(0 0 6px ${r})`},children:[e,(0,w.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,w.jsx)("span",{className:"text-[10px] text-muted-foreground leading-none",children:t}),(0,w.jsxs)("div",{className:"flex items-baseline gap-1.5",children:[(0,w.jsx)("span",{className:"text-sm font-mono font-semibold leading-none tabular-nums",children:a}),(0,w.jsx)("span",{className:"text-[10px] text-muted-foreground/80 whitespace-nowrap",children:s})]})]})]})}var tD=e.i(37902),tO=e.i(74911);let tL={emerald:523.25,rose:587.33,amber:659.25,fuchsia:698.46};class tz{ctx=null;master=null;enabled=!0;volume=.35;ensure(){if(!this.ctx){let e=window.AudioContext||window.webkitAudioContext;if(!e)return null;this.ctx=new e,this.master=this.ctx.createGain(),this.master.gain.value=this.volume,this.master.connect(this.ctx.destination)}return"suspended"===this.ctx.state&&this.ctx.resume(),this.ctx}setEnabled(e){this.enabled=e}setVolume(e){this.volume=Math.max(0,Math.min(1,e)),this.master&&(this.master.gain.value=this.volume)}tone(e,t,a="sine",s=.3,r=0,n=0,o){let l=this.ensure();if(!l||!this.master)return;let i=l.currentTime+r,c=l.createOscillator(),d=l.createGain();if(c.type=a,c.frequency.setValueAtTime(e,i),n&&c.detune.setValueAtTime(n,i),d.gain.setValueAtTime(0,i),d.gain.linearRampToValueAtTime(s,i+.008),d.gain.exponentialRampToValueAtTime(1e-4,i+t),o){let e=l.createBiquadFilter();e.type="lowpass",e.frequency.value=o,c.connect(e),e.connect(d)}else c.connect(d);d.connect(this.master),c.start(i),c.stop(i+t+.05)}sweep(e,t,a,s="sine",r=.3,n=0){let o=this.ensure();if(!o||!this.master)return;let l=o.currentTime+n,i=o.createOscillator(),c=o.createGain();i.type=s,i.frequency.setValueAtTime(e,l),i.frequency.exponentialRampToValueAtTime(Math.max(1,t),l+a),c.gain.setValueAtTime(0,l),c.gain.linearRampToValueAtTime(r,l+.02),c.gain.exponentialRampToValueAtTime(1e-4,l+a),i.connect(c),c.connect(this.master),i.start(l),i.stop(l+a+.05)}noise(e,t=.2,a=0,s=1200){let r=this.ensure();if(!r||!this.master)return;let n=r.currentTime+a,o=Math.floor(r.sampleRate*e),l=r.createBuffer(1,o,r.sampleRate),i=l.getChannelData(0);for(let e=0;e=5?tV:e>=3?tK:tq}function tY(){let e=tn(e=>e.pulse),t=tn(e=>e.crystals),a=tn(e=>e.crystalsPerSec),s=tn(e=>e.crystalCap),r=tn(e=>e._combo),{toast:n}=(0,tO.useToast)(),[o,l]=(0,v.useState)([]),i=(0,v.useRef)(0),c=(0,v.useRef)(null),d=(0,v.useRef)(null);(0,v.useRef)(0);let[u,h]=(0,v.useState)(0),f=(0,v.useRef)([]),m=(0,v.useRef)([]),p=(0,v.useRef)([]),x=(0,v.useRef)([]),g=(0,v.useRef)(r),b=(0,v.useRef)(0),y=(0,v.useRef)(t),j=(0,v.useRef)(s);(0,v.useEffect)(()=>{g.current=r,y.current=t,j.current=s},[r,t,s]);let N=(0,v.useRef)({x:0,y:0,inside:!1}),k=(0,v.useCallback)((e,t)=>{let a=.28*Math.min(e,t),s=[];[{count:14,rMul:.95,speed:.6,color:tq},{count:10,rMul:1.15,speed:-.4,color:tK},{count:8,rMul:1.35,speed:.3,color:tU}].forEach(e=>{for(let t=0;t{let s=tX(a.combo),r=performance.now();p.current.push({born:r,color:tq,maxRadius:140,duration:700}),a.combo>=3&&p.current.push({born:r+100,color:tK,maxRadius:170,duration:800}),a.combo>=5&&p.current.push({born:r+200,color:tV,maxRadius:200,duration:900});let n=10+2*Math.min(10,a.combo);for(let a=0;a{e.radius=e.baseRadius*(1.25+.15*Math.random())})},[]),S=(0,v.useCallback)(t=>{let a=e();if(!a)return;let s=t.currentTarget.getBoundingClientRect(),r=t.clientX-s.left,o=t.clientY-s.top,c=i.current++,d=tX(a.combo);l(e=>[...e,{id:c,x:r,y:o,text:`+${a.gain.toFixed(1)}`,born:Date.now(),color:d}]),M(r,o,a),h(e=>e+1),tW(a.combo>=3?"pulseCombo":"pulse",{combo:a.combo}),setTimeout(()=>{l(e=>e.filter(e=>e.id!==c))},900),a.combo>=5&&a.combo%5==0&&n({title:`\xd7${a.combo} 连击!`,description:"谐振叠加,产能飙升。"})},[e,n,M]);(0,v.useEffect)(()=>{let e=c.current,t=d.current;if(!e||!t)return;let a=e.getContext("2d");if(!a)return;let s=0,r=performance.now(),n=Math.min(window.devicePixelRatio||1,2),o=()=>{let s=t.getBoundingClientRect();n=Math.min(window.devicePixelRatio||1,2),e.width=Math.max(1,Math.floor(s.width*n)),e.height=Math.max(1,Math.floor(s.height*n)),e.style.width=`${s.width}px`,e.style.height=`${s.height}px`,a.setTransform(n,0,0,n,0,0),k(s.width,s.height)};o();let l=new ResizeObserver(o);l.observe(t);let i=t=>{let o=Math.min(.05,(t-r)/1e3);r=t;let l=e.width/n,c=e.height/n,d=l/2,u=c/2,h=.28*Math.min(l,c);a.clearRect(0,0,l,c),m.current.forEach(e=>{e.x+=e.vx*o,e.y+=e.vy*o,e.twinkle+=2*o,e.x<0&&(e.x=l),e.x>l&&(e.x=0),e.y<0&&(e.y=c),e.y>c&&(e.y=0);let t=.5+.5*Math.sin(e.twinkle);a.globalAlpha=e.alpha*t,a.fillStyle="#ffffff",a.beginPath(),a.arc(e.x,e.y,e.size,0,2*Math.PI),a.fill()}),a.globalAlpha=1;let g=.85+.15*Math.sin(.001*t),w=a.createRadialGradient(d,u,.3*h,d,u,2.2*h);w.addColorStop(0,`rgba(52,211,153,${.18*g})`),w.addColorStop(.5,`rgba(232,121,249,${.1*g})`),w.addColorStop(1,"rgba(0,0,0,0)"),a.fillStyle=w,a.fillRect(0,0,l,c),a.lineWidth=2.5,a.strokeStyle="rgba(255,255,255,0.06)",a.beginPath(),a.arc(d,u,1.45*h,0,2*Math.PI),a.stroke();let v=Math.min(100,y.current/Math.max(1,j.current)*100);b.current=v;let k=1.45*h,M=a.createLinearGradient(d-k,u-k,d+k,u+k);M.addColorStop(0,tq),M.addColorStop(.5,tK),M.addColorStop(1,tU),a.strokeStyle=M,a.lineWidth=3,a.lineCap="round",a.shadowBlur=8,a.shadowColor=tq,a.beginPath(),a.arc(d,u,k,-Math.PI/2,-Math.PI/2+2*Math.PI*v/100),a.stroke(),a.shadowBlur=0,f.current.forEach(e=>{e.angle+=e.speed*o,e.radius+=(e.baseRadius-e.radius)*Math.min(1,4*o);let s=d+Math.cos(e.angle)*e.radius,r=u+Math.sin(e.angle)*e.radius,n=.7+.3*Math.sin(.005*t+e.phase);a.globalAlpha=e.alpha*n,a.fillStyle=e.color,a.shadowBlur=10,a.shadowColor=e.color,a.beginPath(),a.arc(s,r,e.size,0,2*Math.PI),a.fill(),a.globalAlpha=e.alpha*n*.4,a.strokeStyle=e.color,a.lineWidth=.6*e.size,a.beginPath(),a.moveTo(s,r),a.lineTo(d+Math.cos(e.angle-.08*e.speed)*(e.radius-2),u+Math.sin(e.angle-.08*e.speed)*(e.radius-2)),a.stroke()}),a.globalAlpha=1,a.shadowBlur=0;let S=.95*h,C=0,_=0;if(N.current.inside){let e=N.current.x-d,t=N.current.y-u,a=Math.hypot(e,t);a>.1&&(C=e/a*Math.min(8,.05*a),_=t/a*Math.min(8,.05*a))}let T=d+C,P=u+_,R=a.createRadialGradient(T-.25*S,P-.3*S,.1*S,T,P,S);R.addColorStop(0,"rgba(255,255,255,0.95)"),R.addColorStop(.3,`rgba(52,211,153,${.85*g})`),R.addColorStop(.65,"rgba(232,121,249,0.55)"),R.addColorStop(1,"rgba(251,113,133,0.2)"),a.fillStyle=R,a.shadowBlur=30,a.shadowColor=tq,a.beginPath(),a.arc(T,P,S,0,2*Math.PI),a.fill(),a.save(),a.translate(T,P),a.globalAlpha=.25,a.strokeStyle="rgba(255,255,255,0.6)",a.lineWidth=.8;let E=.7*S;for(let e=0;e<3;e++){let s=E*(1-.3*e);a.beginPath();for(let r=0;r<6;r++){let n=Math.PI/3*r+2e-4*t*(e%2?1:-1),o=Math.cos(n)*s,l=Math.sin(n)*s;0===r?a.moveTo(o,l):a.lineTo(o,l)}a.closePath(),a.stroke()}a.restore(),a.globalAlpha=.4,a.fillStyle="#ffffff",a.beginPath(),a.ellipse(T-.25*S,P-.35*S,.35*S,.18*S,-.4,0,2*Math.PI),a.fill(),a.globalAlpha=1,a.shadowBlur=0,p.current=p.current.filter(e=>{let s=t-e.born;if(s<0||s>e.duration)return s<=e.duration+50;let r=s/e.duration,n=e.maxRadius*r;return a.globalAlpha=(1-r)*.8,a.strokeStyle=e.color,a.lineWidth=2.5*(1-.5*r),a.shadowBlur=12,a.shadowColor=e.color,a.beginPath(),a.arc(d,u,n,0,2*Math.PI),a.stroke(),a.shadowBlur=0,!0}),p.current=p.current.filter(e=>t-e.born{let s=t-e.born;if(s>e.life)return!1;e.x+=e.vx*o,e.y+=e.vy*o,e.vx*=.96,e.vy*=.96;let r=s/e.life;return a.globalAlpha=1-r,a.fillStyle=e.color,a.shadowBlur=8,a.shadowColor=e.color,a.beginPath(),a.arc(e.x,e.y,e.size*(1-.5*r),0,2*Math.PI),a.fill(),!0}),a.globalAlpha=1,a.shadowBlur=0,s=requestAnimationFrame(i)};return s=requestAnimationFrame(i),()=>{cancelAnimationFrame(s),l.disconnect()}},[k]);let C=(0,v.useCallback)(e=>{let t=e.currentTarget.getBoundingClientRect();N.current={x:e.clientX-t.left,y:e.clientY-t.top,inside:!0}},[]),_=(0,v.useCallback)(()=>{N.current.inside=!1},[]),T=Math.min(100,t/Math.max(1,s)*100);return(0,w.jsxs)("div",{className:"jsx-dda3ce20a1930cc3 relative flex flex-col items-center justify-center gap-4 select-none",children:[r>1&&(0,w.jsxs)("div",{className:"jsx-dda3ce20a1930cc3 absolute -top-2 left-1/2 -translate-x-1/2 px-3 py-1 rounded-full bg-rose-500/20 border border-rose-400/40 text-rose-200 text-xs font-mono animate-pulse z-10",children:["×",r," 连击"]}),(0,w.jsxs)("button",{onClick:S,onMouseMove:C,onMouseLeave:_,"aria-label":"脉冲扫描,获取记忆晶体",className:"jsx-dda3ce20a1930cc3 relative h-52 w-52 sm:h-64 sm:w-64 rounded-full focus:outline-none group",children:[(0,w.jsx)("div",{ref:d,className:"jsx-dda3ce20a1930cc3 absolute inset-0 rounded-full overflow-hidden",children:(0,w.jsx)("canvas",{ref:c,className:"jsx-dda3ce20a1930cc3 block w-full h-full"})}),(0,w.jsxs)("div",{style:{animation:"echo-spin 18s linear infinite"},className:"jsx-dda3ce20a1930cc3 absolute inset-2 rounded-full border border-emerald-400/30 pointer-events-none",children:[(0,w.jsx)("div",{className:"jsx-dda3ce20a1930cc3 absolute top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 h-2 w-2 rounded-full bg-emerald-300 shadow-[0_0_8px_#34d399]"}),(0,w.jsx)("div",{className:"jsx-dda3ce20a1930cc3 absolute bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2 h-1.5 w-1.5 rounded-full bg-rose-300 shadow-[0_0_8px_#fb7185]"})]}),(0,w.jsx)("div",{style:{animation:"echo-spin 24s linear infinite reverse"},className:"jsx-dda3ce20a1930cc3 absolute inset-6 rounded-full border border-fuchsia-400/20 border-dashed pointer-events-none"}),(0,w.jsx)("div",{style:{animation:"echo-ring 0.7s ease-out forwards"},className:"jsx-dda3ce20a1930cc3 absolute inset-8 rounded-full border-2 border-emerald-400/60 pointer-events-none"},`ring-${u}`),o.map(e=>(0,w.jsx)("span",{style:{left:e.x,top:e.y,color:e.color,transform:"translate(-50%, -50%)",animation:"echo-float 0.9s ease-out forwards",textShadow:`0 0 8px ${e.color}`},className:"jsx-dda3ce20a1930cc3 absolute pointer-events-none font-mono font-bold text-sm z-10",children:e.text},e.id))]}),(0,w.jsxs)("div",{className:"jsx-dda3ce20a1930cc3 text-center",children:[(0,w.jsx)("div",{style:{textShadow:"0 0 12px rgba(52,211,153,0.5)"},className:"jsx-dda3ce20a1930cc3 text-2xl font-mono font-bold text-emerald-300",children:O(t)}),(0,w.jsxs)("div",{className:"jsx-dda3ce20a1930cc3 text-xs text-muted-foreground mt-0.5",children:["记忆晶体 · ",a.toFixed(1),"/s · 上限"," ",O(s)]}),(0,w.jsxs)("div",{className:"jsx-dda3ce20a1930cc3 text-[11px] text-muted-foreground/70 mt-2",children:["点击晶体发起",(0,w.jsx)("span",{className:"jsx-dda3ce20a1930cc3 text-emerald-300",children:"脉冲扫描"}),",连击叠加加成"]}),(0,w.jsxs)("div",{className:"jsx-dda3ce20a1930cc3 text-[10px] text-muted-foreground/50 mt-1 tabular-nums",children:["仓库 ",T.toFixed(1),"% · 连击 ×",Math.max(1,r)]})]}),(0,w.jsx)(tD.default,{id:"dda3ce20a1930cc3",children:"@keyframes echo-spin{to{transform:rotate(360deg)}}@keyframes echo-float{0%{opacity:1;transform:translate(-50%,-50%)scale(1)}to{opacity:0;transform:translate(-50%,-180%)scale(1.3)}}@keyframes echo-ring{0%{opacity:.8;transform:scale(.8)}to{opacity:0;transform:scale(1.6)}}"})]})}let tG=(0,e.i(25913).cva)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function tJ({className:e,variant:t,size:a,asChild:s=!1,...r}){return(0,w.jsx)(s?tx:"button",{"data-slot":"button",className:(0,tA.cn)(tG({variant:t,size:a,className:e})),...r})}var tQ=e.i(37727);let tZ=(0,to.default)("sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]),t0=(0,to.default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]),t1=(0,to.default)("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]),t2=(0,to.default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);function t5(){let e=tn(e=>e.activePuzzle),t=tn(e=>e.clickNode),a=tn(e=>e.undoStep),s=tn(e=>e.retryPuzzle),r=tn(e=>e.abandonPuzzle),{toast:n}=(0,tO.useToast)(),[o,l]=(0,v.useState)(null),[i,c]=(0,v.useState)(null),[d,u]=(0,v.useState)(!1);if(!e)return null;let{grid:h,rows:f,cols:m,target:p,path:x,stepLimit:g,tier:b}=e,y=x.length,j=p[y],N=x.length>0&&x.length{a(),u(!1),c(null)},M=100/m,S=100/f,C=x.map(e=>h.find(t=>t.id===e)).filter(Boolean);return(0,w.jsxs)("div",{className:"jsx-35ab0418fdc54847 flex flex-col gap-4 h-full",children:[(0,w.jsxs)("div",{className:"jsx-35ab0418fdc54847 flex items-center justify-center gap-2 flex-wrap",children:[(0,w.jsx)("span",{className:"jsx-35ab0418fdc54847 text-xs text-muted-foreground mr-1",children:"目标谐振"}),p.map((e,t)=>{let a=t{if(0===t)return null;let a=C[t-1],s=(a.col+.5)*M,r=(a.row+.5)*S,n=(e.col+.5)*M,o=(e.row+.5)*S,l=R[e.color];return(0,w.jsx)("line",{x1:`${s}%`,y1:`${r}%`,x2:`${n}%`,y2:`${o}%`,stroke:l.hex,strokeWidth:2.5,strokeLinecap:"round",style:{filter:`drop-shadow(0 0 4px ${l.glow})`},className:"jsx-35ab0418fdc54847 echo-path-line"},t)})}),h.map(a=>{let s=R[a.color],r=a.used,h=void 0!==j&&a.color===j&&!r,f=0===x.length&&h&&function(e,t){if(0!==e.path.length)return!1;let a=e.grid.find(e=>e.id===t);if(!a||a.used||a.color!==e.target[0])return!1;let s=JSON.parse(JSON.stringify(e));return s.grid.find(e=>e.id===t).used=!0,s.path.push(t),ej(s)}(e,a.id),p=0===x.length&&h&&!f,g=o===a.id,b=i?.id===a.id,y=(a.col+.5)*M,v=(a.row+.5)*S;return(0,w.jsx)("button",{onClick:()=>(e=>{let a=t(e.id);if(a.ok&&a.finished){u(!1),tW("decodeSuccess"),a.failReason&&a.failReason.split(",").filter(Boolean).length&&(tW("fragmentUnlock"),n({title:"✦ 记忆碎片浮现",description:"新的回响被拼入图谱,前往「记忆图谱」查看。"})),n({title:"谐振闭合!",description:"晶体解码成功,记忆已释放。"});return}a.ok?(tW("decodeClick",{color:e.color}),c({id:e.id,ok:!0}),setTimeout(()=>c(null),280),!1!==a.solvable||d||(u(!0),n({title:"谐振受阻",description:"此路不通,建议撤销上一步或重排。"})),!0===a.solvable&&u(!1)):(tW("decodeFail"),c({id:e.id,ok:!1}),setTimeout(()=>c(null),280))})(a),onMouseEnter:()=>l(a.id),onMouseLeave:()=>l(null),disabled:r,style:{left:`${y}%`,top:`${v}%`,width:`min(${100/m*.62}%, 56px)`,aspectRatio:"1",background:r?"rgba(255,255,255,0.04)":`radial-gradient(circle at 35% 30%, ${s.hex}, ${s.hex}cc 55%, ${s.hex}55)`,boxShadow:r?"inset 0 0 12px rgba(0,0,0,0.5)":f?`0 0 16px ${s.glow}, 0 0 32px ${s.glow}, inset 0 0 10px rgba(255,255,255,0.5)`:h?`0 0 10px ${s.glow}, 0 0 20px ${s.glow}, inset 0 0 6px rgba(255,255,255,0.3)`:`0 0 6px ${s.glow}`,border:f?`2px solid ${s.hex}`:h?`1.5px solid ${s.hex}aa`:"1px solid rgba(255,255,255,0.12)",opacity:r?.35:p?.5:1,transform:`translate(-50%, -50%) scale(${g&&!r?1.12:b?i?.ok?1.25:.8:1})`,animation:f?"echo-pulse 1.2s ease-in-out infinite":h&&!p?"echo-pulse 1.6s ease-in-out infinite":void 0},"aria-label":`${s.label}色节点 ${a.row+1}-${a.col+1}`,className:"jsx-35ab0418fdc54847 absolute rounded-full transition-[box-shadow,background,border,opacity] duration-200 focus:outline-none disabled:cursor-not-allowed",children:!r&&(0,w.jsx)("span",{style:{background:"radial-gradient(circle at 35% 30%, rgba(255,255,255,0.5), transparent 45%)"},className:"jsx-35ab0418fdc54847 absolute inset-0 rounded-full"})},a.id)})]}),N&&(0,w.jsxs)("div",{className:"jsx-35ab0418fdc54847 flex items-center gap-2 px-3 py-2 rounded-lg border border-rose-400/40 bg-rose-950/40 text-rose-200 text-xs animate-pulse",children:[(0,w.jsx)(t2,{className:"h-3.5 w-3.5 shrink-0"}),(0,w.jsx)("span",{className:"jsx-35ab0418fdc54847",children:"谐振受阻,此路已无解。"}),(0,w.jsxs)(tJ,{size:"sm",variant:"outline",onClick:k,className:"h-6 px-2 ml-auto border-rose-400/50 text-rose-100 hover:bg-rose-500/20 text-[11px]",children:[(0,w.jsx)(t1,{className:"h-3 w-3 mr-1"}),"撤销"]})]}),(0,w.jsxs)("div",{className:"jsx-35ab0418fdc54847 flex items-center justify-between gap-3",children:[(0,w.jsxs)("div",{className:"jsx-35ab0418fdc54847 flex items-center gap-2 text-xs",children:[(0,w.jsx)("span",{className:"jsx-35ab0418fdc54847 text-muted-foreground",children:"步数"}),(0,w.jsxs)("span",{className:`jsx-35ab0418fdc54847 font-mono font-semibold ${x.length>=g?"text-rose-400":"text-foreground"}`,children:[x.length," / ",g]}),(0,w.jsxs)("span",{className:"jsx-35ab0418fdc54847 ml-2 text-muted-foreground",children:["T",b]})]}),(0,w.jsxs)("div",{className:"jsx-35ab0418fdc54847 flex items-center gap-1.5",children:[(0,w.jsxs)(tJ,{variant:"ghost",size:"sm",onClick:k,disabled:0===x.length,className:"h-7",children:[(0,w.jsx)(t1,{className:"h-3.5 w-3.5 mr-1"}),"撤销"]}),(0,w.jsxs)(tJ,{variant:"ghost",size:"sm",onClick:()=>{s(),u(!1),c(null)},className:"h-7",children:[(0,w.jsx)(td,{className:"h-3.5 w-3.5 mr-1"}),"重排"]}),(0,w.jsxs)(tJ,{variant:"ghost",size:"sm",onClick:()=>{r(),c(null),u(!1)},className:"h-7",children:[(0,w.jsx)(tQ.X,{className:"h-3.5 w-3.5 mr-1"}),"放回"]})]})]}),(0,w.jsx)("p",{className:"jsx-35ab0418fdc54847 text-[11px] text-muted-foreground/80 text-center leading-relaxed",children:0===x.length?(0,w.jsxs)(w.Fragment,{children:["点击",(0,w.jsx)("span",{className:"jsx-35ab0418fdc54847 text-emerald-300",children:"高亮"}),"的可行起点开始,按目标顺序走",(0,w.jsx)("span",{className:"jsx-35ab0418fdc54847 text-emerald-300",children:"相邻同色"}),"节点;走错可",(0,w.jsx)("span",{className:"jsx-35ab0418fdc54847 text-rose-300",children:"撤销"}),"。"]}):(0,w.jsxs)(w.Fragment,{children:["按「目标谐振」顺序,点击",(0,w.jsx)("span",{className:"jsx-35ab0418fdc54847 text-emerald-300",children:"上下左右相邻"}),"的同色节点。每个节点仅可使用一次;走错可",(0,w.jsx)("span",{className:"jsx-35ab0418fdc54847 text-rose-300",children:"撤销"}),"。"]})}),(0,w.jsx)(tD.default,{id:"35ab0418fdc54847",children:"@keyframes echo-pulse{0%,to{filter:brightness()}50%{filter:brightness(1.4)}}@keyframes echo-line{0%{stroke-dashoffset:100px}to{stroke-dashoffset:0}}.echo-path-line{stroke-dasharray:100;animation:.4s ease-out forwards echo-line}"})]})}function t3(){let e=tn(e=>e.activePuzzle),t=tn(e=>e.pendingCrystals),a=tn(e=>e.startDecode),s=tn(e=>e.crystalsPerSec),r=tn(e=>e.crystalCap),n=tn(e=>e.crystals);return e?(0,w.jsxs)("div",{className:"h-full flex flex-col",children:[(0,w.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,w.jsx)(tZ,{className:"h-4 w-4 text-rose-400"}),(0,w.jsx)("h3",{className:"text-sm font-semibold",children:"解码共振阵列"})]}),(0,w.jsx)("div",{className:"flex-1 min-h-0",children:(0,w.jsx)(t5,{})})]}):(0,w.jsxs)("div",{className:"jsx-53059b9e32765d5f h-full flex flex-col",children:[(0,w.jsxs)("div",{className:"jsx-53059b9e32765d5f flex items-center gap-2 mb-3",children:[(0,w.jsx)(tZ,{className:"h-4 w-4 text-rose-400"}),(0,w.jsx)("h3",{className:"jsx-53059b9e32765d5f text-sm font-semibold",children:"待解码晶体"}),(0,w.jsxs)("span",{className:"jsx-53059b9e32765d5f text-xs text-muted-foreground ml-auto",children:["产能 ",s.toFixed(1),"/s · ",Math.floor(n),"/",Math.floor(r)]})]}),0===t.length?(0,w.jsxs)("div",{className:"jsx-53059b9e32765d5f flex-1 flex flex-col items-center justify-center text-center gap-3 rounded-2xl border border-dashed border-white/10 bg-black/20 p-6",children:[(0,w.jsxs)("div",{className:"jsx-53059b9e32765d5f relative h-16 w-16",children:[(0,w.jsx)("div",{className:"jsx-53059b9e32765d5f absolute inset-0 rounded-full bg-rose-500/20 blur-xl animate-pulse"}),(0,w.jsx)("div",{className:"jsx-53059b9e32765d5f absolute inset-2 rounded-full border-2 border-rose-400/40 rotate-45"}),(0,w.jsx)("div",{className:"jsx-53059b9e32765d5f absolute inset-4 rounded-full bg-rose-500/30"})]}),(0,w.jsx)("p",{className:"jsx-53059b9e32765d5f text-sm text-muted-foreground",children:"晶体正在生成中…"}),(0,w.jsx)("p",{className:"jsx-53059b9e32765d5f text-xs text-muted-foreground/70 max-w-[220px]",children:"自治无人机每数秒回收一颗记忆晶体,点击下方晶体开启解码。"})]}):(0,w.jsx)("div",{className:"jsx-53059b9e32765d5f flex-1 grid grid-cols-2 sm:grid-cols-3 gap-3 content-start max-h-[420px] overflow-y-auto echo-scroll pr-1",children:t.map(e=>(0,w.jsx)(t4,{crystal:e,onClick:()=>a(e.id)},e.id))}),(0,w.jsx)(tD.default,{id:"53059b9e32765d5f",children:".echo-scroll::-webkit-scrollbar{width:6px}.echo-scroll::-webkit-scrollbar-thumb{background:#ffffff26;border-radius:3px}.echo-scroll::-webkit-scrollbar-track{background:0 0}"})]})}function t4({crystal:e,onClick:t}){let a=1===e.tier?"#34d399":2===e.tier?"#fbbf24":"#e879f9",s=1===e.tier?"常见":2===e.tier?"稀有":"史诗";return(0,w.jsxs)("button",{onClick:t,className:"group relative aspect-square rounded-2xl border border-white/10 bg-black/40 hover:border-white/30 transition-all duration-300 hover:scale-[1.03] focus:outline-none overflow-hidden",style:{boxShadow:`inset 0 0 24px ${a}22`},children:[(0,w.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,w.jsxs)("div",{className:"relative h-12 w-12 transition-transform duration-500 group-hover:rotate-180",style:{filter:`drop-shadow(0 0 12px ${a}88)`},children:[(0,w.jsx)("div",{className:"absolute inset-0 rotate-45 rounded-md",style:{background:`linear-gradient(135deg, ${a}, ${a}66)`,border:`1px solid ${a}`}}),(0,w.jsx)("div",{className:"absolute inset-2 rotate-45 rounded-sm",style:{background:"linear-gradient(135deg, rgba(255,255,255,0.5), transparent)"}})]})}),(0,w.jsxs)("div",{className:"absolute top-1.5 left-1.5 text-[10px] font-mono px-1.5 py-0.5 rounded bg-black/50",style:{color:a},children:["T",e.tier]}),(0,w.jsx)("div",{className:"absolute bottom-1.5 right-1.5 text-[10px] text-white/70",children:s}),(0,w.jsx)("div",{className:"absolute inset-0 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity flex items-end justify-center pb-2",children:(0,w.jsx)("span",{className:"text-[11px] font-medium text-white",children:"解码 →"})})]})}function t9({className:e,...t}){return(0,w.jsx)("div",{"data-slot":"card",className:(0,tA.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}let t7=(0,to.default)("pickaxe",[["path",{d:"M14.531 12.469 6.619 20.38a1 1 0 1 1-3-3l7.912-7.912",key:"we99rg"}],["path",{d:"M15.686 4.314A12.5 12.5 0 0 0 5.461 2.958 1 1 0 0 0 5.58 4.71a22 22 0 0 1 6.318 3.393",key:"1w6hck"}],["path",{d:"M17.7 3.7a1 1 0 0 0-1.4 0l-4.6 4.6a1 1 0 0 0 0 1.4l2.6 2.6a1 1 0 0 0 1.4 0l4.6-4.6a1 1 0 0 0 0-1.4z",key:"15hgfx"}],["path",{d:"M19.686 8.314a12.501 12.501 0 0 1 1.356 10.225 1 1 0 0 1-1.751-.119 22 22 0 0 0-3.393-6.319",key:"452b4h"}]]),t6=(0,to.default)("scan-line",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 12h10",key:"b7w52i"}]]),t8=(0,to.default)("rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]),ae=(0,to.default)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]),at=(0,to.default)("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]),aa={Pickaxe:t7,ScanLine:t6,Rocket:t8,BookOpen:ae},as={mining:"#34d399",decoding:"#fb7185",expedition:"#fbbf24",narrative:"#e879f9"};function ar(){let e=tn(e=>e.tech),t=tn(e=>e.insights),a=tn(e=>e.buyTech);return(0,w.jsxs)("div",{className:"jsx-fbf3fdae687a84dd flex flex-col gap-3 h-full",children:[(0,w.jsxs)("div",{className:"jsx-fbf3fdae687a84dd flex items-center justify-between",children:[(0,w.jsx)("h3",{className:"jsx-fbf3fdae687a84dd text-sm font-semibold",children:"技术树"}),(0,w.jsxs)("span",{className:"jsx-fbf3fdae687a84dd text-xs text-muted-foreground",children:["洞见 ",(0,w.jsx)("span",{className:"jsx-fbf3fdae687a84dd text-amber-300 font-mono",children:O(t)})]})]}),(0,w.jsx)("div",{className:"jsx-fbf3fdae687a84dd flex-1 overflow-y-auto echo-scroll pr-1 space-y-3",children:["mining","decoding","expedition","narrative"].map(s=>{let r=A[s],n=aa[r.icon],o=as[s],l=E.filter(e=>e.branch===s);return(0,w.jsxs)("div",{className:"jsx-fbf3fdae687a84dd",children:[(0,w.jsxs)("div",{className:"jsx-fbf3fdae687a84dd flex items-center gap-2 mb-1.5 px-1",children:[(0,w.jsx)(n,{className:"jsx-fbf3fdae687a84dd h-3.5 w-3.5"}),(0,w.jsx)("span",{style:{color:o},className:"jsx-fbf3fdae687a84dd text-xs font-medium",children:r.name}),(0,w.jsx)("span",{className:"jsx-fbf3fdae687a84dd text-[10px] text-muted-foreground/70",children:r.desc})]}),(0,w.jsx)("div",{className:"jsx-fbf3fdae687a84dd grid gap-1.5",children:l.map(s=>{let r=(e[s.id]??0)>=1,n=t>=s.cost;return(0,w.jsx)(t9,{className:`p-2.5 transition-all duration-200 ${r?"bg-white/5 border-white/10":n?"bg-black/30 border-white/15 hover:border-white/30 cursor-pointer":"bg-black/20 border-white/5 opacity-60"}`,style:r?{boxShadow:`inset 0 0 0 1px ${o}44, 0 0 12px ${o}22`}:void 0,children:(0,w.jsxs)("div",{className:"jsx-fbf3fdae687a84dd flex items-center gap-2",children:[(0,w.jsxs)("div",{className:"jsx-fbf3fdae687a84dd flex-1 min-w-0",children:[(0,w.jsxs)("div",{className:"jsx-fbf3fdae687a84dd flex items-center gap-1.5",children:[(0,w.jsx)("span",{style:{color:r?o:void 0},className:"jsx-fbf3fdae687a84dd text-xs font-semibold truncate",children:s.name}),r&&(0,w.jsx)(t0,{className:"h-3 w-3",style:{color:o}})]}),(0,w.jsx)("p",{className:"jsx-fbf3fdae687a84dd text-[10px] text-muted-foreground/80 truncate",children:s.desc})]}),!r&&(0,w.jsxs)(tJ,{size:"sm",variant:n?"default":"ghost",disabled:!n,onClick:()=>{a(s.id)&&tW("techBuy")},className:"h-7 px-2 text-[11px] shrink-0",style:n?{background:`${o}22`,border:`1px solid ${o}66`,color:o}:void 0,children:[(0,w.jsx)(at,{className:"h-2.5 w-2.5 mr-1"}),s.cost]})]})},s.id)})})]},s)})}),(0,w.jsx)(tD.default,{id:"fbf3fdae687a84dd",children:".echo-scroll::-webkit-scrollbar{width:5px}.echo-scroll::-webkit-scrollbar-thumb{background:#ffffff1f;border-radius:3px}.echo-scroll::-webkit-scrollbar-track{background:0 0}"})]})}var an=e.i(48425),ao=e.i(96626),al=e.i(30030),ai=e.i(30207),ac=v.createContext(void 0);function ad(e){let t=v.useContext(ac);return e||t||"ltr"}var au=e.i(34620),ah=e.i(81140),af="ScrollArea",[am,ap]=(0,al.createContextScope)(af),[ax,ag]=am(af),ab=v.forwardRef((e,t)=>{let{__scopeScrollArea:a,type:s="hover",dir:r,scrollHideDelay:n=600,...o}=e,[l,i]=v.useState(null),[c,d]=v.useState(null),[u,h]=v.useState(null),[f,m]=v.useState(null),[p,x]=v.useState(null),[g,b]=v.useState(0),[y,j]=v.useState(0),[N,k]=v.useState(!1),[M,S]=v.useState(!1),C=(0,tu.useComposedRefs)(t,e=>i(e)),_=ad(r);return(0,w.jsx)(ax,{scope:a,type:s,dir:_,scrollHideDelay:n,scrollArea:l,viewport:c,onViewportChange:d,content:u,onContentChange:h,scrollbarX:f,onScrollbarXChange:m,scrollbarXEnabled:N,onScrollbarXEnabledChange:k,scrollbarY:p,onScrollbarYChange:x,scrollbarYEnabled:M,onScrollbarYEnabledChange:S,onCornerWidthChange:b,onCornerHeightChange:j,children:(0,w.jsx)(an.Primitive.div,{dir:_,...o,ref:C,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":y+"px",...e.style}})})});ab.displayName=af;var ay="ScrollAreaViewport",aw=v.forwardRef((e,t)=>{let{__scopeScrollArea:a,children:s,nonce:r,...n}=e,o=ag(ay,a),l=v.useRef(null),i=(0,tu.useComposedRefs)(t,l,o.onViewportChange);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),(0,w.jsx)(an.Primitive.div,{"data-radix-scroll-area-viewport":"",...n,ref:i,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...e.style},children:(0,w.jsx)("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});aw.displayName=ay;var av="ScrollAreaScrollbar",aj=v.forwardRef((e,t)=>{let{forceMount:a,...s}=e,r=ag(av,e.__scopeScrollArea),{onScrollbarXEnabledChange:n,onScrollbarYEnabledChange:o}=r,l="horizontal"===e.orientation;return v.useEffect(()=>(l?n(!0):o(!0),()=>{l?n(!1):o(!1)}),[l,n,o]),"hover"===r.type?(0,w.jsx)(aN,{...s,ref:t,forceMount:a}):"scroll"===r.type?(0,w.jsx)(ak,{...s,ref:t,forceMount:a}):"auto"===r.type?(0,w.jsx)(aM,{...s,ref:t,forceMount:a}):"always"===r.type?(0,w.jsx)(aS,{...s,ref:t}):null});aj.displayName=av;var aN=v.forwardRef((e,t)=>{let{forceMount:a,...s}=e,r=ag(av,e.__scopeScrollArea),[n,o]=v.useState(!1);return v.useEffect(()=>{let e=r.scrollArea,t=0;if(e){let a=()=>{window.clearTimeout(t),o(!0)},s=()=>{t=window.setTimeout(()=>o(!1),r.scrollHideDelay)};return e.addEventListener("pointerenter",a),e.addEventListener("pointerleave",s),()=>{window.clearTimeout(t),e.removeEventListener("pointerenter",a),e.removeEventListener("pointerleave",s)}}},[r.scrollArea,r.scrollHideDelay]),(0,w.jsx)(ao.Presence,{present:a||n,children:(0,w.jsx)(aM,{"data-state":n?"visible":"hidden",...s,ref:t})})}),ak=v.forwardRef((e,t)=>{var a;let{forceMount:s,...r}=e,n=ag(av,e.__scopeScrollArea),o="horizontal"===e.orientation,l=aq(()=>c("SCROLL_END"),100),[i,c]=(a={hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}},v.useReducer((e,t)=>a[e][t]??e,"hidden"));return v.useEffect(()=>{if("idle"===i){let e=window.setTimeout(()=>c("HIDE"),n.scrollHideDelay);return()=>window.clearTimeout(e)}},[i,n.scrollHideDelay,c]),v.useEffect(()=>{let e=n.viewport,t=o?"scrollLeft":"scrollTop";if(e){let a=e[t],s=()=>{let s=e[t];a!==s&&(c("SCROLL"),l()),a=s};return e.addEventListener("scroll",s),()=>e.removeEventListener("scroll",s)}},[n.viewport,o,c,l]),(0,w.jsx)(ao.Presence,{present:s||"hidden"!==i,children:(0,w.jsx)(aS,{"data-state":"hidden"===i?"hidden":"visible",...r,ref:t,onPointerEnter:(0,ah.composeEventHandlers)(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:(0,ah.composeEventHandlers)(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),aM=v.forwardRef((e,t)=>{let a=ag(av,e.__scopeScrollArea),{forceMount:s,...r}=e,[n,o]=v.useState(!1),l="horizontal"===e.orientation,i=aq(()=>{if(a.viewport){let e=a.viewport.offsetWidth{let{orientation:a="vertical",...s}=e,r=ag(av,e.__scopeScrollArea),n=v.useRef(null),o=v.useRef(0),[l,i]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=aL(l.viewport,l.content),d={...s,sizes:l,onSizesChange:i,hasThumb:!!(c>0&&c<1),onThumbChange:e=>n.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function u(e,t){return function(e,t,a,s="ltr"){let r=az(a),n=t||r/2,o=a.scrollbar.paddingStart+n,l=a.scrollbar.size-a.scrollbar.paddingEnd-(r-n),i=a.content-a.viewport;return aH([o,l],"ltr"===s?[0,i]:[-1*i,0])(e)}(e,o.current,l,t)}return"horizontal"===a?(0,w.jsx)(aC,{...d,ref:t,onThumbPositionChange:()=>{if(r.viewport&&n.current){let e=aF(r.viewport.scrollLeft,l,r.dir);n.current.style.transform=`translate3d(${e}px, 0, 0)`}},onWheelScroll:e=>{r.viewport&&(r.viewport.scrollLeft=e)},onDragScroll:e=>{r.viewport&&(r.viewport.scrollLeft=u(e,r.dir))}}):"vertical"===a?(0,w.jsx)(a_,{...d,ref:t,onThumbPositionChange:()=>{if(r.viewport&&n.current){let e=aF(r.viewport.scrollTop,l);n.current.style.transform=`translate3d(0, ${e}px, 0)`}},onWheelScroll:e=>{r.viewport&&(r.viewport.scrollTop=e)},onDragScroll:e=>{r.viewport&&(r.viewport.scrollTop=u(e))}}):null}),aC=v.forwardRef((e,t)=>{let{sizes:a,onSizesChange:s,...r}=e,n=ag(av,e.__scopeScrollArea),[o,l]=v.useState(),i=v.useRef(null),c=(0,tu.useComposedRefs)(t,i,n.onScrollbarXChange);return v.useEffect(()=>{i.current&&l(getComputedStyle(i.current))},[i]),(0,w.jsx)(aR,{"data-orientation":"horizontal",...r,ref:c,sizes:a,style:{bottom:0,left:"rtl"===n.dir?"var(--radix-scroll-area-corner-width)":0,right:"ltr"===n.dir?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":az(a)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,a)=>{if(n.viewport){var s,r;let o=n.viewport.scrollLeft+t.deltaX;e.onWheelScroll(o),s=o,r=a,s>0&&s{i.current&&n.viewport&&o&&s({content:n.viewport.scrollWidth,viewport:n.viewport.offsetWidth,scrollbar:{size:i.current.clientWidth,paddingStart:aO(o.paddingLeft),paddingEnd:aO(o.paddingRight)}})}})}),a_=v.forwardRef((e,t)=>{let{sizes:a,onSizesChange:s,...r}=e,n=ag(av,e.__scopeScrollArea),[o,l]=v.useState(),i=v.useRef(null),c=(0,tu.useComposedRefs)(t,i,n.onScrollbarYChange);return v.useEffect(()=>{i.current&&l(getComputedStyle(i.current))},[i]),(0,w.jsx)(aR,{"data-orientation":"vertical",...r,ref:c,sizes:a,style:{top:0,right:"ltr"===n.dir?0:void 0,left:"rtl"===n.dir?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":az(a)+"px",...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,a)=>{if(n.viewport){var s,r;let o=n.viewport.scrollTop+t.deltaY;e.onWheelScroll(o),s=o,r=a,s>0&&s{i.current&&n.viewport&&o&&s({content:n.viewport.scrollHeight,viewport:n.viewport.offsetHeight,scrollbar:{size:i.current.clientHeight,paddingStart:aO(o.paddingTop),paddingEnd:aO(o.paddingBottom)}})}})}),[aT,aP]=am(av),aR=v.forwardRef((e,t)=>{let{__scopeScrollArea:a,sizes:s,hasThumb:r,onThumbChange:n,onThumbPointerUp:o,onThumbPointerDown:l,onThumbPositionChange:i,onDragScroll:c,onWheelScroll:d,onResize:u,...h}=e,f=ag(av,a),[m,p]=v.useState(null),x=(0,tu.useComposedRefs)(t,e=>p(e)),g=v.useRef(null),b=v.useRef(""),y=f.viewport,j=s.content-s.viewport,N=(0,ai.useCallbackRef)(d),k=(0,ai.useCallbackRef)(i),M=aq(u,10);function S(e){g.current&&c({x:e.clientX-g.current.left,y:e.clientY-g.current.top})}return v.useEffect(()=>{let e=e=>{let t=e.target;m?.contains(t)&&N(e,j)};return document.addEventListener("wheel",e,{passive:!1}),()=>document.removeEventListener("wheel",e,{passive:!1})},[y,m,j,N]),v.useEffect(k,[s,k]),aK(m,M),aK(f.content,M),(0,w.jsx)(aT,{scope:a,scrollbar:m,hasThumb:r,onThumbChange:(0,ai.useCallbackRef)(n),onThumbPointerUp:(0,ai.useCallbackRef)(o),onThumbPositionChange:k,onThumbPointerDown:(0,ai.useCallbackRef)(l),children:(0,w.jsx)(an.Primitive.div,{...h,ref:x,style:{position:"absolute",...h.style},onPointerDown:(0,ah.composeEventHandlers)(e.onPointerDown,e=>{0===e.button&&(e.target.setPointerCapture(e.pointerId),g.current=m.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),S(e))}),onPointerMove:(0,ah.composeEventHandlers)(e.onPointerMove,S),onPointerUp:(0,ah.composeEventHandlers)(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=b.current,f.viewport&&(f.viewport.style.scrollBehavior=""),g.current=null})})})}),aE="ScrollAreaThumb",aA=v.forwardRef((e,t)=>{let{forceMount:a,...s}=e,r=aP(aE,e.__scopeScrollArea);return(0,w.jsx)(ao.Presence,{present:a||r.hasThumb,children:(0,w.jsx)(a$,{ref:t,...s})})}),a$=v.forwardRef((e,t)=>{let{__scopeScrollArea:a,style:s,...r}=e,n=ag(aE,a),o=aP(aE,a),{onThumbPositionChange:l}=o,i=(0,tu.useComposedRefs)(t,e=>o.onThumbChange(e)),c=v.useRef(void 0),d=aq(()=>{c.current&&(c.current(),c.current=void 0)},100);return v.useEffect(()=>{let e=n.viewport;if(e){let t=()=>{d(),c.current||(c.current=aW(e,l),l())};return l(),e.addEventListener("scroll",t),()=>e.removeEventListener("scroll",t)}},[n.viewport,d,l]),(0,w.jsx)(an.Primitive.div,{"data-state":o.hasThumb?"visible":"hidden",...r,ref:i,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:(0,ah.composeEventHandlers)(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),a=e.clientX-t.left,s=e.clientY-t.top;o.onThumbPointerDown({x:a,y:s})}),onPointerUp:(0,ah.composeEventHandlers)(e.onPointerUp,o.onThumbPointerUp)})});aA.displayName=aE;var aB="ScrollAreaCorner",aI=v.forwardRef((e,t)=>{let a=ag(aB,e.__scopeScrollArea),s=!!(a.scrollbarX&&a.scrollbarY);return"scroll"!==a.type&&s?(0,w.jsx)(aD,{...e,ref:t}):null});aI.displayName=aB;var aD=v.forwardRef((e,t)=>{let{__scopeScrollArea:a,...s}=e,r=ag(aB,a),[n,o]=v.useState(0),[l,i]=v.useState(0),c=!!(n&&l);return aK(r.scrollbarX,()=>{let e=r.scrollbarX?.offsetHeight||0;r.onCornerHeightChange(e),i(e)}),aK(r.scrollbarY,()=>{let e=r.scrollbarY?.offsetWidth||0;r.onCornerWidthChange(e),o(e)}),c?(0,w.jsx)(an.Primitive.div,{...s,ref:t,style:{width:n,height:l,position:"absolute",right:"ltr"===r.dir?0:void 0,left:"rtl"===r.dir?0:void 0,bottom:0,...e.style}}):null});function aO(e){return e?parseInt(e,10):0}function aL(e,t){let a=e/t;return isNaN(a)?0:a}function az(e){let t=aL(e.viewport,e.content),a=e.scrollbar.paddingStart+e.scrollbar.paddingEnd;return Math.max((e.scrollbar.size-a)*t,18)}function aF(e,t,a="ltr"){let s=az(t),r=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,n=t.scrollbar.size-r,o=t.content-t.viewport,l=function(e,[t,a]){return Math.min(a,Math.max(t,e))}(e,"ltr"===a?[0,o]:[-1*o,0]);return aH([0,o],[0,n-s])(l)}function aH(e,t){return a=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(a-e[0])}}var aW=(e,t=()=>{})=>{let a={left:e.scrollLeft,top:e.scrollTop},s=0;return!function r(){let n={left:e.scrollLeft,top:e.scrollTop},o=a.left!==n.left,l=a.top!==n.top;(o||l)&&t(),a=n,s=window.requestAnimationFrame(r)}(),()=>window.cancelAnimationFrame(s)};function aq(e,t){let a=(0,ai.useCallbackRef)(e),s=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(s.current),[]),v.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(a,t)},[a,t])}function aK(e,t){let a=(0,ai.useCallbackRef)(t);(0,au.useLayoutEffect)(()=>{let t=0;if(e){let s=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(a)});return s.observe(e),()=>{window.cancelAnimationFrame(t),s.unobserve(e)}}},[e,a])}function aU({className:e,children:t,...a}){return(0,w.jsxs)(ab,{"data-slot":"scroll-area",className:(0,tA.cn)("relative",e),...a,children:[(0,w.jsx)(aw,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),(0,w.jsx)(aV,{}),(0,w.jsx)(aI,{})]})}function aV({className:e,orientation:t="vertical",...a}){return(0,w.jsx)(aj,{"data-slot":"scroll-area-scrollbar",orientation:t,className:(0,tA.cn)("flex touch-none p-px transition-colors select-none","vertical"===t&&"h-full w-2.5 border-l border-l-transparent","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent",e),...a,children:(0,w.jsx)(aA,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}let aX=["","寂灭前夜","谐振纪","飞升潮","回响纪","接触纪"];function aY(){let e=tn(e=>e.fragments),t=tn(e=>e.totalDecoded),a=function(e){for(let t of $)if(e1===e.era),o=n.filter(t=>e[t.id]).length;return(0,w.jsxs)("div",{className:"flex flex-col gap-2 h-full",children:[(0,w.jsxs)("div",{className:"flex items-center justify-between",children:[(0,w.jsxs)("h3",{className:"text-sm font-semibold flex items-center gap-1.5",children:[(0,w.jsx)(ae,{className:"h-4 w-4 text-fuchsia-400"}),"记忆图谱"]}),(0,w.jsxs)("span",{className:"text-xs text-muted-foreground",children:[o,"/",n.length," · 第一纪元"]})]}),a&&(0,w.jsxs)("div",{className:"text-[10px] text-muted-foreground/80 px-1",children:["再解码 ",(0,w.jsx)("span",{className:"text-fuchsia-300 font-mono",children:a-t})," 颗 → 下一个碎片"]}),(0,w.jsx)(aU,{className:"flex-1 min-h-0",children:(0,w.jsx)("div",{className:"grid grid-cols-2 gap-2 pr-2",children:n.map((t,a)=>{let s=!!e[t.id];return(0,w.jsxs)("button",{onClick:()=>s&&r(t),disabled:!s,className:`relative aspect-[4/3] rounded-xl border text-left p-2 transition-all duration-300 overflow-hidden ${s?"border-fuchsia-400/40 bg-gradient-to-br from-fuchsia-950/40 to-black/40 hover:border-fuchsia-400/70 hover:scale-[1.02] cursor-pointer":"border-white/5 bg-black/30 cursor-not-allowed"}`,style:s?{boxShadow:"0 0 16px rgba(232,121,249,0.15)"}:void 0,children:[(0,w.jsx)("span",{className:`absolute top-1.5 right-1.5 text-[9px] font-mono ${s?"text-fuchsia-300/70":"text-white/20"}`,children:String(a+1).padStart(2,"0")}),s?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("div",{className:"absolute -top-3 -right-3 h-12 w-12 rounded-full bg-fuchsia-500/20 blur-xl"}),(0,w.jsx)(tZ,{className:"h-3 w-3 text-fuchsia-300 mb-1"}),(0,w.jsx)("div",{className:"text-[11px] font-semibold text-fuchsia-100 leading-tight",children:t.title}),(0,w.jsxs)("div",{className:"text-[9px] text-muted-foreground mt-1 line-clamp-2",children:[t.echo.slice(0,28),"…"]})]}):(0,w.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-1",children:[(0,w.jsx)(at,{className:"h-4 w-4 text-white/20"}),(0,w.jsxs)("span",{className:"text-[9px] text-white/30",children:["需解码 ",t.threshold," 颗"]})]})]},t.id)})})}),s&&(0,w.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/70 backdrop-blur-sm",onClick:()=>r(null),children:(0,w.jsxs)(t9,{className:"max-w-md w-full p-5 bg-gradient-to-br from-fuchsia-950/60 to-black/80 border-fuchsia-400/40",onClick:e=>e.stopPropagation(),style:{boxShadow:"0 0 40px rgba(232,121,249,0.25)"},children:[(0,w.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,w.jsx)(tZ,{className:"h-4 w-4 text-fuchsia-300"}),(0,w.jsxs)("span",{className:"text-[10px] text-fuchsia-300/70 font-mono",children:["第 ",s.era," 纪元 · ",aX[s.era]||""]})]}),(0,w.jsx)("h4",{className:"text-lg font-bold text-fuchsia-100 mb-3",children:s.title}),(0,w.jsxs)("p",{className:"text-sm text-foreground/90 leading-relaxed italic",children:["「",s.echo,"」"]}),(0,w.jsx)("button",{onClick:()=>r(null),className:"mt-4 text-xs text-muted-foreground hover:text-foreground transition",children:"关闭"})]})})]})}var aG=v[" useId ".trim().toString()]||(()=>void 0),aJ=0;function aQ(e){let[t,a]=v.useState(aG());return(0,au.useLayoutEffect)(()=>{e||a(e=>e??String(aJ++))},[e]),e||(t?`radix-${t}`:"")}var aZ=e.i(69340),a0=e.i(26330),a1="focusScope.autoFocusOnMount",a2="focusScope.autoFocusOnUnmount",a5={bubbles:!1,cancelable:!0},a3=v.forwardRef((e,t)=>{let{loop:a=!1,trapped:s=!1,onMountAutoFocus:r,onUnmountAutoFocus:n,...o}=e,[l,i]=v.useState(null),c=(0,ai.useCallbackRef)(r),d=(0,ai.useCallbackRef)(n),u=v.useRef(null),h=(0,tu.useComposedRefs)(t,e=>i(e)),f=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(s){let e=function(e){if(f.paused||!l)return;let t=e.target;l.contains(t)?u.current=t:a7(u.current,{select:!0})},t=function(e){if(f.paused||!l)return;let t=e.relatedTarget;null!==t&&(l.contains(t)||a7(u.current,{select:!0}))};document.addEventListener("focusin",e),document.addEventListener("focusout",t);let a=new MutationObserver(function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&a7(l)});return l&&a.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",t),a.disconnect()}}},[s,l,f.paused]),v.useEffect(()=>{if(l){a6.add(f);let e=document.activeElement;if(!l.contains(e)){let t=new CustomEvent(a1,a5);l.addEventListener(a1,c),l.dispatchEvent(t),t.defaultPrevented||(function(e,{select:t=!1}={}){let a=document.activeElement;for(let s of e)if(a7(s,{select:t}),document.activeElement!==a)return}(a4(l).filter(e=>"A"!==e.tagName),{select:!0}),document.activeElement===e&&a7(l))}return()=>{l.removeEventListener(a1,c),setTimeout(()=>{let t=new CustomEvent(a2,a5);l.addEventListener(a2,d),l.dispatchEvent(t),t.defaultPrevented||a7(e??document.body,{select:!0}),l.removeEventListener(a2,d),a6.remove(f)},0)}}},[l,c,d,f]);let m=v.useCallback(e=>{if(!a&&!s||f.paused)return;let t="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,r=document.activeElement;if(t&&r){var n;let t,s=e.currentTarget,[o,l]=[a9(t=a4(n=s),n),a9(t.reverse(),n)];o&&l?e.shiftKey||r!==l?e.shiftKey&&r===o&&(e.preventDefault(),a&&a7(l,{select:!0})):(e.preventDefault(),a&&a7(o,{select:!0})):r===s&&e.preventDefault()}},[a,s,f.paused]);return(0,w.jsx)(an.Primitive.div,{tabIndex:-1,...o,ref:h,onKeyDown:m})});function a4(e){let t=[],a=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;a.nextNode();)t.push(a.currentNode);return t}function a9(e,t){for(let a of e)if(!function(e,{upTo:t}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e&&(void 0===t||e!==t);){if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}(a,{upTo:t}))return a}function a7(e,{select:t=!1}={}){if(e&&e.focus){var a;let s=document.activeElement;e.focus({preventScroll:!0}),e!==s&&(a=e)instanceof HTMLInputElement&&"select"in a&&t&&e.select()}}a3.displayName="FocusScope";var a6=(c=[],{add(e){let t=c[0];e!==t&&t?.pause(),(c=a8(c,e)).unshift(e)},remove(e){c=a8(c,e),c[0]?.resume()}});function a8(e,t){let a=[...e],s=a.indexOf(t);return -1!==s&&a.splice(s,1),a}var se=e.i(74606),st=0;function sa(){let e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ss=function(){return(ss=Object.assign||function(e){for(var t,a=1,s=arguments.length;at.indexOf(s)&&(a[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,s=Object.getOwnPropertySymbols(e);rt.indexOf(s[r])&&Object.prototype.propertyIsEnumerable.call(e,s[r])&&(a[s[r]]=e[s[r]]);return a}var sn=("function"==typeof SuppressedError&&SuppressedError,"right-scroll-bar-position"),so="width-before-scroll-bar";function sl(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var si="u">typeof window?v.useLayoutEffect:v.useEffect,sc=new WeakMap,sd=(void 0===u&&(u={}),(void 0===h&&(h=function(e){return e}),f=[],m=!1,p={read:function(){if(m)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return f.length?f[f.length-1]:null},useMedium:function(e){var t=h(e,m);return f.push(t),function(){f=f.filter(function(e){return e!==t})}},assignSyncMedium:function(e){for(m=!0;f.length;){var t=f;f=[],t.forEach(e)}f={push:function(t){return e(t)},filter:function(){return f}}},assignMedium:function(e){m=!0;var t=[];if(f.length){var a=f;f=[],a.forEach(e),t=f}var s=function(){var a=t;t=[],a.forEach(e)},r=function(){return Promise.resolve().then(s)};r(),f={push:function(e){t.push(e),r()},filter:function(e){return t=t.filter(e),f}}}}).options=ss({async:!0,ssr:!1},u),p),su=function(){},sh=v.forwardRef(function(e,t){var a,s,r,n,o=v.useRef(null),l=v.useState({onScrollCapture:su,onWheelCapture:su,onTouchMoveCapture:su}),i=l[0],c=l[1],d=e.forwardProps,u=e.children,h=e.className,f=e.removeScrollBar,m=e.enabled,p=e.shards,x=e.sideCar,g=e.noRelative,b=e.noIsolation,y=e.inert,w=e.allowPinchZoom,j=e.as,N=e.gapMode,k=sr(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),M=(a=[o,t],s=function(e){return a.forEach(function(t){return sl(t,e)})},(r=(0,v.useState)(function(){return{value:null,callback:s,facade:{get current(){return r.value},set current(value){var e=r.value;e!==value&&(r.value=value,r.callback(value,e))}}}})[0]).callback=s,n=r.facade,si(function(){var e=sc.get(n);if(e){var t=new Set(e),s=new Set(a),r=n.current;t.forEach(function(e){s.has(e)||sl(e,null)}),s.forEach(function(e){t.has(e)||sl(e,r)})}sc.set(n,a)},[a]),n),S=ss(ss({},k),i);return v.createElement(v.Fragment,null,m&&v.createElement(x,{sideCar:sd,removeScrollBar:f,shards:p,noRelative:g,noIsolation:b,inert:y,setCallbacks:c,allowPinchZoom:!!w,lockRef:o,gapMode:N}),d?v.cloneElement(v.Children.only(u),ss(ss({},S),{ref:M})):v.createElement(void 0===j?"div":j,ss({},S,{className:h,ref:M}),u))});sh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},sh.classNames={fullWidth:so,zeroRight:sn};var sf=function(e){var t=e.sideCar,a=sr(e,["sideCar"]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw Error("Sidecar medium not found");return v.createElement(s,ss({},a))};sf.isSideCarExport=!0;var sm=function(){var e=0,t=null;return{add:function(a){if(0==e&&(t=function(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=b||("u">typeof __webpack_nonce__?__webpack_nonce__:void 0);return t&&e.setAttribute("nonce",t),e}())){var s,r;(s=t).styleSheet?s.styleSheet.cssText=a:s.appendChild(document.createTextNode(a)),r=t,(document.head||document.getElementsByTagName("head")[0]).appendChild(r)}e++},remove:function(){--e||!t||(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},sp=function(){var e=sm();return function(t,a){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&a])}},sx=function(){var e=sp();return function(t){return e(t.styles,t.dynamic),null}},sg={left:0,top:0,right:0,gap:0},sb=function(e){return parseInt(e||"",10)||0},sy=function(e){var t=window.getComputedStyle(document.body),a=t["padding"===e?"paddingLeft":"marginLeft"],s=t["padding"===e?"paddingTop":"marginTop"],r=t["padding"===e?"paddingRight":"marginRight"];return[sb(a),sb(s),sb(r)]},sw=function(e){if(void 0===e&&(e="margin"),"u"