luckytri 1.0.8 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/docs/en/CHANGELOG.md +44 -24
- package/docs/en/architecture.md +4 -0
- package/docs/en/cognition.md +34 -0
- package/docs/en/guide.md +8 -6
- package/docs/zh/CHANGELOG.md +44 -24
- package/docs/zh/architecture.md +4 -0
- package/docs/zh/cognition.md +34 -0
- package/docs/zh/guide.md +8 -6
- package/package.json +112 -112
- package/public/app/assets/ChatsPage-DH4ZPRXB.js +3 -0
- package/public/app/assets/{Empty-C7yzOBzy.js → Empty-DRsHeX-L.js} +1 -1
- package/public/app/assets/Field-BfIUcaNa.js +1 -0
- package/public/app/assets/HeartPage-BxgSUJJ_.js +1 -0
- package/public/app/assets/LifePage-CAKr8h_q.js +1 -0
- package/public/app/assets/MemoryPage-CFq8L_TC.js +1 -0
- package/public/app/assets/NaturePage-BU1iDno3.js +3 -0
- package/public/app/assets/PeoplePage-C6i_nAfr.js +1 -0
- package/public/app/assets/PluginsPage-DRV8lzk3.js +2 -0
- package/public/app/assets/SystemPage-21AlQBiC.js +1 -0
- package/public/app/assets/SystemPage-CMcuUdLm.css +1 -0
- package/public/app/assets/TimePage-DUzjLnZV.js +3 -0
- package/public/app/assets/index-WAvrlAcO.js +4 -0
- package/public/app/assets/{knowledge-BJOIyuJo.js → knowledge-V_blbx9R.js} +1 -1
- package/public/app/assets/media-C7j5HqxK.js +1 -0
- package/public/app/assets/{mind-DtTVrW6Z.js → mind-BBAstMqH.js} +1 -1
- package/public/app/index.html +3 -3
- package/public/guide.en.html +13 -5
- package/public/guide.html +12 -5
- package/public/tutorial.en.md +3 -1
- package/public/tutorial.md +3 -1
- package/server/core/backoff.js +123 -0
- package/server/core/context-builder.js +307 -288
- package/server/core/contribution-check.js +50 -0
- package/server/core/conversation-cues.js +377 -385
- package/server/core/conversation-grounding.js +547 -304
- package/server/core/dialogue-context.js +247 -244
- package/server/core/dialogue-contract.js +33 -9
- package/server/core/embedding.js +246 -0
- package/server/core/expression-strategy.js +90 -0
- package/server/core/initiative-context.js +88 -68
- package/server/core/model-json.js +223 -190
- package/server/core/model-manager.js +256 -56
- package/server/core/model-presets.js +1045 -900
- package/server/core/orchestrator.js +41 -3
- package/server/core/persona-manager.js +364 -359
- package/server/core/reader-check.js +166 -62
- package/server/core/reply-delivery.js +688 -537
- package/server/core/repository.js +36 -0
- package/server/core/response-generator.js +101 -92
- package/server/core/response-validator.js +18 -3
- package/server/core/retired-prompts.js +53 -51
- package/server/core/time-expressions.js +143 -0
- package/server/core/turn-processor.js +175 -5
- package/server/core/turn.js +299 -44
- package/server/core/understanding.js +85 -0
- package/server/core/working-memory.js +149 -0
- package/server/i18n/decisions.js +225 -209
- package/server/i18n/errors.js +14 -0
- package/server/i18n/models.js +120 -111
- package/server/knowledge/api.js +362 -342
- package/server/knowledge/embedding-profile.js +158 -114
- package/server/knowledge/manager.js +6 -1
- package/server/mind/api.js +68 -0
- package/server/mind/continuity.js +634 -562
- package/server/mind/day-planner.js +52 -3
- package/server/mind/episodes.js +242 -0
- package/server/mind/expression-grounding.js +24 -21
- package/server/mind/index.js +13 -2
- package/server/mind/initiative.js +356 -338
- package/server/mind/life/index.js +6 -0
- package/server/mind/meetings.js +1112 -1069
- package/server/mind/memory.js +1091 -888
- package/server/mind/recall/index.js +776 -0
- package/server/mind/recall/schema.js +132 -0
- package/server/mind/recall/sources.js +220 -0
- package/server/mind/recall/store.js +368 -0
- package/server/mind/salience.js +202 -201
- package/server/mind/schema.js +568 -567
- package/server/mind/self.js +537 -496
- package/server/mind/time/activity-recall.js +65 -0
- package/server/mind/time/index.js +6 -2
- package/server/mind/time/tasks.js +36 -10
- package/server/mind/time/works.js +528 -527
- package/server/mind/view.js +63 -17
- package/server/storage/archive.js +1 -1
- package/public/app/assets/ChatsPage-CshdtTzV.js +0 -3
- package/public/app/assets/Field-BjFv4Rfn.js +0 -1
- package/public/app/assets/HeartPage-eqo6ru16.js +0 -1
- package/public/app/assets/LifePage-CN8GE5NK.js +0 -1
- package/public/app/assets/MemoryPage-CCpMN4Wg.js +0 -1
- package/public/app/assets/NaturePage-C0JqdBTR.js +0 -3
- package/public/app/assets/PeoplePage-BXGBbO4u.js +0 -1
- package/public/app/assets/PluginsPage-Dksp5AV5.js +0 -2
- package/public/app/assets/SystemPage-BenIyTvk.css +0 -1
- package/public/app/assets/SystemPage-Cd7aa8eE.js +0 -1
- package/public/app/assets/TimePage-Bs_zImb4.js +0 -3
- package/public/app/assets/index-CyRtYxP3.js +0 -4
- package/public/app/assets/media-Bwtx8blz.js +0 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatsPage-DH4ZPRXB.js","assets/Empty-DRsHeX-L.js","assets/Empty-DmUB2-Bk.css","assets/mind-BBAstMqH.js","assets/media-C7j5HqxK.js","assets/Field-BfIUcaNa.js","assets/ChatsPage-DfyPCS9N.css","assets/HeartPage-BxgSUJJ_.js","assets/HeartPage-Bft9wZp5.css","assets/PeoplePage-C6i_nAfr.js","assets/knowledge-V_blbx9R.js","assets/PeoplePage-BTU0H1pM.css","assets/LifePage-CAKr8h_q.js","assets/LifePage-BUi5euBF.css","assets/TimePage-DUzjLnZV.js","assets/TimePage-BOms_n4I.css","assets/MemoryPage-CFq8L_TC.js","assets/MemoryPage-cZvXfkXb.css","assets/NaturePage-BU1iDno3.js","assets/NaturePage-CHkpb5NK.css","assets/SystemPage-21AlQBiC.js","assets/SystemPage-CMcuUdLm.css","assets/PluginsPage-DRV8lzk3.js","assets/PluginsPage-CVVQwEBI.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{$ as e,A as t,B as n,C as r,Ct as i,Dt as a,Et as o,F as s,G as c,H as l,I as u,J as d,K as f,L as p,M as m,N as h,O as g,P as _,Q as v,R as y,S as b,St as x,T as ee,Tt as S,U as te,W as C,X as w,Y as T,Z as E,_ as ne,_t as D,a as O,at as k,bt as A,c as j,ct as M,d as N,dt as P,et as F,ft as I,g as re,gt as ie,h as ae,ht as oe,i as L,it as se,j as R,k as ce,l as le,lt as ue,m as de,mt as fe,n as z,nt as pe,ot as me,pt as he,q as ge,r as _e,rt as B,s as V,st as ve,t as ye,tt as H,u as be,ut as xe,v as U,vt as Se,wt as W,x as Ce,xt as G,y as we,yt as K}from"./Empty-DRsHeX-L.js";import{g as Te,i as Ee,m as De,n as Oe,p as ke,t as Ae,u as je,y as Me}from"./mind-BBAstMqH.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var q=_({calm:{key:`calm`,label:R(`平静`),feel:R(`像一杯温水`),particle:`mote`,tempo:1},sweet:{key:`sweet`,label:R(`甜甜`),feel:R(`心里软软的`),particle:`bubble`,tempo:1.05},bright:{key:`bright`,label:R(`雀跃`),feel:R(`想蹦起来`),particle:`sparkle`,tempo:1.45},blue:{key:`blue`,label:R(`低落`),feel:R(`有点灰灰的`),particle:`rain`,tempo:.7},stormy:{key:`stormy`,label:R(`烦躁`),feel:R(`心里起风了`),particle:`fluff`,tempo:1.25},drowsy:{key:`drowsy`,label:R(`困倦`),feel:R(`眼皮在打架`),particle:`dust`,tempo:.6},night:{key:`night`,label:R(`夜晚`),feel:R(`睡着了`),particle:`star`,tempo:.45}}),Ne=Object.keys(q);function Pe(e){return typeof e==`string`&&e in q}function Fe(e){if(!e)return`calm`;let t=e.valence??0,n=e.arousal??.35;return e.phase===`asleep`?`night`:e.phase===`sleepy`||e.phase===`waking`||(e.energy??1)<.25?`drowsy`:t>.45?n>.5?`bright`:`sweet`:t>.22?`sweet`:t>-.12?`calm`:n>.5?`stormy`:`blue`}function Ie(e){if(!e)return .45;if(e.phase===`asleep`)return .6;let t=.25+Math.abs(e.valence??0)*.5+(e.arousal??.35)*.35;return Math.min(1,Math.max(.2,t))}var Le=`luckyTheme`,Re=`luckyQuietMotion`;function ze(e){try{return localStorage.getItem(e)}catch{return null}}function Be(e,t){try{t===null?localStorage.removeItem(e):localStorage.setItem(e,t)}catch{}}var Ve=typeof matchMedia==`function`?matchMedia(`(prefers-reduced-motion: reduce)`):null,He=ze(Le),J=G({affect:null,pinned:Pe(He)?He:null,quiet:ze(Re)===`true`,reduced:!!Ve?.matches});Ve?.addEventListener?.(`change`,e=>{J.reduced=e.matches});var Y=d(()=>Fe(J.affect)),Ue=d(()=>J.pinned??Y.value),X=d(()=>!J.quiet&&!J.reduced),We=d(()=>J.pinned?.6:Ie(J.affect));function Ge(e){J.affect=e}function Ke(e){J.pinned=e,Be(Le,e)}function qe(e){J.quiet=e,Be(Re,String(e))}function Je(){Se(()=>{let e=document.documentElement,t=Ue.value,n=J.affect?.phase||`awake`,r=X.value?`full`:`quiet`;e.dataset.mood!==t&&(e.dataset.mood=t),e.dataset.phase!==n&&(e.dataset.phase=n),e.dataset.motion!==r&&(e.dataset.motion=r);let i=String(q[t].tempo),a=We.value.toFixed(2);e.style.getPropertyValue(`--tempo`)!==i&&e.style.setProperty(`--tempo`,i),e.style.getPropertyValue(`--intensity`)!==a&&e.style.setProperty(`--intensity`,a)})}var Z=G({data:null,error:``}),Ye=null,Xe=0;function Ze(){return Ye??=de(`/mind/presence`).then(e=>{Z.data=e,Z.error=``,Ge({...e.affect})}).catch(e=>{Z.error=e.message}).finally(()=>{Ye=null}),Ye}function Qe(){Ze(),clearInterval(Xe),Xe=window.setInterval(()=>{document.hidden||Ze()},3e4);let e=()=>{document.hidden||Ze()};return document.addEventListener(`visibilitychange`,e),()=>{clearInterval(Xe),document.removeEventListener(`visibilitychange`,e)}}async function $e(e,t={}){let{session:n=``,signal:r,reconnectMs:i=3e3}=t,a=e=>new Promise(t=>{if(r?.aborted)return t();let n=setTimeout(i,e);function i(){clearTimeout(n),r?.removeEventListener(`abort`,i),t()}r?.addEventListener(`abort`,i,{once:!0})});for(;!r?.aborted;){try{await ee();let t=new URL(`/api/core/stream`,location.origin);n&&t.searchParams.set(`session`,n);let i=await fetch(t,{credentials:`same-origin`,signal:r});if(i.status===401&&b(),!i.ok)throw Error(`stream unavailable`);let a=i.body.getReader(),o=new TextDecoder,s=``;for(;;){let{value:t,done:n}=await a.read();if(n)break;s+=o.decode(t,{stream:!0});let r;for(;(r=s.indexOf(`
|
|
3
|
+
|
|
4
|
+
`))>=0;){let t=s.slice(0,r);s=s.slice(r+2),t.startsWith(`data: `)&&await e(JSON.parse(t.slice(6)))}}}catch{}r?.aborted||await a(i)}}var et=`/app/assets/luckytri-home-95QKeMtc.png`,tt=`luckytri-wallpapers`,nt=`files`,rt=`luckytri-sky-opacity-v1`,it=.22,at=.4,Q=G({hero:et,sky:``,skyOpacity:st()}),ot=null;function st(){try{let e=Number(localStorage.getItem(rt));return Number.isFinite(e)?ct(e):it}catch{return it}}function ct(e){return Math.min(.82,Math.max(.08,e))}function lt(){return new Promise((e,t)=>{let n=indexedDB.open(tt,1);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains(nt)||n.result.createObjectStore(nt)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error)})}function ut(e){return lt().then(t=>new Promise((n,r)=>{let i=t.transaction(nt).objectStore(nt).get(e);i.onsuccess=()=>n(i.result||null),i.onerror=()=>r(i.error)}))}function dt(e,t){return lt().then(n=>new Promise((r,i)=>{let a=n.transaction(nt,`readwrite`).objectStore(nt),o=t?a.put(t,e):a.delete(e);o.onsuccess=()=>r(),o.onerror=()=>i(o.error)}))}function ft(e,t){let n=Q[e];n.startsWith(`blob:`)&&URL.revokeObjectURL(n),Q[e]=t?URL.createObjectURL(t):e===`hero`?et:``}async function pt(e,t){if(!e.type.startsWith(`image/`))throw Error(u(`请选择一张图片`));if(e.size>20971520)throw Error(u(`图片太大了,请换一张 20MB 以内的`));try{let n=await createImageBitmap(e),r=Math.min(1,t/Math.max(n.width,n.height)),i=document.createElement(`canvas`);i.width=Math.max(1,Math.round(n.width*r)),i.height=Math.max(1,Math.round(n.height*r));let a=i.getContext(`2d`);if(!a)throw Error(u(`无法处理这张图片`));a.drawImage(n,0,0,i.width,i.height),n.close();let o=await new Promise(e=>i.toBlob(e,`image/jpeg`,.86));if(!o)throw Error(u(`无法处理这张图片`));return o}catch(t){if(t instanceof Error&&t.message!==u(`请选择一张图片`)&&e.size<=6291456)return e;throw t instanceof Error?t:Error(u(`无法处理这张图片`))}}function mt(){return ot??=(async()=>{try{let[e,t]=await Promise.all([ut(`hero`),ut(`sky`)]);e&&ft(`hero`,e),t&&ft(`sky`,t)}catch{}})(),ot}async function ht(e){let t=await pt(e,1600);await dt(`hero`,t),ft(`hero`,t)}async function gt(){await dt(`hero`,null),ft(`hero`,null)}async function _t(e){let t=await pt(e,1920);await dt(`sky`,t),ft(`sky`,t);let n=null;try{n=localStorage.getItem(rt)}catch{n=null}n||yt(at)}async function vt(){await dt(`sky`,null),ft(`sky`,null)}function yt(e){let t=ct(e);Q.skyOpacity=t;try{localStorage.setItem(rt,String(t))}catch{}}var bt=_({idle:R(`闲着`),speaking:R(`刚说完话`),thinking:R(`在想怎么回`),solitude:R(`在独处`),reading:R(`在读资料`),diary:R(`在写日记`),review:R(`在回顾这段日子`),night:R(`在夜里整理今天`),asleep:R(`睡着了`),busy:R(`在忙自己的事`)});function xt(e){if(!e)return``;if(e.phase===`asleep`)return u(`睡着了,呼吸很轻`);let t=[e.phaseLabel,e.energyLabel,e.mood].filter(Boolean).join(`,`);return e.cause?u(`{line},因为{cause}`,{line:t,cause:e.cause}):t}function St(e){return e?.lately||``}function Ct(e){if(!e)return``;if(e.currentLife?.current)return e.currentLife.current.label+(e.currentLife.current.title?` · `+e.currentLife.current.title:``);let{kind:t,sessionName:n}=e.activity||{kind:`idle`},r=bt[t]||bt.idle;return(t===`speaking`||t===`thinking`)&&n?`${r} · ${n}`:r}var wt={mote:16,sparkle:12,bubble:10,rain:28,fluff:8,dust:18,star:24},Tt=36,Et=class{canvas;ctx;parts=[];kind=`mote`;intensity=.5;colors={particle:`#ffffff`,accent:`#2c8465`,cheek:`#ff9db1`};w=0;h=0;raf=0;last=0;running=!1;shooting=null;nextShot=0;constructor(e){this.canvas=e;let t=e.getContext(`2d`,{alpha:!0,desynchronized:!0});if(!t)throw Error(`canvas unavailable`);this.ctx=t}configure(e,t){let n=e!==this.kind||Math.abs(t-this.intensity)>.15||!this.parts.length;this.kind=e,this.intensity=t,this.readColors(),n&&this.seed()}readColors(){let e=getComputedStyle(document.documentElement),t=(t,n)=>e.getPropertyValue(t).trim()||n;this.colors={particle:t(`--particle`,`#ffffff`),accent:t(`--accent`,`#2c8465`),cheek:t(`--cheek`,`#ff9db1`)}}resize(){let e=this.canvas.getBoundingClientRect();this.w=e.width,this.h=e.height,this.canvas.width=Math.round(e.width*1),this.canvas.height=Math.round(e.height*1),this.ctx.setTransform(1,0,0,1,0,0),this.seed()}start(){if(this.running)return;this.running=!0,this.last=performance.now();let e=t=>{if(!this.running)return;this.raf=requestAnimationFrame(e);let n=t-this.last;n<1e3/60-1||(this.last=t,this.step(Math.min(.05,n/1e3),t/1e3))};this.raf=requestAnimationFrame(e)}stop(){this.running=!1,cancelAnimationFrame(this.raf),this.ctx.clearRect(0,0,this.w,this.h)}count(){let e=Math.min(1.25,Math.max(.4,this.w*this.h/1296e3));return Math.min(Tt,Math.round(wt[this.kind]*e*(.55+this.intensity*.9)))}seed(){this.parts=Array.from({length:this.count()},()=>this.spawn(!0))}spawn(e){let t=Math.random,n={x:t()*this.w,y:t()*this.h,vx:0,vy:0,r:2,a:1,phase:t()*Math.PI*2,spin:(t()-.5)*.6,alt:!1};switch(this.kind){case`mote`:Object.assign(n,{r:2+t()*4,vx:(t()-.5)*8,vy:-4-t()*8,a:.25+t()*.45}),e||(n.y=this.h+10);break;case`sparkle`:Object.assign(n,{r:2.5+t()*4.5,vx:(t()-.5)*14,vy:-6-t()*14,a:.5+t()*.5,alt:t()<.35}),e||(n.y=this.h+10);break;case`bubble`:Object.assign(n,{r:3+t()*8,vx:(t()-.5)*10,vy:-10-t()*18,a:.35+t()*.4,alt:t()<.3}),e||(n.y=this.h+14);break;case`rain`:Object.assign(n,{x:t()*(this.w+120),r:10+t()*14,vx:-40,vy:380+t()*180,a:.12+t()*.2}),e||(n.y=-24);break;case`fluff`:Object.assign(n,{r:14+t()*26,vx:(t()-.5)*30,vy:(t()-.5)*18,a:.06+t()*.08});break;case`dust`:Object.assign(n,{r:.8+t()*1.8,vx:(t()-.5)*6,vy:(t()-.5)*6,a:.3+t()*.5});break;case`star`:Object.assign(n,{r:.6+t()*1.6,a:.4+t()*.6,y:t()*this.h*.8})}return n}step(e,t){let{ctx:n,w:r,h:i,colors:a}=this;n.clearRect(0,0,r,i);let o=.6+this.intensity*.8;for(let n=0;n<this.parts.length;n++){let s=this.parts[n];switch(s.phase+=e,s.x+=s.vx*e*o,s.y+=s.vy*e*o,this.kind){case`mote`:case`sparkle`:case`bubble`:s.x+=Math.sin(t*.6+s.phase)*.25,s.y<-24&&(this.parts[n]=this.spawn(!1));break;case`rain`:s.y>i+24&&(this.parts[n]=this.spawn(!1));break;default:this.kind===`fluff`&&(s.vx+=Math.sin(t*.7+s.phase*3)*12*e,s.vy+=Math.cos(t*.5+s.phase*2)*8*e,s.vx=Math.max(-24,Math.min(24,s.vx)),s.vy=Math.max(-16,Math.min(16,s.vy))),s.x<-40&&(s.x=r+40),s.x>r+40&&(s.x=-40),s.y<-40&&(s.y=i+40),s.y>i+40&&(s.y=-40)}this.draw(this.parts[n],t,a)}this.kind===`star`&&this.shoot(e,t),n.globalAlpha=1}draw(e,t,n){let r=this.ctx;switch(this.kind){case`mote`:{let t=e.a*(.7+.3*Math.sin(e.phase*1.3));r.fillStyle=n.particle,r.globalAlpha=t*.25,this.circle(e.x,e.y,e.r*2.4),r.globalAlpha=t,this.circle(e.x,e.y,e.r);break}case`sparkle`:r.fillStyle=e.alt?n.accent:n.particle,r.globalAlpha=e.a*(.35+.65*(.5+.5*Math.sin(e.phase*2.2))),this.star(e.x,e.y,e.r,t*e.spin);break;case`bubble`:r.globalAlpha=e.a,e.alt?(r.fillStyle=n.cheek,this.heart(e.x,e.y,e.r*.8)):(r.strokeStyle=n.particle,r.lineWidth=1.2,r.beginPath(),r.arc(e.x,e.y,e.r,0,Math.PI*2),r.stroke(),r.globalAlpha=e.a*.8,r.beginPath(),r.arc(e.x-e.r*.35,e.y-e.r*.35,e.r*.25,0,Math.PI*2),r.fillStyle=n.particle,r.fill());break;case`rain`:r.strokeStyle=n.particle,r.globalAlpha=e.a,r.lineWidth=1,r.beginPath(),r.moveTo(e.x,e.y),r.lineTo(e.x-e.r*.1,e.y+e.r),r.stroke();break;case`fluff`:{let t=r.createRadialGradient(e.x,e.y,0,e.x,e.y,e.r);t.addColorStop(0,n.particle),t.addColorStop(1,`transparent`),r.fillStyle=t,r.globalAlpha=e.a,this.circle(e.x,e.y,e.r);break}case`dust`:r.fillStyle=n.particle,r.globalAlpha=e.a*(.75+.25*Math.sin(e.phase*.9)),this.circle(e.x,e.y,e.r);break;case`star`:r.fillStyle=n.particle,r.globalAlpha=e.a*(.55+.45*Math.sin(t*(.6+e.spin)+e.phase)),this.circle(e.x,e.y,e.r),e.r>1.8&&(r.globalAlpha*=.35,this.star(e.x,e.y,e.r*3.2,0))}}shoot(e,t){!this.shooting&&t>this.nextShot&&(this.nextShot=t+9+Math.random()*10,this.shooting={x:this.w*(.3+Math.random()*.6),y:this.h*Math.random()*.3,life:0});let n=this.shooting;if(!n)return;n.life+=e;let r=n.life/1.4;if(r>=1){this.shooting=null;return}let i=n.x-r*220,a=n.y+r*110,o=this.ctx,s=o.createLinearGradient(i,a,i+60,a-30);s.addColorStop(0,this.colors.particle),s.addColorStop(1,`transparent`),o.strokeStyle=s,o.globalAlpha=Math.sin(r*Math.PI)*.7,o.lineWidth=1.4,o.beginPath(),o.moveTo(i,a),o.lineTo(i+60,a-30),o.stroke()}circle(e,t,n){this.ctx.beginPath(),this.ctx.arc(e,t,n,0,Math.PI*2),this.ctx.fill()}star(e,t,n,r){let i=this.ctx;i.save(),i.translate(e,t),i.rotate(r),i.beginPath(),i.moveTo(0,-n),i.quadraticCurveTo(0,0,n,0),i.quadraticCurveTo(0,0,0,n),i.quadraticCurveTo(0,0,-n,0),i.quadraticCurveTo(0,0,0,-n),i.fill(),i.restore()}heart(e,t,n){let r=this.ctx;r.beginPath(),r.moveTo(e,t+n*.9),r.bezierCurveTo(e-n*1.6,t-n*.2,e-n*.6,t-n*1.3,e,t-n*.45),r.bezierCurveTo(e+n*.6,t-n*1.3,e+n*1.6,t-n*.2,e,t+n*.9),r.fill()}},Dt=[`data-particles`],Ot={key:0,class:`moon`},kt=z(B({__name:`MoodSky`,setup(t){let n=x(),r=d(()=>Q.sky?{backgroundImage:`url("${Q.sky}")`,opacity:String(Q.skyOpacity)}:void 0),i=d(()=>X.value?q[Ue.value].particle:`off`),a=null,s=0;function c(){a&&(a.configure(q[Ue.value].particle,We.value),clearTimeout(s),s=window.setTimeout(()=>a?.readColors(),1500),X.value&&!document.hidden?a.start():a.stop())}function l(){a?.resize()}function u(){a&&(document.hidden?a.stop():X.value&&a.start())}return ue(()=>{if(n.value){try{a=new Et(n.value)}catch{return}a.resize(),c(),window.addEventListener(`resize`,l,{passive:!0}),document.addEventListener(`visibilitychange`,u)}}),D([Ue,We,X],c),ve(()=>{a?.stop(),clearTimeout(s),window.removeEventListener(`resize`,l),document.removeEventListener(`visibilitychange`,u)}),(t,a)=>(P(),v(`div`,{class:`sky`,"aria-hidden":`true`,"data-particles":i.value},[a[0]||=T(`div`,{class:`sky-base`},null,-1),T(`div`,{class:S([`garden`,{custom:!!W(Q).sky}]),style:o(r.value)},null,6),a[1]||=e(`<div class="glow g1" data-v-d7604463></div><div class="glow g2" data-v-d7604463></div><div class="glow g3" data-v-d7604463></div><div class="glow g4" data-v-d7604463></div><div class="horizon" data-v-d7604463></div><div class="landscape" data-v-d7604463><i data-v-d7604463></i><i data-v-d7604463></i><i data-v-d7604463></i><i data-v-d7604463></i></div><div class="sheen" data-v-d7604463></div>`,7),W(Ue)===`night`?(P(),v(`div`,Ot)):E(``,!0),a[2]||=T(`div`,{class:`vignette`},null,-1),T(`canvas`,{ref_key:`canvas`,ref:n,class:S([`particles`,{off:!W(X)}])},null,2)],8,Dt))}}),[[`__scopeId`,`data-v-d7604463`]]),At=_({calm:[R(`嗯?`),R(`我在这儿。`),R(`有什么事吗?`),R(`戳我做什么呀`)],sweet:[R(`在呢~`),R(`被你发现啦`),R(`嘿嘿,找我呀`),R(`今天心情不错哦`)],bright:[R(`哇!干嘛呀~`),R(`今天超开心的!`),R(`再戳我也还是好开心`),R(`嘿嘿嘿`)],blue:[R(`……嗯`),R(`我没事,就是有点低落`),R(`陪我待一会儿就好`),R(`唔……`)],stormy:[R(`别戳啦!`),R(`我现在有点烦……`),R(`让我静一静嘛`),R(`哼`)],drowsy:[R(`唔……好困`),R(`再让我眯一会儿`),R(`嗯……?`),R(`哈——欠`)],night:[R(`呼……呼……`),R(`(翻了个身)`),`zzz……`,R(`(嘟囔了一句梦话)`)]}),jt=_({calm:[R(`……有点痒`),R(`嗯,这样挺好`),R(`谢谢你`)],sweet:[R(`嘿嘿,好舒服`),R(`再摸一下嘛`),R(`脸要红了……`)],bright:[R(`哈哈哈好痒!`),R(`最喜欢这样了!`),R(`嘿嘿,开心加倍`)],blue:[R(`……谢谢你`),R(`好像好一点了`),R(`嗯,别走开`)],stormy:[R(`……好吧,就一下`),R(`哼,勉强接受`),R(`嗯……好像没那么烦了`)],drowsy:[R(`呼……要睡着了`),R(`好温暖……`),R(`嗯……`)],night:[R(`(在梦里笑了一下)`),R(`(蹭了蹭)`),`zzz……`]}),Mt=_({thinking:[R(`等等,我在想怎么回……`),R(`嘘,我在看大家聊什么`)],speaking:[R(`刚刚在说话来着`),R(`你看到我说的了吗`)],solitude:[R(`我在想事情,一会儿就好`),R(`让我安静一下下`)],reading:[R(`我在看书呢`),R(`这一页好有意思`)],diary:[R(`我在写日记,不许偷看`),R(`今天的事,写下来`)],review:[R(`在翻以前的日记呢`),R(`原来那时候我是这样想的`)],night:[R(`在整理今天的事……`),R(`嘘,快整理完了`)]}),Nt=0;function Pt(e,t,n=`idle`){let r=e===`poke`&&n!==`asleep`&&Mt[n]?Mt[n]:(e===`pet`?jt:At)[n===`asleep`?`night`:t]||At.calm;return Nt+=1,r[Nt%r.length]}var Ft=[`role`,`tabindex`,`aria-label`,`data-mood`,`data-activity`,`onKeydown`],It=[`id`],Lt=[`id`],Rt=[`id`],zt=[`fill`],Bt={key:0,class:`halo`},Vt={class:`squish`},Ht=[`d`,`fill`],Ut=[`d`,`fill`],Wt=[`transform`],Gt={key:0,class:`brows`},Kt=[`d`],qt=[`d`],Jt=[`cx`,`cy`,`ry`],Yt=[`cx`,`cy`],Xt=[`d`],Zt=[`d`],Qt={key:3},$t=[`d`],en=[`d`],tn={class:`mouth`},nn=[`d`],rn={key:1,class:`line`,d:`M94 125Q100 129.5 106 125`},an={key:2},on={key:3,class:`line`,d:`M89 123Q94.5 129 100 123.5Q105.5 129 111 123`},sn={key:4,class:`line`,d:`M91 130Q100 122.5 109 130`},cn={key:5,class:`line`,d:`M88 127q3 -3.4 6 0t6 0t6 0t6 0`},ln={key:6,class:`ink yawn`,cx:`100`,cy:`127`,rx:`4.6`,ry:`5.6`},un={key:7,class:`ink`,cx:`100`,cy:`127`,rx:`2.6`,ry:`3`},dn={key:8,class:`ink talk`,cx:`100`,cy:`126`,rx:`5`,ry:`4.5`},fn={key:9,class:`line`,d:`M91 127Q102 130 110 121`},pn={key:10,class:`line`,d:`M93 126L107 126`},mn={key:0,class:`held`},hn={key:1,class:`held`},gn={key:1,class:`fx`},_n=[`d`],vn={key:2,class:`fx`},yn=[`d`],bn={key:3,class:`fx rain`},xn={key:4,class:`fx storm`},Sn={key:5,class:`fx`},Cn={key:6,class:`fx`},wn={key:7,class:`fx`},Tn={key:8,class:`fx`},En={key:9,class:`fx think`},Dn={key:10,class:`fx talkwaves`},On=z(B({__name:`TaOrb`,props:{mood:{default:`calm`},activity:{default:`idle`},size:{default:160},interactive:{type:Boolean,default:!1},speech:{default:``},traits:{default:null},bubbleSide:{default:`top`},label:{default:``}},emits:[`open-chat`,`react`],setup(t,{expose:n,emit:r}){let i=t,s=r,l={calm:{wobble:.6,speed:.8,bounce:0,droop:0,jitter:0,eyes:`open`,mouth:`small`,cheeks:.25},sweet:{wobble:.8,speed:1,bounce:1.6,droop:0,jitter:0,eyes:`happy`,mouth:`cat`,cheeks:.8},bright:{wobble:1,speed:1.5,bounce:7,droop:0,jitter:0,eyes:`happy`,mouth:`grin`,cheeks:.55},blue:{wobble:.35,speed:.5,bounce:0,droop:4,jitter:0,eyes:`sad`,mouth:`frown`,cheeks:.1},stormy:{wobble:1.1,speed:1.2,bounce:0,droop:0,jitter:.9,eyes:`cross`,mouth:`wavy`,cheeks:.15},drowsy:{wobble:.45,speed:.45,bounce:0,droop:2,jitter:0,eyes:`sleepy`,mouth:`yawn`,cheeks:.35},night:{wobble:.3,speed:.35,bounce:0,droop:3,jitter:0,eyes:`closed`,mouth:`sleep`,cheeks:.3}},f=new Set([`open`,`sad`,`cross`,`up`,`down`]),m=[{x:28,y:48,r:8,d:0},{x:176,y:36,r:6,d:.8},{x:184,y:128,r:7,d:1.5},{x:18,y:138,r:5,d:2.1}],h=[{x:164,y:70,s:7,d:0},{x:34,y:84,s:5.5,d:1.4},{x:178,y:118,s:4.5,d:2.6}],g=`orb`+Math.random().toString(36).slice(2,8),_={fill:g+`-fill`,aura:g+`-aura`,rim:g+`-rim`},y=`${(Math.random()*3).toFixed(2)}s`,b=x(),ee=x(),w=x(),ne=x(),O=x(),k=x({x:0,y:0}),A=x(``),j=x(``),N=d(()=>{let e={...l[i.mood]},t=i.traits;if(t){let n=t.warmth??65,r=t.activity??40;e.eyes=(t.humor??25)>60?`happy`:`open`,e.mouth=(t.sarcasm??5)>40?`smirk`:n>35?`smile`:`flat`,e.cheeks=Math.max(0,(n-30)/70)*.9,e.bounce=r/100*8,e.speed=.5+r/100*1.2,e.wobble=.4+r/100*.8,e.jitter=0,e.droop=0}switch(i.activity){case`asleep`:Object.assign(e,{eyes:`closed`,mouth:`sleep`,bounce:0,speed:.35,wobble:.3,jitter:0});break;case`solitude`:case`night`:case`review`:Object.assign(e,{eyes:`closed`,mouth:`small`,bounce:0,jitter:0});break;case`diary`:case`reading`:e.eyes=`down`,e.bounce=0,(e.mouth===`grin`||e.mouth===`wavy`)&&(e.mouth=`small`);break;case`thinking`:e.eyes=`up`,e.mouth===`grin`&&(e.mouth=`small`);break;case`speaking`:e.mouth=`talk`}return A.value===`pet`&&e.eyes!==`closed`?Object.assign(e,{eyes:`happy`,mouth:`cat`,cheeks:1}):A.value===`pet`&&(e.cheeks=1),A.value===`poke`&&e.eyes===`happy`&&(e.eyes=`open`),e}),F=d(()=>i.size<72),re=d(()=>N.value.eyes===`up`?{x:2,y:-3}:N.value.eyes===`down`?{x:0,y:2.5}:{x:0,y:0}),ie=d(()=>i.traits?.3+(i.traits.warmth??65)/100*1.1:1),ae=d(()=>(i.traits?.humor??0)>45),oe=d(()=>{let{eyes:e,mouth:t}=N.value;return e===`sad`?[`M70 95 Q78 92 87 90`,`M113 90 Q122 92 130 95`]:e===`cross`?[`M71 90 L87 95.5`,`M113 95.5 L129 90`]:t===`smirk`?[`M71 94 L87 93`,`M113 90 Q121 85.5 129 89`]:null}),L=d(()=>{let e=i.traits;if(!e)return;let t=((e.warmth??65)-50)/50,n=(e.initiative??25)/100;return{filter:`hue-rotate(${Math.round(-t*28)}deg) saturate(${(1+t*.18).toFixed(2)})`,transform:`scale(${(.92+n*.14).toFixed(3)}) rotate(${((n-.25)*8).toFixed(1)}deg)`}}),se=d(()=>j.value||i.speech),R=d(()=>i.label||(i.interactive?u(`TA:轻触互动,按住摸摸头,双击和 TA 聊聊`):`TA`)),ce=d(()=>F.value?``:i.activity===`asleep`?`night`:i.mood);function le(e,t,n,r){let i=[];for(let a=0;a<8;a++){let o=a/8*Math.PI*2-Math.PI/2,s=62*(1+(Math.sin(e*1.3+a*1.7)*.6+Math.sin(e*.7+a*2.9)*.4)*.055*t),c=Math.sin(o)>0?.92:1.02;i.push([100+Math.cos(o)*s*n,112+Math.sin(o)*s*r*c])}let a=`M${i[0][0].toFixed(2)},${i[0][1].toFixed(2)}`;for(let e=0;e<8;e++){let t=i[(e-1+8)%8],n=i[e],r=i[(e+1)%8],o=i[(e+2)%8];a+=`C${(n[0]+(r[0]-t[0])/6).toFixed(2)},${(n[1]+(r[1]-t[1])/6).toFixed(2)} ${(r[0]-(o[0]-n[0])/6).toFixed(2)},${(r[1]-(o[1]-n[1])/6).toFixed(2)} ${r[0].toFixed(2)},${r[1].toFixed(2)}`}return a+`Z`}let de=le(0,0,1,1),fe=performance.now()-Math.random()*1e4,z=0,pe=0;function he(e,t=!1){let n=N.value,r=(e-fe)/1e3,i=r*n.speed,a=t?0:Math.sin(i*1.7)*.022,o=t||!n.bounce?0:Math.max(0,Math.sin(i*2.6))**1.5*n.bounce,s=t||!n.jitter||Math.sin(r*.8)<.55?0:Math.sin(r*38)*n.jitter,c=t?de:le(i,n.wobble,1+a-o*.004,1-a*.7+o*.006);ee.value?.setAttribute(`d`,c),w.value?.setAttribute(`d`,c),ne.value?.setAttribute(`transform`,`translate(${s.toFixed(2)} ${(n.droop-o).toFixed(2)})`),O.value?.setAttribute(`rx`,(46*(1-o/30)).toFixed(2))}function ge(e){z=requestAnimationFrame(ge),!(e-pe<1e3/60-1)&&(pe=e,he(e))}let _e=!0,B=!0,V=null;function ye(){cancelAnimationFrame(z),z=0,X.value&&_e&&B&&!document.hidden?z=requestAnimationFrame(ge):he(performance.now(),!0)}let be=0;function xe(e){be||=requestAnimationFrame(()=>{be=0;let t=b.value;if(!t||N.value.eyes===`closed`){k.value={x:0,y:0};return}let n=t.getBoundingClientRect(),r=e.clientX-(n.left+n.width/2),i=e.clientY-(n.top+n.height/2),a=Math.hypot(r,i)||1,o=Math.min(1,a/360);k.value={x:Math.round(r/a*4*o*10)/10,y:Math.round(i/a*3*o*10)/10}})}function U(e){window.removeEventListener(`pointermove`,xe),e&&_e&&B&&!document.hidden&&i.size>=56?window.addEventListener(`pointermove`,xe,{passive:!0}):k.value={x:0,y:0}}let Se=0,Ce=0,G=0;function we(e){j.value=e,clearTimeout(Se),Se=window.setTimeout(()=>j.value=``,2800)}function Te(e){A.value=e,clearTimeout(Ce),Ce=window.setTimeout(()=>A.value=``,e===`pet`?1500:650),we(Pt(e,i.mood,i.activity)),s(`react`,e)}function Ee(){i.interactive&&Te(`poke`)}function De(){i.interactive&&Te(`pet`)}function Oe(e){!i.interactive||e.button>0||(A.value=`press`,clearTimeout(G),G=window.setTimeout(()=>{G=0,Te(`pet`)},520))}function ke(){i.interactive&&G&&(clearTimeout(G),G=0,Te(`poke`))}function Ae(){G&&clearTimeout(G),G=0,A.value===`press`&&(A.value=``)}function je(e,t,n){return`M${e} ${t-n}Q${e} ${t} ${e+n} ${t}Q${e} ${t} ${e} ${t+n}Q${e} ${t} ${e-n} ${t}Q${e} ${t} ${e} ${t-n}Z`}function Me(e,t,n){return`M${e} ${t+n*.9}C${e-n*1.6} ${t-n*.2} ${e-n*.6} ${t-n*1.3} ${e} ${t-n*.45}C${e+n*.6} ${t-n*1.3} ${e+n*1.6} ${t-n*.2} ${e} ${t+n*.9}Z`}D([N,X],ye),D(X,U);function q(){ye(),U(X.value)}return me(()=>{B=!0,q()}),M(()=>{B=!1,q()}),ue(()=>{ye(),U(X.value),b.value&&`IntersectionObserver`in window&&(V=new IntersectionObserver(e=>{_e=e[0].isIntersecting,q()}),V.observe(b.value)),document.addEventListener(`visibilitychange`,q)}),ve(()=>{cancelAnimationFrame(z),cancelAnimationFrame(be),window.removeEventListener(`pointermove`,xe),V?.disconnect(),document.removeEventListener(`visibilitychange`,q),clearTimeout(Se),clearTimeout(Ce),clearTimeout(G)}),n({poke:Ee,pet:De,cancel:Ae}),(n,r)=>(P(),v(`div`,{ref_key:`root`,ref:b,class:S([`ta-orb`,[`mood-${t.mood}`,`act-${t.activity}`,A.value&&`is-${A.value}`,{interactive:t.interactive,small:F.value}]]),style:o({width:t.size+`px`,height:t.size+`px`,"--blink-delay":y}),role:t.interactive?`button`:`img`,tabindex:t.interactive?0:void 0,"aria-label":R.value,"data-mood":t.mood,"data-activity":t.activity,onPointerdown:Oe,onPointerup:ke,onPointerleave:Ae,onPointercancel:Ae,onDblclick:r[0]||=e=>s(`open-chat`),onKeydown:[te(C(Ee,[`prevent`]),[`enter`]),te(C(De,[`prevent`]),[`space`])],onContextmenu:r[1]||=C(()=>{},[`prevent`])},[(P(),v(`svg`,{viewBox:`0 0 200 200`,style:o(L.value),"aria-hidden":`true`},[T(`defs`,null,[T(`radialGradient`,{id:_.fill,cx:`38%`,cy:`30%`,r:`78%`},[...r[2]||=[T(`stop`,{offset:`0%`,style:{"stop-color":`var(--orb-a)`}},null,-1),T(`stop`,{offset:`58%`,style:{"stop-color":`var(--orb-b)`}},null,-1),T(`stop`,{offset:`100%`,style:{"stop-color":`var(--orb-c)`}},null,-1)]],8,It),T(`radialGradient`,{id:_.aura},[...r[3]||=[T(`stop`,{offset:`45%`,style:{"stop-color":`var(--orb-b)`,"stop-opacity":`0.5`}},null,-1),T(`stop`,{offset:`100%`,style:{"stop-color":`var(--orb-b)`,"stop-opacity":`0`}},null,-1)]],8,Lt),T(`radialGradient`,{id:_.rim,cx:`50%`,cy:`50%`,r:`50%`},[...r[4]||=[T(`stop`,{offset:`72%`,style:{"stop-color":`#ffffff`,"stop-opacity":`0`}},null,-1),T(`stop`,{offset:`100%`,style:{"stop-color":`#ffffff`,"stop-opacity":`0.4`}},null,-1)]],8,Rt)]),T(`circle`,{class:`aura`,cx:`100`,cy:`112`,r:`94`,fill:`url(#${_.aura})`},null,8,zt),t.activity===`solitude`?(P(),v(`g`,Bt,[...r[5]||=[T(`circle`,{cx:`100`,cy:`112`,r:`86`},null,-1),T(`circle`,{class:`halo-soft`,cx:`100`,cy:`112`,r:`76`},null,-1)]])):E(``,!0),T(`ellipse`,{ref_key:`shadow`,ref:O,class:`shadow`,cx:`100`,cy:`186`,rx:`46`,ry:`6`},null,512),T(`g`,Vt,[T(`g`,{ref_key:`whole`,ref:ne},[T(`path`,{ref_key:`body`,ref:ee,class:`body`,d:W(de),fill:`url(#${_.fill})`},null,8,Ht),T(`path`,{ref_key:`rim`,ref:w,class:`rim`,d:W(de),fill:`url(#${_.rim})`},null,8,Ut),r[10]||=T(`ellipse`,{class:`shine`,cx:`76`,cy:`80`,rx:`17`,ry:`10`,transform:`rotate(-28 76 80)`},null,-1),r[11]||=T(`ellipse`,{class:`shine dot`,cx:`98`,cy:`68`,rx:`4`,ry:`3`},null,-1),T(`g`,{class:`face`,transform:`translate(${k.value.x} ${k.value.y})`},[oe.value?(P(),v(`g`,Gt,[T(`path`,{class:`line thin`,d:oe.value[0]},null,8,Kt),T(`path`,{class:`line thin`,d:oe.value[1]},null,8,qt)])):E(``,!0),T(`g`,{class:S([`eyes`,{blinks:W(f).has(N.value.eyes)}])},[(P(),v(c,null,I([80,120],(e,t)=>T(`g`,{key:t,class:S([`eye`,{wink:ae.value&&t===1&&W(f).has(N.value.eyes)}])},[W(f).has(N.value.eyes)?(P(),v(c,{key:0},[T(`ellipse`,{class:`ink`,cx:e+re.value.x,cy:106+re.value.y,rx:`5.4`,ry:N.value.eyes===`sad`?6:7.2},null,8,Jt),T(`circle`,{class:`glint`,cx:e+re.value.x+1.8,cy:106+re.value.y-2.6,r:`1.9`},null,8,Yt)],64)):N.value.eyes===`happy`?(P(),v(`path`,{key:1,class:`line`,d:`M${e-7} 108Q${e} 98 ${e+7} 108`},null,8,Xt)):N.value.eyes===`closed`?(P(),v(`path`,{key:2,class:`line`,d:`M${e-7} 105Q${e} 111 ${e+7} 105`},null,8,Zt)):(P(),v(`g`,Qt,[T(`path`,{class:`ink`,d:`M${e-6} 106A6 5 0 0 0 ${e+6} 106Z`},null,8,$t),T(`path`,{class:`line thin`,d:`M${e-7.5} 106L${e+7.5} 106`},null,8,en)]))],2)),64))],2),T(`g`,{class:`cheeks`,style:o({opacity:N.value.cheeks})},[...r[6]||=[T(`ellipse`,{cx:`70`,cy:`119`,rx:`9`,ry:`5.2`},null,-1),T(`ellipse`,{cx:`130`,cy:`119`,rx:`9`,ry:`5.2`},null,-1)]],4),T(`g`,tn,[N.value.mouth===`smile`?(P(),v(`path`,{key:0,class:`line`,d:`M89 124Q100 ${(124+9*ie.value).toFixed(1)} 111 124`},null,8,nn)):N.value.mouth===`small`?(P(),v(`path`,rn)):N.value.mouth===`grin`?(P(),v(`g`,an,[...r[7]||=[T(`path`,{class:`ink`,d:`M87 121Q100 140 113 121Z`},null,-1),T(`path`,{class:`tongue`,d:`M94 129.5Q100 135 106 129.5Q100 127.5 94 129.5Z`},null,-1)]])):N.value.mouth===`cat`?(P(),v(`path`,on)):N.value.mouth===`frown`?(P(),v(`path`,sn)):N.value.mouth===`wavy`?(P(),v(`path`,cn)):N.value.mouth===`yawn`?(P(),v(`ellipse`,ln)):N.value.mouth===`sleep`?(P(),v(`ellipse`,un)):N.value.mouth===`talk`?(P(),v(`ellipse`,dn)):N.value.mouth===`smirk`?(P(),v(`path`,fn)):(P(),v(`path`,pn))])],8,Wt),t.activity===`reading`?(P(),v(`g`,mn,[...r[8]||=[T(`path`,{class:`page`,d:`M100 150L72 142L72 167L100 175Z`},null,-1),T(`path`,{class:`page`,d:`M100 150L128 142L128 167L100 175Z`},null,-1),T(`path`,{class:`line thin`,d:`M100 150L100 175`},null,-1)]])):t.activity===`diary`?(P(),v(`g`,hn,[...r[9]||=[e(`<rect class="page" x="118" y="150" width="50" height="34" rx="5" transform="rotate(-8 143 167)" data-v-3fb60aa5></rect><path class="line hair" d="M126 163L156 159M127 171L150 168" data-v-3fb60aa5></path><g class="pen" transform="rotate(38 152 146)" data-v-3fb60aa5><rect x="148" y="112" width="9" height="40" rx="3.5" data-v-3fb60aa5></rect><path d="M148 152L152.5 163L157 152Z" data-v-3fb60aa5></path></g>`,3)]])):E(``,!0)],512)]),ce.value===`bright`?(P(),v(`g`,gn,[(P(),v(c,null,I(m,(e,t)=>T(`path`,{key:t,class:`sparkle`,d:je(e.x,e.y,e.r),style:o({animationDelay:e.d+`s`})},null,12,_n)),64))])):ce.value===`sweet`?(P(),v(`g`,vn,[(P(),v(c,null,I(h,(e,t)=>T(`path`,{key:t,class:`heart`,d:Me(e.x,e.y,e.s),style:o({animationDelay:e.d+`s`})},null,12,yn)),64))])):ce.value===`blue`?(P(),v(`g`,bn,[...r[12]||=[e(`<g class="cloud" data-v-3fb60aa5><circle cx="30" cy="36" r="9" data-v-3fb60aa5></circle><circle cx="42" cy="30" r="11" data-v-3fb60aa5></circle><circle cx="54" cy="36" r="8" data-v-3fb60aa5></circle><rect x="22" y="35" width="40" height="10" rx="5" data-v-3fb60aa5></rect></g><path class="drop" d="M31 50l-1.5 6" data-v-3fb60aa5></path><path class="drop" d="M42 50l-1.5 6" style="animation-delay:0.45s;" data-v-3fb60aa5></path><path class="drop" d="M53 50l-1.5 6" style="animation-delay:0.9s;" data-v-3fb60aa5></path>`,4)]])):ce.value===`stormy`?(P(),v(`g`,xn,[...r[13]||=[e(`<g class="cloud" data-v-3fb60aa5><circle cx="156" cy="34" r="9" data-v-3fb60aa5></circle><circle cx="168" cy="28" r="11" data-v-3fb60aa5></circle><circle cx="180" cy="34" r="8" data-v-3fb60aa5></circle><rect x="148" y="33" width="40" height="10" rx="5" data-v-3fb60aa5></rect></g><path class="scribble" d="M154 54q4 -5 8 0t8 0t8 0" data-v-3fb60aa5></path>`,2)]])):ce.value===`drowsy`&&t.activity===`idle`?(P(),v(`g`,Sn,[...r[14]||=[T(`text`,{class:`zz`,x:`158`,y:`58`},`z`,-1)]])):E(``,!0),ce.value===`night`||t.activity===`review`||t.activity===`night`?(P(),v(`g`,Cn,[...r[15]||=[T(`path`,{class:`moon`,d:`M40 20a18 18 0 1 0 16 28a14 14 0 1 1 -16 -28Z`},null,-1)]])):E(``,!0),t.activity===`asleep`||t.mood===`night`&&t.activity===`idle`?(P(),v(`g`,wn,[...r[16]||=[T(`text`,{class:`zz`,x:`150`,y:`64`},`z`,-1),T(`text`,{class:`zz`,x:`162`,y:`48`,style:{"animation-delay":`1s`,"font-size":`16px`}},` z `,-1),T(`text`,{class:`zz`,x:`174`,y:`30`,style:{"animation-delay":`2s`,"font-size":`20px`}},` Z `,-1)]])):E(``,!0),t.activity===`review`||t.activity===`night`?(P(),v(`g`,Tn,[...r[17]||=[T(`g`,{class:`floating-page`},[T(`rect`,{class:`page`,x:`156`,y:`92`,width:`30`,height:`38`,rx:`4`}),T(`path`,{class:`line hair`,d:`M162 103h18M162 111h18M162 119h11`})],-1)]])):E(``,!0),t.activity===`thinking`?(P(),v(`g`,En,[...r[18]||=[e(`<circle class="puff" cx="146" cy="58" r="3.5" data-v-3fb60aa5></circle><circle class="puff" cx="156" cy="45" r="5" data-v-3fb60aa5></circle><ellipse class="puff" cx="176" cy="24" rx="21" ry="14" data-v-3fb60aa5></ellipse><circle class="dot" cx="167" cy="24" r="2.6" data-v-3fb60aa5></circle><circle class="dot" cx="176" cy="24" r="2.6" style="animation-delay:0.18s;" data-v-3fb60aa5></circle><circle class="dot" cx="185" cy="24" r="2.6" style="animation-delay:0.36s;" data-v-3fb60aa5></circle>`,6)]])):E(``,!0),t.activity===`speaking`&&!F.value?(P(),v(`g`,Dn,[...r[19]||=[T(`path`,{class:`line thin`,d:`M170 94q8 9 0 18`},null,-1),T(`path`,{class:`line thin`,d:`M180 88q13 15 0 30`,style:{"animation-delay":`0.3s`}},null,-1)]])):E(``,!0)],4)),H(p,{name:`orb-say`},{default:K(()=>[se.value?(P(),v(`p`,{key:se.value,class:S([`orb-say`,`say-`+t.bubbleSide]),role:`status`},a(se.value),3)):E(``,!0)]),_:1})],46,Ft))}}),[[`__scopeId`,`data-v-3fb60aa5`]]);function kn(e,t=`Asia/Shanghai`){return e?Me(m(),{timeZone:t,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}).format(e):``}function An(e){let[,t,n]=e.split(`-`).map(Number);return t&&n?u(`{month} 月 {date} 日`,{month:t,date:n}):e}function jn(e){let t=new Date(e+`T12:00:00`);return Number.isNaN(t.getTime())?``:Me(m(),{weekday:`short`}).format(t)}function Mn(e,t=Date.now()){if(!e)return``;let n=Math.round((t-e)/6e4);if(n<1)return u(`刚刚`);if(n<60)return u(`{minutes} 分钟前`,{minutes:n});let r=Math.round(n/60);if(r<24)return u(`{hours} 小时前`,{hours:r});let i=Math.round(r/24);if(i<30)return u(`{days} 天前`,{days:i});let a=Math.round(i/30);return a<12?u(`{months} 个月前`,{months:a}):u(`{v} 年前`,{v:Math.round(a/12)})}function Nn(e){return Number(e||0).toLocaleString(m())}var Pn=/^\d{4,20}$/;function Fn(e){let t=String(e||``).split(`:`);return t[t.length-1]||``}function In(e){let t=Fn(e.id||``),n=String(e.name||``).trim(),r=n.replace(/^(群聊|私聊)\s+/,``),i=e.kind||(String(e.id||``).startsWith(`private:`)?`private`:`group`);return!n||r===t||Pn.test(r)?u(i===`private`?`未命名的人`:`未命名的群`):n}function Ln(e,t=``){let n=e.map(e=>({value:e.id,label:In(e)}));return t?[{value:``,label:t,disabled:!0},...n]:n}function Rn(e){let t=String(e||`?`).trim();return/^[\x00-\x7f]/.test(t)?t.slice(0,2).toUpperCase():t.slice(-2)}function zn(e){let t=0;for(let n of String(e))t=(t*31+n.codePointAt(0))%360;return t}var Bn=[`id`,`aria-controls`,`aria-activedescendant`,`aria-label`,`aria-expanded`,`disabled`],Vn=[`id`,`aria-labelledby`],Hn=[`id`,`tabindex`,`aria-selected`,`onClick`],Un={key:0,class:`empty`},Wn=[`id`,`name`,`value`,`disabled`],Gn=[`value`,`disabled`],Kn=z(B({__name:`Select`,props:{modelValue:{default:``},options:{},id:{default:``},name:{default:``},ariaLabel:{default:``},disabled:{type:Boolean,default:!1}},emits:[`update:modelValue`,`change`],setup(e,{emit:t}){let n=e,r=t,i=x(!1),s=x(),l=x(),f=x(),p=x(),m=oe(),h=x(0),g=x({top:0,bottom:0,left:0,width:220,maxHeight:280,upward:!1}),_=d(()=>n.options.filter(e=>!e.disabled)),y=d(()=>n.options.find(e=>String(e.value)===String(n.modelValue))?.label||_.value[0]?.label||u(`请选择`));function b(){let e=l.value?.getBoundingClientRect();if(!e)return;let t=n.options.reduce((e,t)=>Math.max(e,String(t.label||``).length),0),r=Math.min(window.innerWidth-16,Math.max(e.width,Math.min(t*15+32,420),220)),i=Math.max(8,Math.min(e.left,window.innerWidth-r-8)),a=window.innerHeight-e.bottom-6-8,o=e.top-6-8,s=a<220&&o>a;g.value={top:e.bottom+6,bottom:window.innerHeight-e.top+6,left:i,width:r,maxHeight:Math.max(96,Math.min(320,s?o:a)),upward:s}}function ee(){n.disabled||(i.value=!i.value,i.value&&b())}function te(){let e=p.value?.querySelectorAll(`[role="option"]`)[h.value];e?.focus({preventScroll:!0}),e?.scrollIntoView({block:`nearest`})}function ne(e){if(e.key===`Tab`){i.value=!1;return}if([`Escape`,`ArrowDown`,`ArrowUp`,`Home`,`End`,`Enter`,` `].includes(e.key)){if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i.value=!1,l.value?.focus();return}if(_.value.length){if(e.key===`Enter`||e.key===` `){A(_.value[h.value].value);return}h.value=e.key===`Home`?0:e.key===`End`?_.value.length-1:(h.value+(e.key===`ArrowUp`?-1:1)+_.value.length)%_.value.length,te()}}}function O(e){[`ArrowDown`,`ArrowUp`].includes(e.key)&&!i.value&&(e.preventDefault(),ee())}function A(e){let t=String(e);if(i.value=!1,!f.value){r(`update:modelValue`,t);return}f.value.value=t;let n=new Event(`change`,{bubbles:!0});f.value.dispatchEvent(n),l.value?.focus()}function j(e){s.value&&!s.value.contains(e.target)&&(i.value=!1)}function N(){i.value&&b()}function F(){document.removeEventListener(`pointerdown`,j),window.removeEventListener(`scroll`,N,!0),window.removeEventListener(`resize`,N),document.removeEventListener(`keydown`,ne,!0)}return D(i,async e=>{F(),e&&(h.value=Math.max(0,_.value.findIndex(e=>String(e.value)===String(n.modelValue))),document.addEventListener(`pointerdown`,j),window.addEventListener(`scroll`,N,!0),window.addEventListener(`resize`,N),document.addEventListener(`keydown`,ne,!0),await k(),i.value&&te())}),D(()=>n.disabled,e=>{e&&(i.value=!1)}),M(()=>{i.value=!1,F()}),ve(F),(t,n)=>(P(),v(`div`,{ref_key:`root`,ref:s,class:S([`menu-select`,{open:i.value,disabled:e.disabled}])},[T(`button`,{ref_key:`face`,ref:l,type:`button`,class:`menu-face`,id:W(m)+`-face`,role:`combobox`,"aria-haspopup":`listbox`,"aria-controls":W(m),"aria-activedescendant":i.value&&_.value.length?W(m)+`-`+h.value:void 0,"aria-label":e.ariaLabel||void 0,"aria-expanded":i.value,disabled:e.disabled,onClick:ee,onKeydown:O},[T(`span`,null,a(y.value),1),n[2]||=T(`i`,{"aria-hidden":`true`},null,-1)],40,Bn),(P(),w(ge,{to:`body`},[i.value?(P(),v(`ul`,{key:0,ref_key:`menu`,ref:p,id:W(m),class:S([`menu-list`,{up:g.value.upward}]),role:`listbox`,"aria-labelledby":W(m)+`-face`,onPointerdown:n[0]||=C(()=>{},[`stop`]),style:o({top:g.value.upward?`auto`:g.value.top+`px`,bottom:g.value.upward?g.value.bottom+`px`:`auto`,left:g.value.left+`px`,width:g.value.width+`px`,maxHeight:g.value.maxHeight+`px`})},[(P(!0),v(c,null,I(_.value,(t,n)=>(P(),v(`li`,{key:String(t.value)},[T(`button`,{type:`button`,role:`option`,id:W(m)+`-`+n,tabindex:n===h.value?0:-1,"aria-selected":String(t.value)===String(e.modelValue),onClick:e=>A(t.value)},a(t.label),9,Hn)]))),128)),_.value.length?E(``,!0):(P(),v(`li`,Un,a(W(u)(`没有可选项`)),1))],46,Vn)):E(``,!0)])),T(`select`,{ref_key:`native`,ref:f,class:`native`,id:e.id||void 0,name:e.name||void 0,value:e.modelValue,disabled:e.disabled,tabindex:`-1`,"aria-hidden":`true`,onChange:n[1]||=e=>{i.value=!1,r(`update:modelValue`,e.target.value),r(`change`,e)}},[(P(!0),v(c,null,I(e.options,e=>(P(),v(`option`,{key:`n-`+String(e.value),value:e.value,disabled:e.disabled},a(e.label),9,Gn))),128))],40,Wn)],2))}}),[[`__scopeId`,`data-v-fc4ee90c`]]),qn=[`id`],Jn={class:`preview-meta`,role:`status`},Yn=[`id`],Xn={key:1},Zn={key:2,class:`why`},Qn=[`aria-label`],$n=[`id`],er={class:`ta-chat-options`},tr={class:`where`},nr=[`disabled`],rr={class:`composer`},ir=[`placeholder`],ar=[`disabled`],or=z(B({__name:`TaChat`,props:{sessions:{default:()=>[]},nature:{default:null},anchored:{type:Boolean,default:!1},starter:{default:``}},setup(e){let t=e,n=x([]),r=x(t.starter),i=x(``),o=x(!1),s=x(``),d=x();async function f(){await k(),d.value?.scrollTo({top:d.value.scrollHeight})}async function p(){let e=r.value.trim();if(!o.value&&e){o.value=!0,n.value.push({role:`user`,text:e}),r.value=``,f();try{let r=await Te.preview({text:e,history:n.value.slice(0,-1).slice(-12).map(({role:e,text:t})=>({role:e,text:t})),...t.nature?{nature:t.nature}:{},viewSession:i.value});r.reply?n.value.push({role:`assistant`,text:r.reply,bubbles:r.bubbles?.length?r.bubbles:[r.reply],note:[Ee[r.choice]||r.choice,r.appraisal].filter(Boolean).join(` · `),why:r.reason}):n.value.push({role:`assistant`,text:u(`(TA 没有出声)`),note:Ee[r.choice]||u(`没出声`),why:r.reason}),s.value=u(`{v} · 心情{v2} · {latency} ms`,{v:r.mode===`model`?u(`真实模型`):u(`本地样例(没有模型档案)`),v2:r.mood||u(`平静`),latency:r.latency})}catch(t){n.value.pop(),r.value=e,s.value=t.message}finally{o.value=!1,f()}}}function m(){n.value=[]}return(t,f)=>(P(),v(`div`,{class:`ta-chat`,id:e.anchored?`ta-preview`:void 0},[T(`p`,Jn,a(s.value||W(u)(`试聊走真实链路:读取 TA 此刻的心智和记忆,但不写入,也不发 QQ。配置了模型时会消耗 Token。`)),1),T(`div`,{id:e.anchored?`previewMessages`:void 0,ref_key:`log`,ref:d,class:`ta-chat-log scroll-pane`},[!n.value.length&&!o.value?(P(),w(ye,{key:0,title:W(u)(`TA 会先理解,再决定说不说`),text:W(u)(`回应会显示 TA 的选择和当时的想法。`)},null,8,[`title`,`text`])):E(``,!0),(P(!0),v(c,null,I(n.value,(e,t)=>(P(),v(`article`,{key:t,class:S([`preview-bubble`,e.role===`assistant`?`bot`:`me`])},[e.bubbles?(P(!0),v(c,{key:0},I(e.bubbles,(e,t)=>(P(),v(`p`,{key:t},a(e),1))),128)):(P(),v(`p`,Xn,a(e.text),1)),e.note||e.why?(P(),v(`details`,Zn,[T(`summary`,null,a(e.note||W(u)(`为什么`)),1),T(`p`,null,a(e.why||W(u)(`没有留下理由。`)),1)])):E(``,!0)],2))),128)),o.value?(P(),v(`div`,{key:1,class:`typing`,"aria-label":W(u)(`TA 在想`)},[...f[2]||=[T(`i`,null,null,-1),T(`i`,null,null,-1),T(`i`,null,null,-1)]],8,Qn)):E(``,!0)],8,Yn),T(`form`,{id:e.anchored?`previewForm`:void 0,class:`ta-chat-form`,onSubmit:C(p,[`prevent`])},[T(`div`,er,[T(`label`,tr,[T(`span`,null,a(W(u)(`想象在这里`)),1),H(Kn,{modelValue:i.value,"onUpdate:modelValue":f[0]||=e=>i.value=e,name:`viewSession`,"aria-label":W(u)(`想象在这里`),options:[{value:``,label:W(u)(`一段新的私聊`)},...W(Ln)(e.sessions)]},null,8,[`modelValue`,`aria-label`,`options`])]),he(t.$slots,`options`,{},void 0,!0),T(`button`,{type:`button`,class:`text-button`,disabled:!n.value.length,onClick:m},a(W(u)(`清空`)),9,nr)]),T(`div`,rr,[A(T(`input`,{"onUpdate:modelValue":f[1]||=e=>r.value=e,name:`text`,placeholder:W(u)(`说一句试试…`),required:``,maxlength:`1000`,autocomplete:`off`},null,8,ir),[[l,r.value]]),T(`button`,{class:`primary`,disabled:o.value},a(o.value?W(u)(`TA 在想…`):W(u)(`说`)),9,ar)])],40,$n)],8,qn))}}),[[`__scopeId`,`data-v-235059b5`]]),sr={class:`companion`},cr=[`aria-label`],lr=[`aria-label`],ur={class:`drawer-head`},dr={class:`drawer-title`},fr={class:`chip`,"data-tone":`quiet`},pr=[`aria-label`],mr={key:0,class:`companion-dock`},hr=[`aria-expanded`],gr=z(B({__name:`TaCompanion`,props:{hideOrb:{type:Boolean}},setup(e){let t=x(),n=d(()=>Z.data?.activity?.kind||`idle`),r=d(()=>Z.data?.name||`TA`);return D(()=>V.chatOpen,async e=>{e&&(await k(),t.value?.querySelector(`input[name=text]`)?.focus())}),(i,o)=>(P(),v(`div`,sr,[H(p,{name:`scrim`},{default:K(()=>[W(V).chatOpen?(P(),v(`button`,{key:0,class:`scrim`,type:`button`,"aria-label":W(u)(`收起聊天`),onClick:o[0]||=e=>W(V).chatOpen=!1},null,8,cr)):E(``,!0)]),_:1}),H(p,{name:`drawer`},{default:K(()=>[W(V).chatOpen?(P(),v(`section`,{key:0,ref_key:`drawer`,ref:t,class:`ta-drawer`,role:`dialog`,"aria-modal":`true`,"aria-label":W(u)(`和 {name} 聊聊(试聊)`,{name:r.value}),onKeydown:o[2]||=te(e=>W(V).chatOpen=!1,[`esc`])},[T(`header`,ur,[H(On,{mood:W(Y),activity:n.value,size:42},null,8,[`mood`,`activity`]),T(`div`,dr,[T(`h2`,null,a(W(u)(`和 {name} 聊聊`,{name:r.value})),1),T(`span`,fr,a(W(u)(`试聊 · 什么都不写入`)),1)]),T(`button`,{class:`icon-button ghost`,"aria-label":W(u)(`收起聊天`),onClick:o[1]||=e=>W(V).chatOpen=!1},` ✕ `,8,pr)]),H(or,{sessions:W(V).core?.sessions||[]},null,8,[`sessions`])],40,lr)):E(``,!0)]),_:1}),!e.hideOrb&&!W(V).chatOpen?(P(),v(`div`,mr,[T(`button`,{class:`companion-talk`,"aria-expanded":W(V).chatOpen,onClick:o[3]||=e=>W(V).chatOpen=!W(V).chatOpen},a(W(V).chatOpen?W(u)(`收起`):W(u)(`聊聊`)),9,hr),H(On,{mood:W(Y),activity:n.value,size:44,interactive:``,"bubble-side":`left`,onOpenChat:o[4]||=e=>W(V).chatOpen=!0},null,8,[`mood`,`activity`])])):E(``,!0)]))}}),[[`__scopeId`,`data-v-038fa72e`]]),_r=[`aria-label`],vr=[`lang`,`aria-pressed`,`aria-label`,`title`,`data-locale`,`onClick`],yr=z(B({__name:`LocaleSwitch`,setup(e){return(e,n)=>(P(),v(`div`,{id:`locale`,class:`seg locale-switch`,role:`group`,"aria-label":W(u)(`语言`)},[(P(!0),v(c,null,I(W(t),e=>(P(),v(`button`,{key:e.code,type:`button`,lang:e.code===`zh`?`zh-CN`:`en`,class:S({active:W(h)===e.code}),"aria-pressed":W(h)===e.code,"aria-label":e.label,title:e.label,"data-locale":e.code,onClick:t=>W(s)(e.code)},a(e.short),11,vr))),128))],8,_r))}}),[[`__scopeId`,`data-v-bc942b38`]]),br=[`aria-expanded`,`title`],xr=[`data-mood`],Sr={class:`rail-label`},Cr=[`aria-label`],wr=[`aria-checked`],Tr=[`data-mood`],Er=[`data-theme-choice`,`aria-checked`,`onClick`],Dr=[`data-mood`],Or=z(B({__name:`ThemePicker`,props:{inline:{type:Boolean,default:!1}},setup(e){let t=x(!1),n=x();function r(e){Ke(e),t.value=!1}function i(e){t.value&&n.value&&!n.value.contains(e.target)&&!e.target.closest(`.theme-menu`)&&(t.value=!1)}return ue(()=>document.addEventListener(`pointerdown`,i)),ve(()=>document.removeEventListener(`pointerdown`,i)),(i,o)=>(P(),v(`div`,{ref_key:`root`,ref:n,class:S([`theme-picker`,{inline:e.inline}]),onKeydown:o[2]||=te(e=>t.value=!1,[`esc`])},[e.inline?E(``,!0):(P(),v(`button`,{key:0,class:`theme-toggle`,type:`button`,"aria-expanded":t.value,"aria-haspopup":`true`,title:W(J).pinned?W(u)(`主题固定为「{v}」`,{v:W(q)[W(J).pinned].label}):W(u)(`主题跟随 TA 的心情`),onClick:o[0]||=e=>t.value=!t.value},[T(`span`,{class:`swatch`,"data-mood":W(J).pinned??W(Y),"aria-hidden":`true`},null,8,xr),T(`span`,Sr,a(W(J).pinned?W(u)(`固定:{v}`,{v:W(q)[W(J).pinned].label}):W(u)(`跟随 TA · {v}`,{v:W(q)[W(Y)].label})),1)],8,br)),(P(),w(ge,{to:`body`,disabled:e.inline},[H(p,{name:`pop`},{default:K(()=>[t.value||e.inline?(P(),v(`div`,{key:0,class:S([`theme-menu`,{"inline-menu":e.inline}]),role:`radiogroup`,"aria-label":W(u)(`界面主题`)},[T(`button`,{type:`button`,role:`radio`,"data-theme-choice":`auto`,"aria-checked":!W(J).pinned,onClick:o[1]||=e=>r(null)},[T(`span`,{class:`swatch auto`,"data-mood":W(Y),"aria-hidden":`true`},null,8,Tr),T(`span`,null,[T(`b`,null,a(W(u)(`跟随 TA 的心情`)),1),T(`small`,null,a(W(u)(`现在是「{v}」`,{v:W(q)[W(Y)].label})),1)])],8,wr),(P(!0),v(c,null,I(W(Ne),e=>(P(),v(`button`,{key:e,type:`button`,role:`radio`,"data-theme-choice":e,"aria-checked":W(J).pinned===e,onClick:t=>r(e)},[T(`span`,{class:`swatch`,"data-mood":e,"aria-hidden":`true`},null,8,Dr),T(`span`,null,[T(`b`,null,a(W(q)[e].label),1),T(`small`,null,a(W(q)[e].feel),1)])],8,Er))),128))],10,Cr)):E(``,!0)]),_:1})],8,[`disabled`]))],34))}}),[[`__scopeId`,`data-v-4e5670d2`]]),kr=[`aria-label`],Ar={class:`presence-detail`},jr={class:`eyebrow`},Mr={class:`mood-word`},Nr={class:`lede`},Pr={class:`row chips`},Fr=[`data-activity`],Ir={key:0,class:`chip`,"data-tone":`quiet`},Lr={key:1,class:`chip`,"data-tone":`quiet`},Rr={key:2,class:`chip`,"data-tone":`quiet`},zr={class:`row actions`},Br=[`disabled`],Vr=[`disabled`],Hr={class:`faint`},Ur={key:0,class:`aside-bit`},Wr={class:`eyebrow`},Gr={key:1,class:`aside-bit`},Kr={class:`eyebrow`},qr={key:0},Jr={key:2,class:`aside-bit`},Yr={class:`eyebrow`},Xr={key:0},Zr=z(B({__name:`NowStatusDock`,setup(e){let t=d(()=>Z.data),n=x(!1),r=d(()=>Z.data),i=d(()=>r.value?.affect||t.value?.affect||{}),o=d(()=>r.value?.activity?.kind||`idle`),s=d(()=>r.value?.expecting?.[0]||null),l=d(()=>n.value||!!t.value?.busy||[`solitude`,`diary`,`review`,`night`].includes(o.value));async function f(e){n.value=!0;try{let t=await Te[e]();U(t.reason||u(`完成了`),t.status===`error`)}catch(e){U(e.message,!0)}finally{n.value=!1,await Ze()}}return(e,n)=>(P(),v(`aside`,{class:`presence-dock`,"aria-label":W(u)(`TA 的此刻状态`)},[T(`div`,Ar,[T(`span`,jr,[F(a(W(u)(`第 {v} 天`,{v:r.value?.dayOfLife??t.value?.dayOfLife??1}))+` `,1),r.value?.clock?(P(),v(c,{key:0},[F(` · `+a(r.value.clock.period)+` `+a(r.value.clock.local.slice(11)),1)],64)):E(``,!0)]),T(`h2`,Mr,a(i.value.mood||W(u)(`平静`)),1),T(`p`,Nr,a(W(xt)(i.value)||W(u)(`没有特别牵动 TA 的事,心情慢慢回到平常。`)),1),T(`div`,Pr,[T(`span`,{class:`chip activity-chip`,"data-activity":o.value},a(W(Ct)(r.value)),9,Fr),W(St)(i.value)?(P(),v(`span`,Ir,a(W(u)(`这阵子 · {v}`,{v:W(St)(i.value)})),1)):E(``,!0),i.value.energyLabel?(P(),v(`span`,Lr,a(W(u)(`精力 · {energyLabel}`,{energyLabel:i.value.energyLabel})),1)):E(``,!0),t.value?.nature?.rhythm?.enabled?(P(),v(`span`,Rr,a(W(u)(`{wake} 醒 / {sleep} 睡`,{wake:t.value.nature.rhythm.wake,sleep:t.value.nature.rhythm.sleep})),1)):E(``,!0)]),T(`div`,zr,[r.value?.currentLife?.current?(P(),v(`button`,{key:0,class:`text-button`,onClick:n[0]||=e=>W(L)(`time`)},a(W(u)(`看看进度`)),1)):E(``,!0),T(`button`,{class:`primary`,onClick:n[1]||=e=>W(V).chatOpen=!0},a(W(u)(`和 TA 聊聊`)),1),T(`button`,{disabled:l.value,onClick:n[2]||=e=>f(`reflect`)},a(l.value?W(u)(`TA 正在想…`):W(u)(`让 TA 独处一会儿`)),9,Br),T(`button`,{disabled:l.value,onClick:n[3]||=e=>f(`review`)},a(W(u)(`写下今天的日记`)),9,Vr)]),T(`small`,Hr,a(t.value?.reason||W(u)(`安静下来时,TA 会自己独处。`)),1),r.value?.lastWords?(P(),v(`div`,Ur,[T(`span`,Wr,a(W(u)(`最近说`)),1),T(`p`,null,`“`+a(r.value.lastWords.text)+`”`,1),T(`small`,null,a(W(In)({name:r.value.lastWords.sessionName,id:r.value.lastWords.session}))+` · `+a(W(Mn)(r.value.lastWords.time,r.value.now)),1)])):E(``,!0),r.value?.thought?(P(),v(`div`,Gr,[T(`span`,Kr,a(W(u)(`放在心上`)),1),T(`p`,null,a(r.value.thought.content),1),r.value.thought.when?(P(),v(`small`,qr,a(r.value.thought.when),1)):E(``,!0)])):E(``,!0),s.value?(P(),v(`div`,Jr,[T(`span`,Yr,a(W(u)(`在等`)),1),T(`p`,null,a(s.value.name?`${s.value.name}:`:``)+a(s.value.content),1),s.value.when?(P(),v(`small`,Xr,a(s.value.when),1)):E(``,!0)])):E(``,!0)])],8,kr))}}),[[`__scopeId`,`data-v-4625711b`]]),Qr=[`onKeydown`],$r=[`aria-label`],ei={key:0},ti=[`type`,`placeholder`,`autocomplete`],ni={class:`row end`},ri=z(B({__name:`Confirm`,setup(e){let t=d(()=>g.queue[0]||null),r=x(``),i=x(),o=x(),s=null;D(t,async(e,t)=>{if(e&&!t&&(s=document.activeElement),!e){s?.focus?.(),s=null;return}r.value=e.value,await k(),e.kind===`prompt`?i.value?.focus():o.value?.focus()});function c(){t.value&&ce(t.value.kind===`prompt`?r.value.trim():`ok`)}function l(){ce(null)}return(e,s)=>(P(),w(ge,{to:`body`},[H(p,{name:`dialog`},{default:K(()=>[t.value?(P(),v(`div`,{key:0,class:`dialog-layer`,onKeydown:te(C(l,[`prevent`]),[`esc`])},[T(`form`,{class:`dialog`,role:`alertdialog`,"aria-modal":`true`,"aria-label":t.value.title,onSubmit:C(c,[`prevent`])},[s[1]||=T(`span`,{class:`dialog-orb`,"aria-hidden":`true`},null,-1),T(`h2`,null,a(t.value.title),1),t.value.message?(P(),v(`p`,ei,a(t.value.message),1)):E(``,!0),t.value.kind===`prompt`?A((P(),v(`input`,{key:1,ref_key:`input`,ref:i,"onUpdate:modelValue":s[0]||=e=>r.value=e,type:t.value.secret?`password`:`text`,placeholder:t.value.placeholder,autocomplete:t.value.secret?`current-password`:`off`},null,8,ti)),[[n,r.value]]):E(``,!0),T(`div`,ni,[T(`button`,{type:`button`,class:`dialog-cancel ghost`,onClick:l},a(t.value.cancelText),1),T(`button`,{ref_key:`confirmButton`,ref:o,type:`submit`,class:S([`dialog-confirm`,t.value.danger?`danger`:`primary`])},a(t.value.confirmText),3)])],40,$r)],40,Qr)):E(``,!0)]),_:1})]))}}),[[`__scopeId`,`data-v-2339e49c`]]),ii={class:`icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`},ai={key:6,d:`M4.5 19.5h15M6 19.5V6.5h3v13M10.5 19.5V4.5h3v15M15.2 19.2l-.6-11.8 2.9-.4 1.2 11.8`},oi={key:14,d:`M12 5.5v13M5.5 12h13`},si={key:15,d:`M14.5 6 8.5 12l6 6`},ci={key:19,cx:`12`,cy:`12`,r:`7`},li=z(B({__name:`Icon`,props:{name:{}},setup(t){return(n,r)=>(P(),v(`svg`,ii,[t.name===`now`?(P(),v(c,{key:0},[r[0]||=T(`path`,{d:`M12 4.5c4.2 0 7 2.9 7 7.2 0 4.6-3 7.8-7 7.8s-7-3.2-7-7.8c0-4.3 2.8-7.2 7-7.2Z`},null,-1),r[1]||=T(`path`,{d:`M9.4 11.4v.6M14.6 11.4v.6M10 15c1.2.9 2.8.9 4 0`},null,-1)],64)):t.name===`time`?(P(),v(c,{key:1},[r[2]||=T(`circle`,{cx:`12`,cy:`12`,r:`8`},null,-1),r[3]||=T(`path`,{d:`M12 7v5l3 2`},null,-1)],64)):t.name===`chats`?(P(),v(c,{key:2},[r[4]||=T(`path`,{d:`M4.5 6.5a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H11l-4 3.5v-3.5h-.5a2 2 0 0 1-2-2v-7Z`},null,-1),r[5]||=T(`path`,{d:`M8.5 10h.01M12 10h.01M15.5 10h.01`},null,-1)],64)):t.name===`heart`?(P(),v(c,{key:3},[r[6]||=T(`path`,{d:`M12 3.5l1.6 4.4 4.6.2-3.6 2.9 1.3 4.5L12 12.9l-3.9 2.6 1.3-4.5-3.6-2.9 4.6-.2L12 3.5Z`},null,-1),r[7]||=T(`path`,{d:`M5 19.5h.01M19 18.5h.01M18.5 4.5h.01`},null,-1)],64)):t.name===`people`?(P(),v(c,{key:4},[r[8]||=e(`<circle cx="12" cy="12" r="2.6" data-v-69e2db74></circle><circle cx="5.2" cy="7.2" r="1.7" data-v-69e2db74></circle><circle cx="18.6" cy="8.4" r="1.4" data-v-69e2db74></circle><circle cx="16.8" cy="18" r="1.9" data-v-69e2db74></circle><path d="M6.6 8.4l3.3 2.1M17.3 9.1l-3 1.7M15.6 16.4l-1.7-2.3" data-v-69e2db74></path>`,5)],64)):t.name===`life`?(P(),v(c,{key:5},[r[9]||=T(`path`,{d:`M12 6.5c-2-1.4-4.6-1.8-7.5-1.5v12.6c2.9-.3 5.5.1 7.5 1.5 2-1.4 4.6-1.8 7.5-1.5V5c-2.9-.3-5.5.1-7.5 1.5Z`},null,-1),r[10]||=T(`path`,{d:`M12 6.5v12.6`},null,-1)],64)):t.name===`memory`?(P(),v(`path`,ai)):t.name===`nature`?(P(),v(c,{key:7},[r[11]||=T(`path`,{d:`M12 20v-7.5`},null,-1),r[12]||=T(`path`,{d:`M12 12.5c0-4 2.6-6.8 6.8-7-.1 4.2-2.8 7-6.8 7Z`},null,-1),r[13]||=T(`path`,{d:`M12 14.5c0-3-2-5.1-5.3-5.2.1 3.1 2.2 5.2 5.3 5.2Z`},null,-1)],64)):t.name===`system`?(P(),v(c,{key:8},[r[14]||=T(`circle`,{cx:`12`,cy:`12`,r:`3`},null,-1),r[15]||=T(`path`,{d:`M12 3.5v2.3M12 18.2v2.3M20.5 12h-2.3M5.8 12H3.5M18 6l-1.6 1.6M7.6 16.4 6 18M18 18l-1.6-1.6M7.6 7.6 6 6`},null,-1)],64)):t.name===`more`?(P(),v(c,{key:9},[r[16]||=T(`circle`,{cx:`6`,cy:`12`,r:`1.3`},null,-1),r[17]||=T(`circle`,{cx:`12`,cy:`12`,r:`1.3`},null,-1),r[18]||=T(`circle`,{cx:`18`,cy:`12`,r:`1.3`},null,-1)],64)):t.name===`refresh`?(P(),v(c,{key:10},[r[19]||=T(`path`,{d:`M19 12a7 7 0 1 1-2.1-5`},null,-1),r[20]||=T(`path`,{d:`M19 4.5V9h-4.5`},null,-1)],64)):t.name===`send`?(P(),v(c,{key:11},[r[21]||=T(`path`,{d:`M4.5 11.8 19.5 5l-4.8 14.5-3.2-6.2-7-1.5Z`},null,-1),r[22]||=T(`path`,{d:`m11.5 13.3 3.4-3.6`},null,-1)],64)):t.name===`palette`?(P(),v(c,{key:12},[r[23]||=T(`path`,{d:`M12 4a8 8 0 1 0 0 16c1.2 0 1.8-.8 1.8-1.6 0-1.3-1.3-1.6-1.3-2.7 0-.9.7-1.5 1.7-1.5H16a4 4 0 0 0 4-4C20 6.9 16.4 4 12 4Z`},null,-1),r[24]||=T(`path`,{d:`M8 11h.01M10 7.8h.01M14 7.8h.01M16.2 11h.01`},null,-1)],64)):t.name===`search`?(P(),v(c,{key:13},[r[25]||=T(`circle`,{cx:`11`,cy:`11`,r:`6`},null,-1),r[26]||=T(`path`,{d:`m20 20-4.5-4.5`},null,-1)],64)):t.name===`plus`?(P(),v(`path`,oi)):t.name===`back`?(P(),v(`path`,si)):t.name===`motion`?(P(),v(c,{key:16},[r[27]||=T(`path`,{d:`M4 14c2.5-4 5.5-4 8 0s5.5 4 8 0`},null,-1),r[28]||=T(`path`,{d:`M4 9c2.5-4 5.5-4 8 0s5.5 4 8 0`},null,-1)],64)):t.name===`plugins`?(P(),v(c,{key:17},[r[29]||=T(`path`,{d:`M8 7h8v4H8zM6 11h12v6H6z`},null,-1),r[30]||=T(`path`,{d:`M9 11V7M15 11V7M12 14v3`},null,-1)],64)):t.name===`guide`?(P(),v(c,{key:18},[r[31]||=T(`circle`,{cx:`12`,cy:`12`,r:`8`},null,-1),r[32]||=T(`path`,{d:`M9.8 9.6a2.3 2.3 0 1 1 3.3 2.1c-.7.3-1.1.9-1.1 1.6v.3M12 16.5h.01`},null,-1)],64)):(P(),v(`circle`,ci))]))}}),[[`__scopeId`,`data-v-69e2db74`]]),ui=[`aria-label`],di={class:`sheet-head`},fi={key:0,class:`eyebrow`},pi=[`aria-label`],mi={class:`sheet-body`},hi=z(B({__name:`Sheet`,props:{open:{type:Boolean},title:{},eyebrow:{default:``},width:{default:`520px`}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=x(),s=x(!0),c=d(()=>n.open&&s.value);me(()=>{s.value=!0}),M(()=>{s.value=!1});let l=null;function f(e){e.key===`Escape`&&r(`close`)}return D(c,async e=>{e?(l=document.activeElement,document.addEventListener(`keydown`,f),await k(),i.value?.focus()):(document.removeEventListener(`keydown`,f),l?.focus?.())},{immediate:!0}),ve(()=>document.removeEventListener(`keydown`,f)),(t,n)=>(P(),w(ge,{to:`body`},[H(p,{name:`sheet`},{default:K(()=>[c.value?(P(),v(`div`,{key:0,class:`sheet-layer`,onClick:n[1]||=C(e=>r(`close`),[`self`])},[T(`aside`,{ref_key:`panel`,ref:i,class:`sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":e.title,tabindex:`-1`,style:o({"--sheet-w":e.width})},[T(`header`,di,[T(`div`,null,[e.eyebrow?(P(),v(`span`,fi,a(e.eyebrow),1)):E(``,!0),T(`h2`,null,a(e.title),1)]),T(`button`,{class:`icon-button ghost sheet-close`,"aria-label":W(u)(`关闭`),onClick:n[0]||=e=>r(`close`)},` ✕ `,8,pi)]),T(`div`,mi,[he(t.$slots,`default`,{},void 0,!0)])],12,ui)])):E(``,!0)]),_:3})]))}}),[[`__scopeId`,`data-v-2c804a0d`]]);function gi(e,t){let n=!1,r=!1,i=!1,a=d(()=>V.page===e),o=()=>{if(a.value){if(r){i=!0;return}r=!0,t().catch(e=>U(e.message,!0)).finally(()=>{r=!1,i&&(i=!1,o())})}};return ue(o),me(()=>{n&&o(),n=!0}),D(()=>[V.tick,V.pulse],o),a}var _i={class:`card`},vi={key:0,class:`card-head`},yi={key:0,class:`eyebrow`},bi={key:1},xi={key:2},Si={key:0,class:`row`},Ci=z(B({__name:`Card`,props:{title:{},eyebrow:{},sub:{}},setup(e){return(t,n)=>(P(),v(`section`,_i,[e.title||e.eyebrow||t.$slots.actions?(P(),v(`header`,vi,[T(`div`,null,[e.eyebrow?(P(),v(`span`,yi,a(e.eyebrow),1)):E(``,!0),e.title?(P(),v(`h2`,bi,a(e.title),1)):E(``,!0),e.sub?(P(),v(`p`,xi,a(e.sub),1)):E(``,!0)]),t.$slots.actions?(P(),v(`div`,Si,[he(t.$slots,`actions`,{},void 0,!0)])):E(``,!0)])):E(``,!0),he(t.$slots,`default`,{},void 0,!0)]))}}),[[`__scopeId`,`data-v-2c88637b`]]),wi={class:`meter-row`},Ti={class:`meter-label`},Ei=[`aria-label`,`aria-valuenow`],Di={class:`meter-value`},Oi=z(B({__name:`Meter`,props:{label:{},value:{},text:{},warn:{type:Boolean}},setup(e){let t=e,n=d(()=>Math.round(Math.max(0,Math.min(1,Number(t.value)||0))*100));return(t,r)=>(P(),v(`div`,wi,[T(`span`,Ti,a(e.label),1),T(`div`,{class:S([`meter`,{warn:e.warn}]),role:`meter`,"aria-label":e.label,"aria-valuemin":`0`,"aria-valuemax":`100`,"aria-valuenow":n.value},[T(`i`,{style:o({width:n.value+`%`})},null,4)],10,Ei),T(`b`,Di,a(e.text??n.value+`%`),1)]))}}),[[`__scopeId`,`data-v-4f51518c`]]),ki=[`aria-label`],Ai=[`data-tab`,`aria-selected`,`tabindex`,`onClick`],ji={key:0,class:`count`},Mi=z(B({__name:`Tabs`,props:se({items:{},label:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=ie(e,`modelValue`);function n(e,n){let r=n.findIndex(e=>e.key===t.value),i=e.key===`ArrowRight`?1:e.key===`ArrowLeft`?-1:0;if(!i)return;e.preventDefault();let a=n[(r+i+n.length)%n.length];t.value=a.key;let o=e.currentTarget.closest(`[role="tablist"]`);requestAnimationFrame(()=>o?.querySelector(`[data-tab="${a.key}"]`)?.focus())}return(r,i)=>(P(),v(`div`,{class:`seg tabs`,role:`tablist`,"aria-label":e.label},[(P(!0),v(c,null,I(e.items,r=>(P(),v(`button`,{key:r.key,type:`button`,role:`tab`,"data-tab":r.key,"aria-selected":t.value===r.key,tabindex:t.value===r.key?0:-1,onClick:e=>t.value=r.key,onKeydown:i[0]||=t=>n(t,e.items)},[F(a(r.label),1),r.count!==void 0&&r.count!==``?(P(),v(`small`,ji,a(r.count),1)):E(``,!0)],40,Ai))),128))],8,ki))}}),[[`__scopeId`,`data-v-e8e03a3b`]]),Ni=[`aria-label`],Pi=[`data-tone`],Fi={class:`entry`},Ii=z(B({__name:`Timeline`,props:{items:{},label:{}},setup(e){return(t,n)=>(P(),v(`ol`,{class:`timeline`,"aria-label":e.label},[(P(!0),v(c,null,I(e.items,(e,r)=>(P(),v(`li`,{key:e.id??r,"data-tone":e.tone||void 0},[n[0]||=T(`span`,{class:`stem`,"aria-hidden":`true`},[T(`i`)],-1),T(`div`,Fi,[he(t.$slots,`default`,{item:e,index:r},void 0,!0)])],8,Pi))),128))],8,Ni))}}),[[`__scopeId`,`data-v-e79d18a9`]]),Li=[`aria-label`],Ri={class:`choice`},zi={class:`row`},Bi=[`disabled`],Vi=[`disabled`],Hi={class:`choice`},Ui={class:`row`},Wi=[`disabled`],Gi=[`disabled`],Ki={key:0,class:`opacity`},qi=[`value`,`aria-label`],Ji=z(B({__name:`WallpaperPicker`,props:{open:{type:Boolean}},emits:[`close`],setup(e,{emit:t}){let n=t,r=x(),i=x(),o=x(``);async function s(e,t){let n=t.target,r=n.files?.[0];if(n.value=``,r){o.value=e;try{e===`hero`?await ht(r):await _t(r),U(u(e===`hero`?`中间这张已换上`:`后面的壁纸已换上`))}catch(e){U(e.message,!0)}finally{o.value=``}}}async function c(e){o.value=e;try{e===`hero`?await gt():await vt(),U(u(`已恢复原来的壁纸`))}catch(e){U(e.message,!0)}finally{o.value=``}}return(t,l)=>e.open?(P(),v(`section`,{key:0,class:`wallpaper-picker`,"aria-label":W(u)(`换壁纸`)},[T(`header`,null,[T(`b`,null,a(W(u)(`换壁纸`)),1),T(`button`,{type:`button`,class:`text-button`,onClick:l[0]||=e=>n(`close`)},a(W(u)(`收起`)),1)]),T(`div`,Ri,[T(`span`,null,a(W(u)(`中间这张`)),1),T(`div`,zi,[T(`button`,{type:`button`,disabled:!!o.value,onClick:l[1]||=e=>r.value?.click()},a(o.value===`hero`?W(u)(`处理中…`):W(u)(`选择图片`)),9,Bi),T(`button`,{type:`button`,disabled:!!o.value,onClick:l[2]||=e=>c(`hero`)},a(W(u)(`恢复默认`)),9,Vi)])]),T(`div`,Hi,[T(`span`,null,a(W(u)(`后面的大壁纸`)),1),T(`div`,Ui,[T(`button`,{type:`button`,disabled:!!o.value,onClick:l[3]||=e=>i.value?.click()},a(o.value===`sky`?W(u)(`处理中…`):W(u)(`选择图片`)),9,Wi),T(`button`,{type:`button`,disabled:!!o.value,onClick:l[4]||=e=>c(`sky`)},a(W(u)(`恢复默认`)),9,Gi)]),W(Q).sky?(P(),v(`label`,Ki,[T(`span`,null,a(W(u)(`透明度 {v}%`,{v:Math.round(W(Q).skyOpacity*100)})),1),T(`input`,{type:`range`,min:`0.08`,max:`0.82`,step:`0.02`,value:W(Q).skyOpacity,"aria-label":W(u)(`后面壁纸的透明度`),onInput:l[5]||=e=>W(yt)(Number(e.target.value))},null,40,qi),T(`small`,null,a(W(u)(`越透明,心情的颜色越清楚。`)),1)])):E(``,!0)]),T(`input`,{ref_key:`heroInput`,ref:r,"data-wallpaper":`hero`,type:`file`,accept:`image/*`,hidden:``,onChange:l[6]||=e=>s(`hero`,e)},null,544),T(`input`,{ref_key:`skyInput`,ref:i,"data-wallpaper":`sky`,type:`file`,accept:`image/*`,hidden:``,onChange:l[7]||=e=>s(`sky`,e)},null,544)],8,Li)):E(``,!0)}}),[[`__scopeId`,`data-v-01d9dcb6`]]),Yi=`luckytri-home-wallpaper-position-v3`;function Xi(e,t){try{let n=JSON.parse(localStorage.getItem(e)||`null`);return!n||!Number.isFinite(n.x)||!Number.isFinite(n.y)?null:{x:Math.min(t.x[1],Math.max(t.x[0],n.x)),y:Math.min(t.y[1],Math.max(t.y[0],n.y))}}catch{return null}}function Zi(e,t,n){try{return localStorage.setItem(e,JSON.stringify(t)),!0}catch{return U(n,!0),!1}}function Qi(){let e=x(!1),t=x(null),n=x(null),r=x(Xi(Yi,{x:[0,100],y:[0,100]})||{x:50,y:50}),i=d(()=>({objectPosition:`${r.value.x}% ${r.value.y}%`})),a=x(null);function o(e){let t=e.currentTarget,i=n.value;if(!i?.naturalWidth||!i.naturalHeight)return;let o=t.getBoundingClientRect(),s=Math.max(o.width/i.naturalWidth,o.height/i.naturalHeight);a.value={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,startPositionX:r.value.x,startPositionY:r.value.y,overflowX:Math.max(0,i.naturalWidth*s-o.width),overflowY:Math.max(0,i.naturalHeight*s-o.height)},t.setPointerCapture(e.pointerId)}function s(e){let t=a.value;t&&t.pointerId===e.pointerId&&(t.overflowX>0&&(r.value.x=Math.min(100,Math.max(0,t.startPositionX-(e.clientX-t.startX)/t.overflowX*100))),t.overflowY>0&&(r.value.y=Math.min(100,Math.max(0,t.startPositionY-(e.clientY-t.startY)/t.overflowY*100))))}function c(e){a.value?.pointerId===e.pointerId&&(a.value=null)}function l(){r.value={x:50,y:50}}function f(){Zi(Yi,r.value,u(`浏览器没有保存这次构图`))&&(e.value=!1,a.value=null,U(u(`首页壁纸构图已记住`)))}return{adjusting:e,heroRef:t,imageRef:n,pictureStyle:i,beginPictureDrag:o,movePicture:s,endPictureDrag:c,resetPicture:l,finishPicture:f}}var $i={class:`page now`},ea={class:`now-presentation`},ta={class:`wallpaper-layer`,"aria-hidden":`true`},na=[`src`],ra=[`aria-label`],ia={class:`wallpaper-tip`},aa={class:`wallpaper-controls`},oa={class:`wallpaper-tip-inline`},sa={class:`notes`},ca={class:`note words`},la={class:`eyebrow`},ua={key:0,class:`recent-list`},da={class:`quote`},fa={key:1,class:`muted`},pa={class:`note thought`},ma={class:`eyebrow`},ha={key:1,class:`muted`},ga={key:2,class:`will-line`},_a={key:3},va={key:4,class:`muted`},ya={key:5},ba={class:`note ahead`},xa={class:`eyebrow`},Sa={key:0,class:`list`},Ca={key:1,class:`muted`},wa={class:`now-grid`},Ta={class:`today-scroll scroll-pane`},Ea={class:`entry-head`},Da={key:0},Oa={key:1},ka={key:2},Aa={key:3},ja={key:4},Ma={key:5,class:`chip`,"data-tone":`quiet`},Na={key:6,class:`chip`,"data-tone":`quiet`},Pa={key:0},Fa={key:0},Ia={key:1,class:`muted`},La={key:2},Ra={key:3,class:`muted`},za={key:4},Ba={key:0},Va={class:`stack side`},Ha={class:`stack tight`},Ua={class:`faint ledger-note`},Wa={key:0,class:`list`},Ga={class:`grow`},Ka=[`data-tone`],qa={key:1,class:`muted small-text`},Ja={class:`counts`},Ya=z(B({__name:`NowPage`,setup(e){let t=i(ne(`/mind`)||null),n=i(ne(`/mind/today`)||null),r=x(`all`),s=x(!1),{adjusting:l,heroRef:f,imageRef:p,pictureStyle:m,beginPictureDrag:h,movePicture:g,endPictureDrag:y,resetPicture:b,finishPicture:ee}=Qi(),te=_([{id:`conversation`,label:R(`对话`)},{id:`inner`,label:R(`独处与日记`)},{id:`upkeep`,label:R(`整理记忆`)}]),D=d(()=>Z.data),O=d(()=>{let e=D.value?.recentWords?.filter(e=>e.text?.trim())||[];return e.length?e.slice(0,3):D.value?.lastWords?[D.value.lastWords]:[]}),k=d(()=>D.value?.clock?.timeZone||t.value?.clock?.timeZone||`Asia/Shanghai`),A=d(()=>{let e=n.value?.items||[],t=[];for(let[n,i]of e.entries()){let e=i.type===`choice`||i.type===`glance`?`talk`:i.type===`feeling`?`feel`:`inner`;if(r.value!==`all`&&r.value!==e)continue;let a=t[t.length-1];if(i.type===`glance`&&a?.type===`glance`){a.count+=1;let e=In({name:i.sessionName,id:i.session});a.places.includes(e)||a.places.push(e);continue}t.push({...i,id:`${i.type}-${i.time}-${n}`,tone:i.type===`glance`||i.type===`choice`&&i.choice===`silent`?`quiet`:i.type===`feeling`?i.valence>=0?`warm`:`night`:i.type===`run`?`night`:`glow`,count:1,places:i.type===`glance`?[In({name:i.sessionName,id:i.session})]:[]})}return t}),j=d(()=>{let e=n.value?.items||[];return{all:e.length,talk:e.filter(e=>e.type===`choice`||e.type===`glance`).length,feel:e.filter(e=>e.type===`feeling`).length,inner:e.filter(e=>e.type===`run`||e.type===`ahead`).length}}),M=d(()=>t.value?.budget?.usage||{}),N=d(()=>t.value?.budget?.limits||{}),re=d(()=>(D.value?.expecting||[]).filter(e=>e.content?.trim()).slice(0,5));function ie(e){let t=N.value[e];return t?(M.value[e]||0)/t:M.value.total?(M.value[e]||0)/M.value.total:0}let ae=0;async function oe(){let e=++ae,[r,i]=await Promise.all([Te.overview(),Te.today()]);e===ae&&(t.value=r,n.value=i)}return gi(`now`,oe),(e,i)=>(P(),v(`div`,$i,[T(`div`,ea,[T(`section`,{ref_key:`heroRef`,ref:f,class:S([`now-hero`,{"wallpaper-adjusting":W(l)}])},[T(`div`,ta,[T(`img`,{ref_key:`imageRef`,ref:p,src:W(Q).hero,style:o(W(m)),alt:``,draggable:`false`},null,12,na)]),W(l)?(P(),v(`div`,{key:0,class:`wallpaper-drag-layer`,role:`application`,"aria-label":W(u)(`拖动调整首页壁纸构图`),onPointerdown:i[0]||=C((...e)=>W(h)&&W(h)(...e),[`prevent`]),onPointermove:i[1]||=C((...e)=>W(g)&&W(g)(...e),[`prevent`]),onPointerup:i[2]||=(...e)=>W(y)&&W(y)(...e),onPointercancel:i[3]||=(...e)=>W(y)&&W(y)(...e),onLostpointercapture:i[4]||=(...e)=>W(y)&&W(y)(...e)},[T(`span`,ia,a(W(u)(`按住并拖动图片,调整人物位置`)),1)],40,ra)):E(``,!0),T(`div`,aa,[W(l)?(P(),v(c,{key:0},[T(`span`,oa,a(W(u)(`拖动背景调整构图`)),1),T(`button`,{type:`button`,onClick:i[5]||=(...e)=>W(b)&&W(b)(...e)},a(W(u)(`恢复默认`)),1),T(`button`,{type:`button`,class:`primary`,onClick:i[6]||=(...e)=>W(ee)&&W(ee)(...e)},a(W(u)(`完成`)),1)],64)):(P(),v(`button`,{key:1,type:`button`,onClick:i[7]||=e=>l.value=!0},a(W(u)(`调整构图`)),1)),W(l)?E(``,!0):(P(),v(`button`,{key:2,type:`button`,onClick:i[8]||=e=>s.value=!s.value},a(W(u)(`换壁纸`)),1))]),H(Ji,{open:s.value&&!W(l),onClose:i[9]||=e=>s.value=!1},null,8,[`open`])],2)]),T(`section`,sa,[T(`article`,ca,[T(`span`,la,a(W(u)(`TA 最近说`)),1),O.value.length?(P(),v(`ul`,ua,[(P(!0),v(c,null,I(O.value,(e,t)=>(P(),v(`li`,{key:`${e.time}-${t}`},[T(`p`,da,`“`+a(e.text)+`”`,1),T(`small`,null,a(W(In)({name:e.sessionName,id:e.session}))+` · `+a(W(Mn)(e.time,D.value?.now)),1)]))),128))])):(P(),v(`p`,fa,a(W(u)(`TA 还没在哪里开过口。`)),1))]),T(`article`,pa,[T(`span`,ma,a(W(u)(`放在心上`)),1),D.value?.thought?(P(),v(c,{key:0},[T(`p`,null,a(D.value.thought.content),1),T(`small`,null,a(D.value.thought.when),1)],64)):(P(),v(`p`,ha,a(W(u)(`心里暂时没有挂着的事。`)),1)),D.value?.will?(P(),v(`p`,ga,a(W(u)(`正在为自己而活:{content}`,{content:D.value.will.content})),1)):E(``,!0),D.value?.will?.touched?(P(),v(`small`,_a,a(W(u)(`被别人的话碰到过 {touched} 次,上次{v}`,{touched:D.value.will.touched,v:D.value.will.lastSpoke?W(u)(`出了声`):W(u)(`没出声`)})),1)):E(``,!0),D.value?.meaning?(P(),v(`p`,va,[F(a(W(u)(`上次相遇:{text}`,{text:D.value.meaning.text})),1),D.value.meaning.spoke?E(``,!0):(P(),v(c,{key:0},[F(a(W(u)(`(没出声)`)),1)],64))])):E(``,!0),D.value?.meaning?.when&&!D.value.meaning.recent?(P(),v(`small`,ya,a(D.value.meaning.when),1)):E(``,!0),T(`button`,{class:`text-button`,onClick:i[10]||=e=>W(L)(`heart`,`notes`)},a(W(u)(`看看 TA 的便签`)),1)]),T(`article`,ba,[T(`span`,xa,a(W(u)(`在等的事`)),1),re.value.length?(P(),v(`ul`,Sa,[(P(!0),v(c,null,I(re.value,e=>(P(),v(`li`,{key:e.id},[T(`b`,null,a(e.when),1),T(`span`,null,a(e.name?`${e.name}:`:``)+a(e.content),1),T(`small`,null,a(W(Ae)[e.kind]||e.kind),1)]))),128))])):(P(),v(`p`,Ca,a(W(u)(`这几天没有 TA 特别在等的事。`)),1)),T(`button`,{class:`text-button`,onClick:i[11]||=e=>W(L)(`life`,`ahead`)},a(W(u)(`约定与期待`)),1)])]),T(`section`,wa,[H(Ci,{class:`today`,title:W(u)(`今天的 TA`),sub:n.value?W(u)(`{v},按时间排在一起`,{v:W(An)(n.value.day)}):``},{actions:K(()=>[H(Mi,{modelValue:r.value,"onUpdate:modelValue":i[12]||=e=>r.value=e,label:W(u)(`筛选今天的事`),items:[{key:`all`,label:W(u)(`全部`),count:j.value.all},{key:`talk`,label:W(u)(`开口与沉默`),count:j.value.talk},{key:`feel`,label:W(u)(`心情`),count:j.value.feel},{key:`inner`,label:W(u)(`独处与日记`),count:j.value.inner}]},null,8,[`modelValue`,`label`,`items`])]),default:K(()=>[T(`div`,Ta,[A.value.length?(P(),w(Ii,{key:0,items:A.value,label:W(u)(`今天的 TA`)},{default:K(({item:e})=>[T(`div`,Ea,[T(`time`,null,a(W(kn)(e.time,k.value)),1),e.type===`choice`?(P(),v(`b`,Da,a(W(Ee)[e.choice]||e.choice),1)):e.type===`glance`?(P(),v(`b`,Oa,a(e.count>1?W(u)(`扫了 {count} 眼`,{count:e.count}):W(u)(`扫了一眼`)),1)):e.type===`feeling`?(P(),v(`b`,ka,a(W(u)(`心情 · {feeling}`,{feeling:e.feeling})),1)):e.type===`run`?(P(),v(`b`,Aa,a(W(ke)[e.kind]||e.kind)+` · `+a(W(De)[e.status]||e.status),1)):(P(),v(`b`,ja,a(W(u)(`约定 · {v}`,{v:W(Oe)[e.status]||e.status})),1)),e.type===`choice`?(P(),v(`span`,Ma,a(W(In)({name:e.sessionName})),1)):e.type===`glance`?(P(),v(`span`,Na,a(e.places.join(`、`)),1)):E(``,!0)]),e.type===`choice`?(P(),v(`p`,Pa,[F(a(e.reason),1),e.appraisal?(P(),v(`small`,Fa,` · `+a(e.appraisal),1)):E(``,!0)])):e.type===`glance`?(P(),v(`p`,Ia,a(e.reason||W(u)(`没什么需要 TA 细看的`)),1)):e.type===`feeling`?(P(),v(`p`,La,[F(a(e.cause||W(u)(`说不清为什么`))+` `,1),T(`small`,null,`· `+a(W(je)[e.origin]||e.origin),1)])):e.type===`run`?(P(),v(`p`,Ra,a(e.reason),1)):(P(),v(`p`,za,[F(a(e.content),1),e.note?(P(),v(`small`,Ba,` · `+a(e.note),1)):E(``,!0)]))]),_:1},8,[`items`,`label`])):(P(),w(ye,{key:1,title:W(u)(`今天还很安静`),text:W(u)(`TA 扫一眼、开口、没出声、心情变化、独处、写日记,都会按时间排在这里。`)},null,8,[`title`,`text`]))])]),_:1},8,[`title`,`sub`]),T(`div`,Va,[H(Ci,{title:W(u)(`今天的注意力`),eyebrow:W(u)(`这一天`)},{default:K(()=>[T(`div`,Ha,[(P(!0),v(c,null,I(W(te),e=>(P(),w(Oi,{key:e.id,label:e.label,value:ie(e.id),warn:!!N.value[e.id]&&ie(e.id)>=.8,text:W(Nn)(M.value[e.id])},null,8,[`label`,`value`,`warn`,`text`]))),128))]),T(`p`,Ua,a(W(u)(`共 {v} 次调用、{v2} Token,缓存命中 {v3}。 {v4}`,{v:W(Nn)(M.value.calls),v2:W(Nn)(M.value.total),v3:W(Nn)(M.value.cached),v4:N.value.total?W(u)(`每日上限 {v}。`,{v:W(Nn)(N.value.total)}):W(u)(`没有设置每日上限。`)})),1)]),_:1},8,[`title`,`eyebrow`]),H(Ci,{title:W(u)(`还没细看的消息`),eyebrow:W(u)(`留意`)},{default:K(()=>[t.value?.attention?.length?(P(),v(`ul`,Wa,[(P(!0),v(c,null,I(t.value.attention,e=>(P(),v(`li`,{key:e.session,class:`list-row`},[T(`span`,Ga,a(e.name),1),T(`span`,{class:`chip`,"data-tone":e.unread?void 0:`quiet`},a(W(u)(`{unread} 条未读`,{unread:e.unread})),9,Ka)]))),128))])):(P(),v(`p`,qa,a(W(u)(`被叫到、聊到 TA 在意的事、熟人说话或攒了不少消息时,TA 才会细看。`)),1))]),_:1},8,[`title`,`eyebrow`]),H(Ci,{title:W(u)(`TA 的这一生`),eyebrow:W(u)(`到现在`)},{default:K(()=>[T(`div`,Ja,[T(`button`,{onClick:i[13]||=e=>W(L)(`heart`)},[T(`b`,null,a(t.value?.counts?.self??0),1),T(`span`,null,a(W(u)(`自我线索`)),1)]),T(`button`,{onClick:i[14]||=e=>W(L)(`people`)},[T(`b`,null,a(t.value?.counts?.people??0),1),T(`span`,null,a(W(u)(`认识的人`)),1)]),T(`button`,{onClick:i[15]||=e=>W(L)(`life`)},[T(`b`,null,a(t.value?.counts?.diaries??0),1),T(`span`,null,a(W(u)(`天日记`)),1)]),T(`button`,{onClick:i[16]||=e=>W(L)(`life`,`ahead`)},[T(`b`,null,a(t.value?.counts?.anticipations??0),1),T(`span`,null,a(W(u)(`件在等的事`)),1)])])]),_:1},8,[`title`,`eyebrow`])])])]))}}),[[`__scopeId`,`data-v-663ff302`]]),Xa=`modulepreload`,Za=function(e){return`/app/`+e},Qa={},$=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Za(t,n),t=s(t),t in Qa)return;Qa[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Xa,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},$a={chats:()=>$(()=>import(`./ChatsPage-DH4ZPRXB.js`),__vite__mapDeps([0,1,2,3,4,5,6])),heart:()=>$(()=>import(`./HeartPage-BxgSUJJ_.js`),__vite__mapDeps([7,1,2,3,4,8])),people:()=>$(()=>import(`./PeoplePage-C6i_nAfr.js`),__vite__mapDeps([9,1,2,3,10,11])),life:()=>$(()=>import(`./LifePage-CAKr8h_q.js`),__vite__mapDeps([12,1,2,3,13])),time:()=>$(()=>import(`./TimePage-DUzjLnZV.js`),__vite__mapDeps([14,1,2,3,15])),memory:()=>$(()=>import(`./MemoryPage-CFq8L_TC.js`),__vite__mapDeps([16,1,2,3,10,17])),nature:()=>$(()=>import(`./NaturePage-BU1iDno3.js`),__vite__mapDeps([18,1,2,3,19])),system:()=>$(()=>import(`./SystemPage-21AlQBiC.js`),__vite__mapDeps([20,1,2,3,21])),plugins:()=>$(()=>import(`./PluginsPage-DRV8lzk3.js`),__vite__mapDeps([22,1,2,5,23]))},eo=new Map;function to(e){let t=$a[e];return t?(eo.has(e)||eo.set(e,t().catch(t=>{throw eo.delete(e),t})),eo.get(e)):Promise.resolve()}var no=Object.fromEntries([[`now`,Ya],...Object.keys($a).map(e=>[e,pe(()=>to(e))])]);function ro(){navigator.connection?.saveData||document.hidden||Promise.all(Object.keys($a).map(e=>to(e).catch(()=>{})))}var io={key:1,class:`access-gate`},ao={class:`access-language`},oo={class:`access-card`},so={key:0},co=[`autocomplete`],lo={key:0},uo={key:1},fo={key:2,class:`access-error`,role:`alert`},po=[`disabled`],mo={class:`access-error`,role:`alert`},ho=z(B({__name:`AccessGate`,setup(e){let t=d(()=>we.phase===`setup`),n=x(``),i=x(``),o=x(``),s=x(!1);async function f(){o.value=``;try{await Ce()}catch{o.value=u(`暂时无法连接,请重试`)}}ue(f);async function p(){if(!s.value){if(o.value=``,t.value&&n.value!==i.value){o.value=u(`两次输入的密码不一致`);return}s.value=!0;try{await r(n.value),n.value=``,i.value=``}catch(e){o.value=e.message}finally{s.value=!1}}}return(e,r)=>W(we).phase===`ready`?he(e.$slots,`default`,{},void 0,!0,0):(P(),v(`main`,io,[T(`div`,ao,[H(yr)]),T(`section`,oo,[r[2]||=T(`div`,{class:`access-orb`,"aria-hidden":`true`},`✦`,-1),r[3]||=T(`p`,{class:`eyebrow`},`LuckyTri`,-1),T(`h1`,null,a(t.value?W(u)(`为这个小世界设置密码`):W(u)(`欢迎回来`)),1),W(we).phase===`checking`?(P(),v(`p`,so,a(W(u)(`正在连接小世界…`)),1)):(P(),v(c,{key:1},[T(`p`,null,a(t.value?W(u)(`只需设置一个管理密码,以后用它登录。`):W(u)(`输入管理密码,继续陪伴 TA。`)),1),T(`form`,{class:`access-form`,onSubmit:C(p,[`prevent`])},[T(`label`,null,[F(a(W(u)(`管理密码`))+` `,1),A(T(`input`,{"onUpdate:modelValue":r[0]||=e=>n.value=e,name:`managementPassword`,type:`password`,autocomplete:t.value?`new-password`:`current-password`,minlength:`8`,maxlength:`256`,required:``,autofocus:``},null,8,co),[[l,n.value]])]),t.value?(P(),v(`label`,lo,[F(a(W(u)(`确认密码`))+` `,1),A(T(`input`,{"onUpdate:modelValue":r[1]||=e=>i.value=e,name:`confirmPassword`,type:`password`,autocomplete:`new-password`,minlength:`8`,maxlength:`256`,required:``},null,512),[[l,i.value]])])):E(``,!0),t.value?(P(),v(`small`,uo,a(W(u)(`至少 8 个字符。密码只保存在本机的加密校验记录中。`)),1)):E(``,!0),o.value?(P(),v(`p`,fo,a(o.value),1)):E(``,!0),T(`button`,{class:`primary`,disabled:s.value},a(s.value?W(u)(`请稍候…`):t.value?W(u)(`设置密码并进入`):W(u)(`登录`)),9,po)],32)],64)),o.value&&W(we).phase===`checking`?(P(),v(c,{key:2},[T(`p`,mo,a(o.value),1),T(`button`,{class:`primary`,onClick:f},a(W(u)(`重试`)),1)],64)):E(``,!0)])]))}}),[[`__scopeId`,`data-v-299ced1e`]]),go={key:0,class:`startup`},_o={class:`eyebrow`},vo=[`aria-label`],yo=[`aria-current`,`aria-label`],bo={class:`dock-ta-text rail-label`},xo={class:`dock-groups`},So={class:`rail-label`},Co=[`data-page`,`aria-current`,`title`,`onClick`,`onPointerenter`,`onFocus`],wo={class:`rail-label`},To={class:`dock-foot`},Eo=[`aria-pressed`,`title`],Do={class:`rail-label`},Oo=[`href`,`title`],ko={class:`rail-label`},Ao={class:`workspace`},jo={id:`main`,tabindex:`-1`},Mo={class:`topbar`},No={class:`topbar-title`},Po={key:0,class:`eyebrow`},Fo={class:`topbar-actions`},Io=[`title`],Lo=[`aria-label`,`title`,`disabled`],Ro={key:0,class:`draft-banner`,role:`status`},zo=[`aria-label`],Bo=[`data-page`,`aria-current`,`onClick`],Vo=[`aria-expanded`],Ho={class:`more-grid`},Uo=[`data-page`,`onClick`],Wo={class:`more-title`},Go={class:`row more-tools`},Ko=[`aria-pressed`],qo=[`href`],Jo={key:2,class:`startup`,role:`status`},Yo=y(z(B({__name:`App`,setup(e){Je();let t=d(()=>j[V.page]),n=d(()=>!!V.health?.connection?.online),r=d(()=>Z.data?.name||V.core?.nature?.name||`TA`),i=d(()=>Z.data?.activity?.kind||`idle`),o=d(()=>le.includes(V.page)),s=d(()=>h.value===`en`?`/guide.en.html`:`/guide.html`),l=0,p=!1,m=new AbortController,g=()=>{},_=x(!1);function y(e){!p&&(p=!0,e?.revision===V.core?.revision)||(l||=(re(),window.setTimeout(()=>{l=0,!document.hidden&&(re(),Ze(),!V.dirty&&V.page!==`chats`&&O().catch(()=>{}),V.pulse+=1)},2e3)))}async function b(){if(!_.value){if(V.dirty){U(u(`请先保存草稿`));return}_.value=!0;try{ae(),await Promise.all([O(),Ze()]),V.tick+=1}finally{_.value=!1}}}D(h,async()=>{if(ae(),V.core&&!V.dirty)try{await Promise.all([O(),Ze()]),V.tick+=1}catch{}});function ee(){document.getElementById(`main`)?.focus()}function te(){window.location.reload()}function ne(){document.documentElement.dataset.visibility=document.hidden?`hidden`:`visible`,document.hidden||(re(),!V.dirty&&V.page!==`chats`&&O().catch(()=>{}),V.pulse++)}return ue(async()=>{mt(),_e(),window.addEventListener(`hashchange`,_e),window.addEventListener(`popstate`,_e),to(V.page).catch(()=>{}),ro();try{await O()}catch(e){V.error=e.message;return}g=Qe(),document.addEventListener(`visibilitychange`,ne),$e(y,{signal:m.signal})}),xe(()=>{window.removeEventListener(`hashchange`,_e),window.removeEventListener(`popstate`,_e),m.abort(),clearTimeout(l),g(),document.removeEventListener(`visibilitychange`,ne)}),(e,l)=>(P(),w(ho,null,{default:K(()=>[H(kt),W(V).error?(P(),v(`div`,go,[H(On,{mood:`blue`,size:128}),T(`span`,_o,a(W(u)(`暂未连接`)),1),T(`h1`,null,a(W(u)(`TA 在等你回来`)),1),T(`p`,null,a(W(V).error),1),T(`button`,{class:`primary`,onClick:te},a(W(u)(`重新连接`)),1)])):W(V).core&&W(V).health?(P(),v(`div`,{key:1,class:S([`shell`,`at-`+W(V).page])},[T(`a`,{class:`skip-link`,href:`#main`,onClick:C(ee,[`prevent`])},a(W(u)(`跳到主要内容`)),1),T(`nav`,{class:`dock primary-nav`,"aria-label":W(u)(`主要功能`)},[T(`button`,{class:S([`dock-ta`,{active:W(V).page===`now`}]),"data-page":`now`,"aria-current":W(V).page===`now`?`page`:void 0,"aria-label":W(u)(`{name}:回到此刻`,{name:r.value}),onClick:l[0]||=e=>W(L)(`now`)},[H(On,{mood:W(Y),activity:i.value,size:50},null,8,[`mood`,`activity`]),T(`span`,bo,[l[6]||=T(`b`,null,`LuckyTri`,-1),T(`small`,null,a(r.value===`LuckyTri`?``:r.value+` · `)+a(W(q)[W(Y)].label)+` · `+a(W(bt)[i.value]||W(u)(`闲着`)),1)])],10,yo),T(`div`,xo,[(P(!0),v(c,null,I(W(N),e=>(P(),v(`section`,{key:e.label,class:`dock-group`},[T(`h2`,So,a(e.label),1),(P(!0),v(c,null,I(e.pages,e=>(P(),v(`button`,{key:e,class:S([`dock-link`,{active:W(V).page===e}]),"data-page":e,"aria-current":W(V).page===e?`page`:void 0,title:W(j)[e].label,onClick:t=>W(L)(e),onPointerenter:t=>W(to)(e).catch(()=>{}),onFocus:t=>W(to)(e).catch(()=>{})},[H(li,{name:e},null,8,[`name`]),T(`span`,wo,a(W(j)[e].label),1)],42,Co))),128))]))),128))]),T(`div`,To,[H(Or),T(`button`,{class:`dock-tool`,"aria-pressed":W(J).quiet,title:W(J).quiet?W(u)(`开启灵动效果`):W(u)(`减少动画`),onClick:l[1]||=e=>W(qe)(!W(J).quiet)},[H(li,{name:`motion`}),T(`span`,Do,a(W(J).quiet?W(u)(`开启灵动效果`):W(u)(`减少动画`)),1)],8,Eo),T(`a`,{class:`dock-tool`,href:s.value,target:`_blank`,rel:`noopener`,title:W(u)(`使用教程`)},[H(li,{name:`guide`}),T(`span`,ko,a(W(u)(`使用教程 ↗`)),1)],8,Oo)])],8,vo),T(`div`,Ao,[H(Zr),T(`main`,jo,[T(`header`,Mo,[T(`div`,No,[W(h)===`zh`?(P(),v(`span`,Po,a(t.value.en),1)):E(``,!0),T(`h1`,null,a(t.value.label),1),T(`p`,null,a(t.value.tagline),1)]),T(`div`,Fo,[H(yr),T(`button`,{id:`connection`,class:S([`pill`,{offline:!n.value}]),title:n.value?W(u)(`QQ 已连接`):W(u)(`去连接 QQ`),onClick:l[2]||=e=>n.value||W(L)(`system`,`connect`)},[T(`span`,{class:S([`dot`,{off:!n.value}])},null,2),F(a(n.value?W(u)(`QQ 已连接`):W(u)(`QQ 未连接`)),1)],10,Io),T(`button`,{id:`refresh`,class:S([`icon-button`,{spinning:_.value}]),"aria-label":W(u)(`刷新当前数据`),title:W(u)(`刷新`),disabled:_.value,onClick:b},[H(li,{name:`refresh`})],10,Lo)])]),W(V).dirty?(P(),v(`div`,Ro,[l[7]||=T(`span`,{class:`dot warn`},null,-1),F(a(W(u)(`草稿还没保存,保存后才会生效`)),1)])):E(``,!0),T(`div`,{class:S([`view`,`page-`+W(V).page])},[(P(),w(f,{max:5,include:[`NowPage`,`HeartPage`,`PeoplePage`,`LifePage`,`TimePage`]},[(P(),w(fe(W(no)[W(V).page]),{key:W(V).page,class:`route-page`}))],1024))],2)])]),T(`nav`,{class:`tabbar`,"aria-label":W(u)(`主要功能`)},[(P(!0),v(c,null,I(W(be),e=>(P(),v(`button`,{key:e,"data-page":e,class:S({active:W(V).page===e}),"aria-current":W(V).page===e?`page`:void 0,onClick:t=>W(L)(e)},[H(li,{name:e},null,8,[`name`]),T(`span`,null,a(W(j)[e].label),1)],10,Bo))),128)),T(`button`,{class:S([`tabbar-more`,{active:o.value}]),"aria-expanded":W(V).moreOpen,onClick:l[3]||=e=>W(V).moreOpen=!W(V).moreOpen},[H(li,{name:`more`}),T(`span`,null,a(W(u)(`更多`)),1)],10,Vo)],8,zo),H(hi,{open:W(V).moreOpen,title:W(u)(`更多`),eyebrow:W(u)(`更多`),width:`420px`,onClose:l[5]||=e=>W(V).moreOpen=!1},{default:K(()=>[T(`div`,Ho,[(P(!0),v(c,null,I(W(le),e=>(P(),v(`button`,{key:e,"data-page":e,class:S({active:W(V).page===e}),onClick:t=>W(L)(e)},[H(li,{name:e},null,8,[`name`]),T(`b`,null,a(W(j)[e].label),1),T(`small`,null,a(W(j)[e].tagline),1)],10,Uo))),128))]),T(`h3`,Wo,a(W(u)(`界面主题`)),1),H(Or,{inline:``}),T(`div`,Go,[T(`button`,{"aria-pressed":W(J).quiet,onClick:l[4]||=e=>W(qe)(!W(J).quiet)},a(W(J).quiet?W(u)(`开启灵动效果`):W(u)(`减少动画`)),9,Ko),T(`a`,{href:s.value,target:`_blank`,rel:`noopener`},a(W(u)(`使用教程 ↗`)),9,qo)])]),_:1},8,[`open`,`title`,`eyebrow`]),H(gr,{"hide-orb":W(V).page===`now`},null,8,[`hide-orb`])],2)):(P(),v(`div`,Jo,[H(On,{mood:W(Y),activity:`idle`,size:128},null,8,[`mood`]),T(`h1`,null,a(W(u)(`正在进入 TA 的小世界`)),1),T(`p`,null,a(W(u)(`连接会话与记忆…`)),1)])),H(ri)]),_:1}))}}),[[`__scopeId`,`data-v-0e622eac`]]));Yo.config.errorHandler=e=>{U(e instanceof Error?e.message:u(`操作失败,请重试`),!0)},Yo.mount(`#app`);export{jn as _,gi as a,Z as b,Kn as c,An as d,zn as f,Ln as g,In as h,Ci as i,Mn as l,Nn as m,Mi as n,hi as o,Rn as p,Oi as r,or as s,Ii as t,kn as u,On as v,Y as x,$e as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as e}from"./Empty-
|
|
1
|
+
import{m as e}from"./Empty-DRsHeX-L.js";async function t(t){return e(`/core/memories?session=`+encodeURIComponent(t))}async function n(t){return e(`/core/memories`,`POST`,t)}async function r(t,n){return e(`/core/memories/`+t,`PATCH`,n)}async function i(t){return e(`/core/memories/batch-delete`,`POST`,t)}async function a(t){return e(`/core/memory-summary?session=`+encodeURIComponent(t))}async function o(t){return e(`/core/memory/consolidate`,`POST`,{session:t})}async function s(t){return e(`/core/knowledge/collections?session=`+encodeURIComponent(t))}async function c(t){return e(`/core/knowledge/documents?collection=`+encodeURIComponent(t))}async function l(t){return e(`/core/knowledge/documents`,`POST`,t)}async function u(t,n){return e(`/core/knowledge/search`,`POST`,{session:t,text:n})}export{s as a,a as c,l as i,r as l,o as n,c as o,i as r,t as s,n as t,u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{St as e,st as t}from"./Empty-DRsHeX-L.js";function n(n){let r=matchMedia(n),i=e(r.matches),a=e=>i.value=e.matches;return r.addEventListener(`change`,a),t(()=>r.removeEventListener(`change`,a)),i}export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as e,M as t,P as n,j as r,m as i}from"./Empty-
|
|
1
|
+
import{I as e,M as t,P as n,j as r,m as i}from"./Empty-DRsHeX-L.js";var a=new Map;function o(e,t){let n=JSON.stringify([e,t]),r=a.get(n);return r||(r=new Intl.DateTimeFormat(e,t),a.set(n,r),a.size>64&&a.delete(a.keys().next().value)),r}var s={overview:()=>i(`/mind`),mood:()=>i(`/mind/mood`),notes:(e=``)=>i(`/mind/thoughts?q=`+encodeURIComponent(e)),presence:()=>i(`/mind/presence`),today:()=>i(`/mind/today`),person:e=>i(`/mind/people/`+encodeURIComponent(e)),self:()=>i(`/mind/self`),thread:e=>i(`/mind/self/`+encodeURIComponent(e)),bonds:()=>i(`/mind/bonds`),relationships:()=>i(`/mind/relationships`),saveRelationship:e=>i(`/mind/relationships`,`PUT`,e),endRelationship:(e,t)=>i(`/mind/relationships/`+encodeURIComponent(e),`DELETE`,t),bondChanges:(e,t)=>i(`/mind/bonds/${e}/`+encodeURIComponent(t)),faces:e=>i(`/mind/faces/`+encodeURIComponent(e)),life:(e=``,t)=>i(`/mind/life?q=`+encodeURIComponent(e)+(t?`&before=`+t:``)),day:e=>i(`/mind/day/`+e),chapter:e=>i(`/mind/chapters/`+e),story:()=>i(`/mind/story`),nature:()=>i(`/mind/nature`),saveNature:e=>i(`/mind/nature`,`PUT`,e),saveSettings:e=>i(`/mind/settings`,`PUT`,e),reflect:()=>i(`/mind/reflect`,`POST`,{}),review:()=>i(`/mind/review`,`POST`,{}),revoke:(e,t,n=``)=>i(`/mind/revoke`,`POST`,{kind:e,id:t,reason:n}),thought:(e,t)=>i(`/mind/thoughts/`+encodeURIComponent(e),`PATCH`,t),removeThought:e=>i(`/mind/thoughts/`+encodeURIComponent(e),`DELETE`,{}),preview:e=>i(`/mind/preview`,`POST`,e),savePrompts:e=>i(`/core/prompts`,`PUT`,e)},c=n({promise:r(`答应的事`),plan:r(`想做的事`),event:r(`别人的安排`),date:r(`每年的日子`)}),l=n({pending:r(`还在等`),lapsed:r(`悄悄错过了`),done:r(`做到了`),missed:r(`错过了`),let_go:r(`不再惦记`),revoked:r(`已撤销`)}),u=n({turn:r(`聊天时`),direct:r(`聊天时`),group:r(`聊天时`),solitude:r(`独处时`),daily:r(`写日记时`),weekly:r(`回顾时`),memory:r(`从 TA 说过的话里`),migration:r(`旧版本`)}),d=n({activity:r(`做自己的事`),solitude:r(`独处`),expression:r(`自己的念头`),daily:r(`写日记`),weekly:r(`回顾这段日子`),night:r(`夜里整理`)}),f=n({running:r(`进行中`),written:r(`留下了东西`),state:r(`心情变了`),empty:r(`没什么新的`),error:r(`出了点问题`),skipped:r(`跳过了`),cancelled:r(`作废了`),interrupted:r(`重启中断`)}),p=n({active:r(`已经是 TA 的一部分`),emerging:r(`刚开始有这种感觉`),closed:r(`已经放下`)}),m={interest:`#ffc15f`,view:`#7fc8ff`,trait:`#ff9a8b`,habit:`#b9a4ff`,intention:`#6fe0b8`,care:`#ff8fbf`,curiosity:`#9ef0ff`},h=n({warmer:r(`更亲近了一点`),closer:r(`走近了`),trust_up:r(`更信任了`),trust_down:r(`有点失望`),friction:r(`有了别扭`),repair:r(`和好了`),distance:r(`疏远了一点`),impression:r(`印象`)}),g=new Set([`friction`,`trust_down`,`distance`]),_=n([[`familiarity`,r(`熟悉`)],[`closeness`,r(`亲近`)],[`trust`,r(`信任`)],[`tension`,r(`别扭`)]]),v=n({open:r(`公开`),private:r(`私下知道`),secret:r(`要 TA 保密`)}),y=n({妹妹:r(`妹妹`),姐姐:r(`姐姐`),弟弟:r(`弟弟`),哥哥:r(`哥哥`),朋友:r(`朋友`),伙伴:r(`伙伴`),年长手足:r(`年长手足`),年幼手足:r(`年幼手足`)}),b=n({confirmed:r(`TA 这样认为`),superseded:r(`已被新的取代`),candidate:r(`旧版待确认`),disputed:r(`有争议`),expired:r(`已过期`),deleted:r(`已撤销`)}),x=n({planned:r(`等合适的时候`),sending:r(`正在发`),sent:r(`说出口了`),declined:r(`TA 后来决定不说`),skipped:r(`时机不合适`),cancelled:r(`没有发`),uncertain:r(`投递未确认`)}),S=n({speak:r(`开口`),react:r(`简短反应`),decline:r(`说不想聊`),silent:r(`没出声`)});function C(n,r=`Asia/Shanghai`){return n?o(t(),{timeZone:r,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`}).format(n):e(`还没有`)}function w(e){return`${Math.round(Math.max(0,Math.min(1,Number(e)||0))*100)}%`}export{w as _,g as a,m as c,x as d,y as f,s as g,p as h,S as i,b as l,f as m,l as n,_ as o,d as p,h as r,v as s,c as t,u,C as v,o as y};
|
package/public/app/index.html
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
if (pinned) document.documentElement.dataset.mood = pinned;
|
|
15
15
|
} catch (e) {}
|
|
16
16
|
</script>
|
|
17
|
-
<script type="module" crossorigin src="/app/assets/index-
|
|
18
|
-
<link rel="modulepreload" crossorigin href="/app/assets/Empty-
|
|
19
|
-
<link rel="modulepreload" crossorigin href="/app/assets/mind-
|
|
17
|
+
<script type="module" crossorigin src="/app/assets/index-WAvrlAcO.js"></script>
|
|
18
|
+
<link rel="modulepreload" crossorigin href="/app/assets/Empty-DRsHeX-L.js">
|
|
19
|
+
<link rel="modulepreload" crossorigin href="/app/assets/mind-BBAstMqH.js">
|
|
20
20
|
<link rel="stylesheet" crossorigin href="/app/assets/Empty-DmUB2-Bk.css">
|
|
21
21
|
<link rel="stylesheet" crossorigin href="/app/assets/index-BHZcHUMh.css">
|
|
22
22
|
</head>
|
package/public/guide.en.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
6
|
-
<title>LuckyTri v1.0
|
|
6
|
+
<title>LuckyTri v1.1.0 · Getting Started</title>
|
|
7
7
|
<style>
|
|
8
8
|
* {
|
|
9
9
|
box-sizing: border-box;
|
|
@@ -269,7 +269,7 @@
|
|
|
269
269
|
<body>
|
|
270
270
|
<header>
|
|
271
271
|
<div>
|
|
272
|
-
<b>LuckyTri · Handbook</b><small>TIME · MEMORY · CHOICE / v1.0
|
|
272
|
+
<b>LuckyTri · Handbook</b><small>TIME · MEMORY · CHOICE / v1.1.0</small>
|
|
273
273
|
</div>
|
|
274
274
|
<nav>
|
|
275
275
|
<a href="/#setup">Back to the studio</a
|
|
@@ -497,8 +497,9 @@ luckytri
|
|
|
497
497
|
<ul>
|
|
498
498
|
<li>
|
|
499
499
|
For the API address enter the root of the provider's compatible
|
|
500
|
-
endpoint. The program appends <code>/chat/completions</code>
|
|
501
|
-
do not write the
|
|
500
|
+
endpoint. The program appends <code>/chat/completions</code> or
|
|
501
|
+
<code>/responses</code> according to the preset; do not write the
|
|
502
|
+
full path again.
|
|
502
503
|
</li>
|
|
503
504
|
<li>For the model name enter a model ID the provider accepts.</li>
|
|
504
505
|
<li>Leaving the API key empty keeps the saved key.</li>
|
|
@@ -508,6 +509,13 @@ luckytri
|
|
|
508
509
|
models are whatever your provider's console shows. Speaking
|
|
509
510
|
decisions and replies need the model to return a JSON object.
|
|
510
511
|
</p>
|
|
512
|
+
<p>
|
|
513
|
+
Volcengine Ark Agent Plan and Coding Plan use separate plans, keys and
|
|
514
|
+
endpoints. The Agent Plan preset uses its dedicated
|
|
515
|
+
<code>/api/plan/v3</code> address and the Responses API. Enter an
|
|
516
|
+
Agent Plan API key; do not reuse a Coding Plan key or a regular Ark
|
|
517
|
+
inference key.
|
|
518
|
+
</p>
|
|
511
519
|
<p>
|
|
512
520
|
After saving, click "Test this model's connection". The
|
|
513
521
|
test carries no group chat text. Test again after changing the
|
|
@@ -1057,7 +1065,7 @@ npm start
|
|
|
1057
1065
|
</div>
|
|
1058
1066
|
<footer>
|
|
1059
1067
|
LuckyTri · so that experience and choice stay coherent. This guide matches
|
|
1060
|
-
the v1.0
|
|
1068
|
+
the v1.1.0 interface.
|
|
1061
1069
|
</footer>
|
|
1062
1070
|
</body>
|
|
1063
1071
|
</html>
|
package/public/guide.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
6
|
-
<title>LuckyTri v1.0
|
|
6
|
+
<title>LuckyTri v1.1.0 · 使用教程</title>
|
|
7
7
|
<style>
|
|
8
8
|
* {
|
|
9
9
|
box-sizing: border-box;
|
|
@@ -269,7 +269,7 @@
|
|
|
269
269
|
<body>
|
|
270
270
|
<header>
|
|
271
271
|
<div>
|
|
272
|
-
<b>LuckyTri · 上手手册</b><small>TIME · MEMORY · CHOICE / v1.0
|
|
272
|
+
<b>LuckyTri · 上手手册</b><small>TIME · MEMORY · CHOICE / v1.1.0</small>
|
|
273
273
|
</div>
|
|
274
274
|
<nav>
|
|
275
275
|
<a href="/#setup">返回管理台</a
|
|
@@ -460,8 +460,9 @@ luckytri
|
|
|
460
460
|
<p>打开「系统 → 模型库」,点「+ 新增模型」选择一个预设。</p>
|
|
461
461
|
<ul>
|
|
462
462
|
<li>
|
|
463
|
-
API
|
|
464
|
-
<code>/chat/completions</code
|
|
463
|
+
API 地址填写服务商的兼容接口根路径。程序会按预设自动拼接
|
|
464
|
+
<code>/chat/completions</code> 或
|
|
465
|
+
<code>/responses</code>,不要把完整路径再写一遍。
|
|
465
466
|
</li>
|
|
466
467
|
<li>模型名称填写服务商接受的模型 ID。</li>
|
|
467
468
|
<li>API Key 留空表示保留已保存的密钥。</li>
|
|
@@ -470,6 +471,12 @@ luckytri
|
|
|
470
471
|
预设只填入常见地址和模型名,以服务商控制台里的实际模型为准。发言决策和回复生成需要模型返回
|
|
471
472
|
JSON 对象。
|
|
472
473
|
</p>
|
|
474
|
+
<p>
|
|
475
|
+
火山方舟 Agent Plan 与 Coding Plan 使用不同套餐、密钥和接口地址。Agent
|
|
476
|
+
Plan 预设使用专属 <code>/api/plan/v3</code> 地址和 Responses
|
|
477
|
+
API;请填入 Agent Plan 专属 API Key,不要与 Coding Plan 或普通方舟推理
|
|
478
|
+
API 的密钥混用。
|
|
479
|
+
</p>
|
|
473
480
|
<p>
|
|
474
481
|
保存后点「测试此模型连接」。测试不携带群聊原文。更换地址、模型或密钥后需要重新测试。
|
|
475
482
|
</p>
|
|
@@ -864,6 +871,6 @@ npm start
|
|
|
864
871
|
</p>
|
|
865
872
|
</article>
|
|
866
873
|
</div>
|
|
867
|
-
<footer>LuckyTri · 让经历和选择彼此连贯。教程与 v1.0
|
|
874
|
+
<footer>LuckyTri · 让经历和选择彼此连贯。教程与 v1.1.0 界面同步。</footer>
|
|
868
875
|
</body>
|
|
869
876
|
</html>
|
package/public/tutorial.en.md
CHANGED
|
@@ -61,12 +61,14 @@ Without a model key, simulated replies use local samples and call no model. Once
|
|
|
61
61
|
|
|
62
62
|
Open "System → Model library", click "+ Add model" and choose a preset.
|
|
63
63
|
|
|
64
|
-
- For the API address enter the root of the provider's compatible endpoint. The program appends `/chat/completions`
|
|
64
|
+
- For the API address enter the root of the provider's compatible endpoint. The program appends `/chat/completions` or `/responses` according to the preset; do not write the full path again.
|
|
65
65
|
- For the model name enter a model ID the provider accepts.
|
|
66
66
|
- Leaving the API key empty keeps the saved key.
|
|
67
67
|
|
|
68
68
|
A preset only fills in a common address and model name; the real models are whatever your provider's console shows. Speaking decisions and replies need the model to return a JSON object.
|
|
69
69
|
|
|
70
|
+
Volcengine Ark Agent Plan and Coding Plan use separate plans, keys and endpoints. The Agent Plan preset uses its dedicated `/api/plan/v3` address and the Responses API. Enter an Agent Plan API key; do not reuse a Coding Plan key or a regular Ark inference key.
|
|
71
|
+
|
|
70
72
|
After saving, click "Test this model's connection". The test carries no group chat text. Test again after changing the address, model or key.
|
|
71
73
|
|
|
72
74
|
You can also stay in simulation mode and trial-chat with TA under "Nature" to see how she speaks before letting her join real QQ.
|
package/public/tutorial.md
CHANGED
|
@@ -61,12 +61,14 @@ LuckyTri 是「TA 的小世界」,左侧导航分三组、十个入口:
|
|
|
61
61
|
|
|
62
62
|
打开「系统 → 模型库」,点「+ 新增模型」选择一个预设。
|
|
63
63
|
|
|
64
|
-
- API
|
|
64
|
+
- API 地址填写服务商的兼容接口根路径。程序会按预设自动拼接 `/chat/completions` 或 `/responses`,不要把完整路径再写一遍。
|
|
65
65
|
- 模型名称填写服务商接受的模型 ID。
|
|
66
66
|
- API Key 留空表示保留已保存的密钥。
|
|
67
67
|
|
|
68
68
|
预设只填入常见地址和模型名,以服务商控制台里的实际模型为准。发言决策和回复生成需要模型返回 JSON 对象。
|
|
69
69
|
|
|
70
|
+
火山方舟 Agent Plan 与 Coding Plan 使用不同套餐、密钥和接口地址。Agent Plan 预设使用专属 `/api/plan/v3` 地址和 Responses API;请填入 Agent Plan 专属 API Key,不要与 Coding Plan 或普通方舟推理 API 的密钥混用。
|
|
71
|
+
|
|
70
72
|
保存后点「测试此模型连接」。测试不携带群聊原文。更换地址、模型或密钥后需要重新测试。
|
|
71
73
|
|
|
72
74
|
也可以先保持模拟模式,在「天性」里和 TA 试聊,确认 TA 说话的样子后再让 TA 参加真实 QQ。
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
// Background work that keeps failing waits longer each time instead of asking
|
|
2
|
+
// again on the same clock. The state lives in the database, so a restart does
|
|
3
|
+
// not turn a long wait back into an immediate retry.
|
|
4
|
+
export const BACKGROUND_SCHEDULE = [
|
|
5
|
+
60000,
|
|
6
|
+
5 * 60000,
|
|
7
|
+
20 * 60000,
|
|
8
|
+
3600000,
|
|
9
|
+
3 * 3600000,
|
|
10
|
+
6 * 3600000,
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
export class Backoff {
|
|
14
|
+
constructor(
|
|
15
|
+
db,
|
|
16
|
+
{ schedule = BACKGROUND_SCHEDULE, jitter = 0.1, random = Math.random } = {},
|
|
17
|
+
) {
|
|
18
|
+
this.db = db;
|
|
19
|
+
this.schedule = schedule;
|
|
20
|
+
this.jitter = jitter;
|
|
21
|
+
this.random = random;
|
|
22
|
+
db.exec(
|
|
23
|
+
"CREATE TABLE IF NOT EXISTS core_backoff(key TEXT PRIMARY KEY,failures INTEGER NOT NULL,next_at INTEGER NOT NULL,last_error TEXT NOT NULL DEFAULT '',meta TEXT NOT NULL DEFAULT '{}',updated INTEGER NOT NULL)",
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
state(key) {
|
|
27
|
+
const row = this.db
|
|
28
|
+
.prepare("SELECT * FROM core_backoff WHERE key=?")
|
|
29
|
+
.get(key);
|
|
30
|
+
if (!row) return { failures: 0, nextAt: 0, lastError: "", meta: {} };
|
|
31
|
+
let meta = {};
|
|
32
|
+
try {
|
|
33
|
+
meta = JSON.parse(row.meta);
|
|
34
|
+
} catch {
|
|
35
|
+
meta = {};
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
failures: row.failures,
|
|
39
|
+
nextAt: row.next_at,
|
|
40
|
+
lastError: row.last_error,
|
|
41
|
+
meta,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
ready(key, now = Date.now()) {
|
|
45
|
+
return this.state(key).nextAt <= now;
|
|
46
|
+
}
|
|
47
|
+
// `minimumMs` lets a caller that knows the cause (a rate limit, an account
|
|
48
|
+
// without credit) wait at least that long.
|
|
49
|
+
fail(
|
|
50
|
+
key,
|
|
51
|
+
error,
|
|
52
|
+
now = Date.now(),
|
|
53
|
+
{ schedule = this.schedule, minimumMs = 0, meta } = {},
|
|
54
|
+
) {
|
|
55
|
+
const old = this.state(key);
|
|
56
|
+
const failures = old.failures + 1;
|
|
57
|
+
const base = schedule[Math.min(failures, schedule.length) - 1];
|
|
58
|
+
const spread = base * this.jitter * (this.random() * 2 - 1);
|
|
59
|
+
const wait = Math.max(minimumMs, Math.round(base + spread));
|
|
60
|
+
const nextAt = now + wait;
|
|
61
|
+
this.db
|
|
62
|
+
.prepare(
|
|
63
|
+
"INSERT INTO core_backoff(key,failures,next_at,last_error,meta,updated) VALUES (?,?,?,?,?,?) ON CONFLICT(key) DO UPDATE SET failures=excluded.failures,next_at=excluded.next_at,last_error=excluded.last_error,meta=excluded.meta,updated=excluded.updated",
|
|
64
|
+
)
|
|
65
|
+
.run(
|
|
66
|
+
key,
|
|
67
|
+
failures,
|
|
68
|
+
nextAt,
|
|
69
|
+
String(error?.message ?? error ?? "").slice(0, 300),
|
|
70
|
+
JSON.stringify(meta ?? old.meta ?? {}),
|
|
71
|
+
now,
|
|
72
|
+
);
|
|
73
|
+
return { failures, nextAt, waitMs: wait };
|
|
74
|
+
}
|
|
75
|
+
// Keeps the failure count but records extra state, such as a smaller block.
|
|
76
|
+
note(key, meta, now = Date.now()) {
|
|
77
|
+
const old = this.state(key);
|
|
78
|
+
this.db
|
|
79
|
+
.prepare(
|
|
80
|
+
"INSERT INTO core_backoff(key,failures,next_at,last_error,meta,updated) VALUES (?,?,?,?,?,?) ON CONFLICT(key) DO UPDATE SET meta=excluded.meta,updated=excluded.updated",
|
|
81
|
+
)
|
|
82
|
+
.run(
|
|
83
|
+
key,
|
|
84
|
+
old.failures,
|
|
85
|
+
old.nextAt,
|
|
86
|
+
old.lastError,
|
|
87
|
+
JSON.stringify({ ...old.meta, ...meta }),
|
|
88
|
+
now,
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
succeed(key) {
|
|
92
|
+
this.db.prepare("DELETE FROM core_backoff WHERE key=?").run(key);
|
|
93
|
+
}
|
|
94
|
+
list(prefix = "") {
|
|
95
|
+
return this.db
|
|
96
|
+
.prepare(
|
|
97
|
+
"SELECT key,failures,next_at,last_error,updated FROM core_backoff WHERE key LIKE ? ORDER BY next_at DESC LIMIT 200",
|
|
98
|
+
)
|
|
99
|
+
.all(`${prefix}%`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Provider answers that will not change by asking again soon: a rate limit or
|
|
104
|
+
// an account without credit. The caller waits at least this long.
|
|
105
|
+
export function providerWaitMs(error) {
|
|
106
|
+
const status = Number(error?.status);
|
|
107
|
+
if ([401, 402, 403].includes(status)) return 3600000;
|
|
108
|
+
if (status === 429) return 5 * 60000;
|
|
109
|
+
if (error?.circuitOpen || error?.unavailable) return 2 * 60000;
|
|
110
|
+
return 0;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// A failure the model itself caused: output that is not usable JSON, or a
|
|
114
|
+
// result that does not fit the expected shape. Retrying the same input with
|
|
115
|
+
// the same model tends to fail the same way.
|
|
116
|
+
export function isFormatFailure(error) {
|
|
117
|
+
return (
|
|
118
|
+
error instanceof SyntaxError ||
|
|
119
|
+
/JSON|格式无效|输出被截断|Unexpected token/i.test(
|
|
120
|
+
String(error?.message || ""),
|
|
121
|
+
)
|
|
122
|
+
);
|
|
123
|
+
}
|