diff --git a/apps/dashboard/build/_app/immutable/assets/0.CLR80qKm.css.gz b/apps/dashboard/build/_app/immutable/assets/0.CLR80qKm.css.gz index f7c82a7..cc7c9c8 100644 Binary files a/apps/dashboard/build/_app/immutable/assets/0.CLR80qKm.css.gz and b/apps/dashboard/build/_app/immutable/assets/0.CLR80qKm.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/12.BxoW8Jf1.css.gz b/apps/dashboard/build/_app/immutable/assets/12.BxoW8Jf1.css.gz index 9b07e15..dfc3505 100644 Binary files a/apps/dashboard/build/_app/immutable/assets/12.BxoW8Jf1.css.gz and b/apps/dashboard/build/_app/immutable/assets/12.BxoW8Jf1.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/20.Duj1vJUf.css.gz b/apps/dashboard/build/_app/immutable/assets/20.Duj1vJUf.css.gz index 99d89f8..6afc78d 100644 Binary files a/apps/dashboard/build/_app/immutable/assets/20.Duj1vJUf.css.gz and b/apps/dashboard/build/_app/immutable/assets/20.Duj1vJUf.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/25.DKhUrxcR.css.gz b/apps/dashboard/build/_app/immutable/assets/25.DKhUrxcR.css.gz index a175ffa..f9799b6 100644 Binary files a/apps/dashboard/build/_app/immutable/assets/25.DKhUrxcR.css.gz and b/apps/dashboard/build/_app/immutable/assets/25.DKhUrxcR.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/6.ksI6gQcB.css.gz b/apps/dashboard/build/_app/immutable/assets/6.ksI6gQcB.css.gz index dfe8068..c061327 100644 Binary files a/apps/dashboard/build/_app/immutable/assets/6.ksI6gQcB.css.gz and b/apps/dashboard/build/_app/immutable/assets/6.ksI6gQcB.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/7.DQ_AfUnN.css.gz b/apps/dashboard/build/_app/immutable/assets/7.DQ_AfUnN.css.gz index ac521f3..f973c72 100644 Binary files a/apps/dashboard/build/_app/immutable/assets/7.DQ_AfUnN.css.gz and b/apps/dashboard/build/_app/immutable/assets/7.DQ_AfUnN.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/Dropdown.C2Z-7Phd.css.gz b/apps/dashboard/build/_app/immutable/assets/Dropdown.C2Z-7Phd.css.gz index 2d115ff..e21b4b8 100644 Binary files a/apps/dashboard/build/_app/immutable/assets/Dropdown.C2Z-7Phd.css.gz and b/apps/dashboard/build/_app/immutable/assets/Dropdown.C2Z-7Phd.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/Icon.tTjeJXhC.css.gz b/apps/dashboard/build/_app/immutable/assets/Icon.tTjeJXhC.css.gz index 8bf20dc..dbe4663 100644 Binary files a/apps/dashboard/build/_app/immutable/assets/Icon.tTjeJXhC.css.gz and b/apps/dashboard/build/_app/immutable/assets/Icon.tTjeJXhC.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/ObservatoryStage.CKoSQgn0.css.gz b/apps/dashboard/build/_app/immutable/assets/ObservatoryStage.CKoSQgn0.css.gz index 3650756..7dc280c 100644 Binary files a/apps/dashboard/build/_app/immutable/assets/ObservatoryStage.CKoSQgn0.css.gz and b/apps/dashboard/build/_app/immutable/assets/ObservatoryStage.CKoSQgn0.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/cognitive-palette.BALpZUFZ.css.gz b/apps/dashboard/build/_app/immutable/assets/cognitive-palette.BALpZUFZ.css.gz index 1b8ea3b..c7a451a 100644 Binary files a/apps/dashboard/build/_app/immutable/assets/cognitive-palette.BALpZUFZ.css.gz and b/apps/dashboard/build/_app/immutable/assets/cognitive-palette.BALpZUFZ.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/assets/reveal.Dmxpik8H.css.gz b/apps/dashboard/build/_app/immutable/assets/reveal.Dmxpik8H.css.gz index 7d64c44..fb7c3df 100644 Binary files a/apps/dashboard/build/_app/immutable/assets/reveal.Dmxpik8H.css.gz and b/apps/dashboard/build/_app/immutable/assets/reveal.Dmxpik8H.css.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/B9l3DI-J.js.gz b/apps/dashboard/build/_app/immutable/chunks/B9l3DI-J.js.gz index c1883cd..f2ebad2 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/B9l3DI-J.js.gz and b/apps/dashboard/build/_app/immutable/chunks/B9l3DI-J.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BKh9s_e0.js.gz b/apps/dashboard/build/_app/immutable/chunks/BKh9s_e0.js.gz index 28aa55b..13bd26c 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/BKh9s_e0.js.gz and b/apps/dashboard/build/_app/immutable/chunks/BKh9s_e0.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BMB5u1EX.js.gz b/apps/dashboard/build/_app/immutable/chunks/BMB5u1EX.js.gz index bc22741..827bcbb 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/BMB5u1EX.js.gz and b/apps/dashboard/build/_app/immutable/chunks/BMB5u1EX.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BeGBxCGK.js.br b/apps/dashboard/build/_app/immutable/chunks/BeGBxCGK.js.br deleted file mode 100644 index e5f8e46..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/BeGBxCGK.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BeGBxCGK.js.gz b/apps/dashboard/build/_app/immutable/chunks/BeGBxCGK.js.gz deleted file mode 100644 index 8883d08..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/BeGBxCGK.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BfiOPhbz.js.gz b/apps/dashboard/build/_app/immutable/chunks/BfiOPhbz.js.gz index 546211a..2f5b730 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/BfiOPhbz.js.gz and b/apps/dashboard/build/_app/immutable/chunks/BfiOPhbz.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/Bo4EDkTQ.js.gz b/apps/dashboard/build/_app/immutable/chunks/Bo4EDkTQ.js.gz index 838211b..402260e 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/Bo4EDkTQ.js.gz and b/apps/dashboard/build/_app/immutable/chunks/Bo4EDkTQ.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BpEKQwpr.js b/apps/dashboard/build/_app/immutable/chunks/BpEKQwpr.js new file mode 100644 index 0000000..e95f02b --- /dev/null +++ b/apps/dashboard/build/_app/immutable/chunks/BpEKQwpr.js @@ -0,0 +1 @@ +var Ee=Object.defineProperty;var Ae=(d,e,s)=>e in d?Ee(d,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):d[e]=s;var N=(d,e,s)=>Ae(d,typeof e!="symbol"?e+"":e,s);import"./Bzak7iHL.js";import{d as be,o as Q,b as $,e as Ne}from"./DAau0uzT.js";import{p as Re,j as ee,g as n,y as _e,Y as ke,a as Se,b as Ce,u as Ie,d as R,f as Me,s as p,c as Pe,r as we}from"./CGq8RnJq.js";import{s as Oe}from"./uCQU803Y.js";import{b as Le}from"./Ccqjq5DS.js";import{p as _,s as He,a as Ve}from"./DV6OI5iy.js";import{g as Fe}from"./DJDK-KWF.js";import{b as T}from"./DY7cP31Q.js";import{p as De}from"./CbBCXwzm.js";import{r as m,C as re,R as S,M as Te,I as te,O as ze}from"./BMB5u1EX.js";import{T as ne}from"./D7ozXiSB.js";const Ue=[{href:"/observatory",label:"Observatory",shortcut:"O"},{href:"/graph",label:"Graph",shortcut:"G"},{href:"/memories",label:"Memories",shortcut:"M"},{href:"/timeline",label:"Timeline",shortcut:"T"},{href:"/feed",label:"Feed",shortcut:"F"},{href:"/explore",label:"Explore",shortcut:"E"},{href:"/reasoning",label:"Reasoning",shortcut:"R"},{href:"/stats",label:"Stats",shortcut:"S"},{href:"/settings",label:"Settings",shortcut:","}],M=-.93,P=.83,z=.024,U=.058,Ge=-.965,Xe=-.9,Ye=-.4,We=.92,Be=-.73,Ke=-.44,Ze=.96,G=[...m(re.forward),1],je=[...m(S.luciferin),1],qe=[...m(S.bridge),.36],Je=[...m(S.bridge),.36],Qe=[...m(Te.blackwater),.15];function $e(d,e={}){return new et(d,e)}class et{constructor(e,s){N(this,"text");N(this,"routes");N(this,"activePath");N(this,"hoverHref",null);N(this,"expanded",!1);N(this,"ready",!1);this.text=new ne(e),this.routes=s.routes??Ue,this.activePath=s.activePath??""}async init(){await this.text.init(),this.ready=!0,this.rebuild()}setActivePath(e){this.activePath!==e&&(this.activePath=e,this.rebuild())}setHoverFromNdc(e,s){const l=e<=Xe&&s>=Ye&&s<=We,u=e<=Be&&s>=Ke&&s<=Ze,A=this.expanded?u:l;A!==this.expanded&&(this.expanded=A,A||(this.hoverHref=null),this.rebuild());const x=this.pickAt(e,s),k=(x==null?void 0:x.payload.href)??null;return k!==this.hoverHref&&(this.hoverHref=k,this.rebuild()),x}clearHover(){!this.expanded&&this.hoverHref===null||(this.expanded=!1,this.hoverHref=null,this.rebuild())}pickAt(e,s){const l=this.text.pickAt(e,s);if(!l||l.kind!=="route-nav")return null;const u=l.payload;return u.route?{id:l.id,kind:"route-nav",payload:u.route}:null}render(e){this.text.render(e)}dispose(){this.text.dispose()}rebuild(){this.ready&&this.text.setText(this.expanded?this.buildExpanded():this.buildCollapsed())}buildCollapsed(){return this.routes.map((e,s)=>{const l=this.isActive(e.href),u=e.shortcut??e.label.charAt(0).toUpperCase();return{id:`route-nav-marker:${e.href}`,kind:"route-nav-marker",text:u,x:Ge,y:P-s*U,size:z,color:l?G:Je,startFrame:0,revealSpan:1,maxWidthEm:4}})}buildExpanded(){return[{id:"route-nav:rail",kind:"route-nav-rail",text:"COGNITIVE OS",x:M,y:P+.075,size:.021,color:Qe,revealSpan:1},...this.routes.map((e,s)=>{const l=this.isActive(e.href),u=this.hoverHref===e.href,A=l?G:u?je:qe,x=l?">":u?"+":"-",k=e.shortcut?` ${e.shortcut}`:"";return{id:`route-nav:${e.href}`,kind:"route-nav",text:`${x} ${e.label.toUpperCase()}${k}`,x:l||u?M+.012:M,y:P-s*U,size:l||u?z*1.06:z,color:A,startFrame:0,revealSpan:1,maxWidthEm:16,hitPadX:.03,hitPadY:.02,route:e}}),...this.hoverHref?[{id:"route-nav:hover-ring",kind:"route-nav-focus",text:">>>>>>>>>>>>>>>>",x:M-.01,y:P-this.routes.findIndex(e=>e.href===this.hoverHref)*U-.029,size:.012,color:G,revealSpan:1}]:[]]}isActive(e){const s=this.activePath||"";return s===e||s.endsWith(e)||e==="/observatory"&&(s==="/"||s==="")}}function tt(d){return{organ:d,nodes:[],edges:[],events:[],receipts:[],scalars:{},alive:!1}}var rt=Me("
");function mt(d,e){Re(e,!0);const s=()=>Ve(De,"$page",l),[l,u]=He();let A=_(e,"seed",3,"vestige-route-organ-v1"),x=_(e,"scene",3,null),k=_(e,"embedded",3,!1),se=_(e,"demo",3,"recall-path"),ie=_(e,"loading",3,!1),X=_(e,"error",3,null),ae=_(e,"emptyLabel",3,"NO ROUTE DATA IN FIELD"),C=Ie(()=>x()??tt(e.organ)),f=R(null),v=R(null),i=null,o=null,y=[],w=R(0),O=R(0),b=R(!1),L=R(!1),H=R(!1),V=null,F=null;const oe=[...m(re.forward),1],Y=[...m(S.recall),.58],le=[...m(S.luciferin),.86],W=[...m(te.veto),.9],ue=[...m(te.caution),.78];function ce(){if(typeof window>"u")return;const t=window.matchMedia("(prefers-reduced-motion: reduce)");t.matches&&!n(L)&&p(b,!0);const r=a=>{n(L)||p(b,a.matches,!0)};return t.addEventListener("change",r),()=>t.removeEventListener("change",r)}function de(){p(L,!0),p(b,!n(b)),I()}ee(()=>{var t;(t=n(v))==null||t.setPaused(n(b)),I()});function B(t){var r;if(n(v)){for(const a of y)(r=a.uploadScene)==null||r.call(a,t);n(v).demoClock.reset(),I()}}function he(t,r){p(w,t,!0),p(O,r,!0),o==null||o.setActivePath(K()),I(t,r)}async function fe(t){var r;p(H,!1),p(v,t,!0);for(const a of y)(r=a.dispose)==null||r.call(a);i==null||i.dispose(),o==null||o.dispose(),y=typeof e.passes=="function"?e.passes(t,n(C)):e.passes??[];for(const a of y)t.addPass(a);o=$e(t,{activePath:K()}),i=new ne(t),t.addPass(o),t.addPass(i),await Promise.all([o.init(),i.init()]),n(v)===t&&(p(H,!0),B(n(C)))}ee(()=>{const t=n(C);!n(v)||!n(H)||_e(()=>B(t))});function K(){const t=s().url.pathname;return t.startsWith(T)?t.slice(T.length)||"/":t}function Z(t){return t.replace(/[—–]/g,"-").replace(/[‘’]/g,"'").replace(/[“”]/g,'"').replace(/…/g,"...").replace(/[^\x20-\x7E]/g,"?")}function pe(t=n(w),r=n(O)){const a=[{id:"route-chrome:pause",kind:"route-chrome",text:n(b)?"> RESUME":"|| PAUSE",x:.66,y:-.86,size:.034,color:n(b)?ue:oe,revealSpan:1},{id:"route-chrome:telemetry",kind:"route-telemetry",text:`${e.organ.toUpperCase()} - ${t}F - ${r}FPS`,x:.44,y:.88,size:.022,color:Y,revealSpan:1}];return ie()?a.push({id:"route-chrome:loading",kind:"route-status",text:"REPLAYING COGNITIVE RECEIPT...",x:-.23,y:.02,size:.046,color:le,startFrame:Math.max(0,t-90),revealSpan:72}):X()?a.push({id:"route-chrome:error-pulse",kind:"route-status-pulse",text:"!!!!!!!!!!!!!!!!!!!!!!!!",x:-.36,y:-.035,size:.025,color:W,revealSpan:1},{id:"route-chrome:error",kind:"route-status",text:Z(`ERROR - ${X()}`).slice(0,72),x:-.54,y:.025,size:.032,color:W,revealSpan:14,maxWidthEm:48}):n(C).alive||a.push({id:"route-chrome:empty",kind:"route-status",text:Z(ae()),x:-.36,y:.02,size:.034,color:Y,revealSpan:24,maxWidthEm:48}),a}function I(t=n(w),r=n(O)){i==null||i.setText(pe(t,r))}function j(t){if(!n(f))return null;const r=n(f).getBoundingClientRect();return r.width===0||r.height===0?null:{x:(t.clientX-r.left)/r.width*2-1,y:-((t.clientY-r.top)/r.height*2-1)}}function me(t){if(!n(f)||!n(v))return;const r=n(f).getBoundingClientRect();if(r.width===0||r.height===0)return;const a=Math.max(1e-4,r.width/Math.max(1,r.height)),h={x:t.x*Math.max(a,1),y:t.y/Math.min(a,1)},c=V??h,E={x:c.x+(h.x-c.x)*.35,y:c.y+(h.y-c.y)*.35};V=E,n(v).setCursorPreNdc(E.x,E.y,E.x-c.x,E.y-c.y)}function ve(t){const r=j(t);if(!r)return;me(r);const a=o==null?void 0:o.setHoverFromNdc(r.x,r.y),h=i==null?void 0:i.pickAt(r.x,r.y),c=(h==null?void 0:h.id)??null;c!==F&&(F=c,i==null||i.setRunDepth(c,1)),n(f)&&(n(f).style.cursor=a||h||e.onpick?"crosshair":"default")}function xe(){var t;o==null||o.clearHover(),F=null,i==null||i.setRunDepth(null),V=null,(t=n(v))==null||t.setCursorPreNdc(999,999,0,0),n(f)&&(n(f).style.cursor="default")}async function ye(t){var c,E,q;const r=j(t);if(!r)return;const a=(o==null?void 0:o.pickAt(r.x,r.y))??null;if(a){await Fe(`${T}${a.payload.href}`);return}const h=i==null?void 0:i.pickAt(r.x,r.y);if((h==null?void 0:h.id)==="route-chrome:pause"){de();return}for(let D=y.length-1;D>=0;D--){const J=await((E=(c=y[D]).pickAt)==null?void 0:E.call(c,r.x,r.y));if(J){(q=e.onpick)==null||q.call(e,J);return}}}Q(()=>()=>{var t;for(const r of y)(t=r.dispose)==null||t.call(r);i==null||i.dispose(),o==null||o.dispose(),y=[],i=null,o=null}),Q(()=>ce());var g=rt(),ge=Pe(g);ze(ge,{get demo(){return se()},get seed(){return A()},onframe:he,onready:fe}),we(g),Le(g,t=>p(f,t),()=>n(f)),ke(()=>Oe(g,1,`${k()?"absolute":"fixed"} inset-0 overflow-hidden`)),$("click",g,ye),$("pointermove",g,ve),Ne("pointerleave",g,xe),Se(d,g),Ce(),u()}be(["click","pointermove"]);export{mt as R,tt as e}; diff --git a/apps/dashboard/build/_app/immutable/chunks/BpEKQwpr.js.br b/apps/dashboard/build/_app/immutable/chunks/BpEKQwpr.js.br new file mode 100644 index 0000000..3d71e58 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/BpEKQwpr.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BpEKQwpr.js.gz b/apps/dashboard/build/_app/immutable/chunks/BpEKQwpr.js.gz new file mode 100644 index 0000000..57899bc Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/BpEKQwpr.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/Bzak7iHL.js.gz b/apps/dashboard/build/_app/immutable/chunks/Bzak7iHL.js.gz index 0311328..f429ed1 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/Bzak7iHL.js.gz and b/apps/dashboard/build/_app/immutable/chunks/Bzak7iHL.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BzfFPM53.js.gz b/apps/dashboard/build/_app/immutable/chunks/BzfFPM53.js.gz index 394991e..027412c 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/BzfFPM53.js.gz and b/apps/dashboard/build/_app/immutable/chunks/BzfFPM53.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/C2CaJvaA.js.gz b/apps/dashboard/build/_app/immutable/chunks/C2CaJvaA.js.gz index 11e9ccd..5ef4ef6 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/C2CaJvaA.js.gz and b/apps/dashboard/build/_app/immutable/chunks/C2CaJvaA.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CGq8RnJq.js.gz b/apps/dashboard/build/_app/immutable/chunks/CGq8RnJq.js.gz index 15cb961..ac2dc4f 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/CGq8RnJq.js.gz and b/apps/dashboard/build/_app/immutable/chunks/CGq8RnJq.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CKbQrCJw.js.gz b/apps/dashboard/build/_app/immutable/chunks/CKbQrCJw.js.gz index 7bde9b4..d87e87c 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/CKbQrCJw.js.gz and b/apps/dashboard/build/_app/immutable/chunks/CKbQrCJw.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CbBCXwzm.js.gz b/apps/dashboard/build/_app/immutable/chunks/CbBCXwzm.js.gz index 531742c..07721da 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/CbBCXwzm.js.gz and b/apps/dashboard/build/_app/immutable/chunks/CbBCXwzm.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CcUbQ_Wl.js.gz b/apps/dashboard/build/_app/immutable/chunks/CcUbQ_Wl.js.gz index 3353949..3d7c9cc 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/CcUbQ_Wl.js.gz and b/apps/dashboard/build/_app/immutable/chunks/CcUbQ_Wl.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/Ccqjq5DS.js.gz b/apps/dashboard/build/_app/immutable/chunks/Ccqjq5DS.js.gz index 2b0ff3e..9f86e9d 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/Ccqjq5DS.js.gz and b/apps/dashboard/build/_app/immutable/chunks/Ccqjq5DS.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/Ch9vNiEl.js.gz b/apps/dashboard/build/_app/immutable/chunks/Ch9vNiEl.js.gz index 27f3118..560100c 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/Ch9vNiEl.js.gz and b/apps/dashboard/build/_app/immutable/chunks/Ch9vNiEl.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/CkiUhdKe.js.gz b/apps/dashboard/build/_app/immutable/chunks/CkiUhdKe.js.gz index 204f82d..7ab6acf 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/CkiUhdKe.js.gz and b/apps/dashboard/build/_app/immutable/chunks/CkiUhdKe.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/Cqe0su6e.js b/apps/dashboard/build/_app/immutable/chunks/Cqe0su6e.js deleted file mode 100644 index 84d47fd..0000000 --- a/apps/dashboard/build/_app/immutable/chunks/Cqe0su6e.js +++ /dev/null @@ -1 +0,0 @@ -var ge=Object.defineProperty;var Ee=(d,e,s)=>e in d?ge(d,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):d[e]=s;var N=(d,e,s)=>Ee(d,typeof e!="symbol"?e+"":e,s);import"./Bzak7iHL.js";import{d as Ae,o as J,b as Q,e as be}from"./DAau0uzT.js";import{p as Ne,j as $,g as n,y as Re,Y as _e,a as ke,b as Se,u as Ce,d as R,f as Ie,s as p,c as Me,r as Pe}from"./CGq8RnJq.js";import{s as we}from"./uCQU803Y.js";import{b as Oe}from"./Ccqjq5DS.js";import{p as _,s as Le,a as He}from"./DV6OI5iy.js";import{g as Ve}from"./DJDK-KWF.js";import{b as T}from"./DY7cP31Q.js";import{p as Fe}from"./CbBCXwzm.js";import{r as m,C as te,R as S,M as De,I as ee,O as Te}from"./BMB5u1EX.js";import{T as re}from"./D7ozXiSB.js";const ze=[{href:"/observatory",label:"Observatory",shortcut:"O"},{href:"/graph",label:"Graph",shortcut:"G"},{href:"/memories",label:"Memories",shortcut:"M"},{href:"/timeline",label:"Timeline",shortcut:"T"},{href:"/feed",label:"Feed",shortcut:"F"},{href:"/explore",label:"Explore",shortcut:"E"},{href:"/reasoning",label:"Reasoning",shortcut:"R"},{href:"/stats",label:"Stats",shortcut:"S"},{href:"/settings",label:"Settings",shortcut:","}],M=-.93,P=.83,z=.024,U=.058,Ue=-.965,Ge=-.9,Xe=-.4,Ye=.92,We=-.73,Be=-.44,Ke=.96,G=[...m(te.forward),1],Ze=[...m(S.luciferin),1],je=[...m(S.bridge),.36],qe=[...m(S.bridge),.36],Je=[...m(De.blackwater),.15];function Qe(d,e={}){return new $e(d,e)}class $e{constructor(e,s){N(this,"text");N(this,"routes");N(this,"activePath");N(this,"hoverHref",null);N(this,"expanded",!1);N(this,"ready",!1);this.text=new re(e),this.routes=s.routes??ze,this.activePath=s.activePath??""}async init(){await this.text.init(),this.ready=!0,this.rebuild()}setActivePath(e){this.activePath!==e&&(this.activePath=e,this.rebuild())}setHoverFromNdc(e,s){const l=e<=Ge&&s>=Xe&&s<=Ye,u=e<=We&&s>=Be&&s<=Ke,E=this.expanded?u:l;E!==this.expanded&&(this.expanded=E,E||(this.hoverHref=null),this.rebuild());const x=this.pickAt(e,s),k=(x==null?void 0:x.payload.href)??null;return k!==this.hoverHref&&(this.hoverHref=k,this.rebuild()),x}clearHover(){!this.expanded&&this.hoverHref===null||(this.expanded=!1,this.hoverHref=null,this.rebuild())}pickAt(e,s){const l=this.text.pickAt(e,s);if(!l||l.kind!=="route-nav")return null;const u=l.payload;return u.route?{id:l.id,kind:"route-nav",payload:u.route}:null}render(e){this.text.render(e)}dispose(){this.text.dispose()}rebuild(){this.ready&&this.text.setText(this.expanded?this.buildExpanded():this.buildCollapsed())}buildCollapsed(){return this.routes.map((e,s)=>{const l=this.isActive(e.href),u=e.shortcut??e.label.charAt(0).toUpperCase();return{id:`route-nav-marker:${e.href}`,kind:"route-nav-marker",text:u,x:Ue,y:P-s*U,size:z,color:l?G:qe,startFrame:0,revealSpan:1,maxWidthEm:4}})}buildExpanded(){return[{id:"route-nav:rail",kind:"route-nav-rail",text:"COGNITIVE OS",x:M,y:P+.075,size:.021,color:Je,revealSpan:1},...this.routes.map((e,s)=>{const l=this.isActive(e.href),u=this.hoverHref===e.href,E=l?G:u?Ze:je,x=l?">":u?"+":"-",k=e.shortcut?` ${e.shortcut}`:"";return{id:`route-nav:${e.href}`,kind:"route-nav",text:`${x} ${e.label.toUpperCase()}${k}`,x:l||u?M+.012:M,y:P-s*U,size:l||u?z*1.06:z,color:E,startFrame:0,revealSpan:1,maxWidthEm:16,hitPadX:.03,hitPadY:.02,route:e}}),...this.hoverHref?[{id:"route-nav:hover-ring",kind:"route-nav-focus",text:">>>>>>>>>>>>>>>>",x:M-.01,y:P-this.routes.findIndex(e=>e.href===this.hoverHref)*U-.029,size:.012,color:G,revealSpan:1}]:[]]}isActive(e){const s=this.activePath||"";return s===e||s.endsWith(e)||e==="/observatory"&&(s==="/"||s==="")}}function et(d){return{organ:d,nodes:[],edges:[],events:[],receipts:[],scalars:{},alive:!1}}var tt=Ie("
");function pt(d,e){Ne(e,!0);const s=()=>He(Fe,"$page",l),[l,u]=Le();let E=_(e,"seed",3,"vestige-route-organ-v1"),x=_(e,"scene",3,null),k=_(e,"embedded",3,!1),ne=_(e,"demo",3,"recall-path"),se=_(e,"loading",3,!1),X=_(e,"error",3,null),ie=_(e,"emptyLabel",3,"NO ROUTE DATA IN FIELD"),C=Ce(()=>x()??et(e.organ)),f=R(null),v=R(null),i=null,a=null,A=[],w=R(0),O=R(0),b=R(!1),L=R(!1),H=R(!1),V=null,F=null;const oe=[...m(te.forward),1],Y=[...m(S.recall),.58],ae=[...m(S.luciferin),.86],W=[...m(ee.veto),.9],le=[...m(ee.caution),.78];function ue(){if(typeof window>"u")return;const t=window.matchMedia("(prefers-reduced-motion: reduce)");t.matches&&!n(L)&&p(b,!0);const r=o=>{n(L)||p(b,o.matches,!0)};return t.addEventListener("change",r),()=>t.removeEventListener("change",r)}function ce(){p(L,!0),p(b,!n(b)),I()}$(()=>{var t;(t=n(v))==null||t.setPaused(n(b)),I()});function B(t){var r;if(n(v)){for(const o of A)(r=o.uploadScene)==null||r.call(o,t);n(v).demoClock.reset(),I()}}function de(t,r){p(w,t,!0),p(O,r,!0),a==null||a.setActivePath(K()),I(t,r)}async function he(t){var r;p(H,!1),p(v,t,!0);for(const o of A)(r=o.dispose)==null||r.call(o);i==null||i.dispose(),a==null||a.dispose(),A=typeof e.passes=="function"?e.passes(t,n(C)):e.passes??[];for(const o of A)t.addPass(o);a=Qe(t,{activePath:K()}),i=new re(t),t.addPass(a),t.addPass(i),await Promise.all([a.init(),i.init()]),n(v)===t&&(p(H,!0),B(n(C)))}$(()=>{const t=n(C);!n(v)||!n(H)||Re(()=>B(t))});function K(){const t=s().url.pathname;return t.startsWith(T)?t.slice(T.length)||"/":t}function Z(t){return t.replace(/[—–]/g,"-").replace(/[‘’]/g,"'").replace(/[“”]/g,'"').replace(/…/g,"...").replace(/[^\x20-\x7E]/g,"?")}function fe(t=n(w),r=n(O)){const o=[{id:"route-chrome:pause",kind:"route-chrome",text:n(b)?"> RESUME":"|| PAUSE",x:.66,y:-.86,size:.034,color:n(b)?le:oe,revealSpan:1},{id:"route-chrome:telemetry",kind:"route-telemetry",text:`${e.organ.toUpperCase()} - ${t}F - ${r}FPS`,x:.44,y:.88,size:.022,color:Y,revealSpan:1}];return se()?o.push({id:"route-chrome:loading",kind:"route-status",text:"REPLAYING COGNITIVE RECEIPT...",x:-.23,y:.02,size:.046,color:ae,startFrame:Math.max(0,t-90),revealSpan:72}):X()?o.push({id:"route-chrome:error-pulse",kind:"route-status-pulse",text:"!!!!!!!!!!!!!!!!!!!!!!!!",x:-.36,y:-.035,size:.025,color:W,revealSpan:1},{id:"route-chrome:error",kind:"route-status",text:Z(`ERROR - ${X()}`).slice(0,72),x:-.54,y:.025,size:.032,color:W,revealSpan:14,maxWidthEm:48}):n(C).alive||o.push({id:"route-chrome:empty",kind:"route-status",text:Z(ie()),x:-.36,y:.02,size:.034,color:Y,revealSpan:24,maxWidthEm:48}),o}function I(t=n(w),r=n(O)){i==null||i.setText(fe(t,r))}function j(t){if(!n(f))return null;const r=n(f).getBoundingClientRect();return r.width===0||r.height===0?null:{x:(t.clientX-r.left)/r.width*2-1,y:-((t.clientY-r.top)/r.height*2-1)}}function pe(t){if(!n(f)||!n(v))return;const r=n(f).getBoundingClientRect();if(r.width===0||r.height===0)return;const o=Math.max(1e-4,r.width/Math.max(1,r.height)),h={x:t.x*Math.max(o,1),y:t.y/Math.min(o,1)},c=V??h,g={x:c.x+(h.x-c.x)*.35,y:c.y+(h.y-c.y)*.35};V=g,n(v).setCursorPreNdc(g.x,g.y,g.x-c.x,g.y-c.y)}function me(t){const r=j(t);if(!r)return;pe(r);const o=a==null?void 0:a.setHoverFromNdc(r.x,r.y),h=i==null?void 0:i.pickAt(r.x,r.y),c=(h==null?void 0:h.id)??null;c!==F&&(F=c,i==null||i.setRunDepth(c,1)),n(f)&&(n(f).style.cursor=o||h||e.onpick?"crosshair":"default")}function ve(){var t;a==null||a.clearHover(),F=null,i==null||i.setRunDepth(null),V=null,(t=n(v))==null||t.setCursorPreNdc(999,999,0,0),n(f)&&(n(f).style.cursor="default")}async function xe(t){var c,g;const r=j(t);if(!r)return;const o=(a==null?void 0:a.pickAt(r.x,r.y))??null;if(o){await Ve(`${T}${o.payload.href}`);return}const h=i==null?void 0:i.pickAt(r.x,r.y);if((h==null?void 0:h.id)==="route-chrome:pause"){ce();return}for(const D of A){const q=await((c=D.pickAt)==null?void 0:c.call(D,r.x,r.y));if(q){(g=e.onpick)==null||g.call(e,q);return}}}J(()=>()=>{var t;for(const r of A)(t=r.dispose)==null||t.call(r);i==null||i.dispose(),a==null||a.dispose(),A=[],i=null,a=null}),J(()=>ue());var y=tt(),ye=Me(y);Te(ye,{get demo(){return ne()},get seed(){return E()},onframe:de,onready:he}),Pe(y),Oe(y,t=>p(f,t),()=>n(f)),_e(()=>we(y,1,`${k()?"absolute":"fixed"} inset-0 overflow-hidden`)),Q("click",y,xe),Q("pointermove",y,me),be("pointerleave",y,ve),ke(d,y),Se(),u()}Ae(["click","pointermove"]);export{pt as R,et as e}; diff --git a/apps/dashboard/build/_app/immutable/chunks/Cqe0su6e.js.br b/apps/dashboard/build/_app/immutable/chunks/Cqe0su6e.js.br deleted file mode 100644 index 6107641..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/Cqe0su6e.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/Cqe0su6e.js.gz b/apps/dashboard/build/_app/immutable/chunks/Cqe0su6e.js.gz deleted file mode 100644 index 15df25d..0000000 Binary files a/apps/dashboard/build/_app/immutable/chunks/Cqe0su6e.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/chunks/Cqk6fVmx.js.gz b/apps/dashboard/build/_app/immutable/chunks/Cqk6fVmx.js.gz index 6be12e3..bf0720f 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/Cqk6fVmx.js.gz and b/apps/dashboard/build/_app/immutable/chunks/Cqk6fVmx.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/D35IQVqe.js.gz b/apps/dashboard/build/_app/immutable/chunks/D35IQVqe.js.gz index 44cf936..29dd91f 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/D35IQVqe.js.gz and b/apps/dashboard/build/_app/immutable/chunks/D35IQVqe.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/D7ozXiSB.js.gz b/apps/dashboard/build/_app/immutable/chunks/D7ozXiSB.js.gz index 05c7b81..f6225e7 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/D7ozXiSB.js.gz and b/apps/dashboard/build/_app/immutable/chunks/D7ozXiSB.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DAau0uzT.js.gz b/apps/dashboard/build/_app/immutable/chunks/DAau0uzT.js.gz index 129e2f3..e94a5e7 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/DAau0uzT.js.gz and b/apps/dashboard/build/_app/immutable/chunks/DAau0uzT.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/BeGBxCGK.js b/apps/dashboard/build/_app/immutable/chunks/DETSv_kY.js similarity index 59% rename from apps/dashboard/build/_app/immutable/chunks/BeGBxCGK.js rename to apps/dashboard/build/_app/immutable/chunks/DETSv_kY.js index 7b9ca2b..c57068c 100644 --- a/apps/dashboard/build/_app/immutable/chunks/BeGBxCGK.js +++ b/apps/dashboard/build/_app/immutable/chunks/DETSv_kY.js @@ -1,4 +1,4 @@ -var F=Object.defineProperty;var D=(o,e,t)=>e in o?F(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var c=(o,e,t)=>D(o,typeof e!="symbol"?e+"":e,t);import{r as m,C as A,I as E,R as _,a as O}from"./BMB5u1EX.js";const S=` +var D=Object.defineProperty;var N=(o,e,t)=>e in o?D(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var f=(o,e,t)=>N(o,typeof e!="symbol"?e+"":e,t);import{r as h,C as F,I as C,R as x,a as I}from"./BMB5u1EX.js";const M=` struct Params { frame: f32, loop_phase: f32, @@ -53,8 +53,8 @@ fn orbit(base: vec2f, phase01: f32, spin_scale: f32) -> vec2f { let rr = radius * (1.0 + 0.016 * sin(params.time * 1.1 + phase01 * TAU)); return vec2f(cos(ang), sin(ang)) * rr; } -`,N=` -${S} +`,k=` +${M} @group(0) @binding(0) var params: Params; @group(0) @binding(1) var cells: array; @@ -101,7 +101,7 @@ fn fs_splat(in: VSOut) -> @location(0) vec4f { // .b = scar/seam accent for endangered cells return vec4f(body, body * (0.4 + metric2 * 0.9), body * scar * 0.7, 1.0); } -`,I=` +`,z=` struct BlurDir { dir: vec2f, _pad: vec2f }; @group(0) @binding(0) var blur_sampler: sampler; @group(0) @binding(1) var blur_src: texture_2d; @@ -130,8 +130,8 @@ fn fs_blur(in: VSOut) -> @location(0) vec4f { acc = acc + textureSampleLevel(blur_src, blur_sampler, in.uv + stepv * 2.0, 0.0) * 0.06136; return acc; } -`,z=` -${S} +`,$=` +${M} @group(0) @binding(0) var params: Params; @group(0) @binding(3) var field_sampler: sampler; @@ -178,8 +178,8 @@ fn fs_membrane(in: VSOut) -> @location(0) vec4f { let vignette = smoothstep(1.02, 0.10, distance(in.uv, vec2f(0.5))); return vec4f(color * (0.5 + 0.5 * vignette) * params.brightness, 1.0); } -`,k=` -${S} +`,H=` +${M} @group(0) @binding(0) var params: Params; @group(0) @binding(1) var cells: array; @@ -235,4 +235,4 @@ fn fs_cell(in: VSOut) -> @location(0) vec4f { color = color + scarlet * scar * smoothstep(0.16, 0.0, abs(d - 0.74)) * 1.5; return vec4f(color, 1.0); } -`,x="rgba16float",B=2048,L=16;class Q{constructor(e){c(this,"engine");c(this,"cells",[]);c(this,"scalars",{});c(this,"resources",null);c(this,"sampler",null);c(this,"splatBindLayout",null);c(this,"blurBindLayout",null);c(this,"membraneBindLayout",null);c(this,"splatPipeline",null);c(this,"blurPipeline",null);c(this,"membranePipeline",null);c(this,"cellPipeline",null);c(this,"cellCount",0);this.engine=e}setCells(e,t={}){this.cells=e.slice(0,B),this.scalars=t;const l=this.engine.gpuDevice;l&&(this.ensurePipelines(l),this.ensureResources(l),this.uploadBuffers(l))}ensurePipelines(e){if(this.splatPipeline||!this.engine.paramsBuffer)return;const t=P(e,"living-field-splat",N),l=P(e,"living-field-blur",I),r=P(e,"living-field-membrane",z),n=P(e,"living-field-cell",k);this.splatBindLayout=e.createBindGroupLayout({label:"living-field-splat-layout",entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}}]}),this.blurBindLayout=e.createBindGroupLayout({label:"living-field-blur-layout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}}]}),this.membraneBindLayout=e.createBindGroupLayout({label:"living-field-membrane-layout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:3,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}}]});const s=e.createPipelineLayout({label:"living-field-splat-pl",bindGroupLayouts:[this.splatBindLayout]}),i=e.createPipelineLayout({label:"living-field-blur-pl",bindGroupLayouts:[this.blurBindLayout]}),u=e.createPipelineLayout({label:"living-field-membrane-pl",bindGroupLayouts:[this.membraneBindLayout]});this.sampler=e.createSampler({magFilter:"linear",minFilter:"linear"});const a={color:{srcFactor:"one",dstFactor:"one",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one",operation:"add"}};this.splatPipeline=e.createRenderPipeline({label:"living-field-splat",layout:s,vertex:{module:t,entryPoint:"vs_splat"},fragment:{module:t,entryPoint:"fs_splat",targets:[{format:x,blend:a}]},primitive:{topology:"triangle-list"}}),this.blurPipeline=e.createRenderPipeline({label:"living-field-blur",layout:i,vertex:{module:l,entryPoint:"vs_fullscreen"},fragment:{module:l,entryPoint:"fs_blur",targets:[{format:x}]},primitive:{topology:"triangle-list"}}),this.membranePipeline=e.createRenderPipeline({label:"living-field-membrane",layout:u,vertex:{module:r,entryPoint:"vs_fullscreen"},fragment:{module:r,entryPoint:"fs_membrane",targets:[{format:this.engine.sceneFormat,blend:a}]},primitive:{topology:"triangle-list"}}),this.cellPipeline=e.createRenderPipeline({label:"living-field-cells",layout:s,vertex:{module:n,entryPoint:"vs_cell"},fragment:{module:n,entryPoint:"fs_cell",targets:[{format:this.engine.sceneFormat,blend:a}]},primitive:{topology:"triangle-list"}})}ensureResources(e){var G,M,w,R,U;if(!this.splatBindLayout||!this.blurBindLayout||!this.membraneBindLayout||!this.engine.paramsBuffer||!this.sampler)return;const t=Math.max(16,Math.floor((this.engine.params[6]||1280)/2)),l=Math.max(16,Math.floor((this.engine.params[7]||720)/2)),r=!this.resources||this.resources.fieldSize[0]!==t||this.resources.fieldSize[1]!==l;let n=(G=this.resources)==null?void 0:G.cellBuffer,s=(M=this.resources)==null?void 0:M.blurHBuffer,i=(w=this.resources)==null?void 0:w.blurVBuffer;if(n||(n=e.createBuffer({label:"living-field-cells",size:B*L*4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})),s||(s=e.createBuffer({label:"living-field-blur-h",size:16,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),e.queue.writeBuffer(s,0,new Float32Array([1,0,0,0]))),i||(i=e.createBuffer({label:"living-field-blur-v",size:16,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),e.queue.writeBuffer(i,0,new Float32Array([0,1,0,0]))),!r&&this.resources)return;(R=this.resources)==null||R.fieldA.destroy(),(U=this.resources)==null||U.fieldB.destroy();const u=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING,a=e.createTexture({label:"living-field-a",size:[t,l],format:x,usage:u}),p=e.createTexture({label:"living-field-b",size:[t,l],format:x,usage:u}),f=a.createView(),b=p.createView(),v=e.createBindGroup({label:"living-field-splat-bind",layout:this.splatBindLayout,entries:[{binding:0,resource:{buffer:this.engine.paramsBuffer}},{binding:1,resource:{buffer:n}}]}),d=e.createBindGroup({label:"living-field-cell-bind",layout:this.splatBindLayout,entries:[{binding:0,resource:{buffer:this.engine.paramsBuffer}},{binding:1,resource:{buffer:n}}]}),h=e.createBindGroup({label:"living-field-blur-h-bind",layout:this.blurBindLayout,entries:[{binding:0,resource:this.sampler},{binding:1,resource:f},{binding:2,resource:{buffer:s}}]}),g=e.createBindGroup({label:"living-field-blur-v-bind",layout:this.blurBindLayout,entries:[{binding:0,resource:this.sampler},{binding:1,resource:b},{binding:2,resource:{buffer:i}}]}),T=e.createBindGroup({label:"living-field-membrane-bind",layout:this.membraneBindLayout,entries:[{binding:0,resource:{buffer:this.engine.paramsBuffer}},{binding:3,resource:this.sampler},{binding:4,resource:f}]});this.resources={cellBuffer:n,blurHBuffer:s,blurVBuffer:i,splatBindGroup:v,cellBindGroup:d,blurHBindGroup:h,blurVBindGroup:g,membraneBindGroup:T,fieldA:a,fieldB:p,fieldAView:f,fieldBView:b,fieldSize:[t,l]}}uploadBuffers(e){if(!this.resources)return;const t=new Float32Array(B*L);this.cellCount=Math.min(B,this.cells.length);for(let l=0;l.8&&(s|=4);const i=l*L;t[i+0]=r.x,t[i+1]=r.y,t[i+2]=Math.max(.006,r.radius),t[i+3]=n,t[i+4]=r.hue[0],t[i+5]=r.hue[1],t[i+6]=r.hue[2],t[i+7]=C(r.energy),t[i+8]=r.phase,t[i+9]=s,t[i+10]=C(r.metric2??r.energy),t[i+11]=r.spin??1,t[i+12]=l,t[i+13]=r.seed??r.phase*97.13,t[i+14]=0,t[i+15]=0}this.engine.params[2]=this.cellCount,e.queue.writeBuffer(this.resources.cellBuffer,0,t)}compute(e){const t=this.engine.gpuDevice;if(!t||!this.resources||!this.splatPipeline||!this.blurPipeline)return;this.ensureResources(t);const l=this.resources,r=e.beginRenderPass({label:"living-field-splat-pass",colorAttachments:[{view:l.fieldAView,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}]});r.setPipeline(this.splatPipeline),r.setBindGroup(0,l.splatBindGroup),this.cellCount>0&&r.draw(6,this.cellCount),r.end();const n=e.beginRenderPass({label:"living-field-blur-h",colorAttachments:[{view:l.fieldBView,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}]});n.setPipeline(this.blurPipeline),n.setBindGroup(0,l.blurHBindGroup),n.draw(6,1),n.end();const s=e.beginRenderPass({label:"living-field-blur-v",colorAttachments:[{view:l.fieldAView,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}]});s.setPipeline(this.blurPipeline),s.setBindGroup(0,l.blurVBindGroup),s.draw(6,1),s.end()}render(e){!this.resources||!this.membranePipeline||!this.cellPipeline||(e.setPipeline(this.membranePipeline),e.setBindGroup(0,this.resources.membraneBindGroup),e.draw(6,1),this.cellCount>0&&(e.setPipeline(this.cellPipeline),e.setBindGroup(0,this.resources.cellBindGroup),e.draw(6,this.cellCount)))}orbitCpu(e,t,l,r){const n=Math.hypot(e,t);if(n<1e-4)return{x:e,y:t};const s=this.engine.params[10]||0,i=Math.atan2(t,e),u=(.045+l*.1)*s*r,a=i+u+Math.sin(s*.6+l*Math.PI*2)*.02,p=n*(1+.016*Math.sin(s*1.1+l*Math.PI*2));return{x:Math.cos(a)*p,y:Math.sin(a)*p}}pickAt(e,t){let l=null,r=1/0;for(let n=0;n{for(const n of r.messages)n.type==="error"&&console.error(`[living-field] ${e} WGSL ${n.type} ${n.lineNum}:${n.linePos} ${n.message}`)}),o.popErrorScope().then(r=>{r&&console.error(`[living-field] ${e} shader module validation: ${r.message}`)}),l}const V=2.399963229728653;function q(o,e={}){const t=o.length;if(t===0)return[];const l=e.maxRadius??.92,r=e.minCellR??.012,n=e.maxCellR??.05;return o.map((i,u)=>({d:i,i:u})).sort((i,u)=>(u.d.score||0)-(i.d.score||0)).map(({d:i},u)=>{const a=t>1?u/(t-1):0,p=l*Math.sqrt(.06+.94*a),f=u*V,b=Math.cos(f)*p,v=Math.sin(f)*p,d=y(i.score),h=r+(n-r)*Math.sqrt(d),g=i.hue??O(d);return{x:b,y:v,radius:h,hue:[g[0],g[1],g[2]],energy:y(i.energy??.35+.65*d),phase:u/t,pickId:i.id,kind:i.kind,payload:i.payload??i,selected:i.selected,scar:i.scar,metric2:y(i.metric2??d),spin:1}})}function W(o,e,t={}){if(o.length===0)return[];const r=t.maxRadius??.9,n=t.minCellR??.014,s=t.maxCellR??.05,i=Math.max(1,t.ringCount??new Set(o.map(e)).size),u=new Map;return o.map((a,p)=>{const f=(e(a,p)%i+i)%i,b=u.get(f)??0;u.set(f,b+1);const v=r*(.18+.82*(f/Math.max(1,i-1))),d=b*V+f*.7,h=y(a.score),g=a.hue??O(h);return{x:Math.cos(d)*v,y:Math.sin(d)*v,radius:n+(s-n)*Math.sqrt(h),hue:[g[0],g[1],g[2]],energy:y(a.energy??.35+.65*h),phase:f/i,pickId:a.id,kind:a.kind,payload:a.payload??a,selected:a.selected,scar:a.scar,metric2:y(a.metric2??h),spin:1}})}const X={oxygen:m(_.luciferin),healthy:m(_.healthy),recall:m(_.recall),bridge:m(_.bridge),debt:m(_.debt),scarlet:m(E.veto),caution:m(E.caution),forward:m(A.forward),retrograde:m(A.retrograde)};function y(o){return Math.min(1,Math.max(0,Number.isFinite(o)?o:0))}export{X as F,Q as L,W as a,q as l}; +`,P="rgba16float",L=2048,G=16;class W{constructor(e){f(this,"engine");f(this,"cells",[]);f(this,"scalars",{});f(this,"resources",null);f(this,"sampler",null);f(this,"splatBindLayout",null);f(this,"blurBindLayout",null);f(this,"membraneBindLayout",null);f(this,"splatPipeline",null);f(this,"blurPipeline",null);f(this,"membranePipeline",null);f(this,"cellPipeline",null);f(this,"cellCount",0);this.engine=e}setCells(e,t={}){this.cells=e.slice(0,L),this.scalars=t;const r=this.engine.gpuDevice;r&&(this.ensurePipelines(r),this.ensureResources(r),this.uploadBuffers(r))}ensurePipelines(e){if(this.splatPipeline||!this.engine.paramsBuffer)return;const t=S(e,"living-field-splat",k),r=S(e,"living-field-blur",z),i=S(e,"living-field-membrane",$),l=S(e,"living-field-cell",H);this.splatBindLayout=e.createBindGroupLayout({label:"living-field-splat-layout",entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}}]}),this.blurBindLayout=e.createBindGroupLayout({label:"living-field-blur-layout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}}]}),this.membraneBindLayout=e.createBindGroupLayout({label:"living-field-membrane-layout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:3,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}}]});const s=e.createPipelineLayout({label:"living-field-splat-pl",bindGroupLayouts:[this.splatBindLayout]}),n=e.createPipelineLayout({label:"living-field-blur-pl",bindGroupLayouts:[this.blurBindLayout]}),c=e.createPipelineLayout({label:"living-field-membrane-pl",bindGroupLayouts:[this.membraneBindLayout]});this.sampler=e.createSampler({magFilter:"linear",minFilter:"linear"});const a={color:{srcFactor:"one",dstFactor:"one",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one",operation:"add"}};this.splatPipeline=e.createRenderPipeline({label:"living-field-splat",layout:s,vertex:{module:t,entryPoint:"vs_splat"},fragment:{module:t,entryPoint:"fs_splat",targets:[{format:P,blend:a}]},primitive:{topology:"triangle-list"}}),this.blurPipeline=e.createRenderPipeline({label:"living-field-blur",layout:n,vertex:{module:r,entryPoint:"vs_fullscreen"},fragment:{module:r,entryPoint:"fs_blur",targets:[{format:P}]},primitive:{topology:"triangle-list"}}),this.membranePipeline=e.createRenderPipeline({label:"living-field-membrane",layout:c,vertex:{module:i,entryPoint:"vs_fullscreen"},fragment:{module:i,entryPoint:"fs_membrane",targets:[{format:this.engine.sceneFormat,blend:a}]},primitive:{topology:"triangle-list"}}),this.cellPipeline=e.createRenderPipeline({label:"living-field-cells",layout:s,vertex:{module:l,entryPoint:"vs_cell"},fragment:{module:l,entryPoint:"fs_cell",targets:[{format:this.engine.sceneFormat,blend:a}]},primitive:{topology:"triangle-list"}})}ensureResources(e){var w,R,U,A,E;if(!this.splatBindLayout||!this.blurBindLayout||!this.membraneBindLayout||!this.engine.paramsBuffer||!this.sampler)return;const t=Math.max(16,Math.floor((this.engine.params[6]||1280)/2)),r=Math.max(16,Math.floor((this.engine.params[7]||720)/2)),i=!this.resources||this.resources.fieldSize[0]!==t||this.resources.fieldSize[1]!==r;let l=(w=this.resources)==null?void 0:w.cellBuffer,s=(R=this.resources)==null?void 0:R.blurHBuffer,n=(U=this.resources)==null?void 0:U.blurVBuffer;if(l||(l=e.createBuffer({label:"living-field-cells",size:L*G*4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})),s||(s=e.createBuffer({label:"living-field-blur-h",size:16,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),e.queue.writeBuffer(s,0,new Float32Array([1,0,0,0]))),n||(n=e.createBuffer({label:"living-field-blur-v",size:16,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),e.queue.writeBuffer(n,0,new Float32Array([0,1,0,0]))),!i&&this.resources)return;(A=this.resources)==null||A.fieldA.destroy(),(E=this.resources)==null||E.fieldB.destroy();const c=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING,a=e.createTexture({label:"living-field-a",size:[t,r],format:P,usage:c}),u=e.createTexture({label:"living-field-b",size:[t,r],format:P,usage:c}),d=a.createView(),_=u.createView(),g=e.createBindGroup({label:"living-field-splat-bind",layout:this.splatBindLayout,entries:[{binding:0,resource:{buffer:this.engine.paramsBuffer}},{binding:1,resource:{buffer:l}}]}),m=e.createBindGroup({label:"living-field-cell-bind",layout:this.splatBindLayout,entries:[{binding:0,resource:{buffer:this.engine.paramsBuffer}},{binding:1,resource:{buffer:l}}]}),b=e.createBindGroup({label:"living-field-blur-h-bind",layout:this.blurBindLayout,entries:[{binding:0,resource:this.sampler},{binding:1,resource:d},{binding:2,resource:{buffer:s}}]}),B=e.createBindGroup({label:"living-field-blur-v-bind",layout:this.blurBindLayout,entries:[{binding:0,resource:this.sampler},{binding:1,resource:_},{binding:2,resource:{buffer:n}}]}),v=e.createBindGroup({label:"living-field-membrane-bind",layout:this.membraneBindLayout,entries:[{binding:0,resource:{buffer:this.engine.paramsBuffer}},{binding:3,resource:this.sampler},{binding:4,resource:d}]});this.resources={cellBuffer:l,blurHBuffer:s,blurVBuffer:n,splatBindGroup:g,cellBindGroup:m,blurHBindGroup:b,blurVBindGroup:B,membraneBindGroup:v,fieldA:a,fieldB:u,fieldAView:d,fieldBView:_,fieldSize:[t,r]}}uploadBuffers(e){if(!this.resources)return;const t=new Float32Array(L*G);this.cellCount=Math.min(L,this.cells.length);for(let r=0;r.8&&(a|=4);const u=r*G;t[u+0]=l,t[u+1]=s,t[u+2]=Math.max(.006,p(i.radius,.02)),t[u+3]=n,t[u+4]=p(i.hue[0]),t[u+5]=p(i.hue[1]),t[u+6]=p(i.hue[2]),t[u+7]=O(i.energy),t[u+8]=c,t[u+9]=a,t[u+10]=O(i.metric2??i.energy),t[u+11]=p(i.spin??1,1),t[u+12]=r,t[u+13]=p(i.seed??c*97.13),t[u+14]=0,t[u+15]=0}e.queue.writeBuffer(this.resources.cellBuffer,0,t)}compute(e){const t=this.engine.gpuDevice;if(!t||!this.resources||!this.splatPipeline||!this.blurPipeline)return;this.ensureResources(t);const r=this.resources,i=e.beginRenderPass({label:"living-field-splat-pass",colorAttachments:[{view:r.fieldAView,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}]});i.setPipeline(this.splatPipeline),i.setBindGroup(0,r.splatBindGroup),this.cellCount>0&&i.draw(6,this.cellCount),i.end();const l=e.beginRenderPass({label:"living-field-blur-h",colorAttachments:[{view:r.fieldBView,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}]});l.setPipeline(this.blurPipeline),l.setBindGroup(0,r.blurHBindGroup),l.draw(6,1),l.end();const s=e.beginRenderPass({label:"living-field-blur-v",colorAttachments:[{view:r.fieldAView,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}]});s.setPipeline(this.blurPipeline),s.setBindGroup(0,r.blurVBindGroup),s.draw(6,1),s.end()}render(e){!this.resources||!this.membranePipeline||!this.cellPipeline||(e.setPipeline(this.membranePipeline),e.setBindGroup(0,this.resources.membraneBindGroup),e.draw(6,1),this.cellCount>0&&(e.setPipeline(this.cellPipeline),e.setBindGroup(0,this.resources.cellBindGroup),e.draw(6,this.cellCount)))}orbitCpu(e,t,r,i){const l=Math.hypot(e,t);if(l<1e-4)return{x:e,y:t};const s=this.engine.params[10]||0,n=Math.atan2(t,e),c=(.045+r*.1)*s*i,a=n+c+Math.sin(s*.6+r*Math.PI*2)*.02,u=l*(1+.016*Math.sin(s*1.1+r*Math.PI*2));return{x:Math.cos(a)*u,y:Math.sin(a)*u}}pickAt(e,t){let r=null,i=1/0;for(let l=0;l{for(const l of i.messages)l.type==="error"&&console.error(`[living-field] ${e} WGSL ${l.type} ${l.lineNum}:${l.linePos} ${l.message}`)}),o.popErrorScope().then(i=>{i&&console.error(`[living-field] ${e} shader module validation: ${i.message}`)}),r}const V=2.399963229728653;function X(o,e={}){const t=o.length;if(t===0)return[];const r=e.maxRadius??.92,i=e.minCellR??.012,l=e.maxCellR??.05;return o.map((n,c)=>({d:n,i:c})).sort((n,c)=>(c.d.score||0)-(n.d.score||0)).map(({d:n},c)=>{const a=t>1?c/(t-1):0,u=r*Math.sqrt(.06+.94*a),d=c*V,_=Math.cos(d)*u,g=Math.sin(d)*u,m=y(n.score),b=i+(l-i)*Math.sqrt(m);return{x:_,y:g,radius:b,hue:T(n.hue,m),energy:y(n.energy??.35+.65*m),phase:c/t,pickId:n.id,kind:n.kind,payload:n.payload??n,selected:n.selected,scar:n.scar,metric2:y(n.metric2??m),spin:1}})}function Y(o,e,t={}){if(o.length===0)return[];const i=t.maxRadius??.9,l=t.minCellR??.014,s=t.maxCellR??.05,n=Math.max(1,t.ringCount??new Set(o.map(e)).size),c=new Map;return o.map((a,u)=>{const d=e(a,u),g=((Number.isFinite(d)?Math.floor(d):0)%n+n)%n,m=c.get(g)??0;c.set(g,m+1);const b=i*(.18+.82*(g/Math.max(1,n-1))),B=m*V+g*.7,v=y(a.score);return{x:Math.cos(B)*b,y:Math.sin(B)*b,radius:l+(s-l)*Math.sqrt(v),hue:T(a.hue,v),energy:y(a.energy??.35+.65*v),phase:g/n,pickId:a.id,kind:a.kind,payload:a.payload??a,selected:a.selected,scar:a.scar,metric2:y(a.metric2??v),spin:1}})}const j={oxygen:h(x.luciferin),healthy:h(x.healthy),recall:h(x.recall),bridge:h(x.bridge),debt:h(x.debt),scarlet:h(C.veto),caution:h(C.caution),forward:h(F.forward),retrograde:h(F.retrograde)};function y(o){return Math.min(1,Math.max(0,Number.isFinite(o)?o:0))}function T(o,e){const t=o??I(e);return[Number.isFinite(t[0])?t[0]:0,Number.isFinite(t[1])?t[1]:0,Number.isFinite(t[2])?t[2]:0]}export{j as F,W as L,Y as a,X as l}; diff --git a/apps/dashboard/build/_app/immutable/chunks/DETSv_kY.js.br b/apps/dashboard/build/_app/immutable/chunks/DETSv_kY.js.br new file mode 100644 index 0000000..267919b Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/DETSv_kY.js.br differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DETSv_kY.js.gz b/apps/dashboard/build/_app/immutable/chunks/DETSv_kY.js.gz new file mode 100644 index 0000000..07a7074 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/chunks/DETSv_kY.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DGM4cicq.js.gz b/apps/dashboard/build/_app/immutable/chunks/DGM4cicq.js.gz index 7a46602..85e4bc8 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/DGM4cicq.js.gz and b/apps/dashboard/build/_app/immutable/chunks/DGM4cicq.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DJDK-KWF.js.gz b/apps/dashboard/build/_app/immutable/chunks/DJDK-KWF.js.gz index ee5f80d..57f76e1 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/DJDK-KWF.js.gz and b/apps/dashboard/build/_app/immutable/chunks/DJDK-KWF.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DV6OI5iy.js.gz b/apps/dashboard/build/_app/immutable/chunks/DV6OI5iy.js.gz index db33535..49684e7 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/DV6OI5iy.js.gz and b/apps/dashboard/build/_app/immutable/chunks/DV6OI5iy.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DY7cP31Q.js.gz b/apps/dashboard/build/_app/immutable/chunks/DY7cP31Q.js.gz index ecf0017..12b8114 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/DY7cP31Q.js.gz and b/apps/dashboard/build/_app/immutable/chunks/DY7cP31Q.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/De_e6MzK.js.gz b/apps/dashboard/build/_app/immutable/chunks/De_e6MzK.js.gz index 88b536c..a35c8c3 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/De_e6MzK.js.gz and b/apps/dashboard/build/_app/immutable/chunks/De_e6MzK.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DnDQzBs4.js.gz b/apps/dashboard/build/_app/immutable/chunks/DnDQzBs4.js.gz index e0549fe..e26df06 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/DnDQzBs4.js.gz and b/apps/dashboard/build/_app/immutable/chunks/DnDQzBs4.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/Dp1pzeXC.js.gz b/apps/dashboard/build/_app/immutable/chunks/Dp1pzeXC.js.gz index 3bdf437..4f6661e 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/Dp1pzeXC.js.gz and b/apps/dashboard/build/_app/immutable/chunks/Dp1pzeXC.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/DqfV0sZu.js.gz b/apps/dashboard/build/_app/immutable/chunks/DqfV0sZu.js.gz index 3d68da1..6c3ee6d 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/DqfV0sZu.js.gz and b/apps/dashboard/build/_app/immutable/chunks/DqfV0sZu.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/HFGAk8XQ.js.gz b/apps/dashboard/build/_app/immutable/chunks/HFGAk8XQ.js.gz index 7a53068..f7fb213 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/HFGAk8XQ.js.gz and b/apps/dashboard/build/_app/immutable/chunks/HFGAk8XQ.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/W8qDZJD6.js.gz b/apps/dashboard/build/_app/immutable/chunks/W8qDZJD6.js.gz index d8536fd..cc2b590 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/W8qDZJD6.js.gz and b/apps/dashboard/build/_app/immutable/chunks/W8qDZJD6.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/kcrnba3G.js.gz b/apps/dashboard/build/_app/immutable/chunks/kcrnba3G.js.gz index 30ad572..3574681 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/kcrnba3G.js.gz and b/apps/dashboard/build/_app/immutable/chunks/kcrnba3G.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/uCQU803Y.js.gz b/apps/dashboard/build/_app/immutable/chunks/uCQU803Y.js.gz index f2d730f..38d4a81 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/uCQU803Y.js.gz and b/apps/dashboard/build/_app/immutable/chunks/uCQU803Y.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/chunks/yYBa834L.js.gz b/apps/dashboard/build/_app/immutable/chunks/yYBa834L.js.gz index c4e86bd..91b9b4f 100644 Binary files a/apps/dashboard/build/_app/immutable/chunks/yYBa834L.js.gz and b/apps/dashboard/build/_app/immutable/chunks/yYBa834L.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/entry/app.DIsclQy8.js b/apps/dashboard/build/_app/immutable/entry/app.Bj0mlYI5.js similarity index 80% rename from apps/dashboard/build/_app/immutable/entry/app.DIsclQy8.js rename to apps/dashboard/build/_app/immutable/entry/app.Bj0mlYI5.js index 4970360..febd5f1 100644 --- a/apps/dashboard/build/_app/immutable/entry/app.DIsclQy8.js +++ b/apps/dashboard/build/_app/immutable/entry/app.Bj0mlYI5.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.CcZXq7cA.js","../chunks/Bzak7iHL.js","../chunks/DAau0uzT.js","../chunks/CGq8RnJq.js","../chunks/Ccqjq5DS.js","../chunks/W8qDZJD6.js","../chunks/DqfV0sZu.js","../chunks/BbCqB9Us.js","../chunks/uCQU803Y.js","../chunks/DGM4cicq.js","../chunks/DV6OI5iy.js","../chunks/CbBCXwzm.js","../chunks/DJDK-KWF.js","../chunks/DY7cP31Q.js","../chunks/Ch9vNiEl.js","../chunks/BfiOPhbz.js","../chunks/HFGAk8XQ.js","../chunks/CcUbQ_Wl.js","../chunks/D35IQVqe.js","../chunks/CKbQrCJw.js","../assets/Icon.tTjeJXhC.css","../assets/0.CLR80qKm.css","../nodes/1.8UKMSR8s.js","../nodes/2.zvt29sR6.js","../nodes/3.C6cru0cW.js","../nodes/4.CIxbWFkr.js","../chunks/BMB5u1EX.js","../assets/cognitive-palette.BALpZUFZ.css","../chunks/D7ozXiSB.js","../nodes/5.bHY_C0IS.js","../chunks/De_e6MzK.js","../chunks/Cqe0su6e.js","../chunks/BeGBxCGK.js","../nodes/6.BAqyGpdp.js","../chunks/B9l3DI-J.js","../assets/reveal.Dmxpik8H.css","../assets/6.ksI6gQcB.css","../nodes/7.AFPOwdob.js","../chunks/DnDQzBs4.js","../assets/Dropdown.C2Z-7Phd.css","../assets/7.DQ_AfUnN.css","../nodes/8.BTNjDzh8.js","../nodes/9.h0jHlQck.js","../nodes/10.8yVvC2-0.js","../nodes/11.DTIAuaCd.js","../nodes/12.CuFt2FF9.js","../chunks/Bo4EDkTQ.js","../chunks/BKh9s_e0.js","../assets/ObservatoryStage.CKoSQgn0.css","../chunks/BzfFPM53.js","../chunks/Dp1pzeXC.js","../assets/12.BxoW8Jf1.css","../nodes/13.z1_JLKKx.js","../nodes/14.B4QyiRph.js","../nodes/15.-ohAmwvw.js","../nodes/16.Dp0Kyz4w.js","../nodes/17.DAadB7bO.js","../nodes/18.DdPknQfI.js","../nodes/19.DCcjdG9r.js","../nodes/20.Dqd6_QcY.js","../assets/20.Duj1vJUf.css","../nodes/21.CwMgmxy2.js","../nodes/22.CdolZyzx.js","../nodes/23.CWsheXid.js","../nodes/24.BbbXGX69.js","../nodes/25.CpxKI_0Q.js","../assets/25.DKhUrxcR.css"])))=>i.map(i=>d[i]); -var z=e=>{throw TypeError(e)};var J=(e,t,r)=>t.has(e)||z("Cannot "+r);var n=(e,t,r)=>(J(e,t,"read from private field"),r?r.call(e):t.get(e)),N=(e,t,r)=>t.has(e)?z("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Y=(e,t,r,_)=>(J(e,t,"write to private field"),_?_.call(e,r):t.set(e,r),r);import{_ as a}from"../chunks/Dp1pzeXC.js";import{w as K,ai as nt,i as mt,E as ut,aj as ct,al as dt,G as lt,F as Q,aG as pt,I as ft,s as S,ae as vt,g as f,aR as Et,a0 as ht,_ as gt,p as Pt,R as Rt,j as Ot,x as Tt,aH as R,X as At,a as v,b as yt,d as B,aS as y,c as It,r as Dt,f as U,u as L,aT as Lt,Y as Vt}from"../chunks/CGq8RnJq.js";import{h as bt,m as xt,u as wt,o as jt,s as kt}from"../chunks/DAau0uzT.js";import"../chunks/Bzak7iHL.js";import{i as j,b as V}from"../chunks/Ccqjq5DS.js";import{B as St}from"../chunks/W8qDZJD6.js";import{p as k}from"../chunks/DV6OI5iy.js";function b(e,t,r){var _;K&&(_=ft,nt());var i=new St(e);mt(()=>{var m=t()??null;if(K){var o=ct(_),s=o===pt,d=m!==null;if(s!==d){var x=dt();lt(x),i.anchor=x,Q(!1),i.ensure(m,m&&(O=>r(O,m))),Q(!0);return}}i.ensure(m,m&&(O=>r(O,m)))},ut)}function Ct(e){return class extends Ft{constructor(t){super({component:e,...t})}}}var E,c;class Ft{constructor(t){N(this,E);N(this,c);var m;var r=new Map,_=(o,s)=>{var d=gt(s,!1,!1);return r.set(o,d),d};const i=new Proxy({...t.props||{},$$events:{}},{get(o,s){return f(r.get(s)??_(s,Reflect.get(o,s)))},has(o,s){return s===vt?!0:(f(r.get(s)??_(s,Reflect.get(o,s))),Reflect.has(o,s))},set(o,s,d){return S(r.get(s)??_(s,d),d),Reflect.set(o,s,d)}});Y(this,c,(t.hydrate?bt:xt)(t.component,{target:t.target,anchor:t.anchor,props:i,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError})),(!((m=t==null?void 0:t.props)!=null&&m.$$host)||t.sync===!1)&&Et(),Y(this,E,i.$$events);for(const o of Object.keys(n(this,c)))o==="$set"||o==="$destroy"||o==="$on"||ht(this,o,{get(){return n(this,c)[o]},set(s){n(this,c)[o]=s},enumerable:!0});n(this,c).$set=o=>{Object.assign(i,o)},n(this,c).$destroy=()=>{wt(n(this,c))}}$set(t){n(this,c).$set(t)}$on(t,r){n(this,E)[t]=n(this,E)[t]||[];const _=(...i)=>r.call(this,...i);return n(this,E)[t].push(_),()=>{n(this,E)[t]=n(this,E)[t].filter(i=>i!==_)}}$destroy(){n(this,c).$destroy()}}E=new WeakMap,c=new WeakMap;const Zt={};var Gt=U('
'),Mt=U(" ",1);function Nt(e,t){Pt(t,!0);let r=k(t,"components",23,()=>[]),_=k(t,"data_0",3,null),i=k(t,"data_1",3,null),m=k(t,"data_2",3,null);Rt(()=>t.stores.page.set(t.page)),Ot(()=>{t.stores,t.page,t.constructors,r(),t.form,_(),i(),m(),t.stores.page.notify()});let o=B(!1),s=B(!1),d=B(null);jt(()=>{const u=t.stores.page.subscribe(()=>{f(o)&&(S(s,!0),Tt().then(()=>{S(d,document.title||"untitled page",!0)}))});return S(o,!0),u});const x=L(()=>t.constructors[2]);var O=Mt(),H=R(O);{var Z=u=>{const h=L(()=>t.constructors[0]);var g=y(),I=R(g);b(I,()=>f(h),(P,T)=>{V(T(P,{get data(){return _()},get form(){return t.form},get params(){return t.page.params},children:(l,Bt)=>{var X=y(),et=R(X);{var at=A=>{const C=L(()=>t.constructors[1]);var D=y(),F=R(D);b(F,()=>f(C),(G,M)=>{V(M(G,{get data(){return i()},get form(){return t.form},get params(){return t.page.params},children:(p,Ht)=>{var q=y(),st=R(q);b(st,()=>f(x),(_t,it)=>{V(it(_t,{get data(){return m()},get form(){return t.form},get params(){return t.page.params}}),w=>r()[2]=w,()=>{var w;return(w=r())==null?void 0:w[2]})}),v(p,q)},$$slots:{default:!0}}),p=>r()[1]=p,()=>{var p;return(p=r())==null?void 0:p[1]})}),v(A,D)},ot=A=>{const C=L(()=>t.constructors[1]);var D=y(),F=R(D);b(F,()=>f(C),(G,M)=>{V(M(G,{get data(){return i()},get form(){return t.form},get params(){return t.page.params}}),p=>r()[1]=p,()=>{var p;return(p=r())==null?void 0:p[1]})}),v(A,D)};j(et,A=>{t.constructors[2]?A(at):A(ot,!1)})}v(l,X)},$$slots:{default:!0}}),l=>r()[0]=l,()=>{var l;return(l=r())==null?void 0:l[0]})}),v(u,g)},$=u=>{const h=L(()=>t.constructors[0]);var g=y(),I=R(g);b(I,()=>f(h),(P,T)=>{V(T(P,{get data(){return _()},get form(){return t.form},get params(){return t.page.params}}),l=>r()[0]=l,()=>{var l;return(l=r())==null?void 0:l[0]})}),v(u,g)};j(H,u=>{t.constructors[1]?u(Z):u($,!1)})}var tt=At(H,2);{var rt=u=>{var h=Gt(),g=It(h);{var I=P=>{var T=Lt();Vt(()=>kt(T,f(d))),v(P,T)};j(g,P=>{f(s)&&P(I)})}Dt(h),v(u,h)};j(tt,u=>{f(o)&&u(rt)})}v(e,O),yt()}const $t=Ct(Nt),tr=[()=>a(()=>import("../nodes/0.CcZXq7cA.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]),import.meta.url),()=>a(()=>import("../nodes/1.8UKMSR8s.js"),__vite__mapDeps([22,1,15,3,2,13,12]),import.meta.url),()=>a(()=>import("../nodes/2.zvt29sR6.js"),__vite__mapDeps([23,1,3,7,5]),import.meta.url),()=>a(()=>import("../nodes/3.C6cru0cW.js"),__vite__mapDeps([24,1,15,3,2,12,13]),import.meta.url),()=>a(()=>import("../nodes/4.CIxbWFkr.js"),__vite__mapDeps([25,1,2,3,4,5,26,10,27,28,13]),import.meta.url),()=>a(()=>import("../nodes/5.bHY_C0IS.js"),__vite__mapDeps([29,1,2,3,30,11,12,13,18,31,8,4,5,10,26,27,28,32]),import.meta.url),()=>a(()=>import("../nodes/6.BAqyGpdp.js"),__vite__mapDeps([33,1,2,3,4,5,6,34,7,8,10,19,20,35,16,9,12,13,18,14,31,11,26,27,28,32,36]),import.meta.url),()=>a(()=>import("../nodes/7.AFPOwdob.js"),__vite__mapDeps([37,1,2,3,4,5,6,34,7,8,10,19,20,35,16,38,39,31,12,13,11,26,27,28,32,18,14,40]),import.meta.url),()=>a(()=>import("../nodes/8.BTNjDzh8.js"),__vite__mapDeps([41,1,2,3,30,31,8,4,5,10,12,13,11,26,27,28,32,18]),import.meta.url),()=>a(()=>import("../nodes/9.h0jHlQck.js"),__vite__mapDeps([42,1,2,3,4,5,6,34,7,8,10,19,20,35,9,16,17,31,12,13,11,26,27,28,18]),import.meta.url),()=>a(()=>import("../nodes/10.8yVvC2-0.js"),__vite__mapDeps([43,1,2,3,30,4,5,12,13,18,26,10,27,28,32]),import.meta.url),()=>a(()=>import("../nodes/11.DTIAuaCd.js"),__vite__mapDeps([44,1,3,30,10,2,14,31,8,4,5,12,13,11,26,27,28,32]),import.meta.url),()=>a(()=>import("../nodes/12.CuFt2FF9.js"),__vite__mapDeps([45,1,2,3,4,5,46,6,8,9,10,18,14,13,16,26,27,47,17,48,49,15,50,19,20,38,39,32,51]),import.meta.url),()=>a(()=>import("../nodes/13.z1_JLKKx.js"),__vite__mapDeps([52,1,2,3,30,4,5,26,10,27,18,28,13,32]),import.meta.url),()=>a(()=>import("../nodes/14.B4QyiRph.js"),__vite__mapDeps([53,1,2,3,30,18,31,8,4,5,10,12,13,11,26,27,28,32]),import.meta.url),()=>a(()=>import("../nodes/15.-ohAmwvw.js"),__vite__mapDeps([54,1,2,3,30,4,5,26,10,27,18,28,13,32]),import.meta.url),()=>a(()=>import("../nodes/16.Dp0Kyz4w.js"),__vite__mapDeps([55,1,2,3,30,10,18,14,31,8,4,5,12,13,11,26,27,28,32]),import.meta.url),()=>a(()=>import("../nodes/17.DAadB7bO.js"),__vite__mapDeps([56,1,2,3,46,5,4,6,8,9,10,18,14,13,16,26,27,47,17,48,30,12,28,32]),import.meta.url),()=>a(()=>import("../nodes/18.DdPknQfI.js"),__vite__mapDeps([57,1,2,3,30,4,5,12,13,26,10,27,47,28]),import.meta.url),()=>a(()=>import("../nodes/19.DCcjdG9r.js"),__vite__mapDeps([58,1,2,3,30,31,8,4,5,10,12,13,11,26,27,28,18,32]),import.meta.url),()=>a(()=>import("../nodes/20.Dqd6_QcY.js"),__vite__mapDeps([59,1,2,3,4,5,6,30,9,18,31,8,10,12,13,11,26,27,28,32,60]),import.meta.url),()=>a(()=>import("../nodes/21.CwMgmxy2.js"),__vite__mapDeps([61,1,2,3,31,8,4,5,10,12,13,11,26,27,28,18,32]),import.meta.url),()=>a(()=>import("../nodes/22.CdolZyzx.js"),__vite__mapDeps([62,1,2,3,10,31,8,4,5,12,13,11,26,27,28,32,18,14]),import.meta.url),()=>a(()=>import("../nodes/23.CWsheXid.js"),__vite__mapDeps([63,1,2,3,31,8,4,5,10,12,13,11,26,27,28,32,18]),import.meta.url),()=>a(()=>import("../nodes/24.BbbXGX69.js"),__vite__mapDeps([64,1,2,3,30,18,26,4,5,10,27,28,13,31,8,12,11]),import.meta.url),()=>a(()=>import("../nodes/25.CpxKI_0Q.js"),__vite__mapDeps([65,1,2,3,4,5,6,30,8,16,9,49,13,66]),import.meta.url)],rr=[],er={"/":[3],"/(app)/_msdftest":[4,[2]],"/(app)/activation":[5,[2]],"/(app)/blackbox":[6,[2]],"/(app)/contradictions":[7,[2]],"/(app)/dreams":[8,[2]],"/(app)/duplicates":[9,[2]],"/(app)/explore":[10,[2]],"/(app)/feed":[11,[2]],"/(app)/graph":[12,[2]],"/(app)/importance":[13,[2]],"/(app)/intentions":[14,[2]],"/(app)/memories":[15,[2]],"/(app)/memory-prs":[16,[2]],"/(app)/observatory":[17,[2]],"/(app)/palace":[18,[2]],"/(app)/patterns":[19,[2]],"/(app)/reasoning":[20,[2]],"/(app)/schedule":[21,[2]],"/(app)/settings":[22,[2]],"/(app)/stats":[23,[2]],"/(app)/timeline":[24,[2]],"/waitlist":[25]},W={handleError:(({error:e})=>{console.error(e)}),reroute:(()=>{}),transport:{}},Yt=Object.fromEntries(Object.entries(W.transport).map(([e,t])=>[e,t.decode])),ar=Object.fromEntries(Object.entries(W.transport).map(([e,t])=>[e,t.encode])),or=!1,sr=(e,t)=>Yt[e](t);export{sr as decode,Yt as decoders,er as dictionary,ar as encoders,or as hash,W as hooks,Zt as matchers,tr as nodes,$t as root,rr as server_loads}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.CcZXq7cA.js","../chunks/Bzak7iHL.js","../chunks/DAau0uzT.js","../chunks/CGq8RnJq.js","../chunks/Ccqjq5DS.js","../chunks/W8qDZJD6.js","../chunks/DqfV0sZu.js","../chunks/BbCqB9Us.js","../chunks/uCQU803Y.js","../chunks/DGM4cicq.js","../chunks/DV6OI5iy.js","../chunks/CbBCXwzm.js","../chunks/DJDK-KWF.js","../chunks/DY7cP31Q.js","../chunks/Ch9vNiEl.js","../chunks/BfiOPhbz.js","../chunks/HFGAk8XQ.js","../chunks/CcUbQ_Wl.js","../chunks/D35IQVqe.js","../chunks/CKbQrCJw.js","../assets/Icon.tTjeJXhC.css","../assets/0.CLR80qKm.css","../nodes/1.8UKMSR8s.js","../nodes/2.zvt29sR6.js","../nodes/3.C6cru0cW.js","../nodes/4.CIxbWFkr.js","../chunks/BMB5u1EX.js","../assets/cognitive-palette.BALpZUFZ.css","../chunks/D7ozXiSB.js","../nodes/5.XKzsmb3Z.js","../chunks/De_e6MzK.js","../chunks/BpEKQwpr.js","../chunks/DETSv_kY.js","../nodes/6.CNes4HHG.js","../chunks/B9l3DI-J.js","../assets/reveal.Dmxpik8H.css","../assets/6.ksI6gQcB.css","../nodes/7.Cs_QL9bJ.js","../chunks/DnDQzBs4.js","../assets/Dropdown.C2Z-7Phd.css","../assets/7.DQ_AfUnN.css","../nodes/8.DYPUVn-a.js","../nodes/9.Bc6B0Hcn.js","../nodes/10.CMLfe2no.js","../nodes/11.BcR5gOV6.js","../nodes/12.CRVOD7oJ.js","../chunks/Bo4EDkTQ.js","../chunks/BKh9s_e0.js","../assets/ObservatoryStage.CKoSQgn0.css","../chunks/BzfFPM53.js","../chunks/Dp1pzeXC.js","../assets/12.BxoW8Jf1.css","../nodes/13.UdclNjnS.js","../nodes/14.CuNExVd0.js","../nodes/15.D2EVaO6c.js","../nodes/16.BHQZgsg5.js","../nodes/17.DpD2KkS8.js","../nodes/18.DdPknQfI.js","../nodes/19.CLd0kemn.js","../nodes/20.Cj35A6gq.js","../assets/20.Duj1vJUf.css","../nodes/21.yCKOHF-q.js","../nodes/22.kK1AQf2j.js","../nodes/23.B0dVDPB6.js","../nodes/24.taYcndi3.js","../nodes/25.CpxKI_0Q.js","../assets/25.DKhUrxcR.css"])))=>i.map(i=>d[i]); +var z=e=>{throw TypeError(e)};var J=(e,t,r)=>t.has(e)||z("Cannot "+r);var n=(e,t,r)=>(J(e,t,"read from private field"),r?r.call(e):t.get(e)),N=(e,t,r)=>t.has(e)?z("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),Y=(e,t,r,_)=>(J(e,t,"write to private field"),_?_.call(e,r):t.set(e,r),r);import{_ as a}from"../chunks/Dp1pzeXC.js";import{w as K,ai as nt,i as mt,E as ut,aj as ct,al as dt,G as lt,F as Q,aG as pt,I as ft,s as S,ae as vt,g as f,aR as Et,a0 as ht,_ as gt,p as Pt,R as Rt,j as Ot,x as Tt,aH as R,X as At,a as v,b as yt,d as B,aS as y,c as It,r as Dt,f as U,u as L,aT as Lt,Y as Vt}from"../chunks/CGq8RnJq.js";import{h as bt,m as xt,u as wt,o as jt,s as kt}from"../chunks/DAau0uzT.js";import"../chunks/Bzak7iHL.js";import{i as j,b as V}from"../chunks/Ccqjq5DS.js";import{B as St}from"../chunks/W8qDZJD6.js";import{p as k}from"../chunks/DV6OI5iy.js";function b(e,t,r){var _;K&&(_=ft,nt());var i=new St(e);mt(()=>{var m=t()??null;if(K){var o=ct(_),s=o===pt,d=m!==null;if(s!==d){var x=dt();lt(x),i.anchor=x,Q(!1),i.ensure(m,m&&(O=>r(O,m))),Q(!0);return}}i.ensure(m,m&&(O=>r(O,m)))},ut)}function Ct(e){return class extends Ft{constructor(t){super({component:e,...t})}}}var E,c;class Ft{constructor(t){N(this,E);N(this,c);var m;var r=new Map,_=(o,s)=>{var d=gt(s,!1,!1);return r.set(o,d),d};const i=new Proxy({...t.props||{},$$events:{}},{get(o,s){return f(r.get(s)??_(s,Reflect.get(o,s)))},has(o,s){return s===vt?!0:(f(r.get(s)??_(s,Reflect.get(o,s))),Reflect.has(o,s))},set(o,s,d){return S(r.get(s)??_(s,d),d),Reflect.set(o,s,d)}});Y(this,c,(t.hydrate?bt:xt)(t.component,{target:t.target,anchor:t.anchor,props:i,context:t.context,intro:t.intro??!1,recover:t.recover,transformError:t.transformError})),(!((m=t==null?void 0:t.props)!=null&&m.$$host)||t.sync===!1)&&Et(),Y(this,E,i.$$events);for(const o of Object.keys(n(this,c)))o==="$set"||o==="$destroy"||o==="$on"||ht(this,o,{get(){return n(this,c)[o]},set(s){n(this,c)[o]=s},enumerable:!0});n(this,c).$set=o=>{Object.assign(i,o)},n(this,c).$destroy=()=>{wt(n(this,c))}}$set(t){n(this,c).$set(t)}$on(t,r){n(this,E)[t]=n(this,E)[t]||[];const _=(...i)=>r.call(this,...i);return n(this,E)[t].push(_),()=>{n(this,E)[t]=n(this,E)[t].filter(i=>i!==_)}}$destroy(){n(this,c).$destroy()}}E=new WeakMap,c=new WeakMap;const Zt={};var Gt=U('
'),Mt=U(" ",1);function Nt(e,t){Pt(t,!0);let r=k(t,"components",23,()=>[]),_=k(t,"data_0",3,null),i=k(t,"data_1",3,null),m=k(t,"data_2",3,null);Rt(()=>t.stores.page.set(t.page)),Ot(()=>{t.stores,t.page,t.constructors,r(),t.form,_(),i(),m(),t.stores.page.notify()});let o=B(!1),s=B(!1),d=B(null);jt(()=>{const u=t.stores.page.subscribe(()=>{f(o)&&(S(s,!0),Tt().then(()=>{S(d,document.title||"untitled page",!0)}))});return S(o,!0),u});const x=L(()=>t.constructors[2]);var O=Mt(),H=R(O);{var Z=u=>{const h=L(()=>t.constructors[0]);var g=y(),I=R(g);b(I,()=>f(h),(P,T)=>{V(T(P,{get data(){return _()},get form(){return t.form},get params(){return t.page.params},children:(l,Bt)=>{var X=y(),et=R(X);{var at=A=>{const C=L(()=>t.constructors[1]);var D=y(),F=R(D);b(F,()=>f(C),(G,M)=>{V(M(G,{get data(){return i()},get form(){return t.form},get params(){return t.page.params},children:(p,Ht)=>{var q=y(),st=R(q);b(st,()=>f(x),(_t,it)=>{V(it(_t,{get data(){return m()},get form(){return t.form},get params(){return t.page.params}}),w=>r()[2]=w,()=>{var w;return(w=r())==null?void 0:w[2]})}),v(p,q)},$$slots:{default:!0}}),p=>r()[1]=p,()=>{var p;return(p=r())==null?void 0:p[1]})}),v(A,D)},ot=A=>{const C=L(()=>t.constructors[1]);var D=y(),F=R(D);b(F,()=>f(C),(G,M)=>{V(M(G,{get data(){return i()},get form(){return t.form},get params(){return t.page.params}}),p=>r()[1]=p,()=>{var p;return(p=r())==null?void 0:p[1]})}),v(A,D)};j(et,A=>{t.constructors[2]?A(at):A(ot,!1)})}v(l,X)},$$slots:{default:!0}}),l=>r()[0]=l,()=>{var l;return(l=r())==null?void 0:l[0]})}),v(u,g)},$=u=>{const h=L(()=>t.constructors[0]);var g=y(),I=R(g);b(I,()=>f(h),(P,T)=>{V(T(P,{get data(){return _()},get form(){return t.form},get params(){return t.page.params}}),l=>r()[0]=l,()=>{var l;return(l=r())==null?void 0:l[0]})}),v(u,g)};j(H,u=>{t.constructors[1]?u(Z):u($,!1)})}var tt=At(H,2);{var rt=u=>{var h=Gt(),g=It(h);{var I=P=>{var T=Lt();Vt(()=>kt(T,f(d))),v(P,T)};j(g,P=>{f(s)&&P(I)})}Dt(h),v(u,h)};j(tt,u=>{f(o)&&u(rt)})}v(e,O),yt()}const $t=Ct(Nt),tr=[()=>a(()=>import("../nodes/0.CcZXq7cA.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]),import.meta.url),()=>a(()=>import("../nodes/1.8UKMSR8s.js"),__vite__mapDeps([22,1,15,3,2,13,12]),import.meta.url),()=>a(()=>import("../nodes/2.zvt29sR6.js"),__vite__mapDeps([23,1,3,7,5]),import.meta.url),()=>a(()=>import("../nodes/3.C6cru0cW.js"),__vite__mapDeps([24,1,15,3,2,12,13]),import.meta.url),()=>a(()=>import("../nodes/4.CIxbWFkr.js"),__vite__mapDeps([25,1,2,3,4,5,26,10,27,28,13]),import.meta.url),()=>a(()=>import("../nodes/5.XKzsmb3Z.js"),__vite__mapDeps([29,1,2,3,30,11,12,13,18,31,8,4,5,10,26,27,28,32]),import.meta.url),()=>a(()=>import("../nodes/6.CNes4HHG.js"),__vite__mapDeps([33,1,2,3,4,5,6,34,7,8,10,19,20,35,16,9,12,13,18,14,31,11,26,27,28,32,36]),import.meta.url),()=>a(()=>import("../nodes/7.Cs_QL9bJ.js"),__vite__mapDeps([37,1,2,3,4,5,6,34,7,8,10,19,20,35,16,38,39,31,12,13,11,26,27,28,32,18,14,40]),import.meta.url),()=>a(()=>import("../nodes/8.DYPUVn-a.js"),__vite__mapDeps([41,1,2,3,30,31,8,4,5,10,12,13,11,26,27,28,32,18]),import.meta.url),()=>a(()=>import("../nodes/9.Bc6B0Hcn.js"),__vite__mapDeps([42,1,2,3,4,5,6,34,7,8,10,19,20,35,9,16,17,31,12,13,11,26,27,28,18]),import.meta.url),()=>a(()=>import("../nodes/10.CMLfe2no.js"),__vite__mapDeps([43,1,2,3,30,4,5,12,13,18,26,10,27,28,32]),import.meta.url),()=>a(()=>import("../nodes/11.BcR5gOV6.js"),__vite__mapDeps([44,1,3,30,10,2,14,31,8,4,5,12,13,11,26,27,28,32]),import.meta.url),()=>a(()=>import("../nodes/12.CRVOD7oJ.js"),__vite__mapDeps([45,1,2,3,4,5,46,6,8,9,10,18,14,13,16,26,27,47,17,48,49,15,50,19,20,38,39,32,51]),import.meta.url),()=>a(()=>import("../nodes/13.UdclNjnS.js"),__vite__mapDeps([52,1,2,3,30,4,5,26,10,27,18,28,13,32]),import.meta.url),()=>a(()=>import("../nodes/14.CuNExVd0.js"),__vite__mapDeps([53,1,2,3,30,18,31,8,4,5,10,12,13,11,26,27,28,32]),import.meta.url),()=>a(()=>import("../nodes/15.D2EVaO6c.js"),__vite__mapDeps([54,1,2,3,30,4,5,26,10,27,18,28,13,32]),import.meta.url),()=>a(()=>import("../nodes/16.BHQZgsg5.js"),__vite__mapDeps([55,1,2,3,30,10,18,14,31,8,4,5,12,13,11,26,27,28,32]),import.meta.url),()=>a(()=>import("../nodes/17.DpD2KkS8.js"),__vite__mapDeps([56,1,2,3,46,5,4,6,8,9,10,18,14,13,16,26,27,47,17,48,30,12,28,32]),import.meta.url),()=>a(()=>import("../nodes/18.DdPknQfI.js"),__vite__mapDeps([57,1,2,3,30,4,5,12,13,26,10,27,47,28]),import.meta.url),()=>a(()=>import("../nodes/19.CLd0kemn.js"),__vite__mapDeps([58,1,2,3,30,31,8,4,5,10,12,13,11,26,27,28,18,32]),import.meta.url),()=>a(()=>import("../nodes/20.Cj35A6gq.js"),__vite__mapDeps([59,1,2,3,4,5,6,30,9,18,31,8,10,12,13,11,26,27,28,32,60]),import.meta.url),()=>a(()=>import("../nodes/21.yCKOHF-q.js"),__vite__mapDeps([61,1,2,3,31,8,4,5,10,12,13,11,26,27,28,18,32]),import.meta.url),()=>a(()=>import("../nodes/22.kK1AQf2j.js"),__vite__mapDeps([62,1,2,3,10,31,8,4,5,12,13,11,26,27,28,32,18,14]),import.meta.url),()=>a(()=>import("../nodes/23.B0dVDPB6.js"),__vite__mapDeps([63,1,2,3,31,8,4,5,10,12,13,11,26,27,28,32,18]),import.meta.url),()=>a(()=>import("../nodes/24.taYcndi3.js"),__vite__mapDeps([64,1,2,3,30,18,26,4,5,10,27,28,13,31,8,12,11]),import.meta.url),()=>a(()=>import("../nodes/25.CpxKI_0Q.js"),__vite__mapDeps([65,1,2,3,4,5,6,30,8,16,9,49,13,66]),import.meta.url)],rr=[],er={"/":[3],"/(app)/_msdftest":[4,[2]],"/(app)/activation":[5,[2]],"/(app)/blackbox":[6,[2]],"/(app)/contradictions":[7,[2]],"/(app)/dreams":[8,[2]],"/(app)/duplicates":[9,[2]],"/(app)/explore":[10,[2]],"/(app)/feed":[11,[2]],"/(app)/graph":[12,[2]],"/(app)/importance":[13,[2]],"/(app)/intentions":[14,[2]],"/(app)/memories":[15,[2]],"/(app)/memory-prs":[16,[2]],"/(app)/observatory":[17,[2]],"/(app)/palace":[18,[2]],"/(app)/patterns":[19,[2]],"/(app)/reasoning":[20,[2]],"/(app)/schedule":[21,[2]],"/(app)/settings":[22,[2]],"/(app)/stats":[23,[2]],"/(app)/timeline":[24,[2]],"/waitlist":[25]},W={handleError:(({error:e})=>{console.error(e)}),reroute:(()=>{}),transport:{}},Yt=Object.fromEntries(Object.entries(W.transport).map(([e,t])=>[e,t.decode])),ar=Object.fromEntries(Object.entries(W.transport).map(([e,t])=>[e,t.encode])),or=!1,sr=(e,t)=>Yt[e](t);export{sr as decode,Yt as decoders,er as dictionary,ar as encoders,or as hash,W as hooks,Zt as matchers,tr as nodes,$t as root,rr as server_loads}; diff --git a/apps/dashboard/build/_app/immutable/entry/app.Bj0mlYI5.js.br b/apps/dashboard/build/_app/immutable/entry/app.Bj0mlYI5.js.br new file mode 100644 index 0000000..c9bcb98 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/entry/app.Bj0mlYI5.js.br differ diff --git a/apps/dashboard/build/_app/immutable/entry/app.Bj0mlYI5.js.gz b/apps/dashboard/build/_app/immutable/entry/app.Bj0mlYI5.js.gz new file mode 100644 index 0000000..6b2ec3b Binary files /dev/null and b/apps/dashboard/build/_app/immutable/entry/app.Bj0mlYI5.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/entry/app.DIsclQy8.js.br b/apps/dashboard/build/_app/immutable/entry/app.DIsclQy8.js.br deleted file mode 100644 index 67189b1..0000000 Binary files a/apps/dashboard/build/_app/immutable/entry/app.DIsclQy8.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/entry/app.DIsclQy8.js.gz b/apps/dashboard/build/_app/immutable/entry/app.DIsclQy8.js.gz deleted file mode 100644 index 00d5ad3..0000000 Binary files a/apps/dashboard/build/_app/immutable/entry/app.DIsclQy8.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/0.CcZXq7cA.js.gz b/apps/dashboard/build/_app/immutable/nodes/0.CcZXq7cA.js.gz index 2b91a69..9dfec28 100644 Binary files a/apps/dashboard/build/_app/immutable/nodes/0.CcZXq7cA.js.gz and b/apps/dashboard/build/_app/immutable/nodes/0.CcZXq7cA.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/1.8UKMSR8s.js.gz b/apps/dashboard/build/_app/immutable/nodes/1.8UKMSR8s.js.gz index a635ab2..443f4df 100644 Binary files a/apps/dashboard/build/_app/immutable/nodes/1.8UKMSR8s.js.gz and b/apps/dashboard/build/_app/immutable/nodes/1.8UKMSR8s.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/10.8yVvC2-0.js.br b/apps/dashboard/build/_app/immutable/nodes/10.8yVvC2-0.js.br deleted file mode 100644 index 751dd04..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/10.8yVvC2-0.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/10.8yVvC2-0.js.gz b/apps/dashboard/build/_app/immutable/nodes/10.8yVvC2-0.js.gz deleted file mode 100644 index e346436..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/10.8yVvC2-0.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/10.8yVvC2-0.js b/apps/dashboard/build/_app/immutable/nodes/10.CMLfe2no.js similarity index 98% rename from apps/dashboard/build/_app/immutable/nodes/10.8yVvC2-0.js rename to apps/dashboard/build/_app/immutable/nodes/10.CMLfe2no.js index 1ac627b..15f805a 100644 --- a/apps/dashboard/build/_app/immutable/nodes/10.8yVvC2-0.js +++ b/apps/dashboard/build/_app/immutable/nodes/10.CMLfe2no.js @@ -1 +1 @@ -import"../chunks/Bzak7iHL.js";import{d as re,o as ie,a as oe,b as q,e as le}from"../chunks/DAau0uzT.js";import{p as se,d as p,e as ae,a as ce,b as ue,h as de,g as r,f as pe,u as he,c as fe,s as l,$ as me,r as xe}from"../chunks/CGq8RnJq.js";import{h as Ee}from"../chunks/De_e6MzK.js";import{b as ge}from"../chunks/Ccqjq5DS.js";import{r as ye}from"../chunks/DJDK-KWF.js";import{a as $}from"../chunks/D35IQVqe.js";import{r as A,O as Re}from"../chunks/BMB5u1EX.js";import{T as Oe}from"../chunks/D7ozXiSB.js";import{L as Ce,F as K,l as Ie}from"../chunks/BeGBxCGK.js";var Te=pe('
');function ke(X,z){se(z,!0);const F=[...A("#22C7DE"),1],Q=[...A("#FF3B30"),.92],y=[...A("#29F2A9"),.62],k=40,D=36,V=-1e5;let u=p(null),c=null,i=null,h=null,v=null,f=p(ae([])),m=p(null),d=p(""),R=p(!0),O=p(null),b=null,C=p(null),I=p(null),T=p(null),E=0;ie(()=>{const e=new URLSearchParams(window.location.search);l(d,e.get("q")??"",!0),U()}),oe(()=>{i==null||i.dispose(),h==null||h.dispose(),i=null,h=null,c=null});async function P(e){c=e;const t=new Ce(e);h=t,t.setCells(W()),e.addPass(t);const n=new Oe(e);i=n,await n.init(),n.setText(S()),e.addPass(n),e.demoClock.reset()}function H(e){const t=e.replace(/\s+/g," ").trim();if(t.length<=280)return t;const n=t.slice(0,280),o=n.lastIndexOf(" ");return o>200?n.slice(0,o):n}function G(){try{ye(`?q=${encodeURIComponent(r(d))}`,{})}catch(e){console.warn("[explore] URL sync failed — walk state is not shareable:",e)}}async function U(){var t;const e=++E;if(l(O,null),!r(d).trim())try{const n=await $.memories.list({limit:"1"});if(e!==E)return;const o=(t=n.memories)==null?void 0:t[0];o!=null&&o.content&&(l(d,H(o.content),!0),l(T,o.id,!0),l(I,o.id.slice(0,8),!0),G())}catch{}if(!r(d).trim()){l(R,!1),l(m,null),l(f,[],!0),i==null||i.setText(S()),c==null||c.demoClock.reset();return}l(R,!0),i==null||i.setText(S());try{const n=r(T)?await $.explore(r(T),"associations",void 0,k):await $.search(r(d),k);if(e!==E)return;l(m,"query"in n?n:null,!0),l(f,n.results,!0)}catch(n){if(e!==E)return;l(m,null),l(f,[],!0),l(O,n instanceof Error?n.message:"UNKNOWN EXPLORE FETCH ERROR",!0)}finally{e===E&&(l(R,!1),l(C,null),i==null||i.setText(S()),h==null||h.setCells(W()),c==null||c.demoClock.reset())}}function W(){const e=r(f).map((t,n)=>({id:t.id,score:N(t),hue:n===0?K.oxygen:K.bridge,energy:N(t),metric2:L(t),selected:n===0,kind:"explore-neighbor",payload:t}));return Ie(e,{maxRadius:.9,minCellR:.035,maxCellR:.1})}function w(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function B(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}function g(e,t=.5){return typeof e=="number"&&Number.isFinite(e)?e:t}function N(e){return B(g(e.similarity,g(e.score,g(e.relevance,g(e.combinedScore,e.retrievalStrength)))))}function L(e){return B(g(e.retention,e.retentionStrength))}function j(e){const t=w(e.content).replace(/\s+/g," ").trim().slice(0,52);return w(`${t} | ${e.id.slice(0,8)} | ${Math.round(N(e)*100)}% | ${Math.round(L(e)*100)}%`)}function M(e,t=y){return{id:"explore:status",kind:"explore-status",text:w(e),x:-.58,y:.02,size:.044,color:t,depth:.78,weight:.62,revealSpan:32,maxWidthEm:50}}function S(){var s;if(r(R))return[M(r(C)?`WALKING FROM ${r(C)}...`:"LOADING SEARCH NEIGHBORS...",F)];if(r(O))return[M(`ERROR - ${r(O)}`.slice(0,72),Q)];if(r(f).length===0){if(!r(d).trim())return[M("SEMANTIC EXPEDITION - EMPTY BRAIN, INGEST A MEMORY TO EXPLORE",y)];const a=(s=r(m))!=null&&s.query?`NO NEIGHBORS FOR "${r(m).query}" | ${r(m).durationMs}ms`:`NO NEIGHBORS FOR "${r(d)}"`;return[M(a,y)]}const e=r(f).slice(0,D),t=.72,n=1.5/Math.max(1,D-1);return[{id:"explore:origin",kind:"explore-origin",text:w(r(I)?`EXPEDITION SEEDED FROM NEWEST MEMORY ${r(I)} - CLICK ANY THOUGHT TO WALK`:`SEMANTIC NEIGHBORHOOD - ${e.length} THOUGHTS - CLICK TO WALK`),x:-.88,y:.82,size:.022,color:y,depth:.85,weight:.6,revealSpan:24,maxWidthEm:60},...e.map((a,Y)=>({id:`explore:${a.id}`,kind:"explore-neighbor",memoryId:a.id,text:j(a),x:-.88,y:t-Y*n,size:.026,color:F,depth:N(a),weight:L(a),startFrame:V+Y*2,revealSpan:20,maxWidthEm:46,hitPadX:.03,hitPadY:.015}))]}function _(e){if(!r(u))return null;const t=r(u).getBoundingClientRect();return t.width<=0||t.height<=0?null:{x:(e.clientX-t.left)/t.width*2-1,y:-((e.clientY-t.top)/t.height*2-1)}}function J(e){if(!r(u)||!c)return;const t=r(u).getBoundingClientRect(),n=Math.max(1e-4,t.width/Math.max(1,t.height)),o={x:e.x*Math.max(n,1),y:e.y/Math.min(n,1)},s=v??o,a={x:s.x+(o.x-s.x)*.35,y:s.y+(o.y-s.y)*.35};v=a,c.setCursorPreNdc(a.x,a.y,a.x-s.x,a.y-s.y)}function Z(e){const t=_(e);if(!t)return;J(t);const n=(i==null?void 0:i.pickAt(t.x,t.y))??null,o=(n==null?void 0:n.kind)==="explore-neighbor"?n.id:null;o!==b&&(b=o,i==null||i.setRunDepth(o,1)),r(u)&&(r(u).style.cursor=o?"crosshair":"default")}function ee(){v=null,b=null,c==null||c.setCursorPreNdc(999,999,0,0),i==null||i.setRunDepth(null),r(u)&&(r(u).style.cursor="default")}async function te(e){const t=_(e);if(!t||!i)return;const n=i.pickAt(t.x,t.y);if((n==null?void 0:n.kind)!=="explore-neighbor")return;const o=n.payload;if(!o.memoryId)return;const s=r(f).find(a=>a.id===o.memoryId);s!=null&&s.content&&(l(C,s.id.slice(0,8),!0),l(T,s.id,!0),l(I,null),l(d,H(s.content),!0),G(),await U())}var x=Te();Ee("15rowvt",e=>{de(()=>{me.title="Explore · Vestige"})});var ne=fe(x);{let e=he(()=>{var t;return`real-explore-neighbors:${r(d)}:${((t=r(m))==null?void 0:t.total)??0}`});Re(ne,{demo:"recall-path",get seed(){return r(e)},onready:P})}xe(x),ge(x,e=>l(u,e),()=>r(u)),q("pointerdown",x,te),q("pointermove",x,Z),le("pointerleave",x,ee),ce(X,x),ue()}re(["pointerdown","pointermove"]);export{ke as component}; +import"../chunks/Bzak7iHL.js";import{d as re,o as ie,a as oe,b as q,e as le}from"../chunks/DAau0uzT.js";import{p as se,d as p,e as ae,a as ce,b as ue,h as de,g as r,f as pe,u as he,c as fe,s as l,$ as me,r as xe}from"../chunks/CGq8RnJq.js";import{h as Ee}from"../chunks/De_e6MzK.js";import{b as ge}from"../chunks/Ccqjq5DS.js";import{r as ye}from"../chunks/DJDK-KWF.js";import{a as $}from"../chunks/D35IQVqe.js";import{r as A,O as Re}from"../chunks/BMB5u1EX.js";import{T as Oe}from"../chunks/D7ozXiSB.js";import{L as Ce,F as K,l as Ie}from"../chunks/DETSv_kY.js";var Te=pe('
');function ke(X,z){se(z,!0);const F=[...A("#22C7DE"),1],Q=[...A("#FF3B30"),.92],y=[...A("#29F2A9"),.62],k=40,D=36,V=-1e5;let u=p(null),c=null,i=null,h=null,v=null,f=p(ae([])),m=p(null),d=p(""),R=p(!0),O=p(null),b=null,C=p(null),I=p(null),T=p(null),E=0;ie(()=>{const e=new URLSearchParams(window.location.search);l(d,e.get("q")??"",!0),U()}),oe(()=>{i==null||i.dispose(),h==null||h.dispose(),i=null,h=null,c=null});async function P(e){c=e;const t=new Ce(e);h=t,t.setCells(W()),e.addPass(t);const n=new Oe(e);i=n,await n.init(),n.setText(S()),e.addPass(n),e.demoClock.reset()}function H(e){const t=e.replace(/\s+/g," ").trim();if(t.length<=280)return t;const n=t.slice(0,280),o=n.lastIndexOf(" ");return o>200?n.slice(0,o):n}function G(){try{ye(`?q=${encodeURIComponent(r(d))}`,{})}catch(e){console.warn("[explore] URL sync failed — walk state is not shareable:",e)}}async function U(){var t;const e=++E;if(l(O,null),!r(d).trim())try{const n=await $.memories.list({limit:"1"});if(e!==E)return;const o=(t=n.memories)==null?void 0:t[0];o!=null&&o.content&&(l(d,H(o.content),!0),l(T,o.id,!0),l(I,o.id.slice(0,8),!0),G())}catch{}if(!r(d).trim()){l(R,!1),l(m,null),l(f,[],!0),i==null||i.setText(S()),c==null||c.demoClock.reset();return}l(R,!0),i==null||i.setText(S());try{const n=r(T)?await $.explore(r(T),"associations",void 0,k):await $.search(r(d),k);if(e!==E)return;l(m,"query"in n?n:null,!0),l(f,n.results,!0)}catch(n){if(e!==E)return;l(m,null),l(f,[],!0),l(O,n instanceof Error?n.message:"UNKNOWN EXPLORE FETCH ERROR",!0)}finally{e===E&&(l(R,!1),l(C,null),i==null||i.setText(S()),h==null||h.setCells(W()),c==null||c.demoClock.reset())}}function W(){const e=r(f).map((t,n)=>({id:t.id,score:N(t),hue:n===0?K.oxygen:K.bridge,energy:N(t),metric2:L(t),selected:n===0,kind:"explore-neighbor",payload:t}));return Ie(e,{maxRadius:.9,minCellR:.035,maxCellR:.1})}function w(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function B(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}function g(e,t=.5){return typeof e=="number"&&Number.isFinite(e)?e:t}function N(e){return B(g(e.similarity,g(e.score,g(e.relevance,g(e.combinedScore,e.retrievalStrength)))))}function L(e){return B(g(e.retention,e.retentionStrength))}function j(e){const t=w(e.content).replace(/\s+/g," ").trim().slice(0,52);return w(`${t} | ${e.id.slice(0,8)} | ${Math.round(N(e)*100)}% | ${Math.round(L(e)*100)}%`)}function M(e,t=y){return{id:"explore:status",kind:"explore-status",text:w(e),x:-.58,y:.02,size:.044,color:t,depth:.78,weight:.62,revealSpan:32,maxWidthEm:50}}function S(){var s;if(r(R))return[M(r(C)?`WALKING FROM ${r(C)}...`:"LOADING SEARCH NEIGHBORS...",F)];if(r(O))return[M(`ERROR - ${r(O)}`.slice(0,72),Q)];if(r(f).length===0){if(!r(d).trim())return[M("SEMANTIC EXPEDITION - EMPTY BRAIN, INGEST A MEMORY TO EXPLORE",y)];const a=(s=r(m))!=null&&s.query?`NO NEIGHBORS FOR "${r(m).query}" | ${r(m).durationMs}ms`:`NO NEIGHBORS FOR "${r(d)}"`;return[M(a,y)]}const e=r(f).slice(0,D),t=.72,n=1.5/Math.max(1,D-1);return[{id:"explore:origin",kind:"explore-origin",text:w(r(I)?`EXPEDITION SEEDED FROM NEWEST MEMORY ${r(I)} - CLICK ANY THOUGHT TO WALK`:`SEMANTIC NEIGHBORHOOD - ${e.length} THOUGHTS - CLICK TO WALK`),x:-.88,y:.82,size:.022,color:y,depth:.85,weight:.6,revealSpan:24,maxWidthEm:60},...e.map((a,Y)=>({id:`explore:${a.id}`,kind:"explore-neighbor",memoryId:a.id,text:j(a),x:-.88,y:t-Y*n,size:.026,color:F,depth:N(a),weight:L(a),startFrame:V+Y*2,revealSpan:20,maxWidthEm:46,hitPadX:.03,hitPadY:.015}))]}function _(e){if(!r(u))return null;const t=r(u).getBoundingClientRect();return t.width<=0||t.height<=0?null:{x:(e.clientX-t.left)/t.width*2-1,y:-((e.clientY-t.top)/t.height*2-1)}}function J(e){if(!r(u)||!c)return;const t=r(u).getBoundingClientRect(),n=Math.max(1e-4,t.width/Math.max(1,t.height)),o={x:e.x*Math.max(n,1),y:e.y/Math.min(n,1)},s=v??o,a={x:s.x+(o.x-s.x)*.35,y:s.y+(o.y-s.y)*.35};v=a,c.setCursorPreNdc(a.x,a.y,a.x-s.x,a.y-s.y)}function Z(e){const t=_(e);if(!t)return;J(t);const n=(i==null?void 0:i.pickAt(t.x,t.y))??null,o=(n==null?void 0:n.kind)==="explore-neighbor"?n.id:null;o!==b&&(b=o,i==null||i.setRunDepth(o,1)),r(u)&&(r(u).style.cursor=o?"crosshair":"default")}function ee(){v=null,b=null,c==null||c.setCursorPreNdc(999,999,0,0),i==null||i.setRunDepth(null),r(u)&&(r(u).style.cursor="default")}async function te(e){const t=_(e);if(!t||!i)return;const n=i.pickAt(t.x,t.y);if((n==null?void 0:n.kind)!=="explore-neighbor")return;const o=n.payload;if(!o.memoryId)return;const s=r(f).find(a=>a.id===o.memoryId);s!=null&&s.content&&(l(C,s.id.slice(0,8),!0),l(T,s.id,!0),l(I,null),l(d,H(s.content),!0),G(),await U())}var x=Te();Ee("15rowvt",e=>{de(()=>{me.title="Explore · Vestige"})});var ne=fe(x);{let e=he(()=>{var t;return`real-explore-neighbors:${r(d)}:${((t=r(m))==null?void 0:t.total)??0}`});Re(ne,{demo:"recall-path",get seed(){return r(e)},onready:P})}xe(x),ge(x,e=>l(u,e),()=>r(u)),q("pointerdown",x,te),q("pointermove",x,Z),le("pointerleave",x,ee),ce(X,x),ue()}re(["pointerdown","pointermove"]);export{ke as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/10.CMLfe2no.js.br b/apps/dashboard/build/_app/immutable/nodes/10.CMLfe2no.js.br new file mode 100644 index 0000000..1aacf8b Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/10.CMLfe2no.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/10.CMLfe2no.js.gz b/apps/dashboard/build/_app/immutable/nodes/10.CMLfe2no.js.gz new file mode 100644 index 0000000..8088faf Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/10.CMLfe2no.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/11.BcR5gOV6.js b/apps/dashboard/build/_app/immutable/nodes/11.BcR5gOV6.js new file mode 100644 index 0000000..2d02957 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/11.BcR5gOV6.js @@ -0,0 +1 @@ +var K=Object.defineProperty;var Y=(d,c,a)=>c in d?K(d,c,{enumerable:!0,configurable:!0,writable:!0,value:a}):d[c]=a;var T=(d,c,a)=>Y(d,typeof c!="symbol"?c+"":c,a);import"../chunks/Bzak7iHL.js";import{p as G,j as U,b as X,h as q,g as w,u as x,$ as H}from"../chunks/CGq8RnJq.js";import{h as Q}from"../chunks/De_e6MzK.js";import{s as Z,a as R}from"../chunks/DV6OI5iy.js";import{w as ee,i as te,a as ne,e as ie}from"../chunks/Ch9vNiEl.js";import{R as se}from"../chunks/BpEKQwpr.js";import{r as h,e as re}from"../chunks/BMB5u1EX.js";import{T as oe}from"../chunks/D7ozXiSB.js";import{L as ae,l as ce}from"../chunks/DETSv_kY.js";function _e(d,c){G(c,!0);const a=()=>R(ie,"$eventFeed",y),l=()=>R(ne,"$isConnected",y),p=()=>R(te,"$isReconnecting",y),[y,N]=Z(),P=[...h("#22C7DE"),1],S=[...h("#FFB000"),.9],C=[...h("#FF3B30"),.92],L=[...h("#29F2A9"),.62],f=42;let u=null,m=null,v=x(()=>O(a()));U(()=>{u==null||u.setText(D(a(),l(),p()))});function I(t,e){const n=new j(t);n.uploadScene(e);const i=new oe(t);return u=i,i.init().then(()=>i.setText(D(a(),l(),p()))),[n,{render(o){i.render(o)},pickAt(o,r){const s=i.pickAt(o,r);return s?(s.id!==m&&(m=s.id,i.setRunDepth(s.id,1)),s):(m&&(m=null,i.setRunDepth(null)),null)},dispose(){i.dispose(),u===i&&(u=null)}}]}class j{constructor(e){T(this,"field");this.field=new ae(e)}uploadScene(e){const i=e.nodes.map((r,s)=>({node:r,event:a()[s]})).filter(r=>r.event).map(({node:r,event:s})=>({id:r.source.id,score:r.retention,hue:re(s.type),energy:r.activation,metric2:r.trust,scar:s.type.includes("Deleted")||s.type.includes("Demoted")||s.type.includes("Verdict"),kind:"feed-event",payload:s})),o=i.length<4;this.field.setCells(ce(i,{maxRadius:o?.78:.92,minCellR:o?.24:.018,maxCellR:o?.32:.06}))}compute(e){this.field.compute(e)}render(e){this.field.render(e)}pickAt(e,n){return this.field.pickAt(e,n)}dispose(){this.field.dispose()}}function O(t){const e=t.slice(0,f);return{organ:"feed",nodes:e.map((n,i)=>({source:{kind:"event",id:$(n,i)},index:i,label:n.type,retention:g(n),activation:A(e,n,i),trust:g(n),tags:Object.keys(n.data).slice(0,6),type:n.type})),edges:[],events:e.map((n,i)=>({source:{kind:"event",id:$(n,i)},type:n.type,targetIndex:i,frame:i,energy:g(n)})),receipts:[],scalars:{eventCount:t.length,connected:l()?1:0,reconnecting:p()?1:0},alive:e.length>0}}function D(t,e,n){const i=t.slice(0,f);if(i.length===0)return[z(M(e,n),n?S:e?L:C)];const o=.72,r=1.5/Math.max(1,f-1);return i.map((s,b)=>{const k=$(s,b);return{id:`feed:${k}`,kind:"feed-event",event:s,eventKey:k,text:B(s,k),x:-.9,y:o-b*r,size:.024,color:W(s),depth:.6+.4*A(i,s,b),weight:g(s),startFrame:0,revealSpan:1,maxWidthEm:58,hitPadX:.03,hitPadY:.013}})}function z(t,e){return{id:"feed:connection-state",kind:"feed-state",text:_(t),x:-.52,y:.03,size:.038,color:e,depth:.72,weight:.62,revealSpan:24,maxWidthEm:48}}function B(t,e){const n=V(t.data);return _(`${t.type} | ${e.slice(0,24)} | ${n}`.slice(0,138))}function V(t){const e=Object.entries(t).filter(([,n])=>n!=null&&typeof n!="object").slice(0,5).map(([n,i])=>`${n}=${String(i).replace(/\s+/g," ").slice(0,32)}`);return e.length?e.join(" "):JSON.stringify(t).replace(/\s+/g," ").slice(0,82)}function $(t,e){const n=t.data,i=n.id??n.event_id??n.memory_id??n.trace_id??n.run_id??n.receipt_id??n.pr_id??n.timestamp??n.at??`${t.type}:${e}`;return _(String(i))}function M(t,e){return JSON.stringify({connected:t,reconnecting:e,events:0})}function g(t){const e=t.data,i=[e.energy,e.confidence,e.strength,e.weight,e.composite_score,e.new_retention,e.retention,e.result_count,e.connections_found,e.insights_generated,e.nodes_processed,e.duration_ms].map(Number).find(o=>Number.isFinite(o));return i===void 0?.5:i<0?0:i<=1?i:F(Math.log10(i+1)/3)}function A(t,e,n){const i=t.map(E).filter(r=>r!==null),o=E(e);if(o!==null&&i.length>1){const r=Math.min(...i),s=Math.max(...i);if(s>r)return F((o-r)/(s-r))}return F(1-n/Math.max(1,f-1))}function E(t){const e=t.data.timestamp??t.data.at??t.data.created_at;if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const n=Date.parse(e);return Number.isFinite(n)?n:null}return null}function W(t){return t.type.includes("Deleted")||t.type.includes("Demoted")||t.type.includes("Verdict")?C:t.type.includes("Progress")||t.type.includes("Started")?S:P}function _(t){return t.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function F(t){return Math.min(1,Math.max(0,Number.isFinite(t)?t:.5))}function J(t){t.kind==="feed-event"&&ee.clearEvents()}Q("1o4vd58",t=>{q(()=>{H.title="Feed · Vestige"})});{let t=x(()=>`live-event-stream:${a().length}:${l()?1:0}:${p()?1:0}`),e=x(()=>M(l(),p()));se(d,{organ:"feed",get seed(){return w(t)},get scene(){return w(v)},passes:I,loading:!1,error:null,get emptyLabel(){return w(e)},onpick:J})}X(),N()}export{_e as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/11.BcR5gOV6.js.br b/apps/dashboard/build/_app/immutable/nodes/11.BcR5gOV6.js.br new file mode 100644 index 0000000..7ac96f1 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/11.BcR5gOV6.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/11.BcR5gOV6.js.gz b/apps/dashboard/build/_app/immutable/nodes/11.BcR5gOV6.js.gz new file mode 100644 index 0000000..3e715e3 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/11.BcR5gOV6.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/11.DTIAuaCd.js b/apps/dashboard/build/_app/immutable/nodes/11.DTIAuaCd.js deleted file mode 100644 index c50736b..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/11.DTIAuaCd.js +++ /dev/null @@ -1 +0,0 @@ -var K=Object.defineProperty;var Y=(d,c,a)=>c in d?K(d,c,{enumerable:!0,configurable:!0,writable:!0,value:a}):d[c]=a;var T=(d,c,a)=>Y(d,typeof c!="symbol"?c+"":c,a);import"../chunks/Bzak7iHL.js";import{p as G,j as U,b as X,h as q,g as w,u as x,$ as H}from"../chunks/CGq8RnJq.js";import{h as Q}from"../chunks/De_e6MzK.js";import{s as Z,a as R}from"../chunks/DV6OI5iy.js";import{w as ee,i as te,a as ne,e as ie}from"../chunks/Ch9vNiEl.js";import{R as se}from"../chunks/Cqe0su6e.js";import{r as h,e as re}from"../chunks/BMB5u1EX.js";import{T as oe}from"../chunks/D7ozXiSB.js";import{L as ae,l as ce}from"../chunks/BeGBxCGK.js";function _e(d,c){G(c,!0);const a=()=>R(ie,"$eventFeed",y),l=()=>R(ne,"$isConnected",y),p=()=>R(te,"$isReconnecting",y),[y,N]=Z(),P=[...h("#22C7DE"),1],S=[...h("#FFB000"),.9],C=[...h("#FF3B30"),.92],L=[...h("#29F2A9"),.62],f=42;let u=null,m=null,v=x(()=>O(a()));U(()=>{u==null||u.setText(D(a(),l(),p()))});function I(t,e){const n=new j(t);n.uploadScene(e);const i=new oe(t);return u=i,i.init().then(()=>i.setText(D(a(),l(),p()))),[n,{render(s){i.render(s)},pickAt(s,r){const o=i.pickAt(s,r);return o?(o.id!==m&&(m=o.id,i.setRunDepth(o.id,1)),o):(m&&(m=null,i.setRunDepth(null)),null)},dispose(){i.dispose(),u===i&&(u=null)}}]}class j{constructor(e){T(this,"field");this.field=new ae(e)}uploadScene(e){const i=e.nodes.map((s,r)=>({node:s,event:a()[r]})).filter(s=>s.event).map(({node:s,event:r})=>({id:s.source.id,score:s.retention,hue:re(r.type),energy:s.activation,metric2:s.trust,scar:r.type.includes("Deleted")||r.type.includes("Demoted")||r.type.includes("Verdict"),kind:"feed-event",payload:r}));this.field.setCells(ce(i,{maxRadius:.78,minCellR:.24,maxCellR:.32}))}compute(e){this.field.compute(e)}render(e){this.field.render(e)}pickAt(e,n){return this.field.pickAt(e,n)}dispose(){this.field.dispose()}}function O(t){const e=t.slice(0,f);return{organ:"feed",nodes:e.map((n,i)=>({source:{kind:"event",id:$(n,i)},index:i,label:n.type,retention:g(n),activation:A(e,n,i),trust:g(n),tags:Object.keys(n.data).slice(0,6),type:n.type})),edges:[],events:e.map((n,i)=>({source:{kind:"event",id:$(n,i)},type:n.type,targetIndex:i,frame:i,energy:g(n)})),receipts:[],scalars:{eventCount:t.length,connected:l()?1:0,reconnecting:p()?1:0},alive:e.length>0}}function D(t,e,n){const i=t.slice(0,f);if(i.length===0)return[z(M(e,n),n?S:e?L:C)];const s=.72,r=1.5/Math.max(1,f-1);return i.map((o,b)=>{const k=$(o,b);return{id:`feed:${k}`,kind:"feed-event",event:o,eventKey:k,text:B(o,k),x:-.9,y:s-b*r,size:.024,color:W(o),depth:.6+.4*A(i,o,b),weight:g(o),startFrame:0,revealSpan:1,maxWidthEm:58,hitPadX:.03,hitPadY:.013}})}function z(t,e){return{id:"feed:connection-state",kind:"feed-state",text:_(t),x:-.52,y:.03,size:.038,color:e,depth:.72,weight:.62,revealSpan:24,maxWidthEm:48}}function B(t,e){const n=V(t.data);return _(`${t.type} | ${e.slice(0,24)} | ${n}`.slice(0,138))}function V(t){const e=Object.entries(t).filter(([,n])=>n!=null&&typeof n!="object").slice(0,5).map(([n,i])=>`${n}=${String(i).replace(/\s+/g," ").slice(0,32)}`);return e.length?e.join(" "):JSON.stringify(t).replace(/\s+/g," ").slice(0,82)}function $(t,e){const n=t.data,i=n.id??n.event_id??n.memory_id??n.trace_id??n.run_id??n.receipt_id??n.pr_id??n.timestamp??n.at??`${t.type}:${e}`;return _(String(i))}function M(t,e){return JSON.stringify({connected:t,reconnecting:e,events:0})}function g(t){const e=t.data,i=[e.energy,e.confidence,e.strength,e.weight,e.composite_score,e.new_retention,e.retention,e.result_count,e.connections_found,e.insights_generated,e.nodes_processed,e.duration_ms].map(Number).find(s=>Number.isFinite(s));return i===void 0?.5:i<0?0:i<=1?i:F(Math.log10(i+1)/3)}function A(t,e,n){const i=t.map(E).filter(r=>r!==null),s=E(e);if(s!==null&&i.length>1){const r=Math.min(...i),o=Math.max(...i);if(o>r)return F((s-r)/(o-r))}return F(1-n/Math.max(1,f-1))}function E(t){const e=t.data.timestamp??t.data.at??t.data.created_at;if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const n=Date.parse(e);return Number.isFinite(n)?n:null}return null}function W(t){return t.type.includes("Deleted")||t.type.includes("Demoted")||t.type.includes("Verdict")?C:t.type.includes("Progress")||t.type.includes("Started")?S:P}function _(t){return t.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function F(t){return Math.min(1,Math.max(0,Number.isFinite(t)?t:.5))}function J(t){t.kind==="feed-event"&&ee.clearEvents()}Q("1o4vd58",t=>{q(()=>{H.title="Feed · Vestige"})});{let t=x(()=>`live-event-stream:${a().length}:${l()?1:0}:${p()?1:0}`),e=x(()=>M(l(),p()));se(d,{organ:"feed",get seed(){return w(t)},get scene(){return w(v)},passes:I,loading:!1,error:null,get emptyLabel(){return w(e)},onpick:J})}X(),N()}export{_e as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/11.DTIAuaCd.js.br b/apps/dashboard/build/_app/immutable/nodes/11.DTIAuaCd.js.br deleted file mode 100644 index 91da709..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/11.DTIAuaCd.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/11.DTIAuaCd.js.gz b/apps/dashboard/build/_app/immutable/nodes/11.DTIAuaCd.js.gz deleted file mode 100644 index 749b915..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/11.DTIAuaCd.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/12.CuFt2FF9.js b/apps/dashboard/build/_app/immutable/nodes/12.CRVOD7oJ.js similarity index 96% rename from apps/dashboard/build/_app/immutable/nodes/12.CuFt2FF9.js rename to apps/dashboard/build/_app/immutable/nodes/12.CRVOD7oJ.js index a54a6bd..a87937d 100644 --- a/apps/dashboard/build/_app/immutable/nodes/12.CuFt2FF9.js +++ b/apps/dashboard/build/_app/immutable/nodes/12.CRVOD7oJ.js @@ -1,5 +1,5 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/kcrnba3G.js","../chunks/Dp1pzeXC.js","../chunks/Bo4EDkTQ.js","../chunks/CGq8RnJq.js","../chunks/W8qDZJD6.js","../chunks/Bzak7iHL.js","../chunks/DAau0uzT.js","../chunks/Ccqjq5DS.js","../chunks/DqfV0sZu.js","../chunks/uCQU803Y.js","../chunks/DGM4cicq.js","../chunks/DV6OI5iy.js","../chunks/D35IQVqe.js","../chunks/Ch9vNiEl.js","../chunks/DY7cP31Q.js","../chunks/HFGAk8XQ.js","../chunks/BMB5u1EX.js","../assets/cognitive-palette.BALpZUFZ.css","../chunks/BKh9s_e0.js","../chunks/CcUbQ_Wl.js","../assets/ObservatoryStage.CKoSQgn0.css"])))=>i.map(i=>d[i]); -var mo=Object.defineProperty;var _o=(e,t,n)=>t in e?mo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ve=(e,t,n)=>_o(e,typeof t!="symbol"?t+"":t,n);import"../chunks/Bzak7iHL.js";import{o as Nr,a as ua,s as tt,d as pa,b as mt}from"../chunks/DAau0uzT.js";import{d as He,e as qi,s as te,g as T,p as Xn,j as ei,a as qe,b as Yn,f as $e,c as oe,X as fe,af as Fn,r as ae,Y as Et,u as en,aS as Or,aH as Tn,aT as go,bh as vo}from"../chunks/CGq8RnJq.js";import{b as Ki,i as pt}from"../chunks/Ccqjq5DS.js";import{aW as So,aw as Eo,a4 as sn,y as Nt,C as Ae,ay as Fr,a6 as Vn,V as Te,A as xo,fw as jt,d as Mt,x as $n,H as ln,aV as An,aA as Zt,B as zt,az as ri,fD as Mo,fE as To,a5 as yi,fF as bo,aB as Ln,h as Ao,E as Ro,b as Ze,a0 as Bn,cL as wo,ar as tn,aS as Ti,aT as ha,aU as oi,U as si,a3 as Br,fG as yo,a7 as Un,bw as bi,b7 as Co,b8 as Po,b9 as jn,eq as Do,df as Lo,er as Uo,dg as Io,ba as No,bb as Oo,bc as Fo,bd as Bo,be as Ho,bf as Go,bg as ko,bh as Vo,bi as zo,bj as Wo,bk as Xo,aX as Yo,aY as qo,aZ as Ko,v as Li,u as In,w as ui,a_ as Zo,a$ as ti,b0 as jo,b1 as $o,b2 as Qo,b3 as Jo,b4 as Hr,aa as es,b5 as ts,b6 as ns,av as Gr,a as at,ej as is,eI as as,ek as rs,eT as Ot,aq as Vt,af as wt,_ as Bt,ax as kr,N as cn,ab as Jt,bF as Ai,bA as Vr,bB as zr,G as Qn,a2 as Wr,eu as ma,bC as os,bD as ss,bE as ls,z as Xr,al as bn,bG as cs,bH as ds,bI as fs,bJ as us,bK as ps,bL as Yr,ac as hs,bM as qr,bN as Kr,bO as Ui,bP as Ii,bQ as Ni,bR as Oi,e as ut,bS as va,bT as Sa,bU as Ea,bV as xa,bW as Ma,bX as Ta,bY as ba,bZ as Aa,b_ as Ra,b$ as wa,c0 as ya,c1 as Ca,c2 as Pa,c3 as Da,c4 as La,c5 as Ua,c6 as Ia,c7 as Na,c8 as Oa,c9 as Fa,ca as Ba,cb as Fi,eK as Ha,eL as Ga,cc as ms,cd as ka,ce as Va,cf as za,bs as Zi,bt as ji,bu as $i,bv as Qi,bx as Ji,by as ea,bz as ta,bl as _s,bm as Wa,bn as gs,Q as vi,bo as vs,bp as Xa,bq as Ya,br as Ct,aP as na,aQ as ia,am as Ss,ak as Zr,fH as Ri,ap as Ci,Y as Es,Z as xs,fI as jr,a1 as $r,fJ as qa,a9 as Qr,fK as Ka,eb as Jr,f as li,g as zn,$ as eo,m as wi,ch as Ms,ci as Ts,fL as bs,dK as Za,fM as It,e1 as As,es as Rs,dq as ws,aN as ys,aM as Cs,aL as to,aK as Ps,aJ as Ds,aI as Ls,cB as Us,dt as Is,fN as Ns,ah as Os,ai as Fs,aj as Bs,cA as Hs,cz as Gs,dh as ks,eh as Hn,fd as Nn,eF as ja,f1 as aa,eO as Vs,M as no,as as $a,d8 as zs,an as Ws,dH as io,aF as Xs,aC as Qa,eP as Ys,dS as qs,P as Gn,ex as kn,l as ra,e3 as oa,eS as Ks,ae as Ja,fO as er,f5 as tr,aR as Zs,fP as js,fQ as $s,fR as nr,fS as Qs,fT as ir,fU as Js,fV as el,fW as tl,fB as nl,fC as ar,fX as il}from"../chunks/Bo4EDkTQ.js";import{e as ni,i as Si,s as _t,r as ci}from"../chunks/DqfV0sZu.js";import{s as on,c as al}from"../chunks/uCQU803Y.js";import{s as di}from"../chunks/HFGAk8XQ.js";import{b as sa,a as rr}from"../chunks/DGM4cicq.js";import{p as ii,s as rl,a as ol}from"../chunks/DV6OI5iy.js";import{b as or}from"../chunks/DY7cP31Q.js";import{N as sl}from"../chunks/CcUbQ_Wl.js";import{b as ll}from"../chunks/BzfFPM53.js";import{i as cl}from"../chunks/BfiOPhbz.js";import{_ as dl}from"../chunks/Dp1pzeXC.js";import{I as mn}from"../chunks/CKbQrCJw.js";import{D as fl}from"../chunks/DnDQzBs4.js";import{a as Pn}from"../chunks/D35IQVqe.js";import{e as ul}from"../chunks/Ch9vNiEl.js";import{L as pl,l as hl}from"../chunks/BeGBxCGK.js";import{a as ml}from"../chunks/BMB5u1EX.js";/** +var mo=Object.defineProperty;var _o=(e,t,n)=>t in e?mo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ve=(e,t,n)=>_o(e,typeof t!="symbol"?t+"":t,n);import"../chunks/Bzak7iHL.js";import{o as Nr,a as ua,s as tt,d as pa,b as mt}from"../chunks/DAau0uzT.js";import{d as He,e as qi,s as te,g as T,p as Yn,j as Fn,a as qe,b as qn,f as $e,c as oe,X as fe,af as Bn,r as ae,Y as Et,u as en,aS as Or,aH as Tn,aT as go,bh as vo}from"../chunks/CGq8RnJq.js";import{b as Ki,i as pt}from"../chunks/Ccqjq5DS.js";import{aW as So,aw as Eo,a4 as sn,y as Nt,C as Ae,ay as Fr,a6 as zn,V as Te,A as xo,fw as jt,d as Mt,x as Qn,H as ln,aV as An,aA as Zt,B as zt,az as ri,fD as Mo,fE as To,a5 as yi,fF as bo,aB as Ln,h as Ao,E as Ro,b as Ze,a0 as Hn,cL as wo,ar as tn,aS as Ti,aT as ha,aU as oi,U as si,a3 as Br,fG as yo,a7 as Un,bw as bi,b7 as Co,b8 as Po,b9 as $n,eq as Do,df as Lo,er as Uo,dg as Io,ba as No,bb as Oo,bc as Fo,bd as Bo,be as Ho,bf as Go,bg as ko,bh as Vo,bi as zo,bj as Wo,bk as Xo,aX as Yo,aY as qo,aZ as Ko,v as Li,u as In,w as ui,a_ as Zo,a$ as ti,b0 as jo,b1 as $o,b2 as Qo,b3 as Jo,b4 as Hr,aa as es,b5 as ts,b6 as ns,av as Gr,a as at,ej as is,eI as as,ek as rs,eT as Ot,aq as Vt,af as wt,_ as Bt,ax as kr,N as cn,ab as Jt,bF as Ai,bA as Vr,bB as zr,G as Jn,a2 as Wr,eu as ma,bC as os,bD as ss,bE as ls,z as Xr,al as bn,bG as cs,bH as ds,bI as fs,bJ as us,bK as ps,bL as Yr,ac as hs,bM as qr,bN as Kr,bO as Ui,bP as Ii,bQ as Ni,bR as Oi,e as ut,bS as va,bT as Sa,bU as Ea,bV as xa,bW as Ma,bX as Ta,bY as ba,bZ as Aa,b_ as Ra,b$ as wa,c0 as ya,c1 as Ca,c2 as Pa,c3 as Da,c4 as La,c5 as Ua,c6 as Ia,c7 as Na,c8 as Oa,c9 as Fa,ca as Ba,cb as Fi,eK as Ha,eL as Ga,cc as ms,cd as ka,ce as Va,cf as za,bs as Zi,bt as ji,bu as $i,bv as Qi,bx as Ji,by as ea,bz as ta,bl as _s,bm as Wa,bn as gs,Q as vi,bo as vs,bp as Xa,bq as Ya,br as Ct,aP as na,aQ as ia,am as Ss,ak as Zr,fH as Ri,ap as Ci,Y as Es,Z as xs,fI as jr,a1 as $r,fJ as qa,a9 as Qr,fK as Ka,eb as Jr,f as li,g as Wn,$ as eo,m as wi,ch as Ms,ci as Ts,fL as bs,dK as Za,fM as It,e1 as As,es as Rs,dq as ws,aN as ys,aM as Cs,aL as to,aK as Ps,aJ as Ds,aI as Ls,cB as Us,dt as Is,fN as Ns,ah as Os,ai as Fs,aj as Bs,cA as Hs,cz as Gs,dh as ks,eh as Gn,fd as Nn,eF as ja,f1 as aa,eO as Vs,M as no,as as $a,d8 as zs,an as Ws,dH as io,aF as Xs,aC as Qa,eP as Ys,dS as qs,P as kn,ex as Vn,l as ra,e3 as oa,eS as Ks,ae as Ja,fO as er,f5 as tr,aR as Zs,fP as js,fQ as $s,fR as nr,fS as Qs,fT as ir,fU as Js,fV as el,fW as tl,fB as nl,fC as ar,fX as il}from"../chunks/Bo4EDkTQ.js";import{e as ni,i as Si,s as _t,r as ci}from"../chunks/DqfV0sZu.js";import{s as on,c as al}from"../chunks/uCQU803Y.js";import{s as di}from"../chunks/HFGAk8XQ.js";import{b as sa,a as rr}from"../chunks/DGM4cicq.js";import{p as ii,s as rl,a as ol}from"../chunks/DV6OI5iy.js";import{b as or}from"../chunks/DY7cP31Q.js";import{N as sl}from"../chunks/CcUbQ_Wl.js";import{b as ll}from"../chunks/BzfFPM53.js";import{i as cl}from"../chunks/BfiOPhbz.js";import{_ as dl}from"../chunks/Dp1pzeXC.js";import{I as mn}from"../chunks/CKbQrCJw.js";import{D as fl}from"../chunks/DnDQzBs4.js";import{a as Pn}from"../chunks/D35IQVqe.js";import{e as ul}from"../chunks/Ch9vNiEl.js";import{l as pl,L as hl}from"../chunks/DETSv_kY.js";import{a as ml}from"../chunks/BMB5u1EX.js";/** * @license * Copyright 2010-2024 Three.js Authors * SPDX-License-Identifier: MIT @@ -3529,7 +3529,7 @@ void main() { #include #include #include -}`,Ye={alphahash_fragment:gl,alphahash_pars_fragment:vl,alphamap_fragment:Sl,alphamap_pars_fragment:El,alphatest_fragment:xl,alphatest_pars_fragment:Ml,aomap_fragment:Tl,aomap_pars_fragment:bl,batching_pars_vertex:Al,batching_vertex:Rl,begin_vertex:wl,beginnormal_vertex:yl,bsdfs:Cl,iridescence_fragment:Pl,bumpmap_pars_fragment:Dl,clipping_planes_fragment:Ll,clipping_planes_pars_fragment:Ul,clipping_planes_pars_vertex:Il,clipping_planes_vertex:Nl,color_fragment:Ol,color_pars_fragment:Fl,color_pars_vertex:Bl,color_vertex:Hl,common:Gl,cube_uv_reflection_fragment:kl,defaultnormal_vertex:Vl,displacementmap_pars_vertex:zl,displacementmap_vertex:Wl,emissivemap_fragment:Xl,emissivemap_pars_fragment:Yl,colorspace_fragment:ql,colorspace_pars_fragment:Kl,envmap_fragment:Zl,envmap_common_pars_fragment:jl,envmap_pars_fragment:$l,envmap_pars_vertex:Ql,envmap_physical_pars_fragment:cc,envmap_vertex:Jl,fog_vertex:ec,fog_pars_vertex:tc,fog_fragment:nc,fog_pars_fragment:ic,gradientmap_pars_fragment:ac,lightmap_pars_fragment:rc,lights_lambert_fragment:oc,lights_lambert_pars_fragment:sc,lights_pars_begin:lc,lights_toon_fragment:dc,lights_toon_pars_fragment:fc,lights_phong_fragment:uc,lights_phong_pars_fragment:pc,lights_physical_fragment:hc,lights_physical_pars_fragment:mc,lights_fragment_begin:_c,lights_fragment_maps:gc,lights_fragment_end:vc,logdepthbuf_fragment:Sc,logdepthbuf_pars_fragment:Ec,logdepthbuf_pars_vertex:xc,logdepthbuf_vertex:Mc,map_fragment:Tc,map_pars_fragment:bc,map_particle_fragment:Ac,map_particle_pars_fragment:Rc,metalnessmap_fragment:wc,metalnessmap_pars_fragment:yc,morphinstance_vertex:Cc,morphcolor_vertex:Pc,morphnormal_vertex:Dc,morphtarget_pars_vertex:Lc,morphtarget_vertex:Uc,normal_fragment_begin:Ic,normal_fragment_maps:Nc,normal_pars_fragment:Oc,normal_pars_vertex:Fc,normal_vertex:Bc,normalmap_pars_fragment:Hc,clearcoat_normal_fragment_begin:Gc,clearcoat_normal_fragment_maps:kc,clearcoat_pars_fragment:Vc,iridescence_pars_fragment:zc,opaque_fragment:Wc,packing:Xc,premultiplied_alpha_fragment:Yc,project_vertex:qc,dithering_fragment:Kc,dithering_pars_fragment:Zc,roughnessmap_fragment:jc,roughnessmap_pars_fragment:$c,shadowmap_pars_fragment:Qc,shadowmap_pars_vertex:Jc,shadowmap_vertex:ed,shadowmask_pars_fragment:td,skinbase_vertex:nd,skinning_pars_vertex:id,skinning_vertex:ad,skinnormal_vertex:rd,specularmap_fragment:od,specularmap_pars_fragment:sd,tonemapping_fragment:ld,tonemapping_pars_fragment:cd,transmission_fragment:dd,transmission_pars_fragment:fd,uv_pars_fragment:ud,uv_pars_vertex:pd,uv_vertex:hd,worldpos_vertex:md,background_vert:_d,background_frag:gd,backgroundCube_vert:vd,backgroundCube_frag:Sd,cube_vert:Ed,cube_frag:xd,depth_vert:Md,depth_frag:Td,distanceRGBA_vert:bd,distanceRGBA_frag:Ad,equirect_vert:Rd,equirect_frag:wd,linedashed_vert:yd,linedashed_frag:Cd,meshbasic_vert:Pd,meshbasic_frag:Dd,meshlambert_vert:Ld,meshlambert_frag:Ud,meshmatcap_vert:Id,meshmatcap_frag:Nd,meshnormal_vert:Od,meshnormal_frag:Fd,meshphong_vert:Bd,meshphong_frag:Hd,meshphysical_vert:Gd,meshphysical_frag:kd,meshtoon_vert:Vd,meshtoon_frag:zd,points_vert:Wd,points_frag:Xd,shadow_vert:Yd,shadow_frag:qd,sprite_vert:Kd,sprite_frag:Zd},me={common:{diffuse:{value:new Ae(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new at},alphaMap:{value:null},alphaMapTransform:{value:new at},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new at}},envmap:{envMap:{value:null},envMapRotation:{value:new at},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new at}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new at}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new at},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new at},normalScale:{value:new Ze(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new at},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new at}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new at}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new at}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ae(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ae(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new at},alphaTest:{value:0},uvTransform:{value:new at}},sprite:{diffuse:{value:new Ae(16777215)},opacity:{value:1},center:{value:new Ze(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new at},alphaMap:{value:null},alphaMapTransform:{value:new at},alphaTest:{value:0}}},Kt={basic:{uniforms:It([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.fog]),vertexShader:Ye.meshbasic_vert,fragmentShader:Ye.meshbasic_frag},lambert:{uniforms:It([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.fog,me.lights,{emissive:{value:new Ae(0)}}]),vertexShader:Ye.meshlambert_vert,fragmentShader:Ye.meshlambert_frag},phong:{uniforms:It([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.fog,me.lights,{emissive:{value:new Ae(0)},specular:{value:new Ae(1118481)},shininess:{value:30}}]),vertexShader:Ye.meshphong_vert,fragmentShader:Ye.meshphong_frag},standard:{uniforms:It([me.common,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.roughnessmap,me.metalnessmap,me.fog,me.lights,{emissive:{value:new Ae(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ye.meshphysical_vert,fragmentShader:Ye.meshphysical_frag},toon:{uniforms:It([me.common,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.gradientmap,me.fog,me.lights,{emissive:{value:new Ae(0)}}]),vertexShader:Ye.meshtoon_vert,fragmentShader:Ye.meshtoon_frag},matcap:{uniforms:It([me.common,me.bumpmap,me.normalmap,me.displacementmap,me.fog,{matcap:{value:null}}]),vertexShader:Ye.meshmatcap_vert,fragmentShader:Ye.meshmatcap_frag},points:{uniforms:It([me.points,me.fog]),vertexShader:Ye.points_vert,fragmentShader:Ye.points_frag},dashed:{uniforms:It([me.common,me.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ye.linedashed_vert,fragmentShader:Ye.linedashed_frag},depth:{uniforms:It([me.common,me.displacementmap]),vertexShader:Ye.depth_vert,fragmentShader:Ye.depth_frag},normal:{uniforms:It([me.common,me.bumpmap,me.normalmap,me.displacementmap,{opacity:{value:1}}]),vertexShader:Ye.meshnormal_vert,fragmentShader:Ye.meshnormal_frag},sprite:{uniforms:It([me.sprite,me.fog]),vertexShader:Ye.sprite_vert,fragmentShader:Ye.sprite_frag},background:{uniforms:{uvTransform:{value:new at},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ye.background_vert,fragmentShader:Ye.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new at}},vertexShader:Ye.backgroundCube_vert,fragmentShader:Ye.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ye.cube_vert,fragmentShader:Ye.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ye.equirect_vert,fragmentShader:Ye.equirect_frag},distanceRGBA:{uniforms:It([me.common,me.displacementmap,{referencePosition:{value:new Te},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ye.distanceRGBA_vert,fragmentShader:Ye.distanceRGBA_frag},shadow:{uniforms:It([me.lights,me.fog,{color:{value:new Ae(0)},opacity:{value:1}}]),vertexShader:Ye.shadow_vert,fragmentShader:Ye.shadow_frag}};Kt.physical={uniforms:It([Kt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new at},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new at},clearcoatNormalScale:{value:new Ze(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new at},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new at},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new at},sheen:{value:0},sheenColor:{value:new Ae(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new at},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new at},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new at},transmissionSamplerSize:{value:new Ze},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new at},attenuationDistance:{value:0},attenuationColor:{value:new Ae(0)},specularColor:{value:new Ae(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new at},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new at},anisotropyVector:{value:new Ze},anisotropyMap:{value:null},anisotropyMapTransform:{value:new at}}]),vertexShader:Ye.meshphysical_vert,fragmentShader:Ye.meshphysical_frag};const pi={r:0,b:0,g:0},_n=new Qr,jd=new Vn;function $d(e,t,n,i,r,a,o){const s=new Ae(0);let u=a===!0?0:1,f,m,_=null,v=0,p=null;function b(M){let x=M.isScene===!0?M.background:null;return x&&x.isTexture&&(x=(M.backgroundBlurriness>0?n:t).get(x)),x}function A(M){let x=!1;const y=b(M);y===null?l(s,u):y&&y.isColor&&(l(y,1),x=!0);const U=e.xr.getEnvironmentBlendMode();U==="additive"?i.buffers.color.setClear(0,0,0,1,o):U==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(e.autoClear||x)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))}function c(M,x){const y=b(x);y&&(y.isCubeTexture||y.mapping===Ci)?(m===void 0&&(m=new Bt(new $r(1,1,1),new Ot({name:"BackgroundCubeMaterial",uniforms:qa(Kt.backgroundCube.uniforms),vertexShader:Kt.backgroundCube.vertexShader,fragmentShader:Kt.backgroundCube.fragmentShader,side:zt,depthTest:!1,depthWrite:!1,fog:!1})),m.geometry.deleteAttribute("normal"),m.geometry.deleteAttribute("uv"),m.onBeforeRender=function(U,F,V){this.matrixWorld.copyPosition(V.matrixWorld)},Object.defineProperty(m.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(m)),_n.copy(x.backgroundRotation),_n.x*=-1,_n.y*=-1,_n.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(_n.y*=-1,_n.z*=-1),m.material.uniforms.envMap.value=y,m.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,m.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,m.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,m.material.uniforms.backgroundRotation.value.setFromMatrix4(jd.makeRotationFromEuler(_n)),m.material.toneMapped=Mt.getTransfer(y.colorSpace)!==ut,(_!==y||v!==y.version||p!==e.toneMapping)&&(m.material.needsUpdate=!0,_=y,v=y.version,p=e.toneMapping),m.layers.enableAll(),M.unshift(m,m.geometry,m.material,0,0,null)):y&&y.isTexture&&(f===void 0&&(f=new Bt(new ma(2,2),new Ot({name:"BackgroundMaterial",uniforms:qa(Kt.background.uniforms),vertexShader:Kt.background.vertexShader,fragmentShader:Kt.background.fragmentShader,side:ri,depthTest:!1,depthWrite:!1,fog:!1})),f.geometry.deleteAttribute("normal"),Object.defineProperty(f.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(f)),f.material.uniforms.t2D.value=y,f.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,f.material.toneMapped=Mt.getTransfer(y.colorSpace)!==ut,y.matrixAutoUpdate===!0&&y.updateMatrix(),f.material.uniforms.uvTransform.value.copy(y.matrix),(_!==y||v!==y.version||p!==e.toneMapping)&&(f.material.needsUpdate=!0,_=y,v=y.version,p=e.toneMapping),f.layers.enableAll(),M.unshift(f,f.geometry,f.material,0,0,null))}function l(M,x){M.getRGB(pi,jr(e)),i.buffers.color.setClear(pi.r,pi.g,pi.b,x,o)}function O(){m!==void 0&&(m.geometry.dispose(),m.material.dispose()),f!==void 0&&(f.geometry.dispose(),f.material.dispose())}return{getClearColor:function(){return s},setClearColor:function(M,x=1){s.set(M),u=x,l(s,u)},getClearAlpha:function(){return u},setClearAlpha:function(M){u=M,l(s,u)},render:A,addToRenderList:c,dispose:O}}function Qd(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=v(null);let a=r,o=!1;function s(g,D,Z,k,Y){let J=!1;const $=_(k,Z,D);a!==$&&(a=$,f(a.object)),J=p(g,k,Z,Y),J&&b(g,k,Z,Y),Y!==null&&t.update(Y,e.ELEMENT_ARRAY_BUFFER),(J||o)&&(o=!1,x(g,D,Z,k),Y!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(Y).buffer))}function u(){return e.createVertexArray()}function f(g){return e.bindVertexArray(g)}function m(g){return e.deleteVertexArray(g)}function _(g,D,Z){const k=Z.wireframe===!0;let Y=i[g.id];Y===void 0&&(Y={},i[g.id]=Y);let J=Y[D.id];J===void 0&&(J={},Y[D.id]=J);let $=J[k];return $===void 0&&($=v(u()),J[k]=$),$}function v(g){const D=[],Z=[],k=[];for(let Y=0;Y=0){const Ce=Y[X];let Ne=J[X];if(Ne===void 0&&(X==="instanceMatrix"&&g.instanceMatrix&&(Ne=g.instanceMatrix),X==="instanceColor"&&g.instanceColor&&(Ne=g.instanceColor)),Ce===void 0||Ce.attribute!==Ne||Ne&&Ce.data!==Ne.data)return!0;$++}return a.attributesNum!==$||a.index!==k}function b(g,D,Z,k){const Y={},J=D.attributes;let $=0;const ne=Z.getAttributes();for(const X in ne)if(ne[X].location>=0){let Ce=J[X];Ce===void 0&&(X==="instanceMatrix"&&g.instanceMatrix&&(Ce=g.instanceMatrix),X==="instanceColor"&&g.instanceColor&&(Ce=g.instanceColor));const Ne={};Ne.attribute=Ce,Ce&&Ce.data&&(Ne.data=Ce.data),Y[X]=Ne,$++}a.attributes=Y,a.attributesNum=$,a.index=k}function A(){const g=a.newAttributes;for(let D=0,Z=g.length;D=0){let xe=Y[ne];if(xe===void 0&&(ne==="instanceMatrix"&&g.instanceMatrix&&(xe=g.instanceMatrix),ne==="instanceColor"&&g.instanceColor&&(xe=g.instanceColor)),xe!==void 0){const Ce=xe.normalized,Ne=xe.itemSize,je=t.get(xe);if(je===void 0)continue;const Je=je.buffer,Q=je.type,de=je.bytesPerElement,Me=Q===e.INT||Q===e.UNSIGNED_INT||xe.gpuType===Xr;if(xe.isInterleavedBufferAttribute){const he=xe.data,Le=he.stride,Ie=xe.offset;if(he.isInstancedInterleavedBuffer){for(let ke=0;ke0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";F="mediump"}return F==="mediump"&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=n.precision!==void 0?n.precision:"highp";const m=u(f);m!==f&&(console.warn("THREE.WebGLRenderer:",f,"not supported, using",m,"instead."),f=m);const _=n.logarithmicDepthBuffer===!0,v=n.reverseDepthBuffer===!0&&t.has("EXT_clip_control"),p=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),b=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),A=e.getParameter(e.MAX_TEXTURE_SIZE),c=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),l=e.getParameter(e.MAX_VERTEX_ATTRIBS),O=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),M=e.getParameter(e.MAX_VARYING_VECTORS),x=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),y=b>0,U=e.getParameter(e.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:u,textureFormatReadable:o,textureTypeReadable:s,precision:f,logarithmicDepthBuffer:_,reverseDepthBuffer:v,maxTextures:p,maxVertexTextures:b,maxTextureSize:A,maxCubemapSize:c,maxAttributes:l,maxVertexUniforms:O,maxVaryings:M,maxFragmentUniforms:x,vertexTextures:y,maxSamples:U}}function tf(e){const t=this;let n=null,i=0,r=!1,a=!1;const o=new Gr,s=new at,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(_,v){const p=_.length!==0||v||i!==0||r;return r=v,i=_.length,p},this.beginShadows=function(){a=!0,m(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(_,v){n=m(_,v,0)},this.setState=function(_,v,p){const b=_.clippingPlanes,A=_.clipIntersection,c=_.clipShadows,l=e.get(_);if(!r||b===null||b.length===0||a&&!c)a?m(null):f();else{const O=a?0:i,M=O*4;let x=l.clippingState||null;u.value=x,x=m(b,v,M,p);for(let y=0;y!==M;++y)x[y]=n[y];l.clippingState=x,this.numIntersection=A?this.numPlanes:0,this.numPlanes+=O}};function f(){u.value!==n&&(u.value=n,u.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function m(_,v,p,b){const A=_!==null?_.length:0;let c=null;if(A!==0){if(c=u.value,b!==!0||c===null){const l=p+A*4,O=v.matrixWorldInverse;s.getNormalMatrix(O),(c===null||c.length0){const f=new Ss(u.height);return f.fromEquirectangularTexture(e,o),t.set(o,f),o.addEventListener("dispose",r),n(f.texture,o.mapping)}else return null}}return o}function r(o){const s=o.target;s.removeEventListener("dispose",r);const u=t.get(s);u!==void 0&&(t.delete(s),u.dispose())}function a(){t=new WeakMap}return{get:i,dispose:a}}const On=4,sr=[.125,.215,.35,.446,.526,.582],Mn=20,Bi=new eo,lr=new Ae;let Hi=null,Gi=0,ki=0,Vi=!1;const En=(1+Math.sqrt(5))/2,Dn=1/En,cr=[new Te(-En,Dn,0),new Te(En,Dn,0),new Te(-Dn,0,En),new Te(Dn,0,En),new Te(0,En,-Dn),new Te(0,En,Dn),new Te(-1,1,-1),new Te(1,1,-1),new Te(-1,1,1),new Te(1,1,1)];class dr{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,n=0,i=.1,r=100){Hi=this._renderer.getRenderTarget(),Gi=this._renderer.getActiveCubeFace(),ki=this._renderer.getActiveMipmapLevel(),Vi=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const a=this._allocateTargets();return a.depthBuffer=!0,this._sceneToCubeUV(t,i,r,a),n>0&&this._blur(a,0,0,n),this._applyPMREM(a),this._cleanup(a),a}fromEquirectangular(t,n=null){return this._fromTexture(t,n)}fromCubemap(t,n=null){return this._fromTexture(t,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=pr(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ur(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t2?M:0,M,M),m.setRenderTarget(r),A&&m.render(b,s),m.render(t,s)}b.geometry.dispose(),b.material.dispose(),m.toneMapping=v,m.autoClear=_,t.background=c}_textureToCubeUV(t,n){const i=this._renderer,r=t.mapping===li||t.mapping===zn;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=pr()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ur());const a=r?this._cubemapMaterial:this._equirectMaterial,o=new Bt(this._lodPlanes[0],a),s=a.uniforms;s.envMap.value=t;const u=this._cubeSize;hi(n,0,0,3*u,2*u),i.setRenderTarget(n),i.render(o,Bi)}_applyPMREM(t){const n=this._renderer,i=n.autoClear;n.autoClear=!1;const r=this._lodPlanes.length;for(let a=1;aMn&&console.warn(`sigmaRadians, ${a}, is too large and will clip, as it requested ${c} samples when the maximum is set to ${Mn}`);const l=[];let O=0;for(let F=0;FM-On?r-M+On:0),U=4*(this._cubeSize-x);hi(n,y,U,3*x,2*x),u.setRenderTarget(n),u.render(_,Bi)}}function af(e){const t=[],n=[],i=[];let r=e;const a=e-On+1+sr.length;for(let o=0;oe-On?u=sr[o-e+On-1]:o===0&&(u=0),i.push(u);const f=1/(s-2),m=-f,_=1+f,v=[m,m,_,m,_,_,m,m,_,_,m,_],p=6,b=6,A=3,c=2,l=1,O=new Float32Array(A*b*p),M=new Float32Array(c*b*p),x=new Float32Array(l*b*p);for(let U=0;U2?0:-1,E=[F,V,0,F+2/3,V,0,F+2/3,V+1,0,F,V,0,F+2/3,V+1,0,F,V+1,0];O.set(E,A*b*U),M.set(v,c*b*U);const g=[U,U,U,U,U,U];x.set(g,l*b*U)}const y=new Vt;y.setAttribute("position",new wt(O,A)),y.setAttribute("uv",new wt(M,c)),y.setAttribute("faceIndex",new wt(x,l)),t.push(y),r>On&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}function fr(e,t,n){const i=new jt(e,t,n);return i.texture.mapping=Ci,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function hi(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function rf(e,t,n){const i=new Float32Array(Mn),r=new Te(0,1,0);return new Ot({name:"SphericalGaussianBlur",defines:{n:Mn,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:_a(),fragmentShader:` +}`,Ye={alphahash_fragment:gl,alphahash_pars_fragment:vl,alphamap_fragment:Sl,alphamap_pars_fragment:El,alphatest_fragment:xl,alphatest_pars_fragment:Ml,aomap_fragment:Tl,aomap_pars_fragment:bl,batching_pars_vertex:Al,batching_vertex:Rl,begin_vertex:wl,beginnormal_vertex:yl,bsdfs:Cl,iridescence_fragment:Pl,bumpmap_pars_fragment:Dl,clipping_planes_fragment:Ll,clipping_planes_pars_fragment:Ul,clipping_planes_pars_vertex:Il,clipping_planes_vertex:Nl,color_fragment:Ol,color_pars_fragment:Fl,color_pars_vertex:Bl,color_vertex:Hl,common:Gl,cube_uv_reflection_fragment:kl,defaultnormal_vertex:Vl,displacementmap_pars_vertex:zl,displacementmap_vertex:Wl,emissivemap_fragment:Xl,emissivemap_pars_fragment:Yl,colorspace_fragment:ql,colorspace_pars_fragment:Kl,envmap_fragment:Zl,envmap_common_pars_fragment:jl,envmap_pars_fragment:$l,envmap_pars_vertex:Ql,envmap_physical_pars_fragment:cc,envmap_vertex:Jl,fog_vertex:ec,fog_pars_vertex:tc,fog_fragment:nc,fog_pars_fragment:ic,gradientmap_pars_fragment:ac,lightmap_pars_fragment:rc,lights_lambert_fragment:oc,lights_lambert_pars_fragment:sc,lights_pars_begin:lc,lights_toon_fragment:dc,lights_toon_pars_fragment:fc,lights_phong_fragment:uc,lights_phong_pars_fragment:pc,lights_physical_fragment:hc,lights_physical_pars_fragment:mc,lights_fragment_begin:_c,lights_fragment_maps:gc,lights_fragment_end:vc,logdepthbuf_fragment:Sc,logdepthbuf_pars_fragment:Ec,logdepthbuf_pars_vertex:xc,logdepthbuf_vertex:Mc,map_fragment:Tc,map_pars_fragment:bc,map_particle_fragment:Ac,map_particle_pars_fragment:Rc,metalnessmap_fragment:wc,metalnessmap_pars_fragment:yc,morphinstance_vertex:Cc,morphcolor_vertex:Pc,morphnormal_vertex:Dc,morphtarget_pars_vertex:Lc,morphtarget_vertex:Uc,normal_fragment_begin:Ic,normal_fragment_maps:Nc,normal_pars_fragment:Oc,normal_pars_vertex:Fc,normal_vertex:Bc,normalmap_pars_fragment:Hc,clearcoat_normal_fragment_begin:Gc,clearcoat_normal_fragment_maps:kc,clearcoat_pars_fragment:Vc,iridescence_pars_fragment:zc,opaque_fragment:Wc,packing:Xc,premultiplied_alpha_fragment:Yc,project_vertex:qc,dithering_fragment:Kc,dithering_pars_fragment:Zc,roughnessmap_fragment:jc,roughnessmap_pars_fragment:$c,shadowmap_pars_fragment:Qc,shadowmap_pars_vertex:Jc,shadowmap_vertex:ed,shadowmask_pars_fragment:td,skinbase_vertex:nd,skinning_pars_vertex:id,skinning_vertex:ad,skinnormal_vertex:rd,specularmap_fragment:od,specularmap_pars_fragment:sd,tonemapping_fragment:ld,tonemapping_pars_fragment:cd,transmission_fragment:dd,transmission_pars_fragment:fd,uv_pars_fragment:ud,uv_pars_vertex:pd,uv_vertex:hd,worldpos_vertex:md,background_vert:_d,background_frag:gd,backgroundCube_vert:vd,backgroundCube_frag:Sd,cube_vert:Ed,cube_frag:xd,depth_vert:Md,depth_frag:Td,distanceRGBA_vert:bd,distanceRGBA_frag:Ad,equirect_vert:Rd,equirect_frag:wd,linedashed_vert:yd,linedashed_frag:Cd,meshbasic_vert:Pd,meshbasic_frag:Dd,meshlambert_vert:Ld,meshlambert_frag:Ud,meshmatcap_vert:Id,meshmatcap_frag:Nd,meshnormal_vert:Od,meshnormal_frag:Fd,meshphong_vert:Bd,meshphong_frag:Hd,meshphysical_vert:Gd,meshphysical_frag:kd,meshtoon_vert:Vd,meshtoon_frag:zd,points_vert:Wd,points_frag:Xd,shadow_vert:Yd,shadow_frag:qd,sprite_vert:Kd,sprite_frag:Zd},me={common:{diffuse:{value:new Ae(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new at},alphaMap:{value:null},alphaMapTransform:{value:new at},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new at}},envmap:{envMap:{value:null},envMapRotation:{value:new at},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new at}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new at}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new at},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new at},normalScale:{value:new Ze(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new at},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new at}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new at}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new at}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ae(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Ae(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new at},alphaTest:{value:0},uvTransform:{value:new at}},sprite:{diffuse:{value:new Ae(16777215)},opacity:{value:1},center:{value:new Ze(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new at},alphaMap:{value:null},alphaMapTransform:{value:new at},alphaTest:{value:0}}},Kt={basic:{uniforms:It([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.fog]),vertexShader:Ye.meshbasic_vert,fragmentShader:Ye.meshbasic_frag},lambert:{uniforms:It([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.fog,me.lights,{emissive:{value:new Ae(0)}}]),vertexShader:Ye.meshlambert_vert,fragmentShader:Ye.meshlambert_frag},phong:{uniforms:It([me.common,me.specularmap,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.fog,me.lights,{emissive:{value:new Ae(0)},specular:{value:new Ae(1118481)},shininess:{value:30}}]),vertexShader:Ye.meshphong_vert,fragmentShader:Ye.meshphong_frag},standard:{uniforms:It([me.common,me.envmap,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.roughnessmap,me.metalnessmap,me.fog,me.lights,{emissive:{value:new Ae(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ye.meshphysical_vert,fragmentShader:Ye.meshphysical_frag},toon:{uniforms:It([me.common,me.aomap,me.lightmap,me.emissivemap,me.bumpmap,me.normalmap,me.displacementmap,me.gradientmap,me.fog,me.lights,{emissive:{value:new Ae(0)}}]),vertexShader:Ye.meshtoon_vert,fragmentShader:Ye.meshtoon_frag},matcap:{uniforms:It([me.common,me.bumpmap,me.normalmap,me.displacementmap,me.fog,{matcap:{value:null}}]),vertexShader:Ye.meshmatcap_vert,fragmentShader:Ye.meshmatcap_frag},points:{uniforms:It([me.points,me.fog]),vertexShader:Ye.points_vert,fragmentShader:Ye.points_frag},dashed:{uniforms:It([me.common,me.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ye.linedashed_vert,fragmentShader:Ye.linedashed_frag},depth:{uniforms:It([me.common,me.displacementmap]),vertexShader:Ye.depth_vert,fragmentShader:Ye.depth_frag},normal:{uniforms:It([me.common,me.bumpmap,me.normalmap,me.displacementmap,{opacity:{value:1}}]),vertexShader:Ye.meshnormal_vert,fragmentShader:Ye.meshnormal_frag},sprite:{uniforms:It([me.sprite,me.fog]),vertexShader:Ye.sprite_vert,fragmentShader:Ye.sprite_frag},background:{uniforms:{uvTransform:{value:new at},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ye.background_vert,fragmentShader:Ye.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new at}},vertexShader:Ye.backgroundCube_vert,fragmentShader:Ye.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ye.cube_vert,fragmentShader:Ye.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ye.equirect_vert,fragmentShader:Ye.equirect_frag},distanceRGBA:{uniforms:It([me.common,me.displacementmap,{referencePosition:{value:new Te},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ye.distanceRGBA_vert,fragmentShader:Ye.distanceRGBA_frag},shadow:{uniforms:It([me.lights,me.fog,{color:{value:new Ae(0)},opacity:{value:1}}]),vertexShader:Ye.shadow_vert,fragmentShader:Ye.shadow_frag}};Kt.physical={uniforms:It([Kt.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new at},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new at},clearcoatNormalScale:{value:new Ze(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new at},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new at},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new at},sheen:{value:0},sheenColor:{value:new Ae(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new at},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new at},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new at},transmissionSamplerSize:{value:new Ze},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new at},attenuationDistance:{value:0},attenuationColor:{value:new Ae(0)},specularColor:{value:new Ae(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new at},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new at},anisotropyVector:{value:new Ze},anisotropyMap:{value:null},anisotropyMapTransform:{value:new at}}]),vertexShader:Ye.meshphysical_vert,fragmentShader:Ye.meshphysical_frag};const pi={r:0,b:0,g:0},_n=new Qr,jd=new zn;function $d(e,t,n,i,r,a,o){const s=new Ae(0);let u=a===!0?0:1,f,m,_=null,v=0,p=null;function b(M){let x=M.isScene===!0?M.background:null;return x&&x.isTexture&&(x=(M.backgroundBlurriness>0?n:t).get(x)),x}function A(M){let x=!1;const y=b(M);y===null?l(s,u):y&&y.isColor&&(l(y,1),x=!0);const U=e.xr.getEnvironmentBlendMode();U==="additive"?i.buffers.color.setClear(0,0,0,1,o):U==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(e.autoClear||x)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))}function c(M,x){const y=b(x);y&&(y.isCubeTexture||y.mapping===Ci)?(m===void 0&&(m=new Bt(new $r(1,1,1),new Ot({name:"BackgroundCubeMaterial",uniforms:qa(Kt.backgroundCube.uniforms),vertexShader:Kt.backgroundCube.vertexShader,fragmentShader:Kt.backgroundCube.fragmentShader,side:zt,depthTest:!1,depthWrite:!1,fog:!1})),m.geometry.deleteAttribute("normal"),m.geometry.deleteAttribute("uv"),m.onBeforeRender=function(U,F,V){this.matrixWorld.copyPosition(V.matrixWorld)},Object.defineProperty(m.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(m)),_n.copy(x.backgroundRotation),_n.x*=-1,_n.y*=-1,_n.z*=-1,y.isCubeTexture&&y.isRenderTargetTexture===!1&&(_n.y*=-1,_n.z*=-1),m.material.uniforms.envMap.value=y,m.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,m.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,m.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,m.material.uniforms.backgroundRotation.value.setFromMatrix4(jd.makeRotationFromEuler(_n)),m.material.toneMapped=Mt.getTransfer(y.colorSpace)!==ut,(_!==y||v!==y.version||p!==e.toneMapping)&&(m.material.needsUpdate=!0,_=y,v=y.version,p=e.toneMapping),m.layers.enableAll(),M.unshift(m,m.geometry,m.material,0,0,null)):y&&y.isTexture&&(f===void 0&&(f=new Bt(new ma(2,2),new Ot({name:"BackgroundMaterial",uniforms:qa(Kt.background.uniforms),vertexShader:Kt.background.vertexShader,fragmentShader:Kt.background.fragmentShader,side:ri,depthTest:!1,depthWrite:!1,fog:!1})),f.geometry.deleteAttribute("normal"),Object.defineProperty(f.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(f)),f.material.uniforms.t2D.value=y,f.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,f.material.toneMapped=Mt.getTransfer(y.colorSpace)!==ut,y.matrixAutoUpdate===!0&&y.updateMatrix(),f.material.uniforms.uvTransform.value.copy(y.matrix),(_!==y||v!==y.version||p!==e.toneMapping)&&(f.material.needsUpdate=!0,_=y,v=y.version,p=e.toneMapping),f.layers.enableAll(),M.unshift(f,f.geometry,f.material,0,0,null))}function l(M,x){M.getRGB(pi,jr(e)),i.buffers.color.setClear(pi.r,pi.g,pi.b,x,o)}function O(){m!==void 0&&(m.geometry.dispose(),m.material.dispose()),f!==void 0&&(f.geometry.dispose(),f.material.dispose())}return{getClearColor:function(){return s},setClearColor:function(M,x=1){s.set(M),u=x,l(s,u)},getClearAlpha:function(){return u},setClearAlpha:function(M){u=M,l(s,u)},render:A,addToRenderList:c,dispose:O}}function Qd(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=v(null);let a=r,o=!1;function s(g,D,Z,k,Y){let J=!1;const $=_(k,Z,D);a!==$&&(a=$,f(a.object)),J=p(g,k,Z,Y),J&&b(g,k,Z,Y),Y!==null&&t.update(Y,e.ELEMENT_ARRAY_BUFFER),(J||o)&&(o=!1,x(g,D,Z,k),Y!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(Y).buffer))}function u(){return e.createVertexArray()}function f(g){return e.bindVertexArray(g)}function m(g){return e.deleteVertexArray(g)}function _(g,D,Z){const k=Z.wireframe===!0;let Y=i[g.id];Y===void 0&&(Y={},i[g.id]=Y);let J=Y[D.id];J===void 0&&(J={},Y[D.id]=J);let $=J[k];return $===void 0&&($=v(u()),J[k]=$),$}function v(g){const D=[],Z=[],k=[];for(let Y=0;Y=0){const Ce=Y[X];let Ne=J[X];if(Ne===void 0&&(X==="instanceMatrix"&&g.instanceMatrix&&(Ne=g.instanceMatrix),X==="instanceColor"&&g.instanceColor&&(Ne=g.instanceColor)),Ce===void 0||Ce.attribute!==Ne||Ne&&Ce.data!==Ne.data)return!0;$++}return a.attributesNum!==$||a.index!==k}function b(g,D,Z,k){const Y={},J=D.attributes;let $=0;const ne=Z.getAttributes();for(const X in ne)if(ne[X].location>=0){let Ce=J[X];Ce===void 0&&(X==="instanceMatrix"&&g.instanceMatrix&&(Ce=g.instanceMatrix),X==="instanceColor"&&g.instanceColor&&(Ce=g.instanceColor));const Ne={};Ne.attribute=Ce,Ce&&Ce.data&&(Ne.data=Ce.data),Y[X]=Ne,$++}a.attributes=Y,a.attributesNum=$,a.index=k}function A(){const g=a.newAttributes;for(let D=0,Z=g.length;D=0){let xe=Y[ne];if(xe===void 0&&(ne==="instanceMatrix"&&g.instanceMatrix&&(xe=g.instanceMatrix),ne==="instanceColor"&&g.instanceColor&&(xe=g.instanceColor)),xe!==void 0){const Ce=xe.normalized,Ne=xe.itemSize,je=t.get(xe);if(je===void 0)continue;const Je=je.buffer,Q=je.type,de=je.bytesPerElement,Me=Q===e.INT||Q===e.UNSIGNED_INT||xe.gpuType===Xr;if(xe.isInterleavedBufferAttribute){const he=xe.data,Le=he.stride,Ie=xe.offset;if(he.isInstancedInterleavedBuffer){for(let ke=0;ke0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";F="mediump"}return F==="mediump"&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let f=n.precision!==void 0?n.precision:"highp";const m=u(f);m!==f&&(console.warn("THREE.WebGLRenderer:",f,"not supported, using",m,"instead."),f=m);const _=n.logarithmicDepthBuffer===!0,v=n.reverseDepthBuffer===!0&&t.has("EXT_clip_control"),p=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),b=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),A=e.getParameter(e.MAX_TEXTURE_SIZE),c=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),l=e.getParameter(e.MAX_VERTEX_ATTRIBS),O=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),M=e.getParameter(e.MAX_VARYING_VECTORS),x=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),y=b>0,U=e.getParameter(e.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:u,textureFormatReadable:o,textureTypeReadable:s,precision:f,logarithmicDepthBuffer:_,reverseDepthBuffer:v,maxTextures:p,maxVertexTextures:b,maxTextureSize:A,maxCubemapSize:c,maxAttributes:l,maxVertexUniforms:O,maxVaryings:M,maxFragmentUniforms:x,vertexTextures:y,maxSamples:U}}function tf(e){const t=this;let n=null,i=0,r=!1,a=!1;const o=new Gr,s=new at,u={value:null,needsUpdate:!1};this.uniform=u,this.numPlanes=0,this.numIntersection=0,this.init=function(_,v){const p=_.length!==0||v||i!==0||r;return r=v,i=_.length,p},this.beginShadows=function(){a=!0,m(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(_,v){n=m(_,v,0)},this.setState=function(_,v,p){const b=_.clippingPlanes,A=_.clipIntersection,c=_.clipShadows,l=e.get(_);if(!r||b===null||b.length===0||a&&!c)a?m(null):f();else{const O=a?0:i,M=O*4;let x=l.clippingState||null;u.value=x,x=m(b,v,M,p);for(let y=0;y!==M;++y)x[y]=n[y];l.clippingState=x,this.numIntersection=A?this.numPlanes:0,this.numPlanes+=O}};function f(){u.value!==n&&(u.value=n,u.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0}function m(_,v,p,b){const A=_!==null?_.length:0;let c=null;if(A!==0){if(c=u.value,b!==!0||c===null){const l=p+A*4,O=v.matrixWorldInverse;s.getNormalMatrix(O),(c===null||c.length0){const f=new Ss(u.height);return f.fromEquirectangularTexture(e,o),t.set(o,f),o.addEventListener("dispose",r),n(f.texture,o.mapping)}else return null}}return o}function r(o){const s=o.target;s.removeEventListener("dispose",r);const u=t.get(s);u!==void 0&&(t.delete(s),u.dispose())}function a(){t=new WeakMap}return{get:i,dispose:a}}const On=4,sr=[.125,.215,.35,.446,.526,.582],Mn=20,Bi=new eo,lr=new Ae;let Hi=null,Gi=0,ki=0,Vi=!1;const En=(1+Math.sqrt(5))/2,Dn=1/En,cr=[new Te(-En,Dn,0),new Te(En,Dn,0),new Te(-Dn,0,En),new Te(Dn,0,En),new Te(0,En,-Dn),new Te(0,En,Dn),new Te(-1,1,-1),new Te(1,1,-1),new Te(-1,1,1),new Te(1,1,1)];class dr{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,n=0,i=.1,r=100){Hi=this._renderer.getRenderTarget(),Gi=this._renderer.getActiveCubeFace(),ki=this._renderer.getActiveMipmapLevel(),Vi=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const a=this._allocateTargets();return a.depthBuffer=!0,this._sceneToCubeUV(t,i,r,a),n>0&&this._blur(a,0,0,n),this._applyPMREM(a),this._cleanup(a),a}fromEquirectangular(t,n=null){return this._fromTexture(t,n)}fromCubemap(t,n=null){return this._fromTexture(t,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=pr(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ur(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t2?M:0,M,M),m.setRenderTarget(r),A&&m.render(b,s),m.render(t,s)}b.geometry.dispose(),b.material.dispose(),m.toneMapping=v,m.autoClear=_,t.background=c}_textureToCubeUV(t,n){const i=this._renderer,r=t.mapping===li||t.mapping===Wn;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=pr()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ur());const a=r?this._cubemapMaterial:this._equirectMaterial,o=new Bt(this._lodPlanes[0],a),s=a.uniforms;s.envMap.value=t;const u=this._cubeSize;hi(n,0,0,3*u,2*u),i.setRenderTarget(n),i.render(o,Bi)}_applyPMREM(t){const n=this._renderer,i=n.autoClear;n.autoClear=!1;const r=this._lodPlanes.length;for(let a=1;aMn&&console.warn(`sigmaRadians, ${a}, is too large and will clip, as it requested ${c} samples when the maximum is set to ${Mn}`);const l=[];let O=0;for(let F=0;FM-On?r-M+On:0),U=4*(this._cubeSize-x);hi(n,y,U,3*x,2*x),u.setRenderTarget(n),u.render(_,Bi)}}function af(e){const t=[],n=[],i=[];let r=e;const a=e-On+1+sr.length;for(let o=0;oe-On?u=sr[o-e+On-1]:o===0&&(u=0),i.push(u);const f=1/(s-2),m=-f,_=1+f,v=[m,m,_,m,_,_,m,m,_,_,m,_],p=6,b=6,A=3,c=2,l=1,O=new Float32Array(A*b*p),M=new Float32Array(c*b*p),x=new Float32Array(l*b*p);for(let U=0;U2?0:-1,E=[F,V,0,F+2/3,V,0,F+2/3,V+1,0,F,V,0,F+2/3,V+1,0,F,V+1,0];O.set(E,A*b*U),M.set(v,c*b*U);const g=[U,U,U,U,U,U];x.set(g,l*b*U)}const y=new Vt;y.setAttribute("position",new wt(O,A)),y.setAttribute("uv",new wt(M,c)),y.setAttribute("faceIndex",new wt(x,l)),t.push(y),r>On&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}function fr(e,t,n){const i=new jt(e,t,n);return i.texture.mapping=Ci,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function hi(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function rf(e,t,n){const i=new Float32Array(Mn),r=new Te(0,1,0);return new Ot({name:"SphericalGaussianBlur",defines:{n:Mn,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:_a(),fragmentShader:` precision mediump float; precision mediump int; @@ -3679,7 +3679,7 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function of(e){let t=new WeakMap,n=null;function i(s){if(s&&s.isTexture){const u=s.mapping,f=u===na||u===ia,m=u===li||u===zn;if(f||m){let _=t.get(s);const v=_!==void 0?_.texture.pmremVersion:0;if(s.isRenderTargetTexture&&s.pmremVersion!==v)return n===null&&(n=new dr(e)),_=f?n.fromEquirectangular(s,_):n.fromCubemap(s,_),_.texture.pmremVersion=s.pmremVersion,t.set(s,_),_.texture;if(_!==void 0)return _.texture;{const p=s.image;return f&&p&&p.height>0||m&&p&&r(p)?(n===null&&(n=new dr(e)),_=f?n.fromEquirectangular(s):n.fromCubemap(s),_.texture.pmremVersion=s.pmremVersion,t.set(s,_),s.addEventListener("dispose",a),_.texture):null}}}return s}function r(s){let u=0;const f=6;for(let m=0;mt.maxTextureSize&&(y=Math.ceil(x/t.maxTextureSize),x=t.maxTextureSize);const U=new Float32Array(x*y*4*_),F=new Zr(U,x,y,_);F.type=bn,F.needsUpdate=!0;const V=M*4;for(let g=0;g<_;g++){const D=c[g],Z=l[g],k=O[g],Y=x*y*4*g;for(let J=0;J0)return e;const r=t*n;let a=mr[r];if(a===void 0&&(a=new Float32Array(r),mr[r]=a),t!==0){i.toArray(a,0);for(let o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function bt(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n0||m&&p&&r(p)?(n===null&&(n=new dr(e)),_=f?n.fromEquirectangular(s):n.fromCubemap(s),_.texture.pmremVersion=s.pmremVersion,t.set(s,_),s.addEventListener("dispose",a),_.texture):null}}}return s}function r(s){let u=0;const f=6;for(let m=0;mt.maxTextureSize&&(y=Math.ceil(x/t.maxTextureSize),x=t.maxTextureSize);const U=new Float32Array(x*y*4*_),F=new Zr(U,x,y,_);F.type=bn,F.needsUpdate=!0;const V=M*4;for(let g=0;g<_;g++){const D=c[g],Z=l[g],k=O[g],Y=x*y*4*g;for(let J=0;J0)return e;const r=t*n;let a=mr[r];if(a===void 0&&(a=new Float32Array(r),mr[r]=a),t!==0){i.toArray(a,0);for(let o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function bt(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n":" "} ${s}: ${n[o]}`)}return i.join(` `)}const Mr=new at;function ou(e){Mt._getMatrix(Mr,Mt.workingColorSpace,e);const t=`mat3( ${Mr.elements.map(n=>n.toFixed(4))} )`;switch(Mt.getTransfer(e)){case Jr:return[t,"LinearTransferOETF"];case ut:return[t,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}function Tr(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),r=e.getShaderInfoLog(t).trim();if(i&&r==="")return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const o=parseInt(a[1]);return n.toUpperCase()+` @@ -3687,9 +3687,9 @@ void main() { `+ru(e.getShaderSource(t),o)}else return r}function su(e,t){const n=ou(t);return[`vec4 ${e}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(` `)}function lu(e,t){let n;switch(t){case Ls:n="Linear";break;case Ds:n="Reinhard";break;case Ps:n="Cineon";break;case to:n="ACESFilmic";break;case Cs:n="AgX";break;case ys:n="Neutral";break;case ws:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const mi=new Te;function cu(){Mt.getLuminanceCoefficients(mi);const e=mi.x.toFixed(4),t=mi.y.toFixed(4),n=mi.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${e}, ${t}, ${n} );`," return dot( weights, rgb );","}"].join(` -`)}function du(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Jn).join(` +`)}function du(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(ei).join(` `)}function fu(e){const t=[];for(const n in e){const i=e[n];i!==!1&&t.push("#define "+n+" "+i)}return t.join(` -`)}function uu(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r/gm;function la(e){return e.replace(pu,mu)}const hu=new Map;function mu(e,t){let n=Ye[t];if(n===void 0){const i=hu.get(t);if(i!==void 0)n=Ye[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,i);else throw new Error("Can not resolve #include <"+t+">")}return la(n)}const _u=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Rr(e){return e.replace(_u,gu)}function gu(e,t,n,i){let r="";for(let a=parseInt(t);a/gm;function la(e){return e.replace(pu,mu)}const hu=new Map;function mu(e,t){let n=Ye[t];if(n===void 0){const i=hu.get(t);if(i!==void 0)n=Ye[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,i);else throw new Error("Can not resolve #include <"+t+">")}return la(n)}const _u=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Rr(e){return e.replace(_u,gu)}function gu(e,t,n,i){let r="";for(let a=parseInt(t);a0&&(c+=` -`),l=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(Jn).join(` +`),l=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b].filter(ei).join(` `),l.length>0&&(l+=` `)):(c=[wr(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+m:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` -`].filter(Jn).join(` +`].filter(ei).join(` `),l=[wr(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,b,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+f:"",n.envMap?"#define "+m:"",n.envMap?"#define "+_:"",v?"#define CUBEUV_TEXEL_WIDTH "+v.texelWidth:"",v?"#define CUBEUV_TEXEL_HEIGHT "+v.texelHeight:"",v?"#define CUBEUV_MAX_MIP "+v.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+u:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==sn?"#define TONE_MAPPING":"",n.toneMapping!==sn?Ye.tonemapping_pars_fragment:"",n.toneMapping!==sn?lu("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Ye.colorspace_pars_fragment,su("linearToOutputTexel",n.outputColorSpace),cu(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",` -`].filter(Jn).join(` +`].filter(ei).join(` `)),o=la(o),o=br(o,n),o=Ar(o,n),s=la(s),s=br(s,n),s=Ar(s,n),o=Rr(o),s=Rr(s),n.isRawShaderMaterial!==!0&&(O=`#version 300 es `,c=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` @@ -3730,7 +3730,7 @@ Material Type: `+D.type+` Program Info Log: `+Z+` `+ne+` -`+X)}else Z!==""?console.warn("THREE.WebGLProgram: Program Info Log:",Z):(k===""||Y==="")&&($=!1);$&&(D.diagnostics={runnable:J,programLog:Z,vertexShader:{log:k,prefix:c},fragmentShader:{log:Y,prefix:l}})}r.deleteShader(y),r.deleteShader(U),V=new Ei(r,A),E=uu(r,A)}let V;this.getUniforms=function(){return V===void 0&&F(this),V};let E;this.getAttributes=function(){return E===void 0&&F(this),E};let g=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return g===!1&&(g=r.getProgramParameter(A,iu)),g},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(A),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=au++,this.cacheKey=t,this.usedTimes=1,this.program=A,this.vertexShader=y,this.fragmentShader=U,this}let bu=0;class Au{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const n=t.vertexShader,i=t.fragmentShader,r=this._getShaderStage(n),a=this._getShaderStage(i),o=this._getShaderCacheForMaterial(t);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(a)===!1&&(o.add(a),a.usedTimes++),this}remove(t){const n=this.materialCache.get(t);for(const i of n)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const n=this.materialCache;let i=n.get(t);return i===void 0&&(i=new Set,n.set(t,i)),i}_getShaderStage(t){const n=this.shaderCache;let i=n.get(t);return i===void 0&&(i=new Ru(t),n.set(t,i)),i}}class Ru{constructor(t){this.id=bu++,this.code=t,this.usedTimes=0}}function wu(e,t,n,i,r,a,o){const s=new As,u=new Au,f=new Set,m=[],_=r.logarithmicDepthBuffer,v=r.vertexTextures;let p=r.precision;const b={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function A(E){return f.add(E),E===0?"uv":`uv${E}`}function c(E,g,D,Z,k){const Y=Z.fog,J=k.geometry,$=E.isMeshStandardMaterial?Z.environment:null,ne=(E.isMeshStandardMaterial?n:t).get(E.envMap||$),X=ne&&ne.mapping===Ci?ne.image.height:null,xe=b[E.type];E.precision!==null&&(p=r.getMaxPrecision(E.precision),p!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",p,"instead."));const Ce=J.morphAttributes.position||J.morphAttributes.normal||J.morphAttributes.color,Ne=Ce!==void 0?Ce.length:0;let je=0;J.morphAttributes.position!==void 0&&(je=1),J.morphAttributes.normal!==void 0&&(je=2),J.morphAttributes.color!==void 0&&(je=3);let Je,Q,de,Me;if(xe){const ye=Kt[xe];Je=ye.vertexShader,Q=ye.fragmentShader}else Je=E.vertexShader,Q=E.fragmentShader,u.update(E),de=u.getVertexShaderID(E),Me=u.getFragmentShaderID(E);const he=e.getRenderTarget(),Le=e.state.buffers.depth.getReversed(),Ie=k.isInstancedMesh===!0,ke=k.isBatchedMesh===!0,nt=!!E.map,Ke=!!E.matcap,dt=!!ne,R=!!E.aoMap,gt=!!E.lightMap,ze=!!E.bumpMap,We=!!E.normalMap,we=!!E.displacementMap,et=!!E.emissiveMap,be=!!E.metalnessMap,S=!!E.roughnessMap,d=E.anisotropy>0,H=E.clearcoat>0,B=E.dispersion>0,W=E.iridescence>0,G=E.sheen>0,re=E.transmission>0,ie=d&&!!E.anisotropyMap,le=H&&!!E.clearcoatMap,Pe=H&&!!E.clearcoatNormalMap,q=H&&!!E.clearcoatRoughnessMap,ce=W&&!!E.iridescenceMap,_e=W&&!!E.iridescenceThicknessMap,Re=G&&!!E.sheenColorMap,ge=G&&!!E.sheenRoughnessMap,Xe=!!E.specularMap,Ge=!!E.specularColorMap,rt=!!E.specularIntensityMap,I=re&&!!E.transmissionMap,ue=re&&!!E.thicknessMap,K=!!E.gradientMap,C=!!E.alphaMap,z=E.alphaTest>0,j=!!E.alphaHash,se=!!E.extensions;let ve=sn;E.toneMapped&&(he===null||he.isXRRenderTarget===!0)&&(ve=e.toneMapping);const Oe={shaderID:xe,shaderType:E.type,shaderName:E.name,vertexShader:Je,fragmentShader:Q,defines:E.defines,customVertexShaderID:de,customFragmentShaderID:Me,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:p,batching:ke,batchingColor:ke&&k._colorsTexture!==null,instancing:Ie,instancingColor:Ie&&k.instanceColor!==null,instancingMorph:Ie&&k.morphTexture!==null,supportsVertexTextures:v,outputColorSpace:he===null?e.outputColorSpace:he.isXRRenderTarget===!0?he.texture.colorSpace:yi,alphaToCoverage:!!E.alphaToCoverage,map:nt,matcap:Ke,envMap:dt,envMapMode:dt&&ne.mapping,envMapCubeUVHeight:X,aoMap:R,lightMap:gt,bumpMap:ze,normalMap:We,displacementMap:v&&we,emissiveMap:et,normalMapObjectSpace:We&&E.normalMapType===xs,normalMapTangentSpace:We&&E.normalMapType===Es,metalnessMap:be,roughnessMap:S,anisotropy:d,anisotropyMap:ie,clearcoat:H,clearcoatMap:le,clearcoatNormalMap:Pe,clearcoatRoughnessMap:q,dispersion:B,iridescence:W,iridescenceMap:ce,iridescenceThicknessMap:_e,sheen:G,sheenColorMap:Re,sheenRoughnessMap:ge,specularMap:Xe,specularColorMap:Ge,specularIntensityMap:rt,transmission:re,transmissionMap:I,thicknessMap:ue,gradientMap:K,opaque:E.transparent===!1&&E.blending===vi&&E.alphaToCoverage===!1,alphaMap:C,alphaTest:z,alphaHash:j,combine:E.combine,mapUv:nt&&A(E.map.channel),aoMapUv:R&&A(E.aoMap.channel),lightMapUv:gt&&A(E.lightMap.channel),bumpMapUv:ze&&A(E.bumpMap.channel),normalMapUv:We&&A(E.normalMap.channel),displacementMapUv:we&&A(E.displacementMap.channel),emissiveMapUv:et&&A(E.emissiveMap.channel),metalnessMapUv:be&&A(E.metalnessMap.channel),roughnessMapUv:S&&A(E.roughnessMap.channel),anisotropyMapUv:ie&&A(E.anisotropyMap.channel),clearcoatMapUv:le&&A(E.clearcoatMap.channel),clearcoatNormalMapUv:Pe&&A(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:q&&A(E.clearcoatRoughnessMap.channel),iridescenceMapUv:ce&&A(E.iridescenceMap.channel),iridescenceThicknessMapUv:_e&&A(E.iridescenceThicknessMap.channel),sheenColorMapUv:Re&&A(E.sheenColorMap.channel),sheenRoughnessMapUv:ge&&A(E.sheenRoughnessMap.channel),specularMapUv:Xe&&A(E.specularMap.channel),specularColorMapUv:Ge&&A(E.specularColorMap.channel),specularIntensityMapUv:rt&&A(E.specularIntensityMap.channel),transmissionMapUv:I&&A(E.transmissionMap.channel),thicknessMapUv:ue&&A(E.thicknessMap.channel),alphaMapUv:C&&A(E.alphaMap.channel),vertexTangents:!!J.attributes.tangent&&(We||d),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!J.attributes.color&&J.attributes.color.itemSize===4,pointsUvs:k.isPoints===!0&&!!J.attributes.uv&&(nt||C),fog:!!Y,useFog:E.fog===!0,fogExp2:!!Y&&Y.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:_,reverseDepthBuffer:Le,skinning:k.isSkinnedMesh===!0,morphTargets:J.morphAttributes.position!==void 0,morphNormals:J.morphAttributes.normal!==void 0,morphColors:J.morphAttributes.color!==void 0,morphTargetsCount:Ne,morphTextureStride:je,numDirLights:g.directional.length,numPointLights:g.point.length,numSpotLights:g.spot.length,numSpotLightMaps:g.spotLightMap.length,numRectAreaLights:g.rectArea.length,numHemiLights:g.hemi.length,numDirLightShadows:g.directionalShadowMap.length,numPointLightShadows:g.pointShadowMap.length,numSpotLightShadows:g.spotShadowMap.length,numSpotLightShadowsWithMaps:g.numSpotLightShadowsWithMaps,numLightProbes:g.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:E.dithering,shadowMapEnabled:e.shadowMap.enabled&&D.length>0,shadowMapType:e.shadowMap.type,toneMapping:ve,decodeVideoTexture:nt&&E.map.isVideoTexture===!0&&Mt.getTransfer(E.map.colorSpace)===ut,decodeVideoTextureEmissive:et&&E.emissiveMap.isVideoTexture===!0&&Mt.getTransfer(E.emissiveMap.colorSpace)===ut,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===Zt,flipSided:E.side===zt,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionClipCullDistance:se&&E.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(se&&E.extensions.multiDraw===!0||ke)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return Oe.vertexUv1s=f.has(1),Oe.vertexUv2s=f.has(2),Oe.vertexUv3s=f.has(3),f.clear(),Oe}function l(E){const g=[];if(E.shaderID?g.push(E.shaderID):(g.push(E.customVertexShaderID),g.push(E.customFragmentShaderID)),E.defines!==void 0)for(const D in E.defines)g.push(D),g.push(E.defines[D]);return E.isRawShaderMaterial===!1&&(O(g,E),M(g,E),g.push(e.outputColorSpace)),g.push(E.customProgramCacheKey),g.join()}function O(E,g){E.push(g.precision),E.push(g.outputColorSpace),E.push(g.envMapMode),E.push(g.envMapCubeUVHeight),E.push(g.mapUv),E.push(g.alphaMapUv),E.push(g.lightMapUv),E.push(g.aoMapUv),E.push(g.bumpMapUv),E.push(g.normalMapUv),E.push(g.displacementMapUv),E.push(g.emissiveMapUv),E.push(g.metalnessMapUv),E.push(g.roughnessMapUv),E.push(g.anisotropyMapUv),E.push(g.clearcoatMapUv),E.push(g.clearcoatNormalMapUv),E.push(g.clearcoatRoughnessMapUv),E.push(g.iridescenceMapUv),E.push(g.iridescenceThicknessMapUv),E.push(g.sheenColorMapUv),E.push(g.sheenRoughnessMapUv),E.push(g.specularMapUv),E.push(g.specularColorMapUv),E.push(g.specularIntensityMapUv),E.push(g.transmissionMapUv),E.push(g.thicknessMapUv),E.push(g.combine),E.push(g.fogExp2),E.push(g.sizeAttenuation),E.push(g.morphTargetsCount),E.push(g.morphAttributeCount),E.push(g.numDirLights),E.push(g.numPointLights),E.push(g.numSpotLights),E.push(g.numSpotLightMaps),E.push(g.numHemiLights),E.push(g.numRectAreaLights),E.push(g.numDirLightShadows),E.push(g.numPointLightShadows),E.push(g.numSpotLightShadows),E.push(g.numSpotLightShadowsWithMaps),E.push(g.numLightProbes),E.push(g.shadowMapType),E.push(g.toneMapping),E.push(g.numClippingPlanes),E.push(g.numClipIntersection),E.push(g.depthPacking)}function M(E,g){s.disableAll(),g.supportsVertexTextures&&s.enable(0),g.instancing&&s.enable(1),g.instancingColor&&s.enable(2),g.instancingMorph&&s.enable(3),g.matcap&&s.enable(4),g.envMap&&s.enable(5),g.normalMapObjectSpace&&s.enable(6),g.normalMapTangentSpace&&s.enable(7),g.clearcoat&&s.enable(8),g.iridescence&&s.enable(9),g.alphaTest&&s.enable(10),g.vertexColors&&s.enable(11),g.vertexAlphas&&s.enable(12),g.vertexUv1s&&s.enable(13),g.vertexUv2s&&s.enable(14),g.vertexUv3s&&s.enable(15),g.vertexTangents&&s.enable(16),g.anisotropy&&s.enable(17),g.alphaHash&&s.enable(18),g.batching&&s.enable(19),g.dispersion&&s.enable(20),g.batchingColor&&s.enable(21),E.push(s.mask),s.disableAll(),g.fog&&s.enable(0),g.useFog&&s.enable(1),g.flatShading&&s.enable(2),g.logarithmicDepthBuffer&&s.enable(3),g.reverseDepthBuffer&&s.enable(4),g.skinning&&s.enable(5),g.morphTargets&&s.enable(6),g.morphNormals&&s.enable(7),g.morphColors&&s.enable(8),g.premultipliedAlpha&&s.enable(9),g.shadowMapEnabled&&s.enable(10),g.doubleSided&&s.enable(11),g.flipSided&&s.enable(12),g.useDepthPacking&&s.enable(13),g.dithering&&s.enable(14),g.transmission&&s.enable(15),g.sheen&&s.enable(16),g.opaque&&s.enable(17),g.pointsUvs&&s.enable(18),g.decodeVideoTexture&&s.enable(19),g.decodeVideoTextureEmissive&&s.enable(20),g.alphaToCoverage&&s.enable(21),E.push(s.mask)}function x(E){const g=b[E.type];let D;if(g){const Z=Kt[g];D=Ri.clone(Z.uniforms)}else D=E.uniforms;return D}function y(E,g){let D;for(let Z=0,k=m.length;Z0?i.push(l):p.transparent===!0?r.push(l):n.push(l)}function u(_,v,p,b,A,c){const l=o(_,v,p,b,A,c);p.transmission>0?i.unshift(l):p.transparent===!0?r.unshift(l):n.unshift(l)}function f(_,v){n.length>1&&n.sort(_||Cu),i.length>1&&i.sort(v||yr),r.length>1&&r.sort(v||yr)}function m(){for(let _=t,v=e.length;_=a.length?(o=new Cr,a.push(o)):o=a[r],o}function n(){e=new WeakMap}return{get:t,dispose:n}}function Du(){const e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new Te,color:new Ae};break;case"SpotLight":n={position:new Te,direction:new Te,color:new Ae,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Te,color:new Ae,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Te,skyColor:new Ae,groundColor:new Ae};break;case"RectAreaLight":n={color:new Ae,position:new Te,halfWidth:new Te,halfHeight:new Te};break}return e[t.id]=n,n}}}function Lu(){const e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ze};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ze};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ze,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=n,n}}}let Uu=0;function Iu(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function Nu(e){const t=new Du,n=Lu(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let f=0;f<9;f++)i.probe.push(new Te);const r=new Te,a=new Vn,o=new Vn;function s(f){let m=0,_=0,v=0;for(let E=0;E<9;E++)i.probe[E].set(0,0,0);let p=0,b=0,A=0,c=0,l=0,O=0,M=0,x=0,y=0,U=0,F=0;f.sort(Iu);for(let E=0,g=f.length;E0&&(e.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=me.LTC_FLOAT_1,i.rectAreaLTC2=me.LTC_FLOAT_2):(i.rectAreaLTC1=me.LTC_HALF_1,i.rectAreaLTC2=me.LTC_HALF_2)),i.ambient[0]=m,i.ambient[1]=_,i.ambient[2]=v;const V=i.hash;(V.directionalLength!==p||V.pointLength!==b||V.spotLength!==A||V.rectAreaLength!==c||V.hemiLength!==l||V.numDirectionalShadows!==O||V.numPointShadows!==M||V.numSpotShadows!==x||V.numSpotMaps!==y||V.numLightProbes!==F)&&(i.directional.length=p,i.spot.length=A,i.rectArea.length=c,i.point.length=b,i.hemi.length=l,i.directionalShadow.length=O,i.directionalShadowMap.length=O,i.pointShadow.length=M,i.pointShadowMap.length=M,i.spotShadow.length=x,i.spotShadowMap.length=x,i.directionalShadowMatrix.length=O,i.pointShadowMatrix.length=M,i.spotLightMatrix.length=x+y-U,i.spotLightMap.length=y,i.numSpotLightShadowsWithMaps=U,i.numLightProbes=F,V.directionalLength=p,V.pointLength=b,V.spotLength=A,V.rectAreaLength=c,V.hemiLength=l,V.numDirectionalShadows=O,V.numPointShadows=M,V.numSpotShadows=x,V.numSpotMaps=y,V.numLightProbes=F,i.version=Uu++)}function u(f,m){let _=0,v=0,p=0,b=0,A=0;const c=m.matrixWorldInverse;for(let l=0,O=f.length;l=o.length?(s=new Pr(e),o.push(s)):s=o[a],s}function i(){t=new WeakMap}return{get:n,dispose:i}}const Fu=`void main() { +`+X)}else Z!==""?console.warn("THREE.WebGLProgram: Program Info Log:",Z):(k===""||Y==="")&&($=!1);$&&(D.diagnostics={runnable:J,programLog:Z,vertexShader:{log:k,prefix:c},fragmentShader:{log:Y,prefix:l}})}r.deleteShader(y),r.deleteShader(U),V=new Ei(r,A),E=uu(r,A)}let V;this.getUniforms=function(){return V===void 0&&F(this),V};let E;this.getAttributes=function(){return E===void 0&&F(this),E};let g=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return g===!1&&(g=r.getProgramParameter(A,iu)),g},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(A),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=au++,this.cacheKey=t,this.usedTimes=1,this.program=A,this.vertexShader=y,this.fragmentShader=U,this}let bu=0;class Au{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const n=t.vertexShader,i=t.fragmentShader,r=this._getShaderStage(n),a=this._getShaderStage(i),o=this._getShaderCacheForMaterial(t);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(a)===!1&&(o.add(a),a.usedTimes++),this}remove(t){const n=this.materialCache.get(t);for(const i of n)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const n=this.materialCache;let i=n.get(t);return i===void 0&&(i=new Set,n.set(t,i)),i}_getShaderStage(t){const n=this.shaderCache;let i=n.get(t);return i===void 0&&(i=new Ru(t),n.set(t,i)),i}}class Ru{constructor(t){this.id=bu++,this.code=t,this.usedTimes=0}}function wu(e,t,n,i,r,a,o){const s=new As,u=new Au,f=new Set,m=[],_=r.logarithmicDepthBuffer,v=r.vertexTextures;let p=r.precision;const b={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function A(E){return f.add(E),E===0?"uv":`uv${E}`}function c(E,g,D,Z,k){const Y=Z.fog,J=k.geometry,$=E.isMeshStandardMaterial?Z.environment:null,ne=(E.isMeshStandardMaterial?n:t).get(E.envMap||$),X=ne&&ne.mapping===Ci?ne.image.height:null,xe=b[E.type];E.precision!==null&&(p=r.getMaxPrecision(E.precision),p!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",p,"instead."));const Ce=J.morphAttributes.position||J.morphAttributes.normal||J.morphAttributes.color,Ne=Ce!==void 0?Ce.length:0;let je=0;J.morphAttributes.position!==void 0&&(je=1),J.morphAttributes.normal!==void 0&&(je=2),J.morphAttributes.color!==void 0&&(je=3);let Je,Q,de,Me;if(xe){const ye=Kt[xe];Je=ye.vertexShader,Q=ye.fragmentShader}else Je=E.vertexShader,Q=E.fragmentShader,u.update(E),de=u.getVertexShaderID(E),Me=u.getFragmentShaderID(E);const he=e.getRenderTarget(),Le=e.state.buffers.depth.getReversed(),Ie=k.isInstancedMesh===!0,ke=k.isBatchedMesh===!0,nt=!!E.map,Ke=!!E.matcap,dt=!!ne,R=!!E.aoMap,gt=!!E.lightMap,ze=!!E.bumpMap,We=!!E.normalMap,we=!!E.displacementMap,et=!!E.emissiveMap,be=!!E.metalnessMap,S=!!E.roughnessMap,d=E.anisotropy>0,H=E.clearcoat>0,B=E.dispersion>0,W=E.iridescence>0,G=E.sheen>0,re=E.transmission>0,ie=d&&!!E.anisotropyMap,le=H&&!!E.clearcoatMap,Pe=H&&!!E.clearcoatNormalMap,q=H&&!!E.clearcoatRoughnessMap,ce=W&&!!E.iridescenceMap,_e=W&&!!E.iridescenceThicknessMap,Re=G&&!!E.sheenColorMap,ge=G&&!!E.sheenRoughnessMap,Xe=!!E.specularMap,Ge=!!E.specularColorMap,rt=!!E.specularIntensityMap,I=re&&!!E.transmissionMap,ue=re&&!!E.thicknessMap,K=!!E.gradientMap,C=!!E.alphaMap,z=E.alphaTest>0,j=!!E.alphaHash,se=!!E.extensions;let ve=sn;E.toneMapped&&(he===null||he.isXRRenderTarget===!0)&&(ve=e.toneMapping);const Oe={shaderID:xe,shaderType:E.type,shaderName:E.name,vertexShader:Je,fragmentShader:Q,defines:E.defines,customVertexShaderID:de,customFragmentShaderID:Me,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:p,batching:ke,batchingColor:ke&&k._colorsTexture!==null,instancing:Ie,instancingColor:Ie&&k.instanceColor!==null,instancingMorph:Ie&&k.morphTexture!==null,supportsVertexTextures:v,outputColorSpace:he===null?e.outputColorSpace:he.isXRRenderTarget===!0?he.texture.colorSpace:yi,alphaToCoverage:!!E.alphaToCoverage,map:nt,matcap:Ke,envMap:dt,envMapMode:dt&&ne.mapping,envMapCubeUVHeight:X,aoMap:R,lightMap:gt,bumpMap:ze,normalMap:We,displacementMap:v&&we,emissiveMap:et,normalMapObjectSpace:We&&E.normalMapType===xs,normalMapTangentSpace:We&&E.normalMapType===Es,metalnessMap:be,roughnessMap:S,anisotropy:d,anisotropyMap:ie,clearcoat:H,clearcoatMap:le,clearcoatNormalMap:Pe,clearcoatRoughnessMap:q,dispersion:B,iridescence:W,iridescenceMap:ce,iridescenceThicknessMap:_e,sheen:G,sheenColorMap:Re,sheenRoughnessMap:ge,specularMap:Xe,specularColorMap:Ge,specularIntensityMap:rt,transmission:re,transmissionMap:I,thicknessMap:ue,gradientMap:K,opaque:E.transparent===!1&&E.blending===vi&&E.alphaToCoverage===!1,alphaMap:C,alphaTest:z,alphaHash:j,combine:E.combine,mapUv:nt&&A(E.map.channel),aoMapUv:R&&A(E.aoMap.channel),lightMapUv:gt&&A(E.lightMap.channel),bumpMapUv:ze&&A(E.bumpMap.channel),normalMapUv:We&&A(E.normalMap.channel),displacementMapUv:we&&A(E.displacementMap.channel),emissiveMapUv:et&&A(E.emissiveMap.channel),metalnessMapUv:be&&A(E.metalnessMap.channel),roughnessMapUv:S&&A(E.roughnessMap.channel),anisotropyMapUv:ie&&A(E.anisotropyMap.channel),clearcoatMapUv:le&&A(E.clearcoatMap.channel),clearcoatNormalMapUv:Pe&&A(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:q&&A(E.clearcoatRoughnessMap.channel),iridescenceMapUv:ce&&A(E.iridescenceMap.channel),iridescenceThicknessMapUv:_e&&A(E.iridescenceThicknessMap.channel),sheenColorMapUv:Re&&A(E.sheenColorMap.channel),sheenRoughnessMapUv:ge&&A(E.sheenRoughnessMap.channel),specularMapUv:Xe&&A(E.specularMap.channel),specularColorMapUv:Ge&&A(E.specularColorMap.channel),specularIntensityMapUv:rt&&A(E.specularIntensityMap.channel),transmissionMapUv:I&&A(E.transmissionMap.channel),thicknessMapUv:ue&&A(E.thicknessMap.channel),alphaMapUv:C&&A(E.alphaMap.channel),vertexTangents:!!J.attributes.tangent&&(We||d),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!J.attributes.color&&J.attributes.color.itemSize===4,pointsUvs:k.isPoints===!0&&!!J.attributes.uv&&(nt||C),fog:!!Y,useFog:E.fog===!0,fogExp2:!!Y&&Y.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:_,reverseDepthBuffer:Le,skinning:k.isSkinnedMesh===!0,morphTargets:J.morphAttributes.position!==void 0,morphNormals:J.morphAttributes.normal!==void 0,morphColors:J.morphAttributes.color!==void 0,morphTargetsCount:Ne,morphTextureStride:je,numDirLights:g.directional.length,numPointLights:g.point.length,numSpotLights:g.spot.length,numSpotLightMaps:g.spotLightMap.length,numRectAreaLights:g.rectArea.length,numHemiLights:g.hemi.length,numDirLightShadows:g.directionalShadowMap.length,numPointLightShadows:g.pointShadowMap.length,numSpotLightShadows:g.spotShadowMap.length,numSpotLightShadowsWithMaps:g.numSpotLightShadowsWithMaps,numLightProbes:g.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:E.dithering,shadowMapEnabled:e.shadowMap.enabled&&D.length>0,shadowMapType:e.shadowMap.type,toneMapping:ve,decodeVideoTexture:nt&&E.map.isVideoTexture===!0&&Mt.getTransfer(E.map.colorSpace)===ut,decodeVideoTextureEmissive:et&&E.emissiveMap.isVideoTexture===!0&&Mt.getTransfer(E.emissiveMap.colorSpace)===ut,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===Zt,flipSided:E.side===zt,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionClipCullDistance:se&&E.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(se&&E.extensions.multiDraw===!0||ke)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return Oe.vertexUv1s=f.has(1),Oe.vertexUv2s=f.has(2),Oe.vertexUv3s=f.has(3),f.clear(),Oe}function l(E){const g=[];if(E.shaderID?g.push(E.shaderID):(g.push(E.customVertexShaderID),g.push(E.customFragmentShaderID)),E.defines!==void 0)for(const D in E.defines)g.push(D),g.push(E.defines[D]);return E.isRawShaderMaterial===!1&&(O(g,E),M(g,E),g.push(e.outputColorSpace)),g.push(E.customProgramCacheKey),g.join()}function O(E,g){E.push(g.precision),E.push(g.outputColorSpace),E.push(g.envMapMode),E.push(g.envMapCubeUVHeight),E.push(g.mapUv),E.push(g.alphaMapUv),E.push(g.lightMapUv),E.push(g.aoMapUv),E.push(g.bumpMapUv),E.push(g.normalMapUv),E.push(g.displacementMapUv),E.push(g.emissiveMapUv),E.push(g.metalnessMapUv),E.push(g.roughnessMapUv),E.push(g.anisotropyMapUv),E.push(g.clearcoatMapUv),E.push(g.clearcoatNormalMapUv),E.push(g.clearcoatRoughnessMapUv),E.push(g.iridescenceMapUv),E.push(g.iridescenceThicknessMapUv),E.push(g.sheenColorMapUv),E.push(g.sheenRoughnessMapUv),E.push(g.specularMapUv),E.push(g.specularColorMapUv),E.push(g.specularIntensityMapUv),E.push(g.transmissionMapUv),E.push(g.thicknessMapUv),E.push(g.combine),E.push(g.fogExp2),E.push(g.sizeAttenuation),E.push(g.morphTargetsCount),E.push(g.morphAttributeCount),E.push(g.numDirLights),E.push(g.numPointLights),E.push(g.numSpotLights),E.push(g.numSpotLightMaps),E.push(g.numHemiLights),E.push(g.numRectAreaLights),E.push(g.numDirLightShadows),E.push(g.numPointLightShadows),E.push(g.numSpotLightShadows),E.push(g.numSpotLightShadowsWithMaps),E.push(g.numLightProbes),E.push(g.shadowMapType),E.push(g.toneMapping),E.push(g.numClippingPlanes),E.push(g.numClipIntersection),E.push(g.depthPacking)}function M(E,g){s.disableAll(),g.supportsVertexTextures&&s.enable(0),g.instancing&&s.enable(1),g.instancingColor&&s.enable(2),g.instancingMorph&&s.enable(3),g.matcap&&s.enable(4),g.envMap&&s.enable(5),g.normalMapObjectSpace&&s.enable(6),g.normalMapTangentSpace&&s.enable(7),g.clearcoat&&s.enable(8),g.iridescence&&s.enable(9),g.alphaTest&&s.enable(10),g.vertexColors&&s.enable(11),g.vertexAlphas&&s.enable(12),g.vertexUv1s&&s.enable(13),g.vertexUv2s&&s.enable(14),g.vertexUv3s&&s.enable(15),g.vertexTangents&&s.enable(16),g.anisotropy&&s.enable(17),g.alphaHash&&s.enable(18),g.batching&&s.enable(19),g.dispersion&&s.enable(20),g.batchingColor&&s.enable(21),E.push(s.mask),s.disableAll(),g.fog&&s.enable(0),g.useFog&&s.enable(1),g.flatShading&&s.enable(2),g.logarithmicDepthBuffer&&s.enable(3),g.reverseDepthBuffer&&s.enable(4),g.skinning&&s.enable(5),g.morphTargets&&s.enable(6),g.morphNormals&&s.enable(7),g.morphColors&&s.enable(8),g.premultipliedAlpha&&s.enable(9),g.shadowMapEnabled&&s.enable(10),g.doubleSided&&s.enable(11),g.flipSided&&s.enable(12),g.useDepthPacking&&s.enable(13),g.dithering&&s.enable(14),g.transmission&&s.enable(15),g.sheen&&s.enable(16),g.opaque&&s.enable(17),g.pointsUvs&&s.enable(18),g.decodeVideoTexture&&s.enable(19),g.decodeVideoTextureEmissive&&s.enable(20),g.alphaToCoverage&&s.enable(21),E.push(s.mask)}function x(E){const g=b[E.type];let D;if(g){const Z=Kt[g];D=Ri.clone(Z.uniforms)}else D=E.uniforms;return D}function y(E,g){let D;for(let Z=0,k=m.length;Z0?i.push(l):p.transparent===!0?r.push(l):n.push(l)}function u(_,v,p,b,A,c){const l=o(_,v,p,b,A,c);p.transmission>0?i.unshift(l):p.transparent===!0?r.unshift(l):n.unshift(l)}function f(_,v){n.length>1&&n.sort(_||Cu),i.length>1&&i.sort(v||yr),r.length>1&&r.sort(v||yr)}function m(){for(let _=t,v=e.length;_=a.length?(o=new Cr,a.push(o)):o=a[r],o}function n(){e=new WeakMap}return{get:t,dispose:n}}function Du(){const e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new Te,color:new Ae};break;case"SpotLight":n={position:new Te,direction:new Te,color:new Ae,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Te,color:new Ae,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Te,skyColor:new Ae,groundColor:new Ae};break;case"RectAreaLight":n={color:new Ae,position:new Te,halfWidth:new Te,halfHeight:new Te};break}return e[t.id]=n,n}}}function Lu(){const e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ze};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ze};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ze,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=n,n}}}let Uu=0;function Iu(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function Nu(e){const t=new Du,n=Lu(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let f=0;f<9;f++)i.probe.push(new Te);const r=new Te,a=new zn,o=new zn;function s(f){let m=0,_=0,v=0;for(let E=0;E<9;E++)i.probe[E].set(0,0,0);let p=0,b=0,A=0,c=0,l=0,O=0,M=0,x=0,y=0,U=0,F=0;f.sort(Iu);for(let E=0,g=f.length;E0&&(e.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=me.LTC_FLOAT_1,i.rectAreaLTC2=me.LTC_FLOAT_2):(i.rectAreaLTC1=me.LTC_HALF_1,i.rectAreaLTC2=me.LTC_HALF_2)),i.ambient[0]=m,i.ambient[1]=_,i.ambient[2]=v;const V=i.hash;(V.directionalLength!==p||V.pointLength!==b||V.spotLength!==A||V.rectAreaLength!==c||V.hemiLength!==l||V.numDirectionalShadows!==O||V.numPointShadows!==M||V.numSpotShadows!==x||V.numSpotMaps!==y||V.numLightProbes!==F)&&(i.directional.length=p,i.spot.length=A,i.rectArea.length=c,i.point.length=b,i.hemi.length=l,i.directionalShadow.length=O,i.directionalShadowMap.length=O,i.pointShadow.length=M,i.pointShadowMap.length=M,i.spotShadow.length=x,i.spotShadowMap.length=x,i.directionalShadowMatrix.length=O,i.pointShadowMatrix.length=M,i.spotLightMatrix.length=x+y-U,i.spotLightMap.length=y,i.numSpotLightShadowsWithMaps=U,i.numLightProbes=F,V.directionalLength=p,V.pointLength=b,V.spotLength=A,V.rectAreaLength=c,V.hemiLength=l,V.numDirectionalShadows=O,V.numPointShadows=M,V.numSpotShadows=x,V.numSpotMaps=y,V.numLightProbes=F,i.version=Uu++)}function u(f,m){let _=0,v=0,p=0,b=0,A=0;const c=m.matrixWorldInverse;for(let l=0,O=f.length;l=o.length?(s=new Pr(e),o.push(s)):s=o[a],s}function i(){t=new WeakMap}return{get:n,dispose:i}}const Fu=`void main() { gl_Position = vec4( position, 1.0 ); }`,Bu=`uniform sampler2D shadow_pass; uniform vec2 resolution; @@ -3758,7 +3758,7 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function Hu(e,t,n){let i=new Fr;const r=new Ze,a=new Ze,o=new Nt,s=new is({depthPacking:as}),u=new rs,f={},m=n.maxTextureSize,_={[ri]:zt,[zt]:ri,[Zt]:Zt},v=new Ot({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ze},radius:{value:4}},vertexShader:Fu,fragmentShader:Bu}),p=v.clone();p.defines.HORIZONTAL_PASS=1;const b=new Vt;b.setAttribute("position",new wt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const A=new Bt(b,v),c=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=kr;let l=this.type;this.render=function(U,F,V){if(c.enabled===!1||c.autoUpdate===!1&&c.needsUpdate===!1||U.length===0)return;const E=e.getRenderTarget(),g=e.getActiveCubeFace(),D=e.getActiveMipmapLevel(),Z=e.state;Z.setBlending(cn),Z.buffers.color.setClear(1,1,1,1),Z.buffers.depth.setTest(!0),Z.setScissorTest(!1);const k=l!==Jt&&this.type===Jt,Y=l===Jt&&this.type!==Jt;for(let J=0,$=U.length;J<$;J++){const ne=U[J],X=ne.shadow;if(X===void 0){console.warn("THREE.WebGLShadowMap:",ne,"has no shadow.");continue}if(X.autoUpdate===!1&&X.needsUpdate===!1)continue;r.copy(X.mapSize);const xe=X.getFrameExtents();if(r.multiply(xe),a.copy(X.mapSize),(r.x>m||r.y>m)&&(r.x>m&&(a.x=Math.floor(m/xe.x),r.x=a.x*xe.x,X.mapSize.x=a.x),r.y>m&&(a.y=Math.floor(m/xe.y),r.y=a.y*xe.y,X.mapSize.y=a.y)),X.map===null||k===!0||Y===!0){const Ne=this.type!==Jt?{minFilter:ti,magFilter:ti}:{};X.map!==null&&X.map.dispose(),X.map=new jt(r.x,r.y,Ne),X.map.texture.name=ne.name+".shadowMap",X.camera.updateProjectionMatrix()}e.setRenderTarget(X.map),e.clear();const Ce=X.getViewportCount();for(let Ne=0;Ne0||F.map&&F.alphaTest>0){const Z=g.uuid,k=F.uuid;let Y=f[Z];Y===void 0&&(Y={},f[Z]=Y);let J=Y[k];J===void 0&&(J=g.clone(),Y[k]=J,F.addEventListener("dispose",y)),g=J}if(g.visible=F.visible,g.wireframe=F.wireframe,E===Jt?g.side=F.shadowSide!==null?F.shadowSide:F.side:g.side=F.shadowSide!==null?F.shadowSide:_[F.side],g.alphaMap=F.alphaMap,g.alphaTest=F.alphaTest,g.map=F.map,g.clipShadows=F.clipShadows,g.clippingPlanes=F.clippingPlanes,g.clipIntersection=F.clipIntersection,g.displacementMap=F.displacementMap,g.displacementScale=F.displacementScale,g.displacementBias=F.displacementBias,g.wireframeLinewidth=F.wireframeLinewidth,g.linewidth=F.linewidth,V.isPointLight===!0&&g.isMeshDistanceMaterial===!0){const Z=e.properties.get(g);Z.light=V}return g}function x(U,F,V,E,g){if(U.visible===!1)return;if(U.layers.test(F.layers)&&(U.isMesh||U.isLine||U.isPoints)&&(U.castShadow||U.receiveShadow&&g===Jt)&&(!U.frustumCulled||i.intersectsObject(U))){U.modelViewMatrix.multiplyMatrices(V.matrixWorldInverse,U.matrixWorld);const k=t.update(U),Y=U.material;if(Array.isArray(Y)){const J=k.groups;for(let $=0,ne=J.length;$=1):X.indexOf("OpenGL ES")!==-1&&(ne=parseFloat(/^OpenGL ES (\d)/.exec(X)[1]),$=ne>=2);let xe=null,Ce={};const Ne=e.getParameter(e.SCISSOR_BOX),je=e.getParameter(e.VIEWPORT),Je=new Nt().fromArray(Ne),Q=new Nt().fromArray(je);function de(I,ue,K,C){const z=new Uint8Array(4),j=e.createTexture();e.bindTexture(I,j),e.texParameteri(I,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(I,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let se=0;se"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new Ze,m=new WeakMap;let _;const v=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(S,d){return p?new OffscreenCanvas(S,d):Ns("canvas")}function A(S,d,H){let B=1;const W=be(S);if((W.width>H||W.height>H)&&(B=H/Math.max(W.width,W.height)),B<1)if(typeof HTMLImageElement<"u"&&S instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&S instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&S instanceof ImageBitmap||typeof VideoFrame<"u"&&S instanceof VideoFrame){const G=Math.floor(B*W.width),re=Math.floor(B*W.height);_===void 0&&(_=b(G,re));const ie=d?b(G,re):_;return ie.width=G,ie.height=re,ie.getContext("2d").drawImage(S,0,0,G,re),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+W.width+"x"+W.height+") to ("+G+"x"+re+")."),ie}else return"data"in S&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+W.width+"x"+W.height+")."),S;return S}function c(S){return S.generateMipmaps}function l(S){e.generateMipmap(S)}function O(S){return S.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:S.isWebGL3DRenderTarget?e.TEXTURE_3D:S.isWebGLArrayRenderTarget||S.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function M(S,d,H,B,W=!1){if(S!==null){if(e[S]!==void 0)return e[S];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+S+"'")}let G=d;if(d===e.RED&&(H===e.FLOAT&&(G=e.R32F),H===e.HALF_FLOAT&&(G=e.R16F),H===e.UNSIGNED_BYTE&&(G=e.R8)),d===e.RED_INTEGER&&(H===e.UNSIGNED_BYTE&&(G=e.R8UI),H===e.UNSIGNED_SHORT&&(G=e.R16UI),H===e.UNSIGNED_INT&&(G=e.R32UI),H===e.BYTE&&(G=e.R8I),H===e.SHORT&&(G=e.R16I),H===e.INT&&(G=e.R32I)),d===e.RG&&(H===e.FLOAT&&(G=e.RG32F),H===e.HALF_FLOAT&&(G=e.RG16F),H===e.UNSIGNED_BYTE&&(G=e.RG8)),d===e.RG_INTEGER&&(H===e.UNSIGNED_BYTE&&(G=e.RG8UI),H===e.UNSIGNED_SHORT&&(G=e.RG16UI),H===e.UNSIGNED_INT&&(G=e.RG32UI),H===e.BYTE&&(G=e.RG8I),H===e.SHORT&&(G=e.RG16I),H===e.INT&&(G=e.RG32I)),d===e.RGB_INTEGER&&(H===e.UNSIGNED_BYTE&&(G=e.RGB8UI),H===e.UNSIGNED_SHORT&&(G=e.RGB16UI),H===e.UNSIGNED_INT&&(G=e.RGB32UI),H===e.BYTE&&(G=e.RGB8I),H===e.SHORT&&(G=e.RGB16I),H===e.INT&&(G=e.RGB32I)),d===e.RGBA_INTEGER&&(H===e.UNSIGNED_BYTE&&(G=e.RGBA8UI),H===e.UNSIGNED_SHORT&&(G=e.RGBA16UI),H===e.UNSIGNED_INT&&(G=e.RGBA32UI),H===e.BYTE&&(G=e.RGBA8I),H===e.SHORT&&(G=e.RGBA16I),H===e.INT&&(G=e.RGBA32I)),d===e.RGB&&H===e.UNSIGNED_INT_5_9_9_9_REV&&(G=e.RGB9_E5),d===e.RGBA){const re=W?Jr:Mt.getTransfer(B);H===e.FLOAT&&(G=e.RGBA32F),H===e.HALF_FLOAT&&(G=e.RGBA16F),H===e.UNSIGNED_BYTE&&(G=re===ut?e.SRGB8_ALPHA8:e.RGBA8),H===e.UNSIGNED_SHORT_4_4_4_4&&(G=e.RGBA4),H===e.UNSIGNED_SHORT_5_5_5_1&&(G=e.RGB5_A1)}return(G===e.R16F||G===e.R32F||G===e.RG16F||G===e.RG32F||G===e.RGBA16F||G===e.RGBA32F)&&t.get("EXT_color_buffer_float"),G}function x(S,d){let H;return S?d===null||d===si||d===oi?H=e.DEPTH24_STENCIL8:d===bn?H=e.DEPTH32F_STENCIL8:d===Ai&&(H=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):d===null||d===si||d===oi?H=e.DEPTH_COMPONENT24:d===bn?H=e.DEPTH_COMPONENT32F:d===Ai&&(H=e.DEPTH_COMPONENT16),H}function y(S,d){return c(S)===!0||S.isFramebufferTexture&&S.minFilter!==ti&&S.minFilter!==In?Math.log2(Math.max(d.width,d.height))+1:S.mipmaps!==void 0&&S.mipmaps.length>0?S.mipmaps.length:S.isCompressedTexture&&Array.isArray(S.image)?d.mipmaps.length:1}function U(S){const d=S.target;d.removeEventListener("dispose",U),V(d),d.isVideoTexture&&m.delete(d)}function F(S){const d=S.target;d.removeEventListener("dispose",F),g(d)}function V(S){const d=i.get(S);if(d.__webglInit===void 0)return;const H=S.source,B=v.get(H);if(B){const W=B[d.__cacheKey];W.usedTimes--,W.usedTimes===0&&E(S),Object.keys(B).length===0&&v.delete(H)}i.remove(S)}function E(S){const d=i.get(S);e.deleteTexture(d.__webglTexture);const H=S.source,B=v.get(H);delete B[d.__cacheKey],o.memory.textures--}function g(S){const d=i.get(S);if(S.depthTexture&&(S.depthTexture.dispose(),i.remove(S.depthTexture)),S.isWebGLCubeRenderTarget)for(let B=0;B<6;B++){if(Array.isArray(d.__webglFramebuffer[B]))for(let W=0;W=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+S+" texture units while this GPU supports only "+r.maxTextures),D+=1,S}function Y(S){const d=[];return d.push(S.wrapS),d.push(S.wrapT),d.push(S.wrapR||0),d.push(S.magFilter),d.push(S.minFilter),d.push(S.anisotropy),d.push(S.internalFormat),d.push(S.format),d.push(S.type),d.push(S.generateMipmaps),d.push(S.premultiplyAlpha),d.push(S.flipY),d.push(S.unpackAlignment),d.push(S.colorSpace),d.join()}function J(S,d){const H=i.get(S);if(S.isVideoTexture&&we(S),S.isRenderTargetTexture===!1&&S.version>0&&H.__version!==S.version){const B=S.image;if(B===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(B.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Q(H,S,d);return}}n.bindTexture(e.TEXTURE_2D,H.__webglTexture,e.TEXTURE0+d)}function $(S,d){const H=i.get(S);if(S.version>0&&H.__version!==S.version){Q(H,S,d);return}n.bindTexture(e.TEXTURE_2D_ARRAY,H.__webglTexture,e.TEXTURE0+d)}function ne(S,d){const H=i.get(S);if(S.version>0&&H.__version!==S.version){Q(H,S,d);return}n.bindTexture(e.TEXTURE_3D,H.__webglTexture,e.TEXTURE0+d)}function X(S,d){const H=i.get(S);if(S.version>0&&H.__version!==S.version){de(H,S,d);return}n.bindTexture(e.TEXTURE_CUBE_MAP,H.__webglTexture,e.TEXTURE0+d)}const xe={[Ko]:e.REPEAT,[qo]:e.CLAMP_TO_EDGE,[Yo]:e.MIRRORED_REPEAT},Ce={[ti]:e.NEAREST,[Zo]:e.NEAREST_MIPMAP_NEAREST,[ui]:e.NEAREST_MIPMAP_LINEAR,[In]:e.LINEAR,[Li]:e.LINEAR_MIPMAP_NEAREST,[$n]:e.LINEAR_MIPMAP_LINEAR},Ne={[ns]:e.NEVER,[ts]:e.ALWAYS,[es]:e.LESS,[Hr]:e.LEQUAL,[Jo]:e.EQUAL,[Qo]:e.GEQUAL,[$o]:e.GREATER,[jo]:e.NOTEQUAL};function je(S,d){if(d.type===bn&&t.has("OES_texture_float_linear")===!1&&(d.magFilter===In||d.magFilter===Li||d.magFilter===ui||d.magFilter===$n||d.minFilter===In||d.minFilter===Li||d.minFilter===ui||d.minFilter===$n)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(S,e.TEXTURE_WRAP_S,xe[d.wrapS]),e.texParameteri(S,e.TEXTURE_WRAP_T,xe[d.wrapT]),(S===e.TEXTURE_3D||S===e.TEXTURE_2D_ARRAY)&&e.texParameteri(S,e.TEXTURE_WRAP_R,xe[d.wrapR]),e.texParameteri(S,e.TEXTURE_MAG_FILTER,Ce[d.magFilter]),e.texParameteri(S,e.TEXTURE_MIN_FILTER,Ce[d.minFilter]),d.compareFunction&&(e.texParameteri(S,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(S,e.TEXTURE_COMPARE_FUNC,Ne[d.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(d.magFilter===ti||d.minFilter!==ui&&d.minFilter!==$n||d.type===bn&&t.has("OES_texture_float_linear")===!1)return;if(d.anisotropy>1||i.get(d).__currentAnisotropy){const H=t.get("EXT_texture_filter_anisotropic");e.texParameterf(S,H.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(d.anisotropy,r.getMaxAnisotropy())),i.get(d).__currentAnisotropy=d.anisotropy}}}function Je(S,d){let H=!1;S.__webglInit===void 0&&(S.__webglInit=!0,d.addEventListener("dispose",U));const B=d.source;let W=v.get(B);W===void 0&&(W={},v.set(B,W));const G=Y(d);if(G!==S.__cacheKey){W[G]===void 0&&(W[G]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,H=!0),W[G].usedTimes++;const re=W[S.__cacheKey];re!==void 0&&(W[S.__cacheKey].usedTimes--,re.usedTimes===0&&E(d)),S.__cacheKey=G,S.__webglTexture=W[G].texture}return H}function Q(S,d,H){let B=e.TEXTURE_2D;(d.isDataArrayTexture||d.isCompressedArrayTexture)&&(B=e.TEXTURE_2D_ARRAY),d.isData3DTexture&&(B=e.TEXTURE_3D);const W=Je(S,d),G=d.source;n.bindTexture(B,S.__webglTexture,e.TEXTURE0+H);const re=i.get(G);if(G.version!==re.__version||W===!0){n.activeTexture(e.TEXTURE0+H);const ie=Mt.getPrimaries(Mt.workingColorSpace),le=d.colorSpace===Un?null:Mt.getPrimaries(d.colorSpace),Pe=d.colorSpace===Un||ie===le?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,d.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,d.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,Pe);let q=A(d.image,!1,r.maxTextureSize);q=et(d,q);const ce=a.convert(d.format,d.colorSpace),_e=a.convert(d.type);let Re=M(d.internalFormat,ce,_e,d.colorSpace,d.isVideoTexture);je(B,d);let ge;const Xe=d.mipmaps,Ge=d.isVideoTexture!==!0,rt=re.__version===void 0||W===!0,I=G.dataReady,ue=y(d,q);if(d.isDepthTexture)Re=x(d.format===Ti,d.type),rt&&(Ge?n.texStorage2D(e.TEXTURE_2D,1,Re,q.width,q.height):n.texImage2D(e.TEXTURE_2D,0,Re,q.width,q.height,0,ce,_e,null));else if(d.isDataTexture)if(Xe.length>0){Ge&&rt&&n.texStorage2D(e.TEXTURE_2D,ue,Re,Xe[0].width,Xe[0].height);for(let K=0,C=Xe.length;K0){const z=Ka(ge.width,ge.height,d.format,d.type);for(const j of d.layerUpdates){const se=ge.data.subarray(j*z/ge.data.BYTES_PER_ELEMENT,(j+1)*z/ge.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,K,0,0,j,ge.width,ge.height,1,ce,se)}d.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,K,0,0,0,ge.width,ge.height,q.depth,ce,ge.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,K,Re,ge.width,ge.height,q.depth,0,ge.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ge?I&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,K,0,0,0,ge.width,ge.height,q.depth,ce,_e,ge.data):n.texImage3D(e.TEXTURE_2D_ARRAY,K,Re,ge.width,ge.height,q.depth,0,ce,_e,ge.data)}else{Ge&&rt&&n.texStorage2D(e.TEXTURE_2D,ue,Re,Xe[0].width,Xe[0].height);for(let K=0,C=Xe.length;K0){const K=Ka(q.width,q.height,d.format,d.type);for(const C of d.layerUpdates){const z=q.data.subarray(C*K/q.data.BYTES_PER_ELEMENT,(C+1)*K/q.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,C,q.width,q.height,1,ce,_e,z)}d.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,q.width,q.height,q.depth,ce,_e,q.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,Re,q.width,q.height,q.depth,0,ce,_e,q.data);else if(d.isData3DTexture)Ge?(rt&&n.texStorage3D(e.TEXTURE_3D,ue,Re,q.width,q.height,q.depth),I&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,q.width,q.height,q.depth,ce,_e,q.data)):n.texImage3D(e.TEXTURE_3D,0,Re,q.width,q.height,q.depth,0,ce,_e,q.data);else if(d.isFramebufferTexture){if(rt)if(Ge)n.texStorage2D(e.TEXTURE_2D,ue,Re,q.width,q.height);else{let K=q.width,C=q.height;for(let z=0;z>=1,C>>=1}}else if(Xe.length>0){if(Ge&&rt){const K=be(Xe[0]);n.texStorage2D(e.TEXTURE_2D,ue,Re,K.width,K.height)}for(let K=0,C=Xe.length;K0&&ue++;const C=be(ce[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,ue,Xe,C.width,C.height)}for(let C=0;C<6;C++)if(q){Ge?I&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+C,0,0,0,ce[C].width,ce[C].height,Re,ge,ce[C].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+C,0,Xe,ce[C].width,ce[C].height,0,Re,ge,ce[C].data);for(let z=0;z>G),_e=Math.max(1,d.height>>G);W===e.TEXTURE_3D||W===e.TEXTURE_2D_ARRAY?n.texImage3D(W,G,le,ce,_e,d.depth,0,re,ie,null):n.texImage2D(W,G,le,ce,_e,0,re,ie,null)}n.bindFramebuffer(e.FRAMEBUFFER,S),We(d)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,B,W,q.__webglTexture,0,ze(d)):(W===e.TEXTURE_2D||W>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&W<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,B,W,q.__webglTexture,G),n.bindFramebuffer(e.FRAMEBUFFER,null)}function he(S,d,H){if(e.bindRenderbuffer(e.RENDERBUFFER,S),d.depthBuffer){const B=d.depthTexture,W=B&&B.isDepthTexture?B.type:null,G=x(d.stencilBuffer,W),re=d.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,ie=ze(d);We(d)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,ie,G,d.width,d.height):H?e.renderbufferStorageMultisample(e.RENDERBUFFER,ie,G,d.width,d.height):e.renderbufferStorage(e.RENDERBUFFER,G,d.width,d.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,re,e.RENDERBUFFER,S)}else{const B=d.textures;for(let W=0;W{delete d.__boundDepthTexture,delete d.__depthDisposeCallback,B.removeEventListener("dispose",W)};B.addEventListener("dispose",W),d.__depthDisposeCallback=W}d.__boundDepthTexture=B}if(S.depthTexture&&!d.__autoAllocateDepthBuffer){if(H)throw new Error("target.depthTexture not supported in Cube render targets");Le(d.__webglFramebuffer,S)}else if(H){d.__webglDepthbuffer=[];for(let B=0;B<6;B++)if(n.bindFramebuffer(e.FRAMEBUFFER,d.__webglFramebuffer[B]),d.__webglDepthbuffer[B]===void 0)d.__webglDepthbuffer[B]=e.createRenderbuffer(),he(d.__webglDepthbuffer[B],S,!1);else{const W=S.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,G=d.__webglDepthbuffer[B];e.bindRenderbuffer(e.RENDERBUFFER,G),e.framebufferRenderbuffer(e.FRAMEBUFFER,W,e.RENDERBUFFER,G)}}else if(n.bindFramebuffer(e.FRAMEBUFFER,d.__webglFramebuffer),d.__webglDepthbuffer===void 0)d.__webglDepthbuffer=e.createRenderbuffer(),he(d.__webglDepthbuffer,S,!1);else{const B=S.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,W=d.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,W),e.framebufferRenderbuffer(e.FRAMEBUFFER,B,e.RENDERBUFFER,W)}n.bindFramebuffer(e.FRAMEBUFFER,null)}function ke(S,d,H){const B=i.get(S);d!==void 0&&Me(B.__webglFramebuffer,S,S.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),H!==void 0&&Ie(S)}function nt(S){const d=S.texture,H=i.get(S),B=i.get(d);S.addEventListener("dispose",F);const W=S.textures,G=S.isWebGLCubeRenderTarget===!0,re=W.length>1;if(re||(B.__webglTexture===void 0&&(B.__webglTexture=e.createTexture()),B.__version=d.version,o.memory.textures++),G){H.__webglFramebuffer=[];for(let ie=0;ie<6;ie++)if(d.mipmaps&&d.mipmaps.length>0){H.__webglFramebuffer[ie]=[];for(let le=0;le0){H.__webglFramebuffer=[];for(let ie=0;ie0&&We(S)===!1){H.__webglMultisampledFramebuffer=e.createFramebuffer(),H.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,H.__webglMultisampledFramebuffer);for(let ie=0;ie0)for(let le=0;le0)for(let le=0;le0){if(We(S)===!1){const d=S.textures,H=S.width,B=S.height;let W=e.COLOR_BUFFER_BIT;const G=S.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,re=i.get(S),ie=d.length>1;if(ie)for(let le=0;le0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&d.__useRenderToTexture!==!1}function we(S){const d=o.render.frame;m.get(S)!==d&&(m.set(S,d),S.update())}function et(S,d){const H=S.colorSpace,B=S.format,W=S.type;return S.isCompressedTexture===!0||S.isVideoTexture===!0||H!==yi&&H!==Un&&(Mt.getTransfer(H)===ut?(B!==tn||W!==An)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",H)),d}function be(S){return typeof HTMLImageElement<"u"&&S instanceof HTMLImageElement?(f.width=S.naturalWidth||S.width,f.height=S.naturalHeight||S.height):typeof VideoFrame<"u"&&S instanceof VideoFrame?(f.width=S.displayWidth,f.height=S.displayHeight):(f.width=S.width,f.height=S.height),f}this.allocateTextureUnit=k,this.resetTextureUnits=Z,this.setTexture2D=J,this.setTexture2DArray=$,this.setTexture3D=ne,this.setTextureCube=X,this.rebindTextures=ke,this.setupRenderTarget=nt,this.updateRenderTargetMipmap=Ke,this.updateMultisampleRenderTarget=gt,this.setupDepthRenderbuffer=Ie,this.setupFrameBufferTexture=Me,this.useMultisampledRTT=We}function zu(e,t){function n(i,r=Un){let a;const o=Mt.getTransfer(r);if(i===An)return e.UNSIGNED_BYTE;if(i===Vr)return e.UNSIGNED_SHORT_4_4_4_4;if(i===zr)return e.UNSIGNED_SHORT_5_5_5_1;if(i===os)return e.UNSIGNED_INT_5_9_9_9_REV;if(i===ss)return e.BYTE;if(i===ls)return e.SHORT;if(i===Ai)return e.UNSIGNED_SHORT;if(i===Xr)return e.INT;if(i===si)return e.UNSIGNED_INT;if(i===bn)return e.FLOAT;if(i===ln)return e.HALF_FLOAT;if(i===cs)return e.ALPHA;if(i===ds)return e.RGB;if(i===tn)return e.RGBA;if(i===fs)return e.LUMINANCE;if(i===us)return e.LUMINANCE_ALPHA;if(i===ha)return e.DEPTH_COMPONENT;if(i===Ti)return e.DEPTH_STENCIL;if(i===ps)return e.RED;if(i===Yr)return e.RED_INTEGER;if(i===hs)return e.RG;if(i===qr)return e.RG_INTEGER;if(i===Kr)return e.RGBA_INTEGER;if(i===Ui||i===Ii||i===Ni||i===Oi)if(o===ut)if(a=t.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(i===Ui)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Ii)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Ni)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Oi)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=t.get("WEBGL_compressed_texture_s3tc"),a!==null){if(i===Ui)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Ii)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Ni)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Oi)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===va||i===Sa||i===Ea||i===xa)if(a=t.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(i===va)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Sa)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Ea)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===xa)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===Ma||i===Ta||i===ba)if(a=t.get("WEBGL_compressed_texture_etc"),a!==null){if(i===Ma||i===Ta)return o===ut?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(i===ba)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===Aa||i===Ra||i===wa||i===ya||i===Ca||i===Pa||i===Da||i===La||i===Ua||i===Ia||i===Na||i===Oa||i===Fa||i===Ba)if(a=t.get("WEBGL_compressed_texture_astc"),a!==null){if(i===Aa)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Ra)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===wa)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===ya)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Ca)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Pa)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Da)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===La)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Ua)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Ia)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Na)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Oa)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Fa)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Ba)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Fi||i===Ha||i===Ga)if(a=t.get("EXT_texture_compression_bptc"),a!==null){if(i===Fi)return o===ut?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Ha)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Ga)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===ms||i===ka||i===Va||i===za)if(a=t.get("EXT_texture_compression_rgtc"),a!==null){if(i===Fi)return a.COMPRESSED_RED_RGTC1_EXT;if(i===ka)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Va)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===za)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===oi?e.UNSIGNED_INT_24_8:e[i]!==void 0?e[i]:null}return{convert:n}}const Wu={type:"move"};class Wi{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Qn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Qn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Te,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Te),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Qn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Te,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Te),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const n=this._hand;if(n)for(const i of t.hand.values())this._getHandJoint(n,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,n,i){let r=null,a=null,o=null;const s=this._targetRay,u=this._grip,f=this._hand;if(t&&n.session.visibilityState!=="visible-blurred"){if(f&&t.hand){o=!0;for(const A of t.hand.values()){const c=n.getJointPose(A,i),l=this._getHandJoint(f,A);c!==null&&(l.matrix.fromArray(c.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,l.jointRadius=c.radius),l.visible=c!==null}const m=f.joints["index-finger-tip"],_=f.joints["thumb-tip"],v=m.position.distanceTo(_.position),p=.02,b=.005;f.inputState.pinching&&v>p+b?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!f.inputState.pinching&&v<=p-b&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else u!==null&&t.gripSpace&&(a=n.getPose(t.gripSpace,i),a!==null&&(u.matrix.fromArray(a.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,a.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(a.linearVelocity)):u.hasLinearVelocity=!1,a.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(a.angularVelocity)):u.hasAngularVelocity=!1));s!==null&&(r=n.getPose(t.targetRaySpace,i),r===null&&a!==null&&(r=a),r!==null&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(Wu)))}return s!==null&&(s.visible=r!==null),u!==null&&(u.visible=a!==null),f!==null&&(f.visible=o!==null),this}_getHandJoint(t,n){if(t.joints[n.jointName]===void 0){const i=new Qn;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[n.jointName]=i,t.add(i)}return t.joints[n.jointName]}}const Xu=` +}`;function Hu(e,t,n){let i=new Fr;const r=new Ze,a=new Ze,o=new Nt,s=new is({depthPacking:as}),u=new rs,f={},m=n.maxTextureSize,_={[ri]:zt,[zt]:ri,[Zt]:Zt},v=new Ot({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ze},radius:{value:4}},vertexShader:Fu,fragmentShader:Bu}),p=v.clone();p.defines.HORIZONTAL_PASS=1;const b=new Vt;b.setAttribute("position",new wt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const A=new Bt(b,v),c=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=kr;let l=this.type;this.render=function(U,F,V){if(c.enabled===!1||c.autoUpdate===!1&&c.needsUpdate===!1||U.length===0)return;const E=e.getRenderTarget(),g=e.getActiveCubeFace(),D=e.getActiveMipmapLevel(),Z=e.state;Z.setBlending(cn),Z.buffers.color.setClear(1,1,1,1),Z.buffers.depth.setTest(!0),Z.setScissorTest(!1);const k=l!==Jt&&this.type===Jt,Y=l===Jt&&this.type!==Jt;for(let J=0,$=U.length;J<$;J++){const ne=U[J],X=ne.shadow;if(X===void 0){console.warn("THREE.WebGLShadowMap:",ne,"has no shadow.");continue}if(X.autoUpdate===!1&&X.needsUpdate===!1)continue;r.copy(X.mapSize);const xe=X.getFrameExtents();if(r.multiply(xe),a.copy(X.mapSize),(r.x>m||r.y>m)&&(r.x>m&&(a.x=Math.floor(m/xe.x),r.x=a.x*xe.x,X.mapSize.x=a.x),r.y>m&&(a.y=Math.floor(m/xe.y),r.y=a.y*xe.y,X.mapSize.y=a.y)),X.map===null||k===!0||Y===!0){const Ne=this.type!==Jt?{minFilter:ti,magFilter:ti}:{};X.map!==null&&X.map.dispose(),X.map=new jt(r.x,r.y,Ne),X.map.texture.name=ne.name+".shadowMap",X.camera.updateProjectionMatrix()}e.setRenderTarget(X.map),e.clear();const Ce=X.getViewportCount();for(let Ne=0;Ne0||F.map&&F.alphaTest>0){const Z=g.uuid,k=F.uuid;let Y=f[Z];Y===void 0&&(Y={},f[Z]=Y);let J=Y[k];J===void 0&&(J=g.clone(),Y[k]=J,F.addEventListener("dispose",y)),g=J}if(g.visible=F.visible,g.wireframe=F.wireframe,E===Jt?g.side=F.shadowSide!==null?F.shadowSide:F.side:g.side=F.shadowSide!==null?F.shadowSide:_[F.side],g.alphaMap=F.alphaMap,g.alphaTest=F.alphaTest,g.map=F.map,g.clipShadows=F.clipShadows,g.clippingPlanes=F.clippingPlanes,g.clipIntersection=F.clipIntersection,g.displacementMap=F.displacementMap,g.displacementScale=F.displacementScale,g.displacementBias=F.displacementBias,g.wireframeLinewidth=F.wireframeLinewidth,g.linewidth=F.linewidth,V.isPointLight===!0&&g.isMeshDistanceMaterial===!0){const Z=e.properties.get(g);Z.light=V}return g}function x(U,F,V,E,g){if(U.visible===!1)return;if(U.layers.test(F.layers)&&(U.isMesh||U.isLine||U.isPoints)&&(U.castShadow||U.receiveShadow&&g===Jt)&&(!U.frustumCulled||i.intersectsObject(U))){U.modelViewMatrix.multiplyMatrices(V.matrixWorldInverse,U.matrixWorld);const k=t.update(U),Y=U.material;if(Array.isArray(Y)){const J=k.groups;for(let $=0,ne=J.length;$=1):X.indexOf("OpenGL ES")!==-1&&(ne=parseFloat(/^OpenGL ES (\d)/.exec(X)[1]),$=ne>=2);let xe=null,Ce={};const Ne=e.getParameter(e.SCISSOR_BOX),je=e.getParameter(e.VIEWPORT),Je=new Nt().fromArray(Ne),Q=new Nt().fromArray(je);function de(I,ue,K,C){const z=new Uint8Array(4),j=e.createTexture();e.bindTexture(I,j),e.texParameteri(I,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(I,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let se=0;se"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new Ze,m=new WeakMap;let _;const v=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function b(S,d){return p?new OffscreenCanvas(S,d):Ns("canvas")}function A(S,d,H){let B=1;const W=be(S);if((W.width>H||W.height>H)&&(B=H/Math.max(W.width,W.height)),B<1)if(typeof HTMLImageElement<"u"&&S instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&S instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&S instanceof ImageBitmap||typeof VideoFrame<"u"&&S instanceof VideoFrame){const G=Math.floor(B*W.width),re=Math.floor(B*W.height);_===void 0&&(_=b(G,re));const ie=d?b(G,re):_;return ie.width=G,ie.height=re,ie.getContext("2d").drawImage(S,0,0,G,re),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+W.width+"x"+W.height+") to ("+G+"x"+re+")."),ie}else return"data"in S&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+W.width+"x"+W.height+")."),S;return S}function c(S){return S.generateMipmaps}function l(S){e.generateMipmap(S)}function O(S){return S.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:S.isWebGL3DRenderTarget?e.TEXTURE_3D:S.isWebGLArrayRenderTarget||S.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function M(S,d,H,B,W=!1){if(S!==null){if(e[S]!==void 0)return e[S];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+S+"'")}let G=d;if(d===e.RED&&(H===e.FLOAT&&(G=e.R32F),H===e.HALF_FLOAT&&(G=e.R16F),H===e.UNSIGNED_BYTE&&(G=e.R8)),d===e.RED_INTEGER&&(H===e.UNSIGNED_BYTE&&(G=e.R8UI),H===e.UNSIGNED_SHORT&&(G=e.R16UI),H===e.UNSIGNED_INT&&(G=e.R32UI),H===e.BYTE&&(G=e.R8I),H===e.SHORT&&(G=e.R16I),H===e.INT&&(G=e.R32I)),d===e.RG&&(H===e.FLOAT&&(G=e.RG32F),H===e.HALF_FLOAT&&(G=e.RG16F),H===e.UNSIGNED_BYTE&&(G=e.RG8)),d===e.RG_INTEGER&&(H===e.UNSIGNED_BYTE&&(G=e.RG8UI),H===e.UNSIGNED_SHORT&&(G=e.RG16UI),H===e.UNSIGNED_INT&&(G=e.RG32UI),H===e.BYTE&&(G=e.RG8I),H===e.SHORT&&(G=e.RG16I),H===e.INT&&(G=e.RG32I)),d===e.RGB_INTEGER&&(H===e.UNSIGNED_BYTE&&(G=e.RGB8UI),H===e.UNSIGNED_SHORT&&(G=e.RGB16UI),H===e.UNSIGNED_INT&&(G=e.RGB32UI),H===e.BYTE&&(G=e.RGB8I),H===e.SHORT&&(G=e.RGB16I),H===e.INT&&(G=e.RGB32I)),d===e.RGBA_INTEGER&&(H===e.UNSIGNED_BYTE&&(G=e.RGBA8UI),H===e.UNSIGNED_SHORT&&(G=e.RGBA16UI),H===e.UNSIGNED_INT&&(G=e.RGBA32UI),H===e.BYTE&&(G=e.RGBA8I),H===e.SHORT&&(G=e.RGBA16I),H===e.INT&&(G=e.RGBA32I)),d===e.RGB&&H===e.UNSIGNED_INT_5_9_9_9_REV&&(G=e.RGB9_E5),d===e.RGBA){const re=W?Jr:Mt.getTransfer(B);H===e.FLOAT&&(G=e.RGBA32F),H===e.HALF_FLOAT&&(G=e.RGBA16F),H===e.UNSIGNED_BYTE&&(G=re===ut?e.SRGB8_ALPHA8:e.RGBA8),H===e.UNSIGNED_SHORT_4_4_4_4&&(G=e.RGBA4),H===e.UNSIGNED_SHORT_5_5_5_1&&(G=e.RGB5_A1)}return(G===e.R16F||G===e.R32F||G===e.RG16F||G===e.RG32F||G===e.RGBA16F||G===e.RGBA32F)&&t.get("EXT_color_buffer_float"),G}function x(S,d){let H;return S?d===null||d===si||d===oi?H=e.DEPTH24_STENCIL8:d===bn?H=e.DEPTH32F_STENCIL8:d===Ai&&(H=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):d===null||d===si||d===oi?H=e.DEPTH_COMPONENT24:d===bn?H=e.DEPTH_COMPONENT32F:d===Ai&&(H=e.DEPTH_COMPONENT16),H}function y(S,d){return c(S)===!0||S.isFramebufferTexture&&S.minFilter!==ti&&S.minFilter!==In?Math.log2(Math.max(d.width,d.height))+1:S.mipmaps!==void 0&&S.mipmaps.length>0?S.mipmaps.length:S.isCompressedTexture&&Array.isArray(S.image)?d.mipmaps.length:1}function U(S){const d=S.target;d.removeEventListener("dispose",U),V(d),d.isVideoTexture&&m.delete(d)}function F(S){const d=S.target;d.removeEventListener("dispose",F),g(d)}function V(S){const d=i.get(S);if(d.__webglInit===void 0)return;const H=S.source,B=v.get(H);if(B){const W=B[d.__cacheKey];W.usedTimes--,W.usedTimes===0&&E(S),Object.keys(B).length===0&&v.delete(H)}i.remove(S)}function E(S){const d=i.get(S);e.deleteTexture(d.__webglTexture);const H=S.source,B=v.get(H);delete B[d.__cacheKey],o.memory.textures--}function g(S){const d=i.get(S);if(S.depthTexture&&(S.depthTexture.dispose(),i.remove(S.depthTexture)),S.isWebGLCubeRenderTarget)for(let B=0;B<6;B++){if(Array.isArray(d.__webglFramebuffer[B]))for(let W=0;W=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+S+" texture units while this GPU supports only "+r.maxTextures),D+=1,S}function Y(S){const d=[];return d.push(S.wrapS),d.push(S.wrapT),d.push(S.wrapR||0),d.push(S.magFilter),d.push(S.minFilter),d.push(S.anisotropy),d.push(S.internalFormat),d.push(S.format),d.push(S.type),d.push(S.generateMipmaps),d.push(S.premultiplyAlpha),d.push(S.flipY),d.push(S.unpackAlignment),d.push(S.colorSpace),d.join()}function J(S,d){const H=i.get(S);if(S.isVideoTexture&&we(S),S.isRenderTargetTexture===!1&&S.version>0&&H.__version!==S.version){const B=S.image;if(B===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(B.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Q(H,S,d);return}}n.bindTexture(e.TEXTURE_2D,H.__webglTexture,e.TEXTURE0+d)}function $(S,d){const H=i.get(S);if(S.version>0&&H.__version!==S.version){Q(H,S,d);return}n.bindTexture(e.TEXTURE_2D_ARRAY,H.__webglTexture,e.TEXTURE0+d)}function ne(S,d){const H=i.get(S);if(S.version>0&&H.__version!==S.version){Q(H,S,d);return}n.bindTexture(e.TEXTURE_3D,H.__webglTexture,e.TEXTURE0+d)}function X(S,d){const H=i.get(S);if(S.version>0&&H.__version!==S.version){de(H,S,d);return}n.bindTexture(e.TEXTURE_CUBE_MAP,H.__webglTexture,e.TEXTURE0+d)}const xe={[Ko]:e.REPEAT,[qo]:e.CLAMP_TO_EDGE,[Yo]:e.MIRRORED_REPEAT},Ce={[ti]:e.NEAREST,[Zo]:e.NEAREST_MIPMAP_NEAREST,[ui]:e.NEAREST_MIPMAP_LINEAR,[In]:e.LINEAR,[Li]:e.LINEAR_MIPMAP_NEAREST,[Qn]:e.LINEAR_MIPMAP_LINEAR},Ne={[ns]:e.NEVER,[ts]:e.ALWAYS,[es]:e.LESS,[Hr]:e.LEQUAL,[Jo]:e.EQUAL,[Qo]:e.GEQUAL,[$o]:e.GREATER,[jo]:e.NOTEQUAL};function je(S,d){if(d.type===bn&&t.has("OES_texture_float_linear")===!1&&(d.magFilter===In||d.magFilter===Li||d.magFilter===ui||d.magFilter===Qn||d.minFilter===In||d.minFilter===Li||d.minFilter===ui||d.minFilter===Qn)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(S,e.TEXTURE_WRAP_S,xe[d.wrapS]),e.texParameteri(S,e.TEXTURE_WRAP_T,xe[d.wrapT]),(S===e.TEXTURE_3D||S===e.TEXTURE_2D_ARRAY)&&e.texParameteri(S,e.TEXTURE_WRAP_R,xe[d.wrapR]),e.texParameteri(S,e.TEXTURE_MAG_FILTER,Ce[d.magFilter]),e.texParameteri(S,e.TEXTURE_MIN_FILTER,Ce[d.minFilter]),d.compareFunction&&(e.texParameteri(S,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(S,e.TEXTURE_COMPARE_FUNC,Ne[d.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(d.magFilter===ti||d.minFilter!==ui&&d.minFilter!==Qn||d.type===bn&&t.has("OES_texture_float_linear")===!1)return;if(d.anisotropy>1||i.get(d).__currentAnisotropy){const H=t.get("EXT_texture_filter_anisotropic");e.texParameterf(S,H.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(d.anisotropy,r.getMaxAnisotropy())),i.get(d).__currentAnisotropy=d.anisotropy}}}function Je(S,d){let H=!1;S.__webglInit===void 0&&(S.__webglInit=!0,d.addEventListener("dispose",U));const B=d.source;let W=v.get(B);W===void 0&&(W={},v.set(B,W));const G=Y(d);if(G!==S.__cacheKey){W[G]===void 0&&(W[G]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,H=!0),W[G].usedTimes++;const re=W[S.__cacheKey];re!==void 0&&(W[S.__cacheKey].usedTimes--,re.usedTimes===0&&E(d)),S.__cacheKey=G,S.__webglTexture=W[G].texture}return H}function Q(S,d,H){let B=e.TEXTURE_2D;(d.isDataArrayTexture||d.isCompressedArrayTexture)&&(B=e.TEXTURE_2D_ARRAY),d.isData3DTexture&&(B=e.TEXTURE_3D);const W=Je(S,d),G=d.source;n.bindTexture(B,S.__webglTexture,e.TEXTURE0+H);const re=i.get(G);if(G.version!==re.__version||W===!0){n.activeTexture(e.TEXTURE0+H);const ie=Mt.getPrimaries(Mt.workingColorSpace),le=d.colorSpace===Un?null:Mt.getPrimaries(d.colorSpace),Pe=d.colorSpace===Un||ie===le?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,d.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,d.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,Pe);let q=A(d.image,!1,r.maxTextureSize);q=et(d,q);const ce=a.convert(d.format,d.colorSpace),_e=a.convert(d.type);let Re=M(d.internalFormat,ce,_e,d.colorSpace,d.isVideoTexture);je(B,d);let ge;const Xe=d.mipmaps,Ge=d.isVideoTexture!==!0,rt=re.__version===void 0||W===!0,I=G.dataReady,ue=y(d,q);if(d.isDepthTexture)Re=x(d.format===Ti,d.type),rt&&(Ge?n.texStorage2D(e.TEXTURE_2D,1,Re,q.width,q.height):n.texImage2D(e.TEXTURE_2D,0,Re,q.width,q.height,0,ce,_e,null));else if(d.isDataTexture)if(Xe.length>0){Ge&&rt&&n.texStorage2D(e.TEXTURE_2D,ue,Re,Xe[0].width,Xe[0].height);for(let K=0,C=Xe.length;K0){const z=Ka(ge.width,ge.height,d.format,d.type);for(const j of d.layerUpdates){const se=ge.data.subarray(j*z/ge.data.BYTES_PER_ELEMENT,(j+1)*z/ge.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,K,0,0,j,ge.width,ge.height,1,ce,se)}d.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,K,0,0,0,ge.width,ge.height,q.depth,ce,ge.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,K,Re,ge.width,ge.height,q.depth,0,ge.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ge?I&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,K,0,0,0,ge.width,ge.height,q.depth,ce,_e,ge.data):n.texImage3D(e.TEXTURE_2D_ARRAY,K,Re,ge.width,ge.height,q.depth,0,ce,_e,ge.data)}else{Ge&&rt&&n.texStorage2D(e.TEXTURE_2D,ue,Re,Xe[0].width,Xe[0].height);for(let K=0,C=Xe.length;K0){const K=Ka(q.width,q.height,d.format,d.type);for(const C of d.layerUpdates){const z=q.data.subarray(C*K/q.data.BYTES_PER_ELEMENT,(C+1)*K/q.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,C,q.width,q.height,1,ce,_e,z)}d.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,q.width,q.height,q.depth,ce,_e,q.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,Re,q.width,q.height,q.depth,0,ce,_e,q.data);else if(d.isData3DTexture)Ge?(rt&&n.texStorage3D(e.TEXTURE_3D,ue,Re,q.width,q.height,q.depth),I&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,q.width,q.height,q.depth,ce,_e,q.data)):n.texImage3D(e.TEXTURE_3D,0,Re,q.width,q.height,q.depth,0,ce,_e,q.data);else if(d.isFramebufferTexture){if(rt)if(Ge)n.texStorage2D(e.TEXTURE_2D,ue,Re,q.width,q.height);else{let K=q.width,C=q.height;for(let z=0;z>=1,C>>=1}}else if(Xe.length>0){if(Ge&&rt){const K=be(Xe[0]);n.texStorage2D(e.TEXTURE_2D,ue,Re,K.width,K.height)}for(let K=0,C=Xe.length;K0&&ue++;const C=be(ce[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,ue,Xe,C.width,C.height)}for(let C=0;C<6;C++)if(q){Ge?I&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+C,0,0,0,ce[C].width,ce[C].height,Re,ge,ce[C].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+C,0,Xe,ce[C].width,ce[C].height,0,Re,ge,ce[C].data);for(let z=0;z>G),_e=Math.max(1,d.height>>G);W===e.TEXTURE_3D||W===e.TEXTURE_2D_ARRAY?n.texImage3D(W,G,le,ce,_e,d.depth,0,re,ie,null):n.texImage2D(W,G,le,ce,_e,0,re,ie,null)}n.bindFramebuffer(e.FRAMEBUFFER,S),We(d)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,B,W,q.__webglTexture,0,ze(d)):(W===e.TEXTURE_2D||W>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&W<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,B,W,q.__webglTexture,G),n.bindFramebuffer(e.FRAMEBUFFER,null)}function he(S,d,H){if(e.bindRenderbuffer(e.RENDERBUFFER,S),d.depthBuffer){const B=d.depthTexture,W=B&&B.isDepthTexture?B.type:null,G=x(d.stencilBuffer,W),re=d.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,ie=ze(d);We(d)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,ie,G,d.width,d.height):H?e.renderbufferStorageMultisample(e.RENDERBUFFER,ie,G,d.width,d.height):e.renderbufferStorage(e.RENDERBUFFER,G,d.width,d.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,re,e.RENDERBUFFER,S)}else{const B=d.textures;for(let W=0;W{delete d.__boundDepthTexture,delete d.__depthDisposeCallback,B.removeEventListener("dispose",W)};B.addEventListener("dispose",W),d.__depthDisposeCallback=W}d.__boundDepthTexture=B}if(S.depthTexture&&!d.__autoAllocateDepthBuffer){if(H)throw new Error("target.depthTexture not supported in Cube render targets");Le(d.__webglFramebuffer,S)}else if(H){d.__webglDepthbuffer=[];for(let B=0;B<6;B++)if(n.bindFramebuffer(e.FRAMEBUFFER,d.__webglFramebuffer[B]),d.__webglDepthbuffer[B]===void 0)d.__webglDepthbuffer[B]=e.createRenderbuffer(),he(d.__webglDepthbuffer[B],S,!1);else{const W=S.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,G=d.__webglDepthbuffer[B];e.bindRenderbuffer(e.RENDERBUFFER,G),e.framebufferRenderbuffer(e.FRAMEBUFFER,W,e.RENDERBUFFER,G)}}else if(n.bindFramebuffer(e.FRAMEBUFFER,d.__webglFramebuffer),d.__webglDepthbuffer===void 0)d.__webglDepthbuffer=e.createRenderbuffer(),he(d.__webglDepthbuffer,S,!1);else{const B=S.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,W=d.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,W),e.framebufferRenderbuffer(e.FRAMEBUFFER,B,e.RENDERBUFFER,W)}n.bindFramebuffer(e.FRAMEBUFFER,null)}function ke(S,d,H){const B=i.get(S);d!==void 0&&Me(B.__webglFramebuffer,S,S.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),H!==void 0&&Ie(S)}function nt(S){const d=S.texture,H=i.get(S),B=i.get(d);S.addEventListener("dispose",F);const W=S.textures,G=S.isWebGLCubeRenderTarget===!0,re=W.length>1;if(re||(B.__webglTexture===void 0&&(B.__webglTexture=e.createTexture()),B.__version=d.version,o.memory.textures++),G){H.__webglFramebuffer=[];for(let ie=0;ie<6;ie++)if(d.mipmaps&&d.mipmaps.length>0){H.__webglFramebuffer[ie]=[];for(let le=0;le0){H.__webglFramebuffer=[];for(let ie=0;ie0&&We(S)===!1){H.__webglMultisampledFramebuffer=e.createFramebuffer(),H.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,H.__webglMultisampledFramebuffer);for(let ie=0;ie0)for(let le=0;le0)for(let le=0;le0){if(We(S)===!1){const d=S.textures,H=S.width,B=S.height;let W=e.COLOR_BUFFER_BIT;const G=S.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,re=i.get(S),ie=d.length>1;if(ie)for(let le=0;le0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&d.__useRenderToTexture!==!1}function we(S){const d=o.render.frame;m.get(S)!==d&&(m.set(S,d),S.update())}function et(S,d){const H=S.colorSpace,B=S.format,W=S.type;return S.isCompressedTexture===!0||S.isVideoTexture===!0||H!==yi&&H!==Un&&(Mt.getTransfer(H)===ut?(B!==tn||W!==An)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",H)),d}function be(S){return typeof HTMLImageElement<"u"&&S instanceof HTMLImageElement?(f.width=S.naturalWidth||S.width,f.height=S.naturalHeight||S.height):typeof VideoFrame<"u"&&S instanceof VideoFrame?(f.width=S.displayWidth,f.height=S.displayHeight):(f.width=S.width,f.height=S.height),f}this.allocateTextureUnit=k,this.resetTextureUnits=Z,this.setTexture2D=J,this.setTexture2DArray=$,this.setTexture3D=ne,this.setTextureCube=X,this.rebindTextures=ke,this.setupRenderTarget=nt,this.updateRenderTargetMipmap=Ke,this.updateMultisampleRenderTarget=gt,this.setupDepthRenderbuffer=Ie,this.setupFrameBufferTexture=Me,this.useMultisampledRTT=We}function zu(e,t){function n(i,r=Un){let a;const o=Mt.getTransfer(r);if(i===An)return e.UNSIGNED_BYTE;if(i===Vr)return e.UNSIGNED_SHORT_4_4_4_4;if(i===zr)return e.UNSIGNED_SHORT_5_5_5_1;if(i===os)return e.UNSIGNED_INT_5_9_9_9_REV;if(i===ss)return e.BYTE;if(i===ls)return e.SHORT;if(i===Ai)return e.UNSIGNED_SHORT;if(i===Xr)return e.INT;if(i===si)return e.UNSIGNED_INT;if(i===bn)return e.FLOAT;if(i===ln)return e.HALF_FLOAT;if(i===cs)return e.ALPHA;if(i===ds)return e.RGB;if(i===tn)return e.RGBA;if(i===fs)return e.LUMINANCE;if(i===us)return e.LUMINANCE_ALPHA;if(i===ha)return e.DEPTH_COMPONENT;if(i===Ti)return e.DEPTH_STENCIL;if(i===ps)return e.RED;if(i===Yr)return e.RED_INTEGER;if(i===hs)return e.RG;if(i===qr)return e.RG_INTEGER;if(i===Kr)return e.RGBA_INTEGER;if(i===Ui||i===Ii||i===Ni||i===Oi)if(o===ut)if(a=t.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(i===Ui)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Ii)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Ni)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Oi)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=t.get("WEBGL_compressed_texture_s3tc"),a!==null){if(i===Ui)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Ii)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Ni)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Oi)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===va||i===Sa||i===Ea||i===xa)if(a=t.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(i===va)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Sa)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===Ea)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===xa)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===Ma||i===Ta||i===ba)if(a=t.get("WEBGL_compressed_texture_etc"),a!==null){if(i===Ma||i===Ta)return o===ut?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(i===ba)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===Aa||i===Ra||i===wa||i===ya||i===Ca||i===Pa||i===Da||i===La||i===Ua||i===Ia||i===Na||i===Oa||i===Fa||i===Ba)if(a=t.get("WEBGL_compressed_texture_astc"),a!==null){if(i===Aa)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===Ra)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===wa)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===ya)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===Ca)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===Pa)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===Da)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===La)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Ua)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Ia)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===Na)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Oa)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===Fa)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Ba)return o===ut?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Fi||i===Ha||i===Ga)if(a=t.get("EXT_texture_compression_bptc"),a!==null){if(i===Fi)return o===ut?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Ha)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===Ga)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===ms||i===ka||i===Va||i===za)if(a=t.get("EXT_texture_compression_rgtc"),a!==null){if(i===Fi)return a.COMPRESSED_RED_RGTC1_EXT;if(i===ka)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Va)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===za)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===oi?e.UNSIGNED_INT_24_8:e[i]!==void 0?e[i]:null}return{convert:n}}const Wu={type:"move"};class Wi{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Jn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Jn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Te,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Te),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Jn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Te,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Te),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const n=this._hand;if(n)for(const i of t.hand.values())this._getHandJoint(n,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,n,i){let r=null,a=null,o=null;const s=this._targetRay,u=this._grip,f=this._hand;if(t&&n.session.visibilityState!=="visible-blurred"){if(f&&t.hand){o=!0;for(const A of t.hand.values()){const c=n.getJointPose(A,i),l=this._getHandJoint(f,A);c!==null&&(l.matrix.fromArray(c.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,l.jointRadius=c.radius),l.visible=c!==null}const m=f.joints["index-finger-tip"],_=f.joints["thumb-tip"],v=m.position.distanceTo(_.position),p=.02,b=.005;f.inputState.pinching&&v>p+b?(f.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!f.inputState.pinching&&v<=p-b&&(f.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else u!==null&&t.gripSpace&&(a=n.getPose(t.gripSpace,i),a!==null&&(u.matrix.fromArray(a.transform.matrix),u.matrix.decompose(u.position,u.rotation,u.scale),u.matrixWorldNeedsUpdate=!0,a.linearVelocity?(u.hasLinearVelocity=!0,u.linearVelocity.copy(a.linearVelocity)):u.hasLinearVelocity=!1,a.angularVelocity?(u.hasAngularVelocity=!0,u.angularVelocity.copy(a.angularVelocity)):u.hasAngularVelocity=!1));s!==null&&(r=n.getPose(t.targetRaySpace,i),r===null&&a!==null&&(r=a),r!==null&&(s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,r.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(r.linearVelocity)):s.hasLinearVelocity=!1,r.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(r.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(Wu)))}return s!==null&&(s.visible=r!==null),u!==null&&(u.visible=a!==null),f!==null&&(f.visible=o!==null),this}_getHandJoint(t,n){if(t.joints[n.jointName]===void 0){const i=new Jn;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[n.jointName]=i,t.add(i)}return t.joints[n.jointName]}}const Xu=` void main() { gl_Position = vec4( position, 1.0 ); @@ -3782,7 +3782,7 @@ void main() { } -}`;class qu{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,n,i){if(this.texture===null){const r=new Wr,a=t.properties.get(r);a.__webglTexture=n.texture,(n.depthNear!==i.depthNear||n.depthFar!==i.depthFar)&&(this.depthNear=n.depthNear,this.depthFar=n.depthFar),this.texture=r}}getMesh(t){if(this.texture!==null&&this.mesh===null){const n=t.cameras[0].viewport,i=new Ot({vertexShader:Xu,fragmentShader:Yu,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Bt(new ma(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Ku extends Ro{constructor(t,n){super();const i=this;let r=null,a=1,o=null,s="local-floor",u=1,f=null,m=null,_=null,v=null,p=null,b=null;const A=new qu,c=n.getContextAttributes();let l=null,O=null;const M=[],x=[],y=new Ze;let U=null;const F=new Bn;F.viewport=new Nt;const V=new Bn;V.viewport=new Nt;const E=[F,V],g=new wo;let D=null,Z=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Q){let de=M[Q];return de===void 0&&(de=new Wi,M[Q]=de),de.getTargetRaySpace()},this.getControllerGrip=function(Q){let de=M[Q];return de===void 0&&(de=new Wi,M[Q]=de),de.getGripSpace()},this.getHand=function(Q){let de=M[Q];return de===void 0&&(de=new Wi,M[Q]=de),de.getHandSpace()};function k(Q){const de=x.indexOf(Q.inputSource);if(de===-1)return;const Me=M[de];Me!==void 0&&(Me.update(Q.inputSource,Q.frame,f||o),Me.dispatchEvent({type:Q.type,data:Q.inputSource}))}function Y(){r.removeEventListener("select",k),r.removeEventListener("selectstart",k),r.removeEventListener("selectend",k),r.removeEventListener("squeeze",k),r.removeEventListener("squeezestart",k),r.removeEventListener("squeezeend",k),r.removeEventListener("end",Y),r.removeEventListener("inputsourceschange",J);for(let Q=0;Q=0&&(x[he]=null,M[he].disconnect(Me))}for(let de=0;de=x.length){x.push(Me),he=Ie;break}else if(x[Ie]===null){x[Ie]=Me,he=Ie;break}if(he===-1)break}const Le=M[he];Le&&Le.connect(Me)}}const $=new Te,ne=new Te;function X(Q,de,Me){$.setFromMatrixPosition(de.matrixWorld),ne.setFromMatrixPosition(Me.matrixWorld);const he=$.distanceTo(ne),Le=de.projectionMatrix.elements,Ie=Me.projectionMatrix.elements,ke=Le[14]/(Le[10]-1),nt=Le[14]/(Le[10]+1),Ke=(Le[9]+1)/Le[5],dt=(Le[9]-1)/Le[5],R=(Le[8]-1)/Le[0],gt=(Ie[8]+1)/Ie[0],ze=ke*R,We=ke*gt,we=he/(-R+gt),et=we*-R;if(de.matrixWorld.decompose(Q.position,Q.quaternion,Q.scale),Q.translateX(et),Q.translateZ(we),Q.matrixWorld.compose(Q.position,Q.quaternion,Q.scale),Q.matrixWorldInverse.copy(Q.matrixWorld).invert(),Le[10]===-1)Q.projectionMatrix.copy(de.projectionMatrix),Q.projectionMatrixInverse.copy(de.projectionMatrixInverse);else{const be=ke+we,S=nt+we,d=ze-et,H=We+(he-et),B=Ke*nt/S*be,W=dt*nt/S*be;Q.projectionMatrix.makePerspective(d,H,B,W,be,S),Q.projectionMatrixInverse.copy(Q.projectionMatrix).invert()}}function xe(Q,de){de===null?Q.matrixWorld.copy(Q.matrix):Q.matrixWorld.multiplyMatrices(de.matrixWorld,Q.matrix),Q.matrixWorldInverse.copy(Q.matrixWorld).invert()}this.updateCamera=function(Q){if(r===null)return;let de=Q.near,Me=Q.far;A.texture!==null&&(A.depthNear>0&&(de=A.depthNear),A.depthFar>0&&(Me=A.depthFar)),g.near=V.near=F.near=de,g.far=V.far=F.far=Me,(D!==g.near||Z!==g.far)&&(r.updateRenderState({depthNear:g.near,depthFar:g.far}),D=g.near,Z=g.far),F.layers.mask=Q.layers.mask|2,V.layers.mask=Q.layers.mask|4,g.layers.mask=F.layers.mask|V.layers.mask;const he=Q.parent,Le=g.cameras;xe(g,he);for(let Ie=0;Ie0&&(c.alphaTest.value=l.alphaTest);const O=t.get(l),M=O.envMap,x=O.envMapRotation;M&&(c.envMap.value=M,gn.copy(x),gn.x*=-1,gn.y*=-1,gn.z*=-1,M.isCubeTexture&&M.isRenderTargetTexture===!1&&(gn.y*=-1,gn.z*=-1),c.envMapRotation.value.setFromMatrix4(Zu.makeRotationFromEuler(gn)),c.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,c.reflectivity.value=l.reflectivity,c.ior.value=l.ior,c.refractionRatio.value=l.refractionRatio),l.lightMap&&(c.lightMap.value=l.lightMap,c.lightMapIntensity.value=l.lightMapIntensity,n(l.lightMap,c.lightMapTransform)),l.aoMap&&(c.aoMap.value=l.aoMap,c.aoMapIntensity.value=l.aoMapIntensity,n(l.aoMap,c.aoMapTransform))}function o(c,l){c.diffuse.value.copy(l.color),c.opacity.value=l.opacity,l.map&&(c.map.value=l.map,n(l.map,c.mapTransform))}function s(c,l){c.dashSize.value=l.dashSize,c.totalSize.value=l.dashSize+l.gapSize,c.scale.value=l.scale}function u(c,l,O,M){c.diffuse.value.copy(l.color),c.opacity.value=l.opacity,c.size.value=l.size*O,c.scale.value=M*.5,l.map&&(c.map.value=l.map,n(l.map,c.uvTransform)),l.alphaMap&&(c.alphaMap.value=l.alphaMap,n(l.alphaMap,c.alphaMapTransform)),l.alphaTest>0&&(c.alphaTest.value=l.alphaTest)}function f(c,l){c.diffuse.value.copy(l.color),c.opacity.value=l.opacity,c.rotation.value=l.rotation,l.map&&(c.map.value=l.map,n(l.map,c.mapTransform)),l.alphaMap&&(c.alphaMap.value=l.alphaMap,n(l.alphaMap,c.alphaMapTransform)),l.alphaTest>0&&(c.alphaTest.value=l.alphaTest)}function m(c,l){c.specular.value.copy(l.specular),c.shininess.value=Math.max(l.shininess,1e-4)}function _(c,l){l.gradientMap&&(c.gradientMap.value=l.gradientMap)}function v(c,l){c.metalness.value=l.metalness,l.metalnessMap&&(c.metalnessMap.value=l.metalnessMap,n(l.metalnessMap,c.metalnessMapTransform)),c.roughness.value=l.roughness,l.roughnessMap&&(c.roughnessMap.value=l.roughnessMap,n(l.roughnessMap,c.roughnessMapTransform)),l.envMap&&(c.envMapIntensity.value=l.envMapIntensity)}function p(c,l,O){c.ior.value=l.ior,l.sheen>0&&(c.sheenColor.value.copy(l.sheenColor).multiplyScalar(l.sheen),c.sheenRoughness.value=l.sheenRoughness,l.sheenColorMap&&(c.sheenColorMap.value=l.sheenColorMap,n(l.sheenColorMap,c.sheenColorMapTransform)),l.sheenRoughnessMap&&(c.sheenRoughnessMap.value=l.sheenRoughnessMap,n(l.sheenRoughnessMap,c.sheenRoughnessMapTransform))),l.clearcoat>0&&(c.clearcoat.value=l.clearcoat,c.clearcoatRoughness.value=l.clearcoatRoughness,l.clearcoatMap&&(c.clearcoatMap.value=l.clearcoatMap,n(l.clearcoatMap,c.clearcoatMapTransform)),l.clearcoatRoughnessMap&&(c.clearcoatRoughnessMap.value=l.clearcoatRoughnessMap,n(l.clearcoatRoughnessMap,c.clearcoatRoughnessMapTransform)),l.clearcoatNormalMap&&(c.clearcoatNormalMap.value=l.clearcoatNormalMap,n(l.clearcoatNormalMap,c.clearcoatNormalMapTransform),c.clearcoatNormalScale.value.copy(l.clearcoatNormalScale),l.side===zt&&c.clearcoatNormalScale.value.negate())),l.dispersion>0&&(c.dispersion.value=l.dispersion),l.iridescence>0&&(c.iridescence.value=l.iridescence,c.iridescenceIOR.value=l.iridescenceIOR,c.iridescenceThicknessMinimum.value=l.iridescenceThicknessRange[0],c.iridescenceThicknessMaximum.value=l.iridescenceThicknessRange[1],l.iridescenceMap&&(c.iridescenceMap.value=l.iridescenceMap,n(l.iridescenceMap,c.iridescenceMapTransform)),l.iridescenceThicknessMap&&(c.iridescenceThicknessMap.value=l.iridescenceThicknessMap,n(l.iridescenceThicknessMap,c.iridescenceThicknessMapTransform))),l.transmission>0&&(c.transmission.value=l.transmission,c.transmissionSamplerMap.value=O.texture,c.transmissionSamplerSize.value.set(O.width,O.height),l.transmissionMap&&(c.transmissionMap.value=l.transmissionMap,n(l.transmissionMap,c.transmissionMapTransform)),c.thickness.value=l.thickness,l.thicknessMap&&(c.thicknessMap.value=l.thicknessMap,n(l.thicknessMap,c.thicknessMapTransform)),c.attenuationDistance.value=l.attenuationDistance,c.attenuationColor.value.copy(l.attenuationColor)),l.anisotropy>0&&(c.anisotropyVector.value.set(l.anisotropy*Math.cos(l.anisotropyRotation),l.anisotropy*Math.sin(l.anisotropyRotation)),l.anisotropyMap&&(c.anisotropyMap.value=l.anisotropyMap,n(l.anisotropyMap,c.anisotropyMapTransform))),c.specularIntensity.value=l.specularIntensity,c.specularColor.value.copy(l.specularColor),l.specularColorMap&&(c.specularColorMap.value=l.specularColorMap,n(l.specularColorMap,c.specularColorMapTransform)),l.specularIntensityMap&&(c.specularIntensityMap.value=l.specularIntensityMap,n(l.specularIntensityMap,c.specularIntensityMapTransform))}function b(c,l){l.matcap&&(c.matcap.value=l.matcap)}function A(c,l){const O=t.get(l).light;c.referencePosition.value.setFromMatrixPosition(O.matrixWorld),c.nearDistance.value=O.shadow.camera.near,c.farDistance.value=O.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function $u(e,t,n,i){let r={},a={},o=[];const s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function u(O,M){const x=M.program;i.uniformBlockBinding(O,x)}function f(O,M){let x=r[O.id];x===void 0&&(b(O),x=m(O),r[O.id]=x,O.addEventListener("dispose",c));const y=M.program;i.updateUBOMapping(O,y);const U=t.render.frame;a[O.id]!==U&&(v(O),a[O.id]=U)}function m(O){const M=_();O.__bindingPointIndex=M;const x=e.createBuffer(),y=O.__size,U=O.usage;return e.bindBuffer(e.UNIFORM_BUFFER,x),e.bufferData(e.UNIFORM_BUFFER,y,U),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,M,x),x}function _(){for(let O=0;O0&&(x+=y-U),O.__size=x,O.__cache={},this}function A(O){const M={boundary:0,storage:0};return typeof O=="number"||typeof O=="boolean"?(M.boundary=4,M.storage=4):O.isVector2?(M.boundary=8,M.storage=8):O.isVector3||O.isColor?(M.boundary=16,M.storage=12):O.isVector4?(M.boundary=16,M.storage=16):O.isMatrix3?(M.boundary=48,M.storage=48):O.isMatrix4?(M.boundary=64,M.storage=64):O.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",O),M}function c(O){const M=O.target;M.removeEventListener("dispose",c);const x=o.indexOf(M.__bindingPointIndex);o.splice(x,1),e.deleteBuffer(r[M.id]),delete r[M.id],delete a[M.id]}function l(){for(const O in r)e.deleteBuffer(r[O]);o=[],r={},a={}}return{bind:u,update:f,dispose:l}}class Qu{constructor(t={}){const{canvas:n=So(),context:i=null,depth:r=!0,stencil:a=!1,alpha:o=!1,antialias:s=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:f=!1,powerPreference:m="default",failIfMajorPerformanceCaveat:_=!1,reverseDepthBuffer:v=!1}=t;this.isWebGLRenderer=!0;let p;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=i.getContextAttributes().alpha}else p=o;const b=new Uint32Array(4),A=new Int32Array(4);let c=null,l=null;const O=[],M=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Eo,this.toneMapping=sn,this.toneMappingExposure=1;const x=this;let y=!1,U=0,F=0,V=null,E=-1,g=null;const D=new Nt,Z=new Nt;let k=null;const Y=new Ae(0);let J=0,$=n.width,ne=n.height,X=1,xe=null,Ce=null;const Ne=new Nt(0,0,$,ne),je=new Nt(0,0,$,ne);let Je=!1;const Q=new Fr;let de=!1,Me=!1;this.transmissionResolutionScale=1;const he=new Vn,Le=new Vn,Ie=new Te,ke=new Nt,nt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ke=!1;function dt(){return V===null?X:1}let R=i;function gt(h,N){return n.getContext(h,N)}try{const h={alpha:!0,depth:r,stencil:a,antialias:s,premultipliedAlpha:u,preserveDrawingBuffer:f,powerPreference:m,failIfMajorPerformanceCaveat:_};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${xo}`),n.addEventListener("webglcontextlost",C,!1),n.addEventListener("webglcontextrestored",z,!1),n.addEventListener("webglcontextcreationerror",j,!1),R===null){const N="webgl2";if(R=gt(N,h),R===null)throw gt(N)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(h){throw console.error("THREE.WebGLRenderer: "+h.message),h}let ze,We,we,et,be,S,d,H,B,W,G,re,ie,le,Pe,q,ce,_e,Re,ge,Xe,Ge,rt,I;function ue(){ze=new sf(R),ze.init(),Ge=new zu(R,ze),We=new ef(R,ze,t,Ge),we=new ku(R,ze),We.reverseDepthBuffer&&v&&we.buffers.depth.setReversed(!0),et=new df(R),be=new yu,S=new Vu(R,ze,we,be,We,Ge,et),d=new nf(x),H=new of(x),B=new _l(R),rt=new Qd(R,B),W=new lf(R,B,et,rt),G=new uf(R,W,B,et),Re=new ff(R,We,S),q=new tf(be),re=new wu(x,d,H,ze,We,rt,q),ie=new ju(x,be),le=new Pu,Pe=new Ou(ze),_e=new $d(x,d,H,we,G,p,u),ce=new Hu(x,G,We),I=new $u(R,et,We,we),ge=new Jd(R,ze,et),Xe=new cf(R,ze,et),et.programs=re.programs,x.capabilities=We,x.extensions=ze,x.properties=be,x.renderLists=le,x.shadowMap=ce,x.state=we,x.info=et}ue();const K=new Ku(x,R);this.xr=K,this.getContext=function(){return R},this.getContextAttributes=function(){return R.getContextAttributes()},this.forceContextLoss=function(){const h=ze.get("WEBGL_lose_context");h&&h.loseContext()},this.forceContextRestore=function(){const h=ze.get("WEBGL_lose_context");h&&h.restoreContext()},this.getPixelRatio=function(){return X},this.setPixelRatio=function(h){h!==void 0&&(X=h,this.setSize($,ne,!1))},this.getSize=function(h){return h.set($,ne)},this.setSize=function(h,N,w=!0){if(K.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}$=h,ne=N,n.width=Math.floor(h*X),n.height=Math.floor(N*X),w===!0&&(n.style.width=h+"px",n.style.height=N+"px"),this.setViewport(0,0,h,N)},this.getDrawingBufferSize=function(h){return h.set($*X,ne*X).floor()},this.setDrawingBufferSize=function(h,N,w){$=h,ne=N,X=w,n.width=Math.floor(h*w),n.height=Math.floor(N*w),this.setViewport(0,0,h,N)},this.getCurrentViewport=function(h){return h.copy(D)},this.getViewport=function(h){return h.copy(Ne)},this.setViewport=function(h,N,w,L){h.isVector4?Ne.set(h.x,h.y,h.z,h.w):Ne.set(h,N,w,L),we.viewport(D.copy(Ne).multiplyScalar(X).round())},this.getScissor=function(h){return h.copy(je)},this.setScissor=function(h,N,w,L){h.isVector4?je.set(h.x,h.y,h.z,h.w):je.set(h,N,w,L),we.scissor(Z.copy(je).multiplyScalar(X).round())},this.getScissorTest=function(){return Je},this.setScissorTest=function(h){we.setScissorTest(Je=h)},this.setOpaqueSort=function(h){xe=h},this.setTransparentSort=function(h){Ce=h},this.getClearColor=function(h){return h.copy(_e.getClearColor())},this.setClearColor=function(){_e.setClearColor.apply(_e,arguments)},this.getClearAlpha=function(){return _e.getClearAlpha()},this.setClearAlpha=function(){_e.setClearAlpha.apply(_e,arguments)},this.clear=function(h=!0,N=!0,w=!0){let L=0;if(h){let P=!1;if(V!==null){const ee=V.texture.format;P=ee===Kr||ee===qr||ee===Yr}if(P){const ee=V.texture.type,pe=ee===An||ee===si||ee===Ai||ee===oi||ee===Vr||ee===zr,Se=_e.getClearColor(),Ee=_e.getClearAlpha(),Fe=Se.r,Be=Se.g,De=Se.b;pe?(b[0]=Fe,b[1]=Be,b[2]=De,b[3]=Ee,R.clearBufferuiv(R.COLOR,0,b)):(A[0]=Fe,A[1]=Be,A[2]=De,A[3]=Ee,R.clearBufferiv(R.COLOR,0,A))}else L|=R.COLOR_BUFFER_BIT}N&&(L|=R.DEPTH_BUFFER_BIT),w&&(L|=R.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),R.clear(L)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",C,!1),n.removeEventListener("webglcontextrestored",z,!1),n.removeEventListener("webglcontextcreationerror",j,!1),_e.dispose(),le.dispose(),Pe.dispose(),be.dispose(),d.dispose(),H.dispose(),G.dispose(),rt.dispose(),I.dispose(),re.dispose(),K.dispose(),K.removeEventListener("sessionstart",Pt),K.removeEventListener("sessionend",Ht),vt.stop()};function C(h){h.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),y=!0}function z(){console.log("THREE.WebGLRenderer: Context Restored."),y=!1;const h=et.autoReset,N=ce.enabled,w=ce.autoUpdate,L=ce.needsUpdate,P=ce.type;ue(),et.autoReset=h,ce.enabled=N,ce.autoUpdate=w,ce.needsUpdate=L,ce.type=P}function j(h){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",h.statusMessage)}function se(h){const N=h.target;N.removeEventListener("dispose",se),ve(N)}function ve(h){Oe(h),be.remove(h)}function Oe(h){const N=be.get(h).programs;N!==void 0&&(N.forEach(function(w){re.releaseProgram(w)}),h.isShaderMaterial&&re.releaseShaderCache(h))}this.renderBufferDirect=function(h,N,w,L,P,ee){N===null&&(N=nt);const pe=P.isMesh&&P.matrixWorld.determinant()<0,Se=pn(h,N,w,L,P);we.setMaterial(L,pe);let Ee=w.index,Fe=1;if(L.wireframe===!0){if(Ee=W.getWireframeAttribute(w),Ee===void 0)return;Fe=2}const Be=w.drawRange,De=w.attributes.position;let Qe=Be.start*Fe,st=(Be.start+Be.count)*Fe;ee!==null&&(Qe=Math.max(Qe,ee.start*Fe),st=Math.min(st,(ee.start+ee.count)*Fe)),Ee!==null?(Qe=Math.max(Qe,0),st=Math.min(st,Ee.count)):De!=null&&(Qe=Math.max(Qe,0),st=Math.min(st,De.count));const xt=st-Qe;if(xt<0||xt===1/0)return;rt.setup(P,L,Se,w,Ee);let St,it=ge;if(Ee!==null&&(St=B.get(Ee),it=Xe,it.setIndex(St)),P.isMesh)L.wireframe===!0?(we.setLineWidth(L.wireframeLinewidth*dt()),it.setMode(R.LINES)):it.setMode(R.TRIANGLES);else if(P.isLine){let Ue=L.linewidth;Ue===void 0&&(Ue=1),we.setLineWidth(Ue*dt()),P.isLineSegments?it.setMode(R.LINES):P.isLineLoop?it.setMode(R.LINE_LOOP):it.setMode(R.LINE_STRIP)}else P.isPoints?it.setMode(R.POINTS):P.isSprite&&it.setMode(R.TRIANGLES);if(P.isBatchedMesh)if(P._multiDrawInstances!==null)it.renderMultiDrawInstances(P._multiDrawStarts,P._multiDrawCounts,P._multiDrawCount,P._multiDrawInstances);else if(ze.get("WEBGL_multi_draw"))it.renderMultiDraw(P._multiDrawStarts,P._multiDrawCounts,P._multiDrawCount);else{const Ue=P._multiDrawStarts,Rt=P._multiDrawCounts,lt=P._multiDrawCount,Xt=Ee?B.get(Ee).bytesPerElement:1,Cn=be.get(L).currentProgram.getUniforms();for(let Ft=0;Ft{function ee(){if(L.forEach(function(pe){be.get(pe).currentProgram.isReady()&&L.delete(pe)}),L.size===0){P(h);return}setTimeout(ee,10)}ze.get("KHR_parallel_shader_compile")!==null?ee():setTimeout(ee,10)})};let ot=null;function ft(h){ot&&ot(h)}function Pt(){vt.stop()}function Ht(){vt.start()}const vt=new ao;vt.setAnimationLoop(ft),typeof self<"u"&&vt.setContext(self),this.setAnimationLoop=function(h){ot=h,K.setAnimationLoop(h),h===null?vt.stop():vt.start()},K.addEventListener("sessionstart",Pt),K.addEventListener("sessionend",Ht),this.render=function(h,N){if(N!==void 0&&N.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(y===!0)return;if(h.matrixWorldAutoUpdate===!0&&h.updateMatrixWorld(),N.parent===null&&N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),K.enabled===!0&&K.isPresenting===!0&&(K.cameraAutoUpdate===!0&&K.updateCamera(N),N=K.getCamera()),h.isScene===!0&&h.onBeforeRender(x,h,N,V),l=Pe.get(h,M.length),l.init(N),M.push(l),Le.multiplyMatrices(N.projectionMatrix,N.matrixWorldInverse),Q.setFromProjectionMatrix(Le),Me=this.localClippingEnabled,de=q.init(this.clippingPlanes,Me),c=le.get(h,O.length),c.init(),O.push(c),K.enabled===!0&&K.isPresenting===!0){const ee=x.xr.getDepthSensingMesh();ee!==null&&Wt(ee,N,-1/0,x.sortObjects)}Wt(h,N,0,x.sortObjects),c.finish(),x.sortObjects===!0&&c.sort(xe,Ce),Ke=K.enabled===!1||K.isPresenting===!1||K.hasDepthSensing()===!1,Ke&&_e.addToRenderList(c,h),this.info.render.frame++,de===!0&&q.beginShadows();const w=l.state.shadowsArray;ce.render(w,h,N),de===!0&&q.endShadows(),this.info.autoReset===!0&&this.info.reset();const L=c.opaque,P=c.transmissive;if(l.setupLights(),N.isArrayCamera){const ee=N.cameras;if(P.length>0)for(let pe=0,Se=ee.length;pe0&&$t(L,P,h,N),Ke&&_e.render(h),dn(c,h,N);V!==null&&F===0&&(S.updateMultisampleRenderTarget(V),S.updateRenderTargetMipmap(V)),h.isScene===!0&&h.onAfterRender(x,h,N),rt.resetDefaultState(),E=-1,g=null,M.pop(),M.length>0?(l=M[M.length-1],de===!0&&q.setGlobalState(x.clippingPlanes,l.state.camera)):l=null,O.pop(),O.length>0?c=O[O.length-1]:c=null};function Wt(h,N,w,L){if(h.visible===!1)return;if(h.layers.test(N.layers)){if(h.isGroup)w=h.renderOrder;else if(h.isLOD)h.autoUpdate===!0&&h.update(N);else if(h.isLight)l.pushLight(h),h.castShadow&&l.pushShadow(h);else if(h.isSprite){if(!h.frustumCulled||Q.intersectsSprite(h)){L&&ke.setFromMatrixPosition(h.matrixWorld).applyMatrix4(Le);const pe=G.update(h),Se=h.material;Se.visible&&c.push(h,pe,Se,w,ke.z,null)}}else if((h.isMesh||h.isLine||h.isPoints)&&(!h.frustumCulled||Q.intersectsObject(h))){const pe=G.update(h),Se=h.material;if(L&&(h.boundingSphere!==void 0?(h.boundingSphere===null&&h.computeBoundingSphere(),ke.copy(h.boundingSphere.center)):(pe.boundingSphere===null&&pe.computeBoundingSphere(),ke.copy(pe.boundingSphere.center)),ke.applyMatrix4(h.matrixWorld).applyMatrix4(Le)),Array.isArray(Se)){const Ee=pe.groups;for(let Fe=0,Be=Ee.length;Fe0&&Yt(P,N,w),ee.length>0&&Yt(ee,N,w),pe.length>0&&Yt(pe,N,w),we.buffers.depth.setTest(!0),we.buffers.depth.setMask(!0),we.buffers.color.setMask(!0),we.setPolygonOffset(!1)}function $t(h,N,w,L){if((w.isScene===!0?w.overrideMaterial:null)!==null)return;l.state.transmissionRenderTarget[L.id]===void 0&&(l.state.transmissionRenderTarget[L.id]=new jt(1,1,{generateMipmaps:!0,type:ze.has("EXT_color_buffer_half_float")||ze.has("EXT_color_buffer_float")?ln:An,minFilter:$n,samples:4,stencilBuffer:a,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Mt.workingColorSpace}));const ee=l.state.transmissionRenderTarget[L.id],pe=L.viewport||D;ee.setSize(pe.z*x.transmissionResolutionScale,pe.w*x.transmissionResolutionScale);const Se=x.getRenderTarget();x.setRenderTarget(ee),x.getClearColor(Y),J=x.getClearAlpha(),J<1&&x.setClearColor(16777215,.5),x.clear(),Ke&&_e.render(w);const Ee=x.toneMapping;x.toneMapping=sn;const Fe=L.viewport;if(L.viewport!==void 0&&(L.viewport=void 0),l.setupLightsView(L),de===!0&&q.setGlobalState(x.clippingPlanes,L),Yt(h,w,L),S.updateMultisampleRenderTarget(ee),S.updateRenderTargetMipmap(ee),ze.has("WEBGL_multisampled_render_to_texture")===!1){let Be=!1;for(let De=0,Qe=N.length;De0),De=!!w.morphAttributes.position,Qe=!!w.morphAttributes.normal,st=!!w.morphAttributes.color;let xt=sn;L.toneMapped&&(V===null||V.isXRRenderTarget===!0)&&(xt=x.toneMapping);const St=w.morphAttributes.position||w.morphAttributes.normal||w.morphAttributes.color,it=St!==void 0?St.length:0,Ue=be.get(L),Rt=l.state.lights;if(de===!0&&(Me===!0||h!==g)){const Dt=h===g&&L.id===E;q.setState(L,h,Dt)}let lt=!1;L.version===Ue.__version?(Ue.needsLights&&Ue.lightsStateVersion!==Rt.state.version||Ue.outputColorSpace!==Se||P.isBatchedMesh&&Ue.batching===!1||!P.isBatchedMesh&&Ue.batching===!0||P.isBatchedMesh&&Ue.batchingColor===!0&&P.colorTexture===null||P.isBatchedMesh&&Ue.batchingColor===!1&&P.colorTexture!==null||P.isInstancedMesh&&Ue.instancing===!1||!P.isInstancedMesh&&Ue.instancing===!0||P.isSkinnedMesh&&Ue.skinning===!1||!P.isSkinnedMesh&&Ue.skinning===!0||P.isInstancedMesh&&Ue.instancingColor===!0&&P.instanceColor===null||P.isInstancedMesh&&Ue.instancingColor===!1&&P.instanceColor!==null||P.isInstancedMesh&&Ue.instancingMorph===!0&&P.morphTexture===null||P.isInstancedMesh&&Ue.instancingMorph===!1&&P.morphTexture!==null||Ue.envMap!==Ee||L.fog===!0&&Ue.fog!==ee||Ue.numClippingPlanes!==void 0&&(Ue.numClippingPlanes!==q.numPlanes||Ue.numIntersection!==q.numIntersection)||Ue.vertexAlphas!==Fe||Ue.vertexTangents!==Be||Ue.morphTargets!==De||Ue.morphNormals!==Qe||Ue.morphColors!==st||Ue.toneMapping!==xt||Ue.morphTargetsCount!==it)&&(lt=!0):(lt=!0,Ue.__version=L.version);let Xt=Ue.currentProgram;lt===!0&&(Xt=qt(L,N,P));let Cn=!1,Ft=!1,Zn=!1;const ht=Xt.getUniforms(),Gt=Ue.uniforms;if(we.useProgram(Xt.program)&&(Cn=!0,Ft=!0,Zn=!0),L.id!==E&&(E=L.id,Ft=!0),Cn||g!==h){we.buffers.depth.getReversed()?(he.copy(h.projectionMatrix),Mo(he),To(he),ht.setValue(R,"projectionMatrix",he)):ht.setValue(R,"projectionMatrix",h.projectionMatrix),ht.setValue(R,"viewMatrix",h.matrixWorldInverse);const Lt=ht.map.cameraPosition;Lt!==void 0&&Lt.setValue(R,Ie.setFromMatrixPosition(h.matrixWorld)),We.logarithmicDepthBuffer&&ht.setValue(R,"logDepthBufFC",2/(Math.log(h.far+1)/Math.LN2)),(L.isMeshPhongMaterial||L.isMeshToonMaterial||L.isMeshLambertMaterial||L.isMeshBasicMaterial||L.isMeshStandardMaterial||L.isShaderMaterial)&&ht.setValue(R,"isOrthographic",h.isOrthographicCamera===!0),g!==h&&(g=h,Ft=!0,Zn=!0)}if(P.isSkinnedMesh){ht.setOptional(R,P,"bindMatrix"),ht.setOptional(R,P,"bindMatrixInverse");const Dt=P.skeleton;Dt&&(Dt.boneTexture===null&&Dt.computeBoneTexture(),ht.setValue(R,"boneTexture",Dt.boneTexture,S))}P.isBatchedMesh&&(ht.setOptional(R,P,"batchingTexture"),ht.setValue(R,"batchingTexture",P._matricesTexture,S),ht.setOptional(R,P,"batchingIdTexture"),ht.setValue(R,"batchingIdTexture",P._indirectTexture,S),ht.setOptional(R,P,"batchingColorTexture"),P._colorsTexture!==null&&ht.setValue(R,"batchingColorTexture",P._colorsTexture,S));const kt=w.morphAttributes;if((kt.position!==void 0||kt.normal!==void 0||kt.color!==void 0)&&Re.update(P,w,Xt),(Ft||Ue.receiveShadow!==P.receiveShadow)&&(Ue.receiveShadow=P.receiveShadow,ht.setValue(R,"receiveShadow",P.receiveShadow)),L.isMeshGouraudMaterial&&L.envMap!==null&&(Gt.envMap.value=Ee,Gt.flipEnvMap.value=Ee.isCubeTexture&&Ee.isRenderTargetTexture===!1?-1:1),L.isMeshStandardMaterial&&L.envMap===null&&N.environment!==null&&(Gt.envMapIntensity.value=N.environmentIntensity),Ft&&(ht.setValue(R,"toneMappingExposure",x.toneMappingExposure),Ue.needsLights&&Rn(Gt,Zn),ee&&L.fog===!0&&ie.refreshFogUniforms(Gt,ee),ie.refreshMaterialUniforms(Gt,L,X,ne,l.state.transmissionRenderTarget[h.id]),Ei.upload(R,fn(Ue),Gt,S)),L.isShaderMaterial&&L.uniformsNeedUpdate===!0&&(Ei.upload(R,fn(Ue),Gt,S),L.uniformsNeedUpdate=!1),L.isSpriteMaterial&&ht.setValue(R,"center",P.center),ht.setValue(R,"modelViewMatrix",P.modelViewMatrix),ht.setValue(R,"normalMatrix",P.normalMatrix),ht.setValue(R,"modelMatrix",P.matrixWorld),L.isShaderMaterial||L.isRawShaderMaterial){const Dt=L.uniformsGroups;for(let Lt=0,Di=Dt.length;Lt0&&S.useMultisampledRTT(h)===!1?P=be.get(h).__webglMultisampledFramebuffer:Array.isArray(Be)?P=Be[w]:P=Be,D.copy(h.viewport),Z.copy(h.scissor),k=h.scissorTest}else D.copy(Ne).multiplyScalar(X).floor(),Z.copy(je).multiplyScalar(X).floor(),k=Je;if(w!==0&&(P=an),we.bindFramebuffer(R.FRAMEBUFFER,P)&&L&&we.drawBuffers(h,P),we.viewport(D),we.scissor(Z),we.setScissorTest(k),ee){const Ee=be.get(h.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+N,Ee.__webglTexture,w)}else if(pe){const Ee=be.get(h.texture),Fe=N;R.framebufferTextureLayer(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,Ee.__webglTexture,w,Fe)}else if(h!==null&&w!==0){const Ee=be.get(h.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,Ee.__webglTexture,w)}E=-1},this.readRenderTargetPixels=function(h,N,w,L,P,ee,pe){if(!(h&&h.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Se=be.get(h).__webglFramebuffer;if(h.isWebGLCubeRenderTarget&&pe!==void 0&&(Se=Se[pe]),Se){we.bindFramebuffer(R.FRAMEBUFFER,Se);try{const Ee=h.texture,Fe=Ee.format,Be=Ee.type;if(!We.textureFormatReadable(Fe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!We.textureTypeReadable(Be)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}N>=0&&N<=h.width-L&&w>=0&&w<=h.height-P&&R.readPixels(N,w,L,P,Ge.convert(Fe),Ge.convert(Be),ee)}finally{const Ee=V!==null?be.get(V).__webglFramebuffer:null;we.bindFramebuffer(R.FRAMEBUFFER,Ee)}}},this.readRenderTargetPixelsAsync=async function(h,N,w,L,P,ee,pe){if(!(h&&h.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Se=be.get(h).__webglFramebuffer;if(h.isWebGLCubeRenderTarget&&pe!==void 0&&(Se=Se[pe]),Se){const Ee=h.texture,Fe=Ee.format,Be=Ee.type;if(!We.textureFormatReadable(Fe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!We.textureTypeReadable(Be))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(N>=0&&N<=h.width-L&&w>=0&&w<=h.height-P){we.bindFramebuffer(R.FRAMEBUFFER,Se);const De=R.createBuffer();R.bindBuffer(R.PIXEL_PACK_BUFFER,De),R.bufferData(R.PIXEL_PACK_BUFFER,ee.byteLength,R.STREAM_READ),R.readPixels(N,w,L,P,Ge.convert(Fe),Ge.convert(Be),0);const Qe=V!==null?be.get(V).__webglFramebuffer:null;we.bindFramebuffer(R.FRAMEBUFFER,Qe);const st=R.fenceSync(R.SYNC_GPU_COMMANDS_COMPLETE,0);return R.flush(),await bo(R,st,4),R.bindBuffer(R.PIXEL_PACK_BUFFER,De),R.getBufferSubData(R.PIXEL_PACK_BUFFER,0,ee),R.deleteBuffer(De),R.deleteSync(st),ee}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(h,N=null,w=0){h.isTexture!==!0&&(Ln("WebGLRenderer: copyFramebufferToTexture function signature has changed."),N=arguments[0]||null,h=arguments[1]);const L=Math.pow(2,-w),P=Math.floor(h.image.width*L),ee=Math.floor(h.image.height*L),pe=N!==null?N.x:0,Se=N!==null?N.y:0;S.setTexture2D(h,0),R.copyTexSubImage2D(R.TEXTURE_2D,w,0,0,pe,Se,P,ee),we.unbindTexture()};const yn=R.createFramebuffer(),Kn=R.createFramebuffer();this.copyTextureToTexture=function(h,N,w=null,L=null,P=0,ee=null){h.isTexture!==!0&&(Ln("WebGLRenderer: copyTextureToTexture function signature has changed."),L=arguments[0]||null,h=arguments[1],N=arguments[2],ee=arguments[3]||0,w=null),ee===null&&(P!==0?(Ln("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),ee=P,P=0):ee=0);let pe,Se,Ee,Fe,Be,De,Qe,st,xt;const St=h.isCompressedTexture?h.mipmaps[ee]:h.image;if(w!==null)pe=w.max.x-w.min.x,Se=w.max.y-w.min.y,Ee=w.isBox3?w.max.z-w.min.z:1,Fe=w.min.x,Be=w.min.y,De=w.isBox3?w.min.z:0;else{const kt=Math.pow(2,-P);pe=Math.floor(St.width*kt),Se=Math.floor(St.height*kt),h.isDataArrayTexture?Ee=St.depth:h.isData3DTexture?Ee=Math.floor(St.depth*kt):Ee=1,Fe=0,Be=0,De=0}L!==null?(Qe=L.x,st=L.y,xt=L.z):(Qe=0,st=0,xt=0);const it=Ge.convert(N.format),Ue=Ge.convert(N.type);let Rt;N.isData3DTexture?(S.setTexture3D(N,0),Rt=R.TEXTURE_3D):N.isDataArrayTexture||N.isCompressedArrayTexture?(S.setTexture2DArray(N,0),Rt=R.TEXTURE_2D_ARRAY):(S.setTexture2D(N,0),Rt=R.TEXTURE_2D),R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,N.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,N.unpackAlignment);const lt=R.getParameter(R.UNPACK_ROW_LENGTH),Xt=R.getParameter(R.UNPACK_IMAGE_HEIGHT),Cn=R.getParameter(R.UNPACK_SKIP_PIXELS),Ft=R.getParameter(R.UNPACK_SKIP_ROWS),Zn=R.getParameter(R.UNPACK_SKIP_IMAGES);R.pixelStorei(R.UNPACK_ROW_LENGTH,St.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,St.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Fe),R.pixelStorei(R.UNPACK_SKIP_ROWS,Be),R.pixelStorei(R.UNPACK_SKIP_IMAGES,De);const ht=h.isDataArrayTexture||h.isData3DTexture,Gt=N.isDataArrayTexture||N.isData3DTexture;if(h.isDepthTexture){const kt=be.get(h),Dt=be.get(N),Lt=be.get(kt.__renderTarget),Di=be.get(Dt.__renderTarget);we.bindFramebuffer(R.READ_FRAMEBUFFER,Lt.__webglFramebuffer),we.bindFramebuffer(R.DRAW_FRAMEBUFFER,Di.__webglFramebuffer);for(let hn=0;hnMath.PI&&(i-=Ut),r<-Math.PI?r+=Ut:r>Math.PI&&(r-=Ut),i<=r?this._spherical.theta=Math.max(i,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(i+r)/2?Math.max(i,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let a=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),a=o!=this._spherical.radius}if(Tt.setFromSpherical(this._spherical),Tt.applyQuaternion(this._quatInverse),n.copy(this.target).add(Tt),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const s=Tt.length();o=this._clampDistance(s*this._scale);const u=s-o;this.object.position.addScaledVector(this._dollyDirection,u),this.object.updateMatrixWorld(),a=!!u}else if(this.object.isOrthographicCamera){const s=new Te(this._mouse.x,this._mouse.y,0);s.unproject(this.object);const u=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),a=u!==this.object.zoom;const f=new Te(this._mouse.x,this._mouse.y,0);f.unproject(this.object),this.object.position.sub(f).add(s),this.object.updateMatrixWorld(),o=Tt.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(_i.origin.copy(this.object.position),_i.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(_i.direction))Xi||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Xi||this._lastTargetPosition.distanceToSquared(this.target)>Xi?(this.dispatchEvent(Dr),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(t){return t!==null?Ut/60*this.autoRotateSpeed*t:Ut/60/60*this.autoRotateSpeed}_getZoomScale(t){const n=Math.abs(t*.01);return Math.pow(.95,this.zoomSpeed*n)}_rotateLeft(t){this._sphericalDelta.theta-=t}_rotateUp(t){this._sphericalDelta.phi-=t}_panLeft(t,n){Tt.setFromMatrixColumn(n,0),Tt.multiplyScalar(-t),this._panOffset.add(Tt)}_panUp(t,n){this.screenSpacePanning===!0?Tt.setFromMatrixColumn(n,1):(Tt.setFromMatrixColumn(n,0),Tt.crossVectors(this.object.up,Tt)),Tt.multiplyScalar(t),this._panOffset.add(Tt)}_pan(t,n){const i=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;Tt.copy(r).sub(this.target);let a=Tt.length();a*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*a/i.clientHeight,this.object.matrix),this._panUp(2*n*a/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(n*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(t,n){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const i=this.domElement.getBoundingClientRect(),r=t-i.left,a=n-i.top,o=i.width,s=i.height;this._mouse.x=r/o*2-1,this._mouse.y=-(a/s)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(t){return Math.max(this.minDistance,Math.min(this.maxDistance,t))}_handleMouseDownRotate(t){this._rotateStart.set(t.clientX,t.clientY)}_handleMouseDownDolly(t){this._updateZoomParameters(t.clientX,t.clientX),this._dollyStart.set(t.clientX,t.clientY)}_handleMouseDownPan(t){this._panStart.set(t.clientX,t.clientY)}_handleMouseMoveRotate(t){this._rotateEnd.set(t.clientX,t.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(Ut*this._rotateDelta.x/n.clientHeight),this._rotateUp(Ut*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(t){this._dollyEnd.set(t.clientX,t.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(t){this._panEnd.set(t.clientX,t.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(t){this._updateZoomParameters(t.clientX,t.clientY),t.deltaY<0?this._dollyIn(this._getZoomScale(t.deltaY)):t.deltaY>0&&this._dollyOut(this._getZoomScale(t.deltaY)),this.update()}_handleKeyDown(t){let n=!1;switch(t.code){case this.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(Ut*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),n=!0;break;case this.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(-Ut*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),n=!0;break;case this.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(Ut*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),n=!0;break;case this.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(-Ut*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),n=!0;break}n&&(t.preventDefault(),this.update())}_handleTouchStartRotate(t){if(this._pointers.length===1)this._rotateStart.set(t.pageX,t.pageY);else{const n=this._getSecondPointerPosition(t),i=.5*(t.pageX+n.x),r=.5*(t.pageY+n.y);this._rotateStart.set(i,r)}}_handleTouchStartPan(t){if(this._pointers.length===1)this._panStart.set(t.pageX,t.pageY);else{const n=this._getSecondPointerPosition(t),i=.5*(t.pageX+n.x),r=.5*(t.pageY+n.y);this._panStart.set(i,r)}}_handleTouchStartDolly(t){const n=this._getSecondPointerPosition(t),i=t.pageX-n.x,r=t.pageY-n.y,a=Math.sqrt(i*i+r*r);this._dollyStart.set(0,a)}_handleTouchStartDollyPan(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enablePan&&this._handleTouchStartPan(t)}_handleTouchStartDollyRotate(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enableRotate&&this._handleTouchStartRotate(t)}_handleTouchMoveRotate(t){if(this._pointers.length==1)this._rotateEnd.set(t.pageX,t.pageY);else{const i=this._getSecondPointerPosition(t),r=.5*(t.pageX+i.x),a=.5*(t.pageY+i.y);this._rotateEnd.set(r,a)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(Ut*this._rotateDelta.x/n.clientHeight),this._rotateUp(Ut*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(t){if(this._pointers.length===1)this._panEnd.set(t.pageX,t.pageY);else{const n=this._getSecondPointerPosition(t),i=.5*(t.pageX+n.x),r=.5*(t.pageY+n.y);this._panEnd.set(i,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(t){const n=this._getSecondPointerPosition(t),i=t.pageX-n.x,r=t.pageY-n.y,a=Math.sqrt(i*i+r*r);this._dollyEnd.set(0,a),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(t.pageX+n.x)*.5,s=(t.pageY+n.y)*.5;this._updateZoomParameters(o,s)}_handleTouchMoveDollyPan(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enablePan&&this._handleTouchMovePan(t)}_handleTouchMoveDollyRotate(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enableRotate&&this._handleTouchMoveRotate(t)}_addPointer(t){this._pointers.push(t.pointerId)}_removePointer(t){delete this._pointerPositions[t.pointerId];for(let n=0;n=0&&(x[he]=null,M[he].disconnect(Me))}for(let de=0;de=x.length){x.push(Me),he=Ie;break}else if(x[Ie]===null){x[Ie]=Me,he=Ie;break}if(he===-1)break}const Le=M[he];Le&&Le.connect(Me)}}const $=new Te,ne=new Te;function X(Q,de,Me){$.setFromMatrixPosition(de.matrixWorld),ne.setFromMatrixPosition(Me.matrixWorld);const he=$.distanceTo(ne),Le=de.projectionMatrix.elements,Ie=Me.projectionMatrix.elements,ke=Le[14]/(Le[10]-1),nt=Le[14]/(Le[10]+1),Ke=(Le[9]+1)/Le[5],dt=(Le[9]-1)/Le[5],R=(Le[8]-1)/Le[0],gt=(Ie[8]+1)/Ie[0],ze=ke*R,We=ke*gt,we=he/(-R+gt),et=we*-R;if(de.matrixWorld.decompose(Q.position,Q.quaternion,Q.scale),Q.translateX(et),Q.translateZ(we),Q.matrixWorld.compose(Q.position,Q.quaternion,Q.scale),Q.matrixWorldInverse.copy(Q.matrixWorld).invert(),Le[10]===-1)Q.projectionMatrix.copy(de.projectionMatrix),Q.projectionMatrixInverse.copy(de.projectionMatrixInverse);else{const be=ke+we,S=nt+we,d=ze-et,H=We+(he-et),B=Ke*nt/S*be,W=dt*nt/S*be;Q.projectionMatrix.makePerspective(d,H,B,W,be,S),Q.projectionMatrixInverse.copy(Q.projectionMatrix).invert()}}function xe(Q,de){de===null?Q.matrixWorld.copy(Q.matrix):Q.matrixWorld.multiplyMatrices(de.matrixWorld,Q.matrix),Q.matrixWorldInverse.copy(Q.matrixWorld).invert()}this.updateCamera=function(Q){if(r===null)return;let de=Q.near,Me=Q.far;A.texture!==null&&(A.depthNear>0&&(de=A.depthNear),A.depthFar>0&&(Me=A.depthFar)),g.near=V.near=F.near=de,g.far=V.far=F.far=Me,(D!==g.near||Z!==g.far)&&(r.updateRenderState({depthNear:g.near,depthFar:g.far}),D=g.near,Z=g.far),F.layers.mask=Q.layers.mask|2,V.layers.mask=Q.layers.mask|4,g.layers.mask=F.layers.mask|V.layers.mask;const he=Q.parent,Le=g.cameras;xe(g,he);for(let Ie=0;Ie0&&(c.alphaTest.value=l.alphaTest);const O=t.get(l),M=O.envMap,x=O.envMapRotation;M&&(c.envMap.value=M,gn.copy(x),gn.x*=-1,gn.y*=-1,gn.z*=-1,M.isCubeTexture&&M.isRenderTargetTexture===!1&&(gn.y*=-1,gn.z*=-1),c.envMapRotation.value.setFromMatrix4(Zu.makeRotationFromEuler(gn)),c.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,c.reflectivity.value=l.reflectivity,c.ior.value=l.ior,c.refractionRatio.value=l.refractionRatio),l.lightMap&&(c.lightMap.value=l.lightMap,c.lightMapIntensity.value=l.lightMapIntensity,n(l.lightMap,c.lightMapTransform)),l.aoMap&&(c.aoMap.value=l.aoMap,c.aoMapIntensity.value=l.aoMapIntensity,n(l.aoMap,c.aoMapTransform))}function o(c,l){c.diffuse.value.copy(l.color),c.opacity.value=l.opacity,l.map&&(c.map.value=l.map,n(l.map,c.mapTransform))}function s(c,l){c.dashSize.value=l.dashSize,c.totalSize.value=l.dashSize+l.gapSize,c.scale.value=l.scale}function u(c,l,O,M){c.diffuse.value.copy(l.color),c.opacity.value=l.opacity,c.size.value=l.size*O,c.scale.value=M*.5,l.map&&(c.map.value=l.map,n(l.map,c.uvTransform)),l.alphaMap&&(c.alphaMap.value=l.alphaMap,n(l.alphaMap,c.alphaMapTransform)),l.alphaTest>0&&(c.alphaTest.value=l.alphaTest)}function f(c,l){c.diffuse.value.copy(l.color),c.opacity.value=l.opacity,c.rotation.value=l.rotation,l.map&&(c.map.value=l.map,n(l.map,c.mapTransform)),l.alphaMap&&(c.alphaMap.value=l.alphaMap,n(l.alphaMap,c.alphaMapTransform)),l.alphaTest>0&&(c.alphaTest.value=l.alphaTest)}function m(c,l){c.specular.value.copy(l.specular),c.shininess.value=Math.max(l.shininess,1e-4)}function _(c,l){l.gradientMap&&(c.gradientMap.value=l.gradientMap)}function v(c,l){c.metalness.value=l.metalness,l.metalnessMap&&(c.metalnessMap.value=l.metalnessMap,n(l.metalnessMap,c.metalnessMapTransform)),c.roughness.value=l.roughness,l.roughnessMap&&(c.roughnessMap.value=l.roughnessMap,n(l.roughnessMap,c.roughnessMapTransform)),l.envMap&&(c.envMapIntensity.value=l.envMapIntensity)}function p(c,l,O){c.ior.value=l.ior,l.sheen>0&&(c.sheenColor.value.copy(l.sheenColor).multiplyScalar(l.sheen),c.sheenRoughness.value=l.sheenRoughness,l.sheenColorMap&&(c.sheenColorMap.value=l.sheenColorMap,n(l.sheenColorMap,c.sheenColorMapTransform)),l.sheenRoughnessMap&&(c.sheenRoughnessMap.value=l.sheenRoughnessMap,n(l.sheenRoughnessMap,c.sheenRoughnessMapTransform))),l.clearcoat>0&&(c.clearcoat.value=l.clearcoat,c.clearcoatRoughness.value=l.clearcoatRoughness,l.clearcoatMap&&(c.clearcoatMap.value=l.clearcoatMap,n(l.clearcoatMap,c.clearcoatMapTransform)),l.clearcoatRoughnessMap&&(c.clearcoatRoughnessMap.value=l.clearcoatRoughnessMap,n(l.clearcoatRoughnessMap,c.clearcoatRoughnessMapTransform)),l.clearcoatNormalMap&&(c.clearcoatNormalMap.value=l.clearcoatNormalMap,n(l.clearcoatNormalMap,c.clearcoatNormalMapTransform),c.clearcoatNormalScale.value.copy(l.clearcoatNormalScale),l.side===zt&&c.clearcoatNormalScale.value.negate())),l.dispersion>0&&(c.dispersion.value=l.dispersion),l.iridescence>0&&(c.iridescence.value=l.iridescence,c.iridescenceIOR.value=l.iridescenceIOR,c.iridescenceThicknessMinimum.value=l.iridescenceThicknessRange[0],c.iridescenceThicknessMaximum.value=l.iridescenceThicknessRange[1],l.iridescenceMap&&(c.iridescenceMap.value=l.iridescenceMap,n(l.iridescenceMap,c.iridescenceMapTransform)),l.iridescenceThicknessMap&&(c.iridescenceThicknessMap.value=l.iridescenceThicknessMap,n(l.iridescenceThicknessMap,c.iridescenceThicknessMapTransform))),l.transmission>0&&(c.transmission.value=l.transmission,c.transmissionSamplerMap.value=O.texture,c.transmissionSamplerSize.value.set(O.width,O.height),l.transmissionMap&&(c.transmissionMap.value=l.transmissionMap,n(l.transmissionMap,c.transmissionMapTransform)),c.thickness.value=l.thickness,l.thicknessMap&&(c.thicknessMap.value=l.thicknessMap,n(l.thicknessMap,c.thicknessMapTransform)),c.attenuationDistance.value=l.attenuationDistance,c.attenuationColor.value.copy(l.attenuationColor)),l.anisotropy>0&&(c.anisotropyVector.value.set(l.anisotropy*Math.cos(l.anisotropyRotation),l.anisotropy*Math.sin(l.anisotropyRotation)),l.anisotropyMap&&(c.anisotropyMap.value=l.anisotropyMap,n(l.anisotropyMap,c.anisotropyMapTransform))),c.specularIntensity.value=l.specularIntensity,c.specularColor.value.copy(l.specularColor),l.specularColorMap&&(c.specularColorMap.value=l.specularColorMap,n(l.specularColorMap,c.specularColorMapTransform)),l.specularIntensityMap&&(c.specularIntensityMap.value=l.specularIntensityMap,n(l.specularIntensityMap,c.specularIntensityMapTransform))}function b(c,l){l.matcap&&(c.matcap.value=l.matcap)}function A(c,l){const O=t.get(l).light;c.referencePosition.value.setFromMatrixPosition(O.matrixWorld),c.nearDistance.value=O.shadow.camera.near,c.farDistance.value=O.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function $u(e,t,n,i){let r={},a={},o=[];const s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function u(O,M){const x=M.program;i.uniformBlockBinding(O,x)}function f(O,M){let x=r[O.id];x===void 0&&(b(O),x=m(O),r[O.id]=x,O.addEventListener("dispose",c));const y=M.program;i.updateUBOMapping(O,y);const U=t.render.frame;a[O.id]!==U&&(v(O),a[O.id]=U)}function m(O){const M=_();O.__bindingPointIndex=M;const x=e.createBuffer(),y=O.__size,U=O.usage;return e.bindBuffer(e.UNIFORM_BUFFER,x),e.bufferData(e.UNIFORM_BUFFER,y,U),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,M,x),x}function _(){for(let O=0;O0&&(x+=y-U),O.__size=x,O.__cache={},this}function A(O){const M={boundary:0,storage:0};return typeof O=="number"||typeof O=="boolean"?(M.boundary=4,M.storage=4):O.isVector2?(M.boundary=8,M.storage=8):O.isVector3||O.isColor?(M.boundary=16,M.storage=12):O.isVector4?(M.boundary=16,M.storage=16):O.isMatrix3?(M.boundary=48,M.storage=48):O.isMatrix4?(M.boundary=64,M.storage=64):O.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",O),M}function c(O){const M=O.target;M.removeEventListener("dispose",c);const x=o.indexOf(M.__bindingPointIndex);o.splice(x,1),e.deleteBuffer(r[M.id]),delete r[M.id],delete a[M.id]}function l(){for(const O in r)e.deleteBuffer(r[O]);o=[],r={},a={}}return{bind:u,update:f,dispose:l}}class Qu{constructor(t={}){const{canvas:n=So(),context:i=null,depth:r=!0,stencil:a=!1,alpha:o=!1,antialias:s=!1,premultipliedAlpha:u=!0,preserveDrawingBuffer:f=!1,powerPreference:m="default",failIfMajorPerformanceCaveat:_=!1,reverseDepthBuffer:v=!1}=t;this.isWebGLRenderer=!0;let p;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=i.getContextAttributes().alpha}else p=o;const b=new Uint32Array(4),A=new Int32Array(4);let c=null,l=null;const O=[],M=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Eo,this.toneMapping=sn,this.toneMappingExposure=1;const x=this;let y=!1,U=0,F=0,V=null,E=-1,g=null;const D=new Nt,Z=new Nt;let k=null;const Y=new Ae(0);let J=0,$=n.width,ne=n.height,X=1,xe=null,Ce=null;const Ne=new Nt(0,0,$,ne),je=new Nt(0,0,$,ne);let Je=!1;const Q=new Fr;let de=!1,Me=!1;this.transmissionResolutionScale=1;const he=new zn,Le=new zn,Ie=new Te,ke=new Nt,nt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ke=!1;function dt(){return V===null?X:1}let R=i;function gt(h,N){return n.getContext(h,N)}try{const h={alpha:!0,depth:r,stencil:a,antialias:s,premultipliedAlpha:u,preserveDrawingBuffer:f,powerPreference:m,failIfMajorPerformanceCaveat:_};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${xo}`),n.addEventListener("webglcontextlost",C,!1),n.addEventListener("webglcontextrestored",z,!1),n.addEventListener("webglcontextcreationerror",j,!1),R===null){const N="webgl2";if(R=gt(N,h),R===null)throw gt(N)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(h){throw console.error("THREE.WebGLRenderer: "+h.message),h}let ze,We,we,et,be,S,d,H,B,W,G,re,ie,le,Pe,q,ce,_e,Re,ge,Xe,Ge,rt,I;function ue(){ze=new sf(R),ze.init(),Ge=new zu(R,ze),We=new ef(R,ze,t,Ge),we=new ku(R,ze),We.reverseDepthBuffer&&v&&we.buffers.depth.setReversed(!0),et=new df(R),be=new yu,S=new Vu(R,ze,we,be,We,Ge,et),d=new nf(x),H=new of(x),B=new _l(R),rt=new Qd(R,B),W=new lf(R,B,et,rt),G=new uf(R,W,B,et),Re=new ff(R,We,S),q=new tf(be),re=new wu(x,d,H,ze,We,rt,q),ie=new ju(x,be),le=new Pu,Pe=new Ou(ze),_e=new $d(x,d,H,we,G,p,u),ce=new Hu(x,G,We),I=new $u(R,et,We,we),ge=new Jd(R,ze,et),Xe=new cf(R,ze,et),et.programs=re.programs,x.capabilities=We,x.extensions=ze,x.properties=be,x.renderLists=le,x.shadowMap=ce,x.state=we,x.info=et}ue();const K=new Ku(x,R);this.xr=K,this.getContext=function(){return R},this.getContextAttributes=function(){return R.getContextAttributes()},this.forceContextLoss=function(){const h=ze.get("WEBGL_lose_context");h&&h.loseContext()},this.forceContextRestore=function(){const h=ze.get("WEBGL_lose_context");h&&h.restoreContext()},this.getPixelRatio=function(){return X},this.setPixelRatio=function(h){h!==void 0&&(X=h,this.setSize($,ne,!1))},this.getSize=function(h){return h.set($,ne)},this.setSize=function(h,N,w=!0){if(K.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}$=h,ne=N,n.width=Math.floor(h*X),n.height=Math.floor(N*X),w===!0&&(n.style.width=h+"px",n.style.height=N+"px"),this.setViewport(0,0,h,N)},this.getDrawingBufferSize=function(h){return h.set($*X,ne*X).floor()},this.setDrawingBufferSize=function(h,N,w){$=h,ne=N,X=w,n.width=Math.floor(h*w),n.height=Math.floor(N*w),this.setViewport(0,0,h,N)},this.getCurrentViewport=function(h){return h.copy(D)},this.getViewport=function(h){return h.copy(Ne)},this.setViewport=function(h,N,w,L){h.isVector4?Ne.set(h.x,h.y,h.z,h.w):Ne.set(h,N,w,L),we.viewport(D.copy(Ne).multiplyScalar(X).round())},this.getScissor=function(h){return h.copy(je)},this.setScissor=function(h,N,w,L){h.isVector4?je.set(h.x,h.y,h.z,h.w):je.set(h,N,w,L),we.scissor(Z.copy(je).multiplyScalar(X).round())},this.getScissorTest=function(){return Je},this.setScissorTest=function(h){we.setScissorTest(Je=h)},this.setOpaqueSort=function(h){xe=h},this.setTransparentSort=function(h){Ce=h},this.getClearColor=function(h){return h.copy(_e.getClearColor())},this.setClearColor=function(){_e.setClearColor.apply(_e,arguments)},this.getClearAlpha=function(){return _e.getClearAlpha()},this.setClearAlpha=function(){_e.setClearAlpha.apply(_e,arguments)},this.clear=function(h=!0,N=!0,w=!0){let L=0;if(h){let P=!1;if(V!==null){const ee=V.texture.format;P=ee===Kr||ee===qr||ee===Yr}if(P){const ee=V.texture.type,pe=ee===An||ee===si||ee===Ai||ee===oi||ee===Vr||ee===zr,Se=_e.getClearColor(),Ee=_e.getClearAlpha(),Fe=Se.r,Be=Se.g,De=Se.b;pe?(b[0]=Fe,b[1]=Be,b[2]=De,b[3]=Ee,R.clearBufferuiv(R.COLOR,0,b)):(A[0]=Fe,A[1]=Be,A[2]=De,A[3]=Ee,R.clearBufferiv(R.COLOR,0,A))}else L|=R.COLOR_BUFFER_BIT}N&&(L|=R.DEPTH_BUFFER_BIT),w&&(L|=R.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),R.clear(L)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",C,!1),n.removeEventListener("webglcontextrestored",z,!1),n.removeEventListener("webglcontextcreationerror",j,!1),_e.dispose(),le.dispose(),Pe.dispose(),be.dispose(),d.dispose(),H.dispose(),G.dispose(),rt.dispose(),I.dispose(),re.dispose(),K.dispose(),K.removeEventListener("sessionstart",Pt),K.removeEventListener("sessionend",Ht),vt.stop()};function C(h){h.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),y=!0}function z(){console.log("THREE.WebGLRenderer: Context Restored."),y=!1;const h=et.autoReset,N=ce.enabled,w=ce.autoUpdate,L=ce.needsUpdate,P=ce.type;ue(),et.autoReset=h,ce.enabled=N,ce.autoUpdate=w,ce.needsUpdate=L,ce.type=P}function j(h){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",h.statusMessage)}function se(h){const N=h.target;N.removeEventListener("dispose",se),ve(N)}function ve(h){Oe(h),be.remove(h)}function Oe(h){const N=be.get(h).programs;N!==void 0&&(N.forEach(function(w){re.releaseProgram(w)}),h.isShaderMaterial&&re.releaseShaderCache(h))}this.renderBufferDirect=function(h,N,w,L,P,ee){N===null&&(N=nt);const pe=P.isMesh&&P.matrixWorld.determinant()<0,Se=pn(h,N,w,L,P);we.setMaterial(L,pe);let Ee=w.index,Fe=1;if(L.wireframe===!0){if(Ee=W.getWireframeAttribute(w),Ee===void 0)return;Fe=2}const Be=w.drawRange,De=w.attributes.position;let Qe=Be.start*Fe,st=(Be.start+Be.count)*Fe;ee!==null&&(Qe=Math.max(Qe,ee.start*Fe),st=Math.min(st,(ee.start+ee.count)*Fe)),Ee!==null?(Qe=Math.max(Qe,0),st=Math.min(st,Ee.count)):De!=null&&(Qe=Math.max(Qe,0),st=Math.min(st,De.count));const xt=st-Qe;if(xt<0||xt===1/0)return;rt.setup(P,L,Se,w,Ee);let St,it=ge;if(Ee!==null&&(St=B.get(Ee),it=Xe,it.setIndex(St)),P.isMesh)L.wireframe===!0?(we.setLineWidth(L.wireframeLinewidth*dt()),it.setMode(R.LINES)):it.setMode(R.TRIANGLES);else if(P.isLine){let Ue=L.linewidth;Ue===void 0&&(Ue=1),we.setLineWidth(Ue*dt()),P.isLineSegments?it.setMode(R.LINES):P.isLineLoop?it.setMode(R.LINE_LOOP):it.setMode(R.LINE_STRIP)}else P.isPoints?it.setMode(R.POINTS):P.isSprite&&it.setMode(R.TRIANGLES);if(P.isBatchedMesh)if(P._multiDrawInstances!==null)it.renderMultiDrawInstances(P._multiDrawStarts,P._multiDrawCounts,P._multiDrawCount,P._multiDrawInstances);else if(ze.get("WEBGL_multi_draw"))it.renderMultiDraw(P._multiDrawStarts,P._multiDrawCounts,P._multiDrawCount);else{const Ue=P._multiDrawStarts,Rt=P._multiDrawCounts,lt=P._multiDrawCount,Xt=Ee?B.get(Ee).bytesPerElement:1,Cn=be.get(L).currentProgram.getUniforms();for(let Ft=0;Ft{function ee(){if(L.forEach(function(pe){be.get(pe).currentProgram.isReady()&&L.delete(pe)}),L.size===0){P(h);return}setTimeout(ee,10)}ze.get("KHR_parallel_shader_compile")!==null?ee():setTimeout(ee,10)})};let ot=null;function ft(h){ot&&ot(h)}function Pt(){vt.stop()}function Ht(){vt.start()}const vt=new ao;vt.setAnimationLoop(ft),typeof self<"u"&&vt.setContext(self),this.setAnimationLoop=function(h){ot=h,K.setAnimationLoop(h),h===null?vt.stop():vt.start()},K.addEventListener("sessionstart",Pt),K.addEventListener("sessionend",Ht),this.render=function(h,N){if(N!==void 0&&N.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(y===!0)return;if(h.matrixWorldAutoUpdate===!0&&h.updateMatrixWorld(),N.parent===null&&N.matrixWorldAutoUpdate===!0&&N.updateMatrixWorld(),K.enabled===!0&&K.isPresenting===!0&&(K.cameraAutoUpdate===!0&&K.updateCamera(N),N=K.getCamera()),h.isScene===!0&&h.onBeforeRender(x,h,N,V),l=Pe.get(h,M.length),l.init(N),M.push(l),Le.multiplyMatrices(N.projectionMatrix,N.matrixWorldInverse),Q.setFromProjectionMatrix(Le),Me=this.localClippingEnabled,de=q.init(this.clippingPlanes,Me),c=le.get(h,O.length),c.init(),O.push(c),K.enabled===!0&&K.isPresenting===!0){const ee=x.xr.getDepthSensingMesh();ee!==null&&Wt(ee,N,-1/0,x.sortObjects)}Wt(h,N,0,x.sortObjects),c.finish(),x.sortObjects===!0&&c.sort(xe,Ce),Ke=K.enabled===!1||K.isPresenting===!1||K.hasDepthSensing()===!1,Ke&&_e.addToRenderList(c,h),this.info.render.frame++,de===!0&&q.beginShadows();const w=l.state.shadowsArray;ce.render(w,h,N),de===!0&&q.endShadows(),this.info.autoReset===!0&&this.info.reset();const L=c.opaque,P=c.transmissive;if(l.setupLights(),N.isArrayCamera){const ee=N.cameras;if(P.length>0)for(let pe=0,Se=ee.length;pe0&&$t(L,P,h,N),Ke&&_e.render(h),dn(c,h,N);V!==null&&F===0&&(S.updateMultisampleRenderTarget(V),S.updateRenderTargetMipmap(V)),h.isScene===!0&&h.onAfterRender(x,h,N),rt.resetDefaultState(),E=-1,g=null,M.pop(),M.length>0?(l=M[M.length-1],de===!0&&q.setGlobalState(x.clippingPlanes,l.state.camera)):l=null,O.pop(),O.length>0?c=O[O.length-1]:c=null};function Wt(h,N,w,L){if(h.visible===!1)return;if(h.layers.test(N.layers)){if(h.isGroup)w=h.renderOrder;else if(h.isLOD)h.autoUpdate===!0&&h.update(N);else if(h.isLight)l.pushLight(h),h.castShadow&&l.pushShadow(h);else if(h.isSprite){if(!h.frustumCulled||Q.intersectsSprite(h)){L&&ke.setFromMatrixPosition(h.matrixWorld).applyMatrix4(Le);const pe=G.update(h),Se=h.material;Se.visible&&c.push(h,pe,Se,w,ke.z,null)}}else if((h.isMesh||h.isLine||h.isPoints)&&(!h.frustumCulled||Q.intersectsObject(h))){const pe=G.update(h),Se=h.material;if(L&&(h.boundingSphere!==void 0?(h.boundingSphere===null&&h.computeBoundingSphere(),ke.copy(h.boundingSphere.center)):(pe.boundingSphere===null&&pe.computeBoundingSphere(),ke.copy(pe.boundingSphere.center)),ke.applyMatrix4(h.matrixWorld).applyMatrix4(Le)),Array.isArray(Se)){const Ee=pe.groups;for(let Fe=0,Be=Ee.length;Fe0&&Yt(P,N,w),ee.length>0&&Yt(ee,N,w),pe.length>0&&Yt(pe,N,w),we.buffers.depth.setTest(!0),we.buffers.depth.setMask(!0),we.buffers.color.setMask(!0),we.setPolygonOffset(!1)}function $t(h,N,w,L){if((w.isScene===!0?w.overrideMaterial:null)!==null)return;l.state.transmissionRenderTarget[L.id]===void 0&&(l.state.transmissionRenderTarget[L.id]=new jt(1,1,{generateMipmaps:!0,type:ze.has("EXT_color_buffer_half_float")||ze.has("EXT_color_buffer_float")?ln:An,minFilter:Qn,samples:4,stencilBuffer:a,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Mt.workingColorSpace}));const ee=l.state.transmissionRenderTarget[L.id],pe=L.viewport||D;ee.setSize(pe.z*x.transmissionResolutionScale,pe.w*x.transmissionResolutionScale);const Se=x.getRenderTarget();x.setRenderTarget(ee),x.getClearColor(Y),J=x.getClearAlpha(),J<1&&x.setClearColor(16777215,.5),x.clear(),Ke&&_e.render(w);const Ee=x.toneMapping;x.toneMapping=sn;const Fe=L.viewport;if(L.viewport!==void 0&&(L.viewport=void 0),l.setupLightsView(L),de===!0&&q.setGlobalState(x.clippingPlanes,L),Yt(h,w,L),S.updateMultisampleRenderTarget(ee),S.updateRenderTargetMipmap(ee),ze.has("WEBGL_multisampled_render_to_texture")===!1){let Be=!1;for(let De=0,Qe=N.length;De0),De=!!w.morphAttributes.position,Qe=!!w.morphAttributes.normal,st=!!w.morphAttributes.color;let xt=sn;L.toneMapped&&(V===null||V.isXRRenderTarget===!0)&&(xt=x.toneMapping);const St=w.morphAttributes.position||w.morphAttributes.normal||w.morphAttributes.color,it=St!==void 0?St.length:0,Ue=be.get(L),Rt=l.state.lights;if(de===!0&&(Me===!0||h!==g)){const Dt=h===g&&L.id===E;q.setState(L,h,Dt)}let lt=!1;L.version===Ue.__version?(Ue.needsLights&&Ue.lightsStateVersion!==Rt.state.version||Ue.outputColorSpace!==Se||P.isBatchedMesh&&Ue.batching===!1||!P.isBatchedMesh&&Ue.batching===!0||P.isBatchedMesh&&Ue.batchingColor===!0&&P.colorTexture===null||P.isBatchedMesh&&Ue.batchingColor===!1&&P.colorTexture!==null||P.isInstancedMesh&&Ue.instancing===!1||!P.isInstancedMesh&&Ue.instancing===!0||P.isSkinnedMesh&&Ue.skinning===!1||!P.isSkinnedMesh&&Ue.skinning===!0||P.isInstancedMesh&&Ue.instancingColor===!0&&P.instanceColor===null||P.isInstancedMesh&&Ue.instancingColor===!1&&P.instanceColor!==null||P.isInstancedMesh&&Ue.instancingMorph===!0&&P.morphTexture===null||P.isInstancedMesh&&Ue.instancingMorph===!1&&P.morphTexture!==null||Ue.envMap!==Ee||L.fog===!0&&Ue.fog!==ee||Ue.numClippingPlanes!==void 0&&(Ue.numClippingPlanes!==q.numPlanes||Ue.numIntersection!==q.numIntersection)||Ue.vertexAlphas!==Fe||Ue.vertexTangents!==Be||Ue.morphTargets!==De||Ue.morphNormals!==Qe||Ue.morphColors!==st||Ue.toneMapping!==xt||Ue.morphTargetsCount!==it)&&(lt=!0):(lt=!0,Ue.__version=L.version);let Xt=Ue.currentProgram;lt===!0&&(Xt=qt(L,N,P));let Cn=!1,Ft=!1,jn=!1;const ht=Xt.getUniforms(),Gt=Ue.uniforms;if(we.useProgram(Xt.program)&&(Cn=!0,Ft=!0,jn=!0),L.id!==E&&(E=L.id,Ft=!0),Cn||g!==h){we.buffers.depth.getReversed()?(he.copy(h.projectionMatrix),Mo(he),To(he),ht.setValue(R,"projectionMatrix",he)):ht.setValue(R,"projectionMatrix",h.projectionMatrix),ht.setValue(R,"viewMatrix",h.matrixWorldInverse);const Lt=ht.map.cameraPosition;Lt!==void 0&&Lt.setValue(R,Ie.setFromMatrixPosition(h.matrixWorld)),We.logarithmicDepthBuffer&&ht.setValue(R,"logDepthBufFC",2/(Math.log(h.far+1)/Math.LN2)),(L.isMeshPhongMaterial||L.isMeshToonMaterial||L.isMeshLambertMaterial||L.isMeshBasicMaterial||L.isMeshStandardMaterial||L.isShaderMaterial)&&ht.setValue(R,"isOrthographic",h.isOrthographicCamera===!0),g!==h&&(g=h,Ft=!0,jn=!0)}if(P.isSkinnedMesh){ht.setOptional(R,P,"bindMatrix"),ht.setOptional(R,P,"bindMatrixInverse");const Dt=P.skeleton;Dt&&(Dt.boneTexture===null&&Dt.computeBoneTexture(),ht.setValue(R,"boneTexture",Dt.boneTexture,S))}P.isBatchedMesh&&(ht.setOptional(R,P,"batchingTexture"),ht.setValue(R,"batchingTexture",P._matricesTexture,S),ht.setOptional(R,P,"batchingIdTexture"),ht.setValue(R,"batchingIdTexture",P._indirectTexture,S),ht.setOptional(R,P,"batchingColorTexture"),P._colorsTexture!==null&&ht.setValue(R,"batchingColorTexture",P._colorsTexture,S));const kt=w.morphAttributes;if((kt.position!==void 0||kt.normal!==void 0||kt.color!==void 0)&&Re.update(P,w,Xt),(Ft||Ue.receiveShadow!==P.receiveShadow)&&(Ue.receiveShadow=P.receiveShadow,ht.setValue(R,"receiveShadow",P.receiveShadow)),L.isMeshGouraudMaterial&&L.envMap!==null&&(Gt.envMap.value=Ee,Gt.flipEnvMap.value=Ee.isCubeTexture&&Ee.isRenderTargetTexture===!1?-1:1),L.isMeshStandardMaterial&&L.envMap===null&&N.environment!==null&&(Gt.envMapIntensity.value=N.environmentIntensity),Ft&&(ht.setValue(R,"toneMappingExposure",x.toneMappingExposure),Ue.needsLights&&Rn(Gt,jn),ee&&L.fog===!0&&ie.refreshFogUniforms(Gt,ee),ie.refreshMaterialUniforms(Gt,L,X,ne,l.state.transmissionRenderTarget[h.id]),Ei.upload(R,fn(Ue),Gt,S)),L.isShaderMaterial&&L.uniformsNeedUpdate===!0&&(Ei.upload(R,fn(Ue),Gt,S),L.uniformsNeedUpdate=!1),L.isSpriteMaterial&&ht.setValue(R,"center",P.center),ht.setValue(R,"modelViewMatrix",P.modelViewMatrix),ht.setValue(R,"normalMatrix",P.normalMatrix),ht.setValue(R,"modelMatrix",P.matrixWorld),L.isShaderMaterial||L.isRawShaderMaterial){const Dt=L.uniformsGroups;for(let Lt=0,Di=Dt.length;Lt0&&S.useMultisampledRTT(h)===!1?P=be.get(h).__webglMultisampledFramebuffer:Array.isArray(Be)?P=Be[w]:P=Be,D.copy(h.viewport),Z.copy(h.scissor),k=h.scissorTest}else D.copy(Ne).multiplyScalar(X).floor(),Z.copy(je).multiplyScalar(X).floor(),k=Je;if(w!==0&&(P=an),we.bindFramebuffer(R.FRAMEBUFFER,P)&&L&&we.drawBuffers(h,P),we.viewport(D),we.scissor(Z),we.setScissorTest(k),ee){const Ee=be.get(h.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+N,Ee.__webglTexture,w)}else if(pe){const Ee=be.get(h.texture),Fe=N;R.framebufferTextureLayer(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,Ee.__webglTexture,w,Fe)}else if(h!==null&&w!==0){const Ee=be.get(h.texture);R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,Ee.__webglTexture,w)}E=-1},this.readRenderTargetPixels=function(h,N,w,L,P,ee,pe){if(!(h&&h.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Se=be.get(h).__webglFramebuffer;if(h.isWebGLCubeRenderTarget&&pe!==void 0&&(Se=Se[pe]),Se){we.bindFramebuffer(R.FRAMEBUFFER,Se);try{const Ee=h.texture,Fe=Ee.format,Be=Ee.type;if(!We.textureFormatReadable(Fe)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!We.textureTypeReadable(Be)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}N>=0&&N<=h.width-L&&w>=0&&w<=h.height-P&&R.readPixels(N,w,L,P,Ge.convert(Fe),Ge.convert(Be),ee)}finally{const Ee=V!==null?be.get(V).__webglFramebuffer:null;we.bindFramebuffer(R.FRAMEBUFFER,Ee)}}},this.readRenderTargetPixelsAsync=async function(h,N,w,L,P,ee,pe){if(!(h&&h.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let Se=be.get(h).__webglFramebuffer;if(h.isWebGLCubeRenderTarget&&pe!==void 0&&(Se=Se[pe]),Se){const Ee=h.texture,Fe=Ee.format,Be=Ee.type;if(!We.textureFormatReadable(Fe))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!We.textureTypeReadable(Be))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(N>=0&&N<=h.width-L&&w>=0&&w<=h.height-P){we.bindFramebuffer(R.FRAMEBUFFER,Se);const De=R.createBuffer();R.bindBuffer(R.PIXEL_PACK_BUFFER,De),R.bufferData(R.PIXEL_PACK_BUFFER,ee.byteLength,R.STREAM_READ),R.readPixels(N,w,L,P,Ge.convert(Fe),Ge.convert(Be),0);const Qe=V!==null?be.get(V).__webglFramebuffer:null;we.bindFramebuffer(R.FRAMEBUFFER,Qe);const st=R.fenceSync(R.SYNC_GPU_COMMANDS_COMPLETE,0);return R.flush(),await bo(R,st,4),R.bindBuffer(R.PIXEL_PACK_BUFFER,De),R.getBufferSubData(R.PIXEL_PACK_BUFFER,0,ee),R.deleteBuffer(De),R.deleteSync(st),ee}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(h,N=null,w=0){h.isTexture!==!0&&(Ln("WebGLRenderer: copyFramebufferToTexture function signature has changed."),N=arguments[0]||null,h=arguments[1]);const L=Math.pow(2,-w),P=Math.floor(h.image.width*L),ee=Math.floor(h.image.height*L),pe=N!==null?N.x:0,Se=N!==null?N.y:0;S.setTexture2D(h,0),R.copyTexSubImage2D(R.TEXTURE_2D,w,0,0,pe,Se,P,ee),we.unbindTexture()};const yn=R.createFramebuffer(),Zn=R.createFramebuffer();this.copyTextureToTexture=function(h,N,w=null,L=null,P=0,ee=null){h.isTexture!==!0&&(Ln("WebGLRenderer: copyTextureToTexture function signature has changed."),L=arguments[0]||null,h=arguments[1],N=arguments[2],ee=arguments[3]||0,w=null),ee===null&&(P!==0?(Ln("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),ee=P,P=0):ee=0);let pe,Se,Ee,Fe,Be,De,Qe,st,xt;const St=h.isCompressedTexture?h.mipmaps[ee]:h.image;if(w!==null)pe=w.max.x-w.min.x,Se=w.max.y-w.min.y,Ee=w.isBox3?w.max.z-w.min.z:1,Fe=w.min.x,Be=w.min.y,De=w.isBox3?w.min.z:0;else{const kt=Math.pow(2,-P);pe=Math.floor(St.width*kt),Se=Math.floor(St.height*kt),h.isDataArrayTexture?Ee=St.depth:h.isData3DTexture?Ee=Math.floor(St.depth*kt):Ee=1,Fe=0,Be=0,De=0}L!==null?(Qe=L.x,st=L.y,xt=L.z):(Qe=0,st=0,xt=0);const it=Ge.convert(N.format),Ue=Ge.convert(N.type);let Rt;N.isData3DTexture?(S.setTexture3D(N,0),Rt=R.TEXTURE_3D):N.isDataArrayTexture||N.isCompressedArrayTexture?(S.setTexture2DArray(N,0),Rt=R.TEXTURE_2D_ARRAY):(S.setTexture2D(N,0),Rt=R.TEXTURE_2D),R.pixelStorei(R.UNPACK_FLIP_Y_WEBGL,N.flipY),R.pixelStorei(R.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),R.pixelStorei(R.UNPACK_ALIGNMENT,N.unpackAlignment);const lt=R.getParameter(R.UNPACK_ROW_LENGTH),Xt=R.getParameter(R.UNPACK_IMAGE_HEIGHT),Cn=R.getParameter(R.UNPACK_SKIP_PIXELS),Ft=R.getParameter(R.UNPACK_SKIP_ROWS),jn=R.getParameter(R.UNPACK_SKIP_IMAGES);R.pixelStorei(R.UNPACK_ROW_LENGTH,St.width),R.pixelStorei(R.UNPACK_IMAGE_HEIGHT,St.height),R.pixelStorei(R.UNPACK_SKIP_PIXELS,Fe),R.pixelStorei(R.UNPACK_SKIP_ROWS,Be),R.pixelStorei(R.UNPACK_SKIP_IMAGES,De);const ht=h.isDataArrayTexture||h.isData3DTexture,Gt=N.isDataArrayTexture||N.isData3DTexture;if(h.isDepthTexture){const kt=be.get(h),Dt=be.get(N),Lt=be.get(kt.__renderTarget),Di=be.get(Dt.__renderTarget);we.bindFramebuffer(R.READ_FRAMEBUFFER,Lt.__webglFramebuffer),we.bindFramebuffer(R.DRAW_FRAMEBUFFER,Di.__webglFramebuffer);for(let hn=0;hnMath.PI&&(i-=Ut),r<-Math.PI?r+=Ut:r>Math.PI&&(r-=Ut),i<=r?this._spherical.theta=Math.max(i,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(i+r)/2?Math.max(i,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let a=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),a=o!=this._spherical.radius}if(Tt.setFromSpherical(this._spherical),Tt.applyQuaternion(this._quatInverse),n.copy(this.target).add(Tt),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const s=Tt.length();o=this._clampDistance(s*this._scale);const u=s-o;this.object.position.addScaledVector(this._dollyDirection,u),this.object.updateMatrixWorld(),a=!!u}else if(this.object.isOrthographicCamera){const s=new Te(this._mouse.x,this._mouse.y,0);s.unproject(this.object);const u=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),a=u!==this.object.zoom;const f=new Te(this._mouse.x,this._mouse.y,0);f.unproject(this.object),this.object.position.sub(f).add(s),this.object.updateMatrixWorld(),o=Tt.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(_i.origin.copy(this.object.position),_i.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(_i.direction))Xi||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Xi||this._lastTargetPosition.distanceToSquared(this.target)>Xi?(this.dispatchEvent(Dr),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(t){return t!==null?Ut/60*this.autoRotateSpeed*t:Ut/60/60*this.autoRotateSpeed}_getZoomScale(t){const n=Math.abs(t*.01);return Math.pow(.95,this.zoomSpeed*n)}_rotateLeft(t){this._sphericalDelta.theta-=t}_rotateUp(t){this._sphericalDelta.phi-=t}_panLeft(t,n){Tt.setFromMatrixColumn(n,0),Tt.multiplyScalar(-t),this._panOffset.add(Tt)}_panUp(t,n){this.screenSpacePanning===!0?Tt.setFromMatrixColumn(n,1):(Tt.setFromMatrixColumn(n,0),Tt.crossVectors(this.object.up,Tt)),Tt.multiplyScalar(t),this._panOffset.add(Tt)}_pan(t,n){const i=this.domElement;if(this.object.isPerspectiveCamera){const r=this.object.position;Tt.copy(r).sub(this.target);let a=Tt.length();a*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*t*a/i.clientHeight,this.object.matrix),this._panUp(2*n*a/i.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(t*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrix),this._panUp(n*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(t){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=t:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(t,n){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const i=this.domElement.getBoundingClientRect(),r=t-i.left,a=n-i.top,o=i.width,s=i.height;this._mouse.x=r/o*2-1,this._mouse.y=-(a/s)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(t){return Math.max(this.minDistance,Math.min(this.maxDistance,t))}_handleMouseDownRotate(t){this._rotateStart.set(t.clientX,t.clientY)}_handleMouseDownDolly(t){this._updateZoomParameters(t.clientX,t.clientX),this._dollyStart.set(t.clientX,t.clientY)}_handleMouseDownPan(t){this._panStart.set(t.clientX,t.clientY)}_handleMouseMoveRotate(t){this._rotateEnd.set(t.clientX,t.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(Ut*this._rotateDelta.x/n.clientHeight),this._rotateUp(Ut*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(t){this._dollyEnd.set(t.clientX,t.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(t){this._panEnd.set(t.clientX,t.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(t){this._updateZoomParameters(t.clientX,t.clientY),t.deltaY<0?this._dollyIn(this._getZoomScale(t.deltaY)):t.deltaY>0&&this._dollyOut(this._getZoomScale(t.deltaY)),this.update()}_handleKeyDown(t){let n=!1;switch(t.code){case this.keys.UP:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(Ut*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),n=!0;break;case this.keys.BOTTOM:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateUp(-Ut*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),n=!0;break;case this.keys.LEFT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(Ut*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),n=!0;break;case this.keys.RIGHT:t.ctrlKey||t.metaKey||t.shiftKey?this.enableRotate&&this._rotateLeft(-Ut*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),n=!0;break}n&&(t.preventDefault(),this.update())}_handleTouchStartRotate(t){if(this._pointers.length===1)this._rotateStart.set(t.pageX,t.pageY);else{const n=this._getSecondPointerPosition(t),i=.5*(t.pageX+n.x),r=.5*(t.pageY+n.y);this._rotateStart.set(i,r)}}_handleTouchStartPan(t){if(this._pointers.length===1)this._panStart.set(t.pageX,t.pageY);else{const n=this._getSecondPointerPosition(t),i=.5*(t.pageX+n.x),r=.5*(t.pageY+n.y);this._panStart.set(i,r)}}_handleTouchStartDolly(t){const n=this._getSecondPointerPosition(t),i=t.pageX-n.x,r=t.pageY-n.y,a=Math.sqrt(i*i+r*r);this._dollyStart.set(0,a)}_handleTouchStartDollyPan(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enablePan&&this._handleTouchStartPan(t)}_handleTouchStartDollyRotate(t){this.enableZoom&&this._handleTouchStartDolly(t),this.enableRotate&&this._handleTouchStartRotate(t)}_handleTouchMoveRotate(t){if(this._pointers.length==1)this._rotateEnd.set(t.pageX,t.pageY);else{const i=this._getSecondPointerPosition(t),r=.5*(t.pageX+i.x),a=.5*(t.pageY+i.y);this._rotateEnd.set(r,a)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const n=this.domElement;this._rotateLeft(Ut*this._rotateDelta.x/n.clientHeight),this._rotateUp(Ut*this._rotateDelta.y/n.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(t){if(this._pointers.length===1)this._panEnd.set(t.pageX,t.pageY);else{const n=this._getSecondPointerPosition(t),i=.5*(t.pageX+n.x),r=.5*(t.pageY+n.y);this._panEnd.set(i,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(t){const n=this._getSecondPointerPosition(t),i=t.pageX-n.x,r=t.pageY-n.y,a=Math.sqrt(i*i+r*r);this._dollyEnd.set(0,a),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(t.pageX+n.x)*.5,s=(t.pageY+n.y)*.5;this._updateZoomParameters(o,s)}_handleTouchMoveDollyPan(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enablePan&&this._handleTouchMovePan(t)}_handleTouchMoveDollyRotate(t){this.enableZoom&&this._handleTouchMoveDolly(t),this.enableRotate&&this._handleTouchMoveRotate(t)}_addPointer(t){this._pointers.push(t.pointerId)}_removePointer(t){delete this._pointerPositions[t.pointerId];for(let n=0;n{var n;(t instanceof Bt||t instanceof qs)&&((n=t.geometry)==null||n.dispose(),Array.isArray(t.material)?t.material.forEach(i=>i.dispose()):t.material&&t.material.dispose())}),e.renderer.dispose(),e.composer.dispose()}class bp{constructor(t){Ve(this,"positions");Ve(this,"velocities");Ve(this,"running",!0);Ve(this,"step",0);Ve(this,"repulsionStrength",500);Ve(this,"attractionStrength",.01);Ve(this,"dampening",.9);Ve(this,"baseMaxSteps",300);Ve(this,"maxSteps",300);Ve(this,"cooldownExtension",0);this.positions=t,this.velocities=new Map;for(const n of t.keys())this.velocities.set(n,new Te)}addNode(t,n){this.positions.set(t,n.clone()),this.velocities.set(t,new Te),this.cooldownExtension=100,this.maxSteps=Math.max(this.maxSteps,this.step+this.cooldownExtension),this.running=!0}removeNode(t){this.positions.delete(t),this.velocities.delete(t)}tick(t){if(!this.running)return;if(this.step>this.maxSteps){this.cooldownExtension>0&&(this.cooldownExtension=0,this.maxSteps=this.baseMaxSteps);return}this.step++;const n=Math.max(.001,1-this.step/this.maxSteps),i=Array.from(this.positions.keys());for(let r=0;r{const r=i;(r.userData.source===t||r.userData.target===t)&&n.push(r)});for(const i of n)this.growingEdges=this.growingEdges.filter(r=>r.line!==i),this.dissolvingEdges.push({line:i,frame:0,totalFrames:40})}animateEdges(t){for(let n=this.growingEdges.length-1;n>=0;n--){const i=this.growingEdges[n];i.frame++;const r=Ap(Math.min(i.frame/i.totalFrames,1)),a=t.get(i.source),o=t.get(i.target);if(!a||!o)continue;const s=a.clone().lerp(o,r),u=i.line.geometry.attributes.position;u.setXYZ(0,a.x,a.y,a.z),u.setXYZ(1,s.x,s.y,s.z),u.needsUpdate=!0;const f=i.line.material;f.opacity=r*.65,i.frame>=i.totalFrames&&(f.opacity=.65,this.growingEdges.splice(n,1))}for(let n=this.dissolvingEdges.length-1;n>=0;n--){const i=this.dissolvingEdges[n];i.frame++;const r=i.frame/i.totalFrames,a=i.line.material;a.opacity=Math.max(0,.65*(1-r)),i.frame>=i.totalFrames&&(this.group.remove(i.line),i.line.geometry.dispose(),i.line.material.dispose(),this.dissolvingEdges.splice(n,1))}}updatePositions(t){this.group.children.forEach(n=>{const i=n;if(this.growingEdges.some(o=>o.line===i)||this.dissolvingEdges.some(o=>o.line===i))return;const r=t.get(i.userData.source),a=t.get(i.userData.target);if(r&&a){const o=i.geometry.attributes.position;o.setXYZ(0,r.x,r.y,r.z),o.setXYZ(1,a.x,a.y,a.z),o.needsUpdate=!0}})}dispose(){this.group.children.forEach(t=>{var i,r;const n=t;(i=n.geometry)==null||i.dispose(),(r=n.material)==null||r.dispose()}),this.growingEdges=[],this.dissolvingEdges=[]}}class wp{constructor(t){Ve(this,"starField");Ve(this,"neuralParticles");this.starField=this.createStarField(),this.neuralParticles=this.createNeuralParticles(),t.add(this.starField),t.add(this.neuralParticles)}createStarField(){const n=new Vt,i=new Float32Array(3e3*3),r=new Float32Array(3e3);for(let o=0;o<3e3;o++)i[o*3]=(Math.random()-.5)*1e3,i[o*3+1]=(Math.random()-.5)*1e3,i[o*3+2]=(Math.random()-.5)*1e3,r[o]=Math.random()*1.5;n.setAttribute("position",new wt(i,3)),n.setAttribute("size",new wt(r,1));const a=new Gn({color:6514417,size:.5,transparent:!0,opacity:.4,sizeAttenuation:!0,blending:Ct});return new kn(n,a)}createNeuralParticles(){const n=new Vt,i=new Float32Array(500*3),r=new Float32Array(500*3);for(let o=0;o<500;o++)i[o*3]=(Math.random()-.5)*100,i[o*3+1]=(Math.random()-.5)*100,i[o*3+2]=(Math.random()-.5)*100,r[o*3]=.4+Math.random()*.3,r[o*3+1]=.3+Math.random()*.2,r[o*3+2]=.8+Math.random()*.2;n.setAttribute("position",new wt(i,3)),n.setAttribute("color",new wt(r,3));const a=new Gn({size:.3,vertexColors:!0,transparent:!0,opacity:.4,blending:Ct,sizeAttenuation:!0});return new kn(n,a)}animate(t){this.starField.rotation.y+=1e-4,this.starField.rotation.x+=5e-5;const n=this.neuralParticles.geometry.attributes.position;for(let i=0;i=0;r--){const a=this.pulseEffects[r];if(a.intensity-=a.decay,a.intensity<=0){this.pulseEffects.splice(r,1);continue}const o=t.get(a.nodeId);if(o){const s=o.material;s.emissive.lerp(a.color,a.intensity*.3),s.emissiveIntensity=Math.max(s.emissiveIntensity,a.intensity)}}for(let r=this.spawnBursts.length-1;r>=0;r--){const a=this.spawnBursts[r];if(a.age++,a.age>120){this.scene.remove(a.particles),a.particles.geometry.dispose(),a.particles.material.dispose(),this.spawnBursts.splice(r,1);continue}const o=a.particles.geometry.attributes.position,s=a.particles.geometry.attributes.velocity;for(let f=0;f=0;r--){const a=this.rainbowBursts[r];if(a.age++,a.age>a.maxAge){this.scene.remove(a.particles),a.particles.geometry.dispose(),a.particles.material.dispose(),this.rainbowBursts.splice(r,1);continue}const o=a.particles.geometry.attributes.position,s=a.particles.geometry.attributes.velocity;for(let v=0;v=0;r--){const a=this.rippleWaves[r];if(a.age++,a.radius+=a.speed,a.age>a.maxAge){this.rippleWaves.splice(r,1);continue}const o=a.radius,s=3;i.forEach((u,f)=>{if(a.pulsedNodes.has(f))return;const m=u.distanceTo(a.origin);m>=o-s&&m<=o+s&&(a.pulsedNodes.add(f),this.addPulse(f,.8,new Ae(65489),.03))})}for(let r=this.implosions.length-1;r>=0;r--){const a=this.implosions[r];if(a.age++,a.age>a.maxAge+20){this.scene.remove(a.particles),a.particles.geometry.dispose(),a.particles.material.dispose(),a.flash&&(this.scene.remove(a.flash),a.flash.geometry.dispose(),a.flash.material.dispose()),this.implosions.splice(r,1);continue}if(a.age<=a.maxAge){const o=a.particles.geometry.attributes.position,s=a.particles.geometry.attributes.velocity,u=1+a.age*.02;for(let m=0;ma.maxAge){const o=(a.age-a.maxAge)/20;a.flash.material.opacity=Math.max(0,1-o),a.flash.scale.setScalar(1+o*3)}}for(let r=this.shockwaves.length-1;r>=0;r--){const a=this.shockwaves[r];if(a.age++,a.age>a.maxAge){this.scene.remove(a.mesh),a.mesh.geometry.dispose(),a.mesh.material.dispose(),this.shockwaves.splice(r,1);continue}const o=a.age/a.maxAge;a.mesh.scale.setScalar(1+o*20),a.mesh.material.opacity=.8*(1-o),a.mesh.lookAt(n.position)}for(let r=this.connectionFlashes.length-1;r>=0;r--){const a=this.connectionFlashes[r];if(a.intensity-=.015,a.intensity<=0){this.scene.remove(a.line),a.line.geometry.dispose(),a.line.material.dispose(),this.connectionFlashes.splice(r,1);continue}a.line.material.opacity=a.intensity}for(let r=this.birthOrbs.length-1;r>=0;r--){const a=this.birthOrbs[r];a.age++;const o=a.gestationFrames+a.flightFrames,s=a.sprite.material,u=a.core.material,f=a.getTargetPos();if(f)a.lastTargetPos.copy(f);else if(a.age>a.gestationFrames&&!a.aborted){a.aborted=!0;const m=a.sprite.position;s.color.setRGB(1,.15,.2),u.color.setRGB(1,.6,.6),this.createImplosion(m,new Ae(16721203)),a.arriveFired=!0,a.age=o+1}if(a.age<=a.gestationFrames){const m=a.age/a.gestationFrames,_=1-Math.pow(1-m,3),v=.85+Math.sin(a.age*.35)*.15,p=.5+_*4.5*v,b=.2+_*1.8*v;a.sprite.scale.set(p,p,1),a.core.scale.set(b,b,1),s.opacity=_*.95,u.opacity=_,s.color.copy(a.color).multiplyScalar(.7+_*.3),a.sprite.position.copy(a.startPos),a.core.position.copy(a.startPos)}else if(a.age<=o){const m=(a.age-a.gestationFrames)/a.flightFrames,_=m<.5?2*m*m:1-Math.pow(-2*m+2,2)/2,v=a.startPos,p=a.lastTargetPos,b=p.x-v.x,A=p.y-v.y,c=p.z-v.z,l=Math.sqrt(b*b+A*A+c*c),O=(v.x+p.x)*.5,M=(v.y+p.y)*.5+30+l*.15,x=(v.z+p.z)*.5,y=1-_,U=y*y,F=2*y*_,V=_*_,E=U*v.x+F*O+V*p.x,g=U*v.y+F*M+V*p.y,D=U*v.z+F*x+V*p.z;a.sprite.position.set(E,g,D),a.core.position.set(E,g,D);const Z=1-_*.35;a.sprite.scale.setScalar(5*Z),a.core.scale.setScalar(2*Z),s.opacity=.95,u.opacity=1,s.color.copy(a.color)}else if(a.arriveFired){const m=a.age-o,_=Math.max(0,1-m/8);s.opacity=.95*_,u.opacity=1*_,a.sprite.scale.setScalar(5*(1+(1-_)*2)),_<=0&&(this.scene.remove(a.sprite),this.scene.remove(a.core),s.dispose(),u.dispose(),this.birthOrbs.splice(r,1))}else{a.arriveFired=!0;try{a.onArrive()}catch(m){console.warn("[birth-orb] onArrive threw",m)}}}}dispose(){for(const t of this.spawnBursts)this.scene.remove(t.particles),t.particles.geometry.dispose(),t.particles.material.dispose();for(const t of this.rainbowBursts)this.scene.remove(t.particles),t.particles.geometry.dispose(),t.particles.material.dispose();for(const t of this.implosions)this.scene.remove(t.particles),t.particles.geometry.dispose(),t.particles.material.dispose(),t.flash&&(this.scene.remove(t.flash),t.flash.geometry.dispose(),t.flash.material.dispose());for(const t of this.shockwaves)this.scene.remove(t.mesh),t.mesh.geometry.dispose(),t.mesh.material.dispose();for(const t of this.connectionFlashes)this.scene.remove(t.line),t.line.geometry.dispose(),t.line.material.dispose();for(const t of this.birthOrbs)this.scene.remove(t.sprite),this.scene.remove(t.core),t.sprite.material.dispose(),t.core.material.dispose();this.pulseEffects=[],this.spawnBursts=[],this.rainbowBursts=[],this.rippleWaves=[],this.implosions=[],this.shockwaves=[],this.connectionFlashes=[],this.birthOrbs=[]}}const Qt={bloomStrength:.8,rotateSpeed:.3,fogColor:328976,fogDensity:.008,nebulaIntensity:0,chromaticIntensity:.002,vignetteRadius:.9,breatheAmplitude:1},rn={bloomStrength:1.8,rotateSpeed:.08,fogColor:656672,fogDensity:.006,nebulaIntensity:1,chromaticIntensity:.005,vignetteRadius:.7,breatheAmplitude:2};class Cp{constructor(){Ve(this,"active",!1);Ve(this,"transition",0);Ve(this,"transitionSpeed",.008);Ve(this,"current");Ve(this,"auroraHue",0);this.current={...Qt}}setActive(t){this.active=t}update(t,n,i,r,a){const o=this.active?1:0;this.transition+=(o-this.transition)*this.transitionSpeed*60*(1/60),this.transition=Math.max(0,Math.min(1,this.transition));const s=this.transition;this.current.bloomStrength=this.lerp(Qt.bloomStrength,rn.bloomStrength,s),this.current.rotateSpeed=this.lerp(Qt.rotateSpeed,rn.rotateSpeed,s),this.current.fogDensity=this.lerp(Qt.fogDensity,rn.fogDensity,s),this.current.nebulaIntensity=this.lerp(Qt.nebulaIntensity,rn.nebulaIntensity,s),this.current.chromaticIntensity=this.lerp(Qt.chromaticIntensity,rn.chromaticIntensity,s),this.current.vignetteRadius=this.lerp(Qt.vignetteRadius,rn.vignetteRadius,s),this.current.breatheAmplitude=this.lerp(Qt.breatheAmplitude,rn.breatheAmplitude,s),n.strength=this.current.bloomStrength,i.autoRotateSpeed=this.current.rotateSpeed;const u=new Ae(Qt.fogColor),f=new Ae(rn.fogColor),m=u.clone().lerp(f,s);if(t.fog=new io(m,this.current.fogDensity),s>.01){this.auroraHue=a*.1%1;const _=new Ae().setHSL(.75+this.auroraHue*.15,.8,.5),v=new Ae().setHSL(.55+this.auroraHue*.2,.7,.4);r.point1.color.lerp(_,s*.3),r.point2.color.lerp(v,s*.3)}else r.point1.color.set(6514417),r.point2.color.set(11032055)}lerp(t,n,i){return t+(n-t)*i}}const Pp=50,ai=[];function Dp(e,t,n){const i=e.tags??[],r=e.type??"";let a=null,o=0;for(const s of t){let u=0;s.type===r&&(u+=2);for(const f of s.tags)i.includes(f)&&(u+=1);u>o&&(o=u,a=s.id)}if(a&&o>0){const s=n.get(a);if(s)return new Te(s.x+(Math.random()-.5)*10,s.y+(Math.random()-.5)*10,s.z+(Math.random()-.5)*10)}return new Te((Math.random()-.5)*40,(Math.random()-.5)*40,(Math.random()-.5)*40)}function Lp(e,t){if(ai.length<=Pp)return;const n=ai.shift();e.edgeManager.removeEdgesForNode(n),e.nodeManager.removeNode(n),e.forceSim.removeNode(n),e.onMutation({type:"edgesRemoved",nodeId:n}),e.onMutation({type:"nodeRemoved",nodeId:n});const i=t.findIndex(r=>r.id===n);i!==-1&&t.splice(i,1)}function Up(e,t,n){var _,v;const{effects:i,nodeManager:r,edgeManager:a,forceSim:o,camera:s,onMutation:u}=t,f=r.positions,m=r.meshMap;switch(e.type){case"MemoryCreated":{const p=e.data;if(!p.id)break;const b={id:p.id,label:(p.content??"").slice(0,60),type:p.node_type??"fact",retention:Math.max(0,Math.min(1,p.retention??.9)),tags:p.tags??[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),isCenter:!1},A=Dp(b,n,f),c=r.addNode(b,A,{isBirthRitual:!0});o.addNode(p.id,c),ai.push(p.id),Lp(t,n);const l=new Ae(sl[b.type]||"#00ffd1"),O=l.clone();O.offsetHSL(.15,0,0),i.createBirthOrb(s,l,()=>r.positions.get(b.id),()=>{r.igniteNode(b.id);const M=r.positions.get(b.id)??A,x=r.meshMap.get(b.id);x&&x.scale.multiplyScalar(1.8),i.createRainbowBurst(M,l),i.createShockwave(M,l,s),i.createShockwave(M,O,s),i.createRippleWave(M)}),u({type:"nodeAdded",node:b});break}case"ConnectionDiscovered":{const p=e.data;if(!p.source_id||!p.target_id)break;const b=f.get(p.source_id),A=f.get(p.target_id),c={source:p.source_id,target:p.target_id,weight:p.weight??.5,type:p.connection_type??"semantic"};a.addEdge(c,f),b&&A&&i.createConnectionFlash(b,A,new Ae(54527)),p.source_id&&m.has(p.source_id)&&i.addPulse(p.source_id,1,new Ae(54527),.02),p.target_id&&m.has(p.target_id)&&i.addPulse(p.target_id,1,new Ae(54527),.02),u({type:"edgeAdded",edge:c});break}case"MemoryDeleted":{const p=e.data;if(!p.id)break;const b=f.get(p.id);if(b){const c=new Ae(16729943);i.createImplosion(b,c)}a.removeEdgesForNode(p.id),r.removeNode(p.id),o.removeNode(p.id);const A=ai.indexOf(p.id);A!==-1&&ai.splice(A,1),u({type:"edgesRemoved",nodeId:p.id}),u({type:"nodeRemoved",nodeId:p.id});break}case"MemoryPromoted":{const p=e.data,b=p==null?void 0:p.id;if(!b)break;const A=p.new_retention??.95;if(m.has(b)){r.growNode(b,A),i.addPulse(b,1.2,new Ae(65416),.01);const c=f.get(b);c&&(i.createShockwave(c,new Ae(65416),s),i.createSpawnBurst(c,new Ae(65416))),u({type:"nodeUpdated",nodeId:b,retention:A})}break}case"MemoryDemoted":{const p=e.data,b=p==null?void 0:p.id;if(!b)break;const A=p.new_retention??.3;m.has(b)&&(r.growNode(b,A),i.addPulse(b,.8,new Ae(16729943),.03),u({type:"nodeUpdated",nodeId:b,retention:A}));break}case"MemoryUpdated":{const p=e.data,b=p==null?void 0:p.id;if(!b||!m.has(b))break;i.addPulse(b,.6,new Ae(8490232),.02),p.retention!==void 0&&(r.growNode(b,p.retention),u({type:"nodeUpdated",nodeId:b,retention:p.retention}));break}case"SearchPerformed":{m.forEach((p,b)=>{i.addPulse(b,.6+Math.random()*.4,new Ae(8490232),.02)});break}case"DreamStarted":{m.forEach((p,b)=>{i.addPulse(b,1,new Ae(11032055),.005)});break}case"DreamProgress":{const p=(_=e.data)==null?void 0:_.memory_id;p&&m.has(p)&&i.addPulse(p,1.5,new Ae(12616956),.01);break}case"DreamCompleted":{i.createSpawnBurst(new Te(0,0,0),new Ae(11032055)),i.createShockwave(new Te(0,0,0),new Ae(11032055),s);break}case"RetentionDecayed":{const p=(v=e.data)==null?void 0:v.id;p&&m.has(p)&&i.addPulse(p,.8,new Ae(16729943),.03);break}case"ConsolidationCompleted":{m.forEach((p,b)=>{i.addPulse(b,.4+Math.random()*.3,new Ae(16758784),.015)});break}case"ActivationSpread":{const p=e.data;if(p.source_id&&p.target_ids){const b=f.get(p.source_id);if(b)for(const A of p.target_ids){const c=f.get(A);c&&i.createConnectionFlash(b,c,new Ae(1370310))}}break}case"MemorySuppressed":{const p=e.data;if(!p.id)break;const b=f.get(p.id);if(b){i.createImplosion(b,new Ae(11032055));const A=Math.max(1,p.suppression_count??1),c=Math.min(.4+A*.15,1);i.addPulse(p.id,c,new Ae(11032055),.04)}break}case"MemoryUnsuppressed":{const p=e.data;if(!p.id)break;const b=f.get(p.id);b&&m.has(p.id)&&(i.createRainbowBurst(b,new Ae(65416)),i.addPulse(p.id,1,new Ae(65416),.02));break}case"Rac1CascadeSwept":{const b=e.data.neighbors_affected??0;if(b===0)break;const A=Array.from(m.keys()),c=Math.min(b,A.length,12);for(let l=0;l{var n;(t instanceof Bt||t instanceof qs)&&((n=t.geometry)==null||n.dispose(),Array.isArray(t.material)?t.material.forEach(i=>i.dispose()):t.material&&t.material.dispose())}),e.renderer.dispose(),e.composer.dispose()}class bp{constructor(t){Ve(this,"positions");Ve(this,"velocities");Ve(this,"running",!0);Ve(this,"step",0);Ve(this,"repulsionStrength",500);Ve(this,"attractionStrength",.01);Ve(this,"dampening",.9);Ve(this,"baseMaxSteps",300);Ve(this,"maxSteps",300);Ve(this,"cooldownExtension",0);this.positions=t,this.velocities=new Map;for(const n of t.keys())this.velocities.set(n,new Te)}addNode(t,n){this.positions.set(t,n.clone()),this.velocities.set(t,new Te),this.cooldownExtension=100,this.maxSteps=Math.max(this.maxSteps,this.step+this.cooldownExtension),this.running=!0}removeNode(t){this.positions.delete(t),this.velocities.delete(t)}tick(t){if(!this.running)return;if(this.step>this.maxSteps){this.cooldownExtension>0&&(this.cooldownExtension=0,this.maxSteps=this.baseMaxSteps);return}this.step++;const n=Math.max(.001,1-this.step/this.maxSteps),i=Array.from(this.positions.keys());for(let r=0;r{const r=i;(r.userData.source===t||r.userData.target===t)&&n.push(r)});for(const i of n)this.growingEdges=this.growingEdges.filter(r=>r.line!==i),this.dissolvingEdges.push({line:i,frame:0,totalFrames:40})}animateEdges(t){for(let n=this.growingEdges.length-1;n>=0;n--){const i=this.growingEdges[n];i.frame++;const r=Ap(Math.min(i.frame/i.totalFrames,1)),a=t.get(i.source),o=t.get(i.target);if(!a||!o)continue;const s=a.clone().lerp(o,r),u=i.line.geometry.attributes.position;u.setXYZ(0,a.x,a.y,a.z),u.setXYZ(1,s.x,s.y,s.z),u.needsUpdate=!0;const f=i.line.material;f.opacity=r*.65,i.frame>=i.totalFrames&&(f.opacity=.65,this.growingEdges.splice(n,1))}for(let n=this.dissolvingEdges.length-1;n>=0;n--){const i=this.dissolvingEdges[n];i.frame++;const r=i.frame/i.totalFrames,a=i.line.material;a.opacity=Math.max(0,.65*(1-r)),i.frame>=i.totalFrames&&(this.group.remove(i.line),i.line.geometry.dispose(),i.line.material.dispose(),this.dissolvingEdges.splice(n,1))}}updatePositions(t){this.group.children.forEach(n=>{const i=n;if(this.growingEdges.some(o=>o.line===i)||this.dissolvingEdges.some(o=>o.line===i))return;const r=t.get(i.userData.source),a=t.get(i.userData.target);if(r&&a){const o=i.geometry.attributes.position;o.setXYZ(0,r.x,r.y,r.z),o.setXYZ(1,a.x,a.y,a.z),o.needsUpdate=!0}})}dispose(){this.group.children.forEach(t=>{var i,r;const n=t;(i=n.geometry)==null||i.dispose(),(r=n.material)==null||r.dispose()}),this.growingEdges=[],this.dissolvingEdges=[]}}class wp{constructor(t){Ve(this,"starField");Ve(this,"neuralParticles");this.starField=this.createStarField(),this.neuralParticles=this.createNeuralParticles(),t.add(this.starField),t.add(this.neuralParticles)}createStarField(){const n=new Vt,i=new Float32Array(3e3*3),r=new Float32Array(3e3);for(let o=0;o<3e3;o++)i[o*3]=(Math.random()-.5)*1e3,i[o*3+1]=(Math.random()-.5)*1e3,i[o*3+2]=(Math.random()-.5)*1e3,r[o]=Math.random()*1.5;n.setAttribute("position",new wt(i,3)),n.setAttribute("size",new wt(r,1));const a=new kn({color:6514417,size:.5,transparent:!0,opacity:.4,sizeAttenuation:!0,blending:Ct});return new Vn(n,a)}createNeuralParticles(){const n=new Vt,i=new Float32Array(500*3),r=new Float32Array(500*3);for(let o=0;o<500;o++)i[o*3]=(Math.random()-.5)*100,i[o*3+1]=(Math.random()-.5)*100,i[o*3+2]=(Math.random()-.5)*100,r[o*3]=.4+Math.random()*.3,r[o*3+1]=.3+Math.random()*.2,r[o*3+2]=.8+Math.random()*.2;n.setAttribute("position",new wt(i,3)),n.setAttribute("color",new wt(r,3));const a=new kn({size:.3,vertexColors:!0,transparent:!0,opacity:.4,blending:Ct,sizeAttenuation:!0});return new Vn(n,a)}animate(t){this.starField.rotation.y+=1e-4,this.starField.rotation.x+=5e-5;const n=this.neuralParticles.geometry.attributes.position;for(let i=0;i=0;r--){const a=this.pulseEffects[r];if(a.intensity-=a.decay,a.intensity<=0){this.pulseEffects.splice(r,1);continue}const o=t.get(a.nodeId);if(o){const s=o.material;s.emissive.lerp(a.color,a.intensity*.3),s.emissiveIntensity=Math.max(s.emissiveIntensity,a.intensity)}}for(let r=this.spawnBursts.length-1;r>=0;r--){const a=this.spawnBursts[r];if(a.age++,a.age>120){this.scene.remove(a.particles),a.particles.geometry.dispose(),a.particles.material.dispose(),this.spawnBursts.splice(r,1);continue}const o=a.particles.geometry.attributes.position,s=a.particles.geometry.attributes.velocity;for(let f=0;f=0;r--){const a=this.rainbowBursts[r];if(a.age++,a.age>a.maxAge){this.scene.remove(a.particles),a.particles.geometry.dispose(),a.particles.material.dispose(),this.rainbowBursts.splice(r,1);continue}const o=a.particles.geometry.attributes.position,s=a.particles.geometry.attributes.velocity;for(let v=0;v=0;r--){const a=this.rippleWaves[r];if(a.age++,a.radius+=a.speed,a.age>a.maxAge){this.rippleWaves.splice(r,1);continue}const o=a.radius,s=3;i.forEach((u,f)=>{if(a.pulsedNodes.has(f))return;const m=u.distanceTo(a.origin);m>=o-s&&m<=o+s&&(a.pulsedNodes.add(f),this.addPulse(f,.8,new Ae(65489),.03))})}for(let r=this.implosions.length-1;r>=0;r--){const a=this.implosions[r];if(a.age++,a.age>a.maxAge+20){this.scene.remove(a.particles),a.particles.geometry.dispose(),a.particles.material.dispose(),a.flash&&(this.scene.remove(a.flash),a.flash.geometry.dispose(),a.flash.material.dispose()),this.implosions.splice(r,1);continue}if(a.age<=a.maxAge){const o=a.particles.geometry.attributes.position,s=a.particles.geometry.attributes.velocity,u=1+a.age*.02;for(let m=0;ma.maxAge){const o=(a.age-a.maxAge)/20;a.flash.material.opacity=Math.max(0,1-o),a.flash.scale.setScalar(1+o*3)}}for(let r=this.shockwaves.length-1;r>=0;r--){const a=this.shockwaves[r];if(a.age++,a.age>a.maxAge){this.scene.remove(a.mesh),a.mesh.geometry.dispose(),a.mesh.material.dispose(),this.shockwaves.splice(r,1);continue}const o=a.age/a.maxAge;a.mesh.scale.setScalar(1+o*20),a.mesh.material.opacity=.8*(1-o),a.mesh.lookAt(n.position)}for(let r=this.connectionFlashes.length-1;r>=0;r--){const a=this.connectionFlashes[r];if(a.intensity-=.015,a.intensity<=0){this.scene.remove(a.line),a.line.geometry.dispose(),a.line.material.dispose(),this.connectionFlashes.splice(r,1);continue}a.line.material.opacity=a.intensity}for(let r=this.birthOrbs.length-1;r>=0;r--){const a=this.birthOrbs[r];a.age++;const o=a.gestationFrames+a.flightFrames,s=a.sprite.material,u=a.core.material,f=a.getTargetPos();if(f)a.lastTargetPos.copy(f);else if(a.age>a.gestationFrames&&!a.aborted){a.aborted=!0;const m=a.sprite.position;s.color.setRGB(1,.15,.2),u.color.setRGB(1,.6,.6),this.createImplosion(m,new Ae(16721203)),a.arriveFired=!0,a.age=o+1}if(a.age<=a.gestationFrames){const m=a.age/a.gestationFrames,_=1-Math.pow(1-m,3),v=.85+Math.sin(a.age*.35)*.15,p=.5+_*4.5*v,b=.2+_*1.8*v;a.sprite.scale.set(p,p,1),a.core.scale.set(b,b,1),s.opacity=_*.95,u.opacity=_,s.color.copy(a.color).multiplyScalar(.7+_*.3),a.sprite.position.copy(a.startPos),a.core.position.copy(a.startPos)}else if(a.age<=o){const m=(a.age-a.gestationFrames)/a.flightFrames,_=m<.5?2*m*m:1-Math.pow(-2*m+2,2)/2,v=a.startPos,p=a.lastTargetPos,b=p.x-v.x,A=p.y-v.y,c=p.z-v.z,l=Math.sqrt(b*b+A*A+c*c),O=(v.x+p.x)*.5,M=(v.y+p.y)*.5+30+l*.15,x=(v.z+p.z)*.5,y=1-_,U=y*y,F=2*y*_,V=_*_,E=U*v.x+F*O+V*p.x,g=U*v.y+F*M+V*p.y,D=U*v.z+F*x+V*p.z;a.sprite.position.set(E,g,D),a.core.position.set(E,g,D);const Z=1-_*.35;a.sprite.scale.setScalar(5*Z),a.core.scale.setScalar(2*Z),s.opacity=.95,u.opacity=1,s.color.copy(a.color)}else if(a.arriveFired){const m=a.age-o,_=Math.max(0,1-m/8);s.opacity=.95*_,u.opacity=1*_,a.sprite.scale.setScalar(5*(1+(1-_)*2)),_<=0&&(this.scene.remove(a.sprite),this.scene.remove(a.core),s.dispose(),u.dispose(),this.birthOrbs.splice(r,1))}else{a.arriveFired=!0;try{a.onArrive()}catch(m){console.warn("[birth-orb] onArrive threw",m)}}}}dispose(){for(const t of this.spawnBursts)this.scene.remove(t.particles),t.particles.geometry.dispose(),t.particles.material.dispose();for(const t of this.rainbowBursts)this.scene.remove(t.particles),t.particles.geometry.dispose(),t.particles.material.dispose();for(const t of this.implosions)this.scene.remove(t.particles),t.particles.geometry.dispose(),t.particles.material.dispose(),t.flash&&(this.scene.remove(t.flash),t.flash.geometry.dispose(),t.flash.material.dispose());for(const t of this.shockwaves)this.scene.remove(t.mesh),t.mesh.geometry.dispose(),t.mesh.material.dispose();for(const t of this.connectionFlashes)this.scene.remove(t.line),t.line.geometry.dispose(),t.line.material.dispose();for(const t of this.birthOrbs)this.scene.remove(t.sprite),this.scene.remove(t.core),t.sprite.material.dispose(),t.core.material.dispose();this.pulseEffects=[],this.spawnBursts=[],this.rainbowBursts=[],this.rippleWaves=[],this.implosions=[],this.shockwaves=[],this.connectionFlashes=[],this.birthOrbs=[]}}const Qt={bloomStrength:.8,rotateSpeed:.3,fogColor:328976,fogDensity:.008,nebulaIntensity:0,chromaticIntensity:.002,vignetteRadius:.9,breatheAmplitude:1},rn={bloomStrength:1.8,rotateSpeed:.08,fogColor:656672,fogDensity:.006,nebulaIntensity:1,chromaticIntensity:.005,vignetteRadius:.7,breatheAmplitude:2};class Cp{constructor(){Ve(this,"active",!1);Ve(this,"transition",0);Ve(this,"transitionSpeed",.008);Ve(this,"current");Ve(this,"auroraHue",0);this.current={...Qt}}setActive(t){this.active=t}update(t,n,i,r,a){const o=this.active?1:0;this.transition+=(o-this.transition)*this.transitionSpeed*60*(1/60),this.transition=Math.max(0,Math.min(1,this.transition));const s=this.transition;this.current.bloomStrength=this.lerp(Qt.bloomStrength,rn.bloomStrength,s),this.current.rotateSpeed=this.lerp(Qt.rotateSpeed,rn.rotateSpeed,s),this.current.fogDensity=this.lerp(Qt.fogDensity,rn.fogDensity,s),this.current.nebulaIntensity=this.lerp(Qt.nebulaIntensity,rn.nebulaIntensity,s),this.current.chromaticIntensity=this.lerp(Qt.chromaticIntensity,rn.chromaticIntensity,s),this.current.vignetteRadius=this.lerp(Qt.vignetteRadius,rn.vignetteRadius,s),this.current.breatheAmplitude=this.lerp(Qt.breatheAmplitude,rn.breatheAmplitude,s),n.strength=this.current.bloomStrength,i.autoRotateSpeed=this.current.rotateSpeed;const u=new Ae(Qt.fogColor),f=new Ae(rn.fogColor),m=u.clone().lerp(f,s);if(t.fog=new io(m,this.current.fogDensity),s>.01){this.auroraHue=a*.1%1;const _=new Ae().setHSL(.75+this.auroraHue*.15,.8,.5),v=new Ae().setHSL(.55+this.auroraHue*.2,.7,.4);r.point1.color.lerp(_,s*.3),r.point2.color.lerp(v,s*.3)}else r.point1.color.set(6514417),r.point2.color.set(11032055)}lerp(t,n,i){return t+(n-t)*i}}const Pp=50,ai=[];function Dp(e,t,n){const i=e.tags??[],r=e.type??"";let a=null,o=0;for(const s of t){let u=0;s.type===r&&(u+=2);for(const f of s.tags)i.includes(f)&&(u+=1);u>o&&(o=u,a=s.id)}if(a&&o>0){const s=n.get(a);if(s)return new Te(s.x+(Math.random()-.5)*10,s.y+(Math.random()-.5)*10,s.z+(Math.random()-.5)*10)}return new Te((Math.random()-.5)*40,(Math.random()-.5)*40,(Math.random()-.5)*40)}function Lp(e,t){if(ai.length<=Pp)return;const n=ai.shift();e.edgeManager.removeEdgesForNode(n),e.nodeManager.removeNode(n),e.forceSim.removeNode(n),e.onMutation({type:"edgesRemoved",nodeId:n}),e.onMutation({type:"nodeRemoved",nodeId:n});const i=t.findIndex(r=>r.id===n);i!==-1&&t.splice(i,1)}function Up(e,t,n){var _,v;const{effects:i,nodeManager:r,edgeManager:a,forceSim:o,camera:s,onMutation:u}=t,f=r.positions,m=r.meshMap;switch(e.type){case"MemoryCreated":{const p=e.data;if(!p.id)break;const b={id:p.id,label:(p.content??"").slice(0,60),type:p.node_type??"fact",retention:Math.max(0,Math.min(1,p.retention??.9)),tags:p.tags??[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),isCenter:!1},A=Dp(b,n,f),c=r.addNode(b,A,{isBirthRitual:!0});o.addNode(p.id,c),ai.push(p.id),Lp(t,n);const l=new Ae(sl[b.type]||"#00ffd1"),O=l.clone();O.offsetHSL(.15,0,0),i.createBirthOrb(s,l,()=>r.positions.get(b.id),()=>{r.igniteNode(b.id);const M=r.positions.get(b.id)??A,x=r.meshMap.get(b.id);x&&x.scale.multiplyScalar(1.8),i.createRainbowBurst(M,l),i.createShockwave(M,l,s),i.createShockwave(M,O,s),i.createRippleWave(M)}),u({type:"nodeAdded",node:b});break}case"ConnectionDiscovered":{const p=e.data;if(!p.source_id||!p.target_id)break;const b=f.get(p.source_id),A=f.get(p.target_id),c={source:p.source_id,target:p.target_id,weight:p.weight??.5,type:p.connection_type??"semantic"};a.addEdge(c,f),b&&A&&i.createConnectionFlash(b,A,new Ae(54527)),p.source_id&&m.has(p.source_id)&&i.addPulse(p.source_id,1,new Ae(54527),.02),p.target_id&&m.has(p.target_id)&&i.addPulse(p.target_id,1,new Ae(54527),.02),u({type:"edgeAdded",edge:c});break}case"MemoryDeleted":{const p=e.data;if(!p.id)break;const b=f.get(p.id);if(b){const c=new Ae(16729943);i.createImplosion(b,c)}a.removeEdgesForNode(p.id),r.removeNode(p.id),o.removeNode(p.id);const A=ai.indexOf(p.id);A!==-1&&ai.splice(A,1),u({type:"edgesRemoved",nodeId:p.id}),u({type:"nodeRemoved",nodeId:p.id});break}case"MemoryPromoted":{const p=e.data,b=p==null?void 0:p.id;if(!b)break;const A=p.new_retention??.95;if(m.has(b)){r.growNode(b,A),i.addPulse(b,1.2,new Ae(65416),.01);const c=f.get(b);c&&(i.createShockwave(c,new Ae(65416),s),i.createSpawnBurst(c,new Ae(65416))),u({type:"nodeUpdated",nodeId:b,retention:A})}break}case"MemoryDemoted":{const p=e.data,b=p==null?void 0:p.id;if(!b)break;const A=p.new_retention??.3;m.has(b)&&(r.growNode(b,A),i.addPulse(b,.8,new Ae(16729943),.03),u({type:"nodeUpdated",nodeId:b,retention:A}));break}case"MemoryUpdated":{const p=e.data,b=p==null?void 0:p.id;if(!b||!m.has(b))break;i.addPulse(b,.6,new Ae(8490232),.02),p.retention!==void 0&&(r.growNode(b,p.retention),u({type:"nodeUpdated",nodeId:b,retention:p.retention}));break}case"SearchPerformed":{m.forEach((p,b)=>{i.addPulse(b,.6+Math.random()*.4,new Ae(8490232),.02)});break}case"DreamStarted":{m.forEach((p,b)=>{i.addPulse(b,1,new Ae(11032055),.005)});break}case"DreamProgress":{const p=(_=e.data)==null?void 0:_.memory_id;p&&m.has(p)&&i.addPulse(p,1.5,new Ae(12616956),.01);break}case"DreamCompleted":{i.createSpawnBurst(new Te(0,0,0),new Ae(11032055)),i.createShockwave(new Te(0,0,0),new Ae(11032055),s);break}case"RetentionDecayed":{const p=(v=e.data)==null?void 0:v.id;p&&m.has(p)&&i.addPulse(p,.8,new Ae(16729943),.03);break}case"ConsolidationCompleted":{m.forEach((p,b)=>{i.addPulse(b,.4+Math.random()*.3,new Ae(16758784),.015)});break}case"ActivationSpread":{const p=e.data;if(p.source_id&&p.target_ids){const b=f.get(p.source_id);if(b)for(const A of p.target_ids){const c=f.get(A);c&&i.createConnectionFlash(b,c,new Ae(1370310))}}break}case"MemorySuppressed":{const p=e.data;if(!p.id)break;const b=f.get(p.id);if(b){i.createImplosion(b,new Ae(11032055));const A=Math.max(1,p.suppression_count??1),c=Math.min(.4+A*.15,1);i.addPulse(p.id,c,new Ae(11032055),.04)}break}case"MemoryUnsuppressed":{const p=e.data;if(!p.id)break;const b=f.get(p.id);b&&m.has(p.id)&&(i.createRainbowBurst(b,new Ae(65416)),i.addPulse(p.id,1,new Ae(65416),.02));break}case"Rac1CascadeSwept":{const b=e.data.neighbors_affected??0;if(b===0)break;const A=Array.from(m.keys()),c=Math.min(b,A.length,12);for(let l=0;l"u")return Mi;const e=localStorage.getItem(po);if(e===null)return Mi;const t=Number(e);return Number.isFinite(t)?Math.min(da,Math.max(ca,t)):Mi}const xn=Wp();function Wp(){let e=He(!1),t=He(qi(new Date)),n=He(!1),i=He(1),r=He(!1),a=He(qi(zp()));return{get temporalEnabled(){return T(e)},set temporalEnabled(o){te(e,o,!0)},get temporalDate(){return T(t)},set temporalDate(o){te(t,o,!0)},get temporalPlaying(){return T(n)},set temporalPlaying(o){te(n,o,!0)},get temporalSpeed(){return T(i)},set temporalSpeed(o){te(i,o,!0)},get dreamMode(){return T(r)},set dreamMode(o){te(r,o,!0)},get brightness(){return T(a)},set brightness(o){const s=Math.min(da,Math.max(ca,o));if(te(a,s,!0),typeof localStorage<"u")try{localStorage.setItem(po,String(s))}catch{}},brightnessMin:ca,brightnessMax:da,brightnessDefault:Mi}}var Xp=$e('
');function Yp(e,t){var Z;Xn(t,!0);let n=ii(t,"events",19,()=>[]),i=ii(t,"isDreaming",3,!1),r=ii(t,"colorMode",3,"type");ei(()=>{_==null||_.setColorMode(r())});let a,o,s,u=typeof window<"u"&&((Z=window.matchMedia)==null?void 0:Z.call(window,"(prefers-reduced-motion: reduce)").matches),f=null;function m(k){u=k.matches,o!=null&&o.controls&&(o.controls.autoRotate=!u)}let _,v,p,b,A,c,l,O,M=null,x=[];Nr(()=>{var J;o=xp(a),u&&(o.controls.autoRotate=!1),typeof window<"u"&&window.matchMedia&&(f=window.matchMedia("(prefers-reduced-motion: reduce)"),(J=f.addEventListener)==null||J.call(f,"change",m)),l=Op(o.scene).material,O=kp(o.composer),p=new wp(o.scene),_=new js,_.colorMode=r(),v=new Rp,b=new yp(o.scene),c=new Cp;const Y=_.createNodes(t.nodes);v.createEdges(t.edges,Y),A=new bp(Y),x=[...t.nodes],o.scene.add(v.group),o.scene.add(_.group),U(),window.addEventListener("resize",V),a.addEventListener("pointermove",E),a.addEventListener("click",g)}),ua(()=>{var k;cancelAnimationFrame(s),window.removeEventListener("resize",V),(k=f==null?void 0:f.removeEventListener)==null||k.call(f,"change",m),a==null||a.removeEventListener("pointermove",E),a==null||a.removeEventListener("click",g),b==null||b.dispose(),p==null||p.dispose(),_==null||_.dispose(),v==null||v.dispose(),o&&Tp(o)});let y=0;function U(){s=requestAnimationFrame(U);const k=performance.now();y===0&&(y=k);const Y=k-y;if(Y<16)return;y=k-Y%16;const J=k*.001;A.tick(t.edges),_.updatePositions(),v.updatePositions(_.positions),v.animateEdges(_.positions),p.animate(J),_.animate(J,x,o.camera,xn.brightness),c.setActive(i()),c.update(o.scene,o.bloomPass,o.controls,o.lights,J),Fp(l,J,c.current.nebulaIntensity,a.clientWidth,a.clientHeight),Vp(O,J,c.current.nebulaIntensity),F(),b.update(_.meshMap,o.camera,_.positions),o.controls.update(),o.composer.render()}function F(){if(!n()||n().length===0)return;const k=[];for(const J of n()){if(J===M)break;k.push(J)}if(k.length===0)return;if(k.length===n().length&&n().length>=200){console.warn("[vestige] Event horizon overflow: dropping visuals for",k.length,"events"),M=n()[0];return}M=n()[0];const Y={effects:b,nodeManager:_,edgeManager:v,forceSim:A,camera:o.camera,onMutation:J=>{var $;J.type==="nodeAdded"?x=[...x,J.node]:J.type==="nodeRemoved"&&(x=x.filter(ne=>ne.id!==J.nodeId)),($=t.onGraphMutation)==null||$.call(t,J)}};for(let J=k.length-1;J>=0;J--)Up(k[J],Y,x)}function V(){!a||!o||Mp(o,a)}function E(k){const Y=a.getBoundingClientRect();o.mouse.x=(k.clientX-Y.left)/Y.width*2-1,o.mouse.y=-((k.clientY-Y.top)/Y.height)*2+1,o.raycaster.setFromCamera(o.mouse,o.camera);const J=o.raycaster.intersectObjects(_.getMeshes());J.length>0?(_.hoveredNode=J[0].object.userData.nodeId,a.style.cursor="pointer"):(_.hoveredNode=null,a.style.cursor="grab")}function g(){var k;if(_.hoveredNode){_.selectedNode=_.hoveredNode,(k=t.onSelect)==null||k.call(t,_.hoveredNode);const Y=_.positions.get(_.hoveredNode);Y&&o.controls.target.lerp(Y.clone(),.5)}}var D=Xp();Ki(D,k=>a=k,()=>a),qe(e,D),Yn()}var qp=$e('
'),Kp=$e('
');function Zp(e,t){Xn(t,!0);let n=ii(t,"width",3,240),i=ii(t,"height",3,80);function r(c){return t.stability<=0?0:Math.exp(-c/t.stability)}let a=en(()=>{const c=[],l=Math.max(t.stability*3,30),O=4,M=n()-O*2,x=i()-O*2;for(let y=0;y<=50;y++){const U=y/50*l,F=r(U),V=O+y/50*M,E=O+(1-F)*x;c.push(`${y===0?"M":"L"}${V.toFixed(1)},${E.toFixed(1)}`)}return c.join(" ")}),o=en(()=>[{label:"Now",days:0,value:t.retention},{label:"1d",days:1,value:r(1)},{label:"7d",days:7,value:r(7)},{label:"30d",days:30,value:r(30)}]);function s(c){return c>.7?"#10b981":c>.4?"#f59e0b":"#ef4444"}var u=Kp(),f=oe(u),m=oe(f),_=fe(m),v=fe(_),p=fe(v),b=fe(p);Fn(),ae(f);var A=fe(f,2);ni(A,21,()=>T(o),Si,(c,l)=>{var O=qp(),M=oe(O),x=oe(M);ae(M);var y=fe(M,2),U=oe(y);ae(y),ae(O),Et((F,V)=>{tt(x,`${T(l).label??""}:`),di(y,`color: ${F??""}`),tt(U,`${V??""}%`)},[()=>s(T(l).value),()=>(T(l).value*100).toFixed(0)]),qe(c,O)}),ae(A),ae(u),Et(c=>{_t(f,"width",n()),_t(f,"height",i()),_t(f,"viewBox",`0 0 ${n()??""} ${i()??""}`),_t(m,"y1",4+(i()-8)*.5),_t(m,"x2",n()-4),_t(m,"y2",4+(i()-8)*.5),_t(_,"y1",4+(i()-8)*.8),_t(_,"x2",n()-4),_t(_,"y2",4+(i()-8)*.8),_t(v,"d",T(a)),_t(p,"d",`${T(a)??""} L${n()-4},${i()-4} L4,${i()-4} Z`),_t(b,"cy",4+(1-t.retention)*(i()-8)),_t(b,"fill",c)},[()=>s(t.retention)]),qe(e,u),Yn()}function Ir(e,t,n){const i=n.getTime(),r=new Set,a=new Map,o=e.filter(u=>{const f=new Date(u.createdAt).getTime();if(f<=i){r.add(u.id);const m=i-f,_=1440*60*1e3,v=m<_?.3+.7*(m/_):1;return a.set(u.id,v),!0}return!1}),s=t.filter(u=>r.has(u.source)&&r.has(u.target));return{visibleNodes:o,visibleEdges:s,nodeOpacities:a}}function jp(e){if(e.length===0){const i=new Date;return{oldest:i,newest:i}}let t=1/0,n=-1/0;for(const i of e){const r=new Date(i.createdAt).getTime();rn&&(n=r)}return{oldest:new Date(t),newest:new Date(n)}}var $p=$e(`
"u")return Mi;const e=localStorage.getItem(po);if(e===null)return Mi;const t=Number(e);return Number.isFinite(t)?Math.min(da,Math.max(ca,t)):Mi}const xn=Wp();function Wp(){let e=He(!1),t=He(qi(new Date)),n=He(!1),i=He(1),r=He(!1),a=He(qi(zp()));return{get temporalEnabled(){return T(e)},set temporalEnabled(o){te(e,o,!0)},get temporalDate(){return T(t)},set temporalDate(o){te(t,o,!0)},get temporalPlaying(){return T(n)},set temporalPlaying(o){te(n,o,!0)},get temporalSpeed(){return T(i)},set temporalSpeed(o){te(i,o,!0)},get dreamMode(){return T(r)},set dreamMode(o){te(r,o,!0)},get brightness(){return T(a)},set brightness(o){const s=Math.min(da,Math.max(ca,o));if(te(a,s,!0),typeof localStorage<"u")try{localStorage.setItem(po,String(s))}catch{}},brightnessMin:ca,brightnessMax:da,brightnessDefault:Mi}}var Xp=$e('
');function Yp(e,t){var Z;Yn(t,!0);let n=ii(t,"events",19,()=>[]),i=ii(t,"isDreaming",3,!1),r=ii(t,"colorMode",3,"type");Fn(()=>{_==null||_.setColorMode(r())});let a,o,s,u=typeof window<"u"&&((Z=window.matchMedia)==null?void 0:Z.call(window,"(prefers-reduced-motion: reduce)").matches),f=null;function m(k){u=k.matches,o!=null&&o.controls&&(o.controls.autoRotate=!u)}let _,v,p,b,A,c,l,O,M=null,x=[];Nr(()=>{var J;o=xp(a),u&&(o.controls.autoRotate=!1),typeof window<"u"&&window.matchMedia&&(f=window.matchMedia("(prefers-reduced-motion: reduce)"),(J=f.addEventListener)==null||J.call(f,"change",m)),l=Op(o.scene).material,O=kp(o.composer),p=new wp(o.scene),_=new js,_.colorMode=r(),v=new Rp,b=new yp(o.scene),c=new Cp;const Y=_.createNodes(t.nodes);v.createEdges(t.edges,Y),A=new bp(Y),x=[...t.nodes],o.scene.add(v.group),o.scene.add(_.group),U(),window.addEventListener("resize",V),a.addEventListener("pointermove",E),a.addEventListener("click",g)}),ua(()=>{var k;cancelAnimationFrame(s),window.removeEventListener("resize",V),(k=f==null?void 0:f.removeEventListener)==null||k.call(f,"change",m),a==null||a.removeEventListener("pointermove",E),a==null||a.removeEventListener("click",g),b==null||b.dispose(),p==null||p.dispose(),_==null||_.dispose(),v==null||v.dispose(),o&&Tp(o)});let y=0;function U(){s=requestAnimationFrame(U);const k=performance.now();y===0&&(y=k);const Y=k-y;if(Y<16)return;y=k-Y%16;const J=k*.001;A.tick(t.edges),_.updatePositions(),v.updatePositions(_.positions),v.animateEdges(_.positions),p.animate(J),_.animate(J,x,o.camera,xn.brightness),c.setActive(i()),c.update(o.scene,o.bloomPass,o.controls,o.lights,J),Fp(l,J,c.current.nebulaIntensity,a.clientWidth,a.clientHeight),Vp(O,J,c.current.nebulaIntensity),F(),b.update(_.meshMap,o.camera,_.positions),o.controls.update(),o.composer.render()}function F(){if(!n()||n().length===0)return;const k=[];for(const J of n()){if(J===M)break;k.push(J)}if(k.length===0)return;if(k.length===n().length&&n().length>=200){console.warn("[vestige] Event horizon overflow: dropping visuals for",k.length,"events"),M=n()[0];return}M=n()[0];const Y={effects:b,nodeManager:_,edgeManager:v,forceSim:A,camera:o.camera,onMutation:J=>{var $;J.type==="nodeAdded"?x=[...x,J.node]:J.type==="nodeRemoved"&&(x=x.filter(ne=>ne.id!==J.nodeId)),($=t.onGraphMutation)==null||$.call(t,J)}};for(let J=k.length-1;J>=0;J--)Up(k[J],Y,x)}function V(){!a||!o||Mp(o,a)}function E(k){const Y=a.getBoundingClientRect();o.mouse.x=(k.clientX-Y.left)/Y.width*2-1,o.mouse.y=-((k.clientY-Y.top)/Y.height)*2+1,o.raycaster.setFromCamera(o.mouse,o.camera);const J=o.raycaster.intersectObjects(_.getMeshes());J.length>0?(_.hoveredNode=J[0].object.userData.nodeId,a.style.cursor="pointer"):(_.hoveredNode=null,a.style.cursor="grab")}function g(){var k;if(_.hoveredNode){_.selectedNode=_.hoveredNode,(k=t.onSelect)==null||k.call(t,_.hoveredNode);const Y=_.positions.get(_.hoveredNode);Y&&o.controls.target.lerp(Y.clone(),.5)}}var D=Xp();Ki(D,k=>a=k,()=>a),qe(e,D),qn()}var qp=$e('
'),Kp=$e('
');function Zp(e,t){Yn(t,!0);let n=ii(t,"width",3,240),i=ii(t,"height",3,80);function r(c){return t.stability<=0?0:Math.exp(-c/t.stability)}let a=en(()=>{const c=[],l=Math.max(t.stability*3,30),O=4,M=n()-O*2,x=i()-O*2;for(let y=0;y<=50;y++){const U=y/50*l,F=r(U),V=O+y/50*M,E=O+(1-F)*x;c.push(`${y===0?"M":"L"}${V.toFixed(1)},${E.toFixed(1)}`)}return c.join(" ")}),o=en(()=>[{label:"Now",days:0,value:t.retention},{label:"1d",days:1,value:r(1)},{label:"7d",days:7,value:r(7)},{label:"30d",days:30,value:r(30)}]);function s(c){return c>.7?"#10b981":c>.4?"#f59e0b":"#ef4444"}var u=Kp(),f=oe(u),m=oe(f),_=fe(m),v=fe(_),p=fe(v),b=fe(p);Bn(),ae(f);var A=fe(f,2);ni(A,21,()=>T(o),Si,(c,l)=>{var O=qp(),M=oe(O),x=oe(M);ae(M);var y=fe(M,2),U=oe(y);ae(y),ae(O),Et((F,V)=>{tt(x,`${T(l).label??""}:`),di(y,`color: ${F??""}`),tt(U,`${V??""}%`)},[()=>s(T(l).value),()=>(T(l).value*100).toFixed(0)]),qe(c,O)}),ae(A),ae(u),Et(c=>{_t(f,"width",n()),_t(f,"height",i()),_t(f,"viewBox",`0 0 ${n()??""} ${i()??""}`),_t(m,"y1",4+(i()-8)*.5),_t(m,"x2",n()-4),_t(m,"y2",4+(i()-8)*.5),_t(_,"y1",4+(i()-8)*.8),_t(_,"x2",n()-4),_t(_,"y2",4+(i()-8)*.8),_t(v,"d",T(a)),_t(p,"d",`${T(a)??""} L${n()-4},${i()-4} L4,${i()-4} Z`),_t(b,"cy",4+(1-t.retention)*(i()-8)),_t(b,"fill",c)},[()=>s(t.retention)]),qe(e,u),qn()}function Ir(e,t,n){const i=n.getTime(),r=new Set,a=new Map,o=e.filter(u=>{const f=new Date(u.createdAt).getTime();if(f<=i){r.add(u.id);const m=i-f,_=1440*60*1e3,v=m<_?.3+.7*(m/_):1;return a.set(u.id,v),!0}return!1}),s=t.filter(u=>r.has(u.source)&&r.has(u.target));return{visibleNodes:o,visibleEdges:s,nodeOpacities:a}}function jp(e){if(e.length===0){const i=new Date;return{oldest:i,newest:i}}let t=1/0,n=-1/0;for(const i of e){const r=new Date(i.createdAt).getTime();rn&&(n=r)}return{oldest:new Date(t),newest:new Date(n)}}var $p=$e(`
`),Qp=$e('');function Jp(e,t){Xn(t,!0);let n=He(!1),i=He(!1),r=He(1),a=He(100),o,s=0,u=en(()=>jp(t.nodes)),f=en(()=>{const M=T(u).oldest.getTime(),y=T(u).newest.getTime()-M||1;return new Date(M+T(a)/100*y)});function m(M){return M.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function _(){te(n,!T(n)),t.onToggle(T(n)),T(n)&&(te(a,100),t.onDateChange(T(f)))}function v(){te(i,!T(i)),T(i)?(te(a,0),s=performance.now(),p()):cancelAnimationFrame(o)}function p(){T(i)&&(o=requestAnimationFrame(M=>{const x=(M-s)/1e3;s=M;const y=T(u).oldest.getTime(),F=(T(u).newest.getTime()-y)/(1440*60*1e3)||1,V=T(r)/F*100;if(te(a,Math.min(100,T(a)+V*x),!0),t.onDateChange(T(f)),T(a)>=100){te(i,!1);return}p()}))}function b(){t.onDateChange(T(f))}ua(()=>{te(i,!1),cancelAnimationFrame(o)});var A=Or(),c=Tn(A);{var l=M=>{var x=$p(),y=oe(x),U=oe(y),F=oe(U),V=oe(F),E=oe(V,!0);ae(V);var g=fe(V,2),D=oe(g);D.value=D.__value=1;var Z=fe(D);Z.value=Z.__value=7;var k=fe(Z);k.value=k.__value=30,ae(g),ae(F);var Y=fe(F,2),J=oe(Y,!0);ae(Y);var $=fe(Y,2);ae(U);var ne=fe(U,2);ci(ne);var X=fe(ne,2),xe=oe(X),Ce=oe(xe,!0);ae(xe);var Ne=fe(xe,2),je=oe(Ne,!0);ae(Ne),ae(X),ae(y),ae(x),Et((Je,Q,de)=>{tt(E,T(i)?"⏸":"▶"),tt(J,Je),tt(Ce,Q),tt(je,de)},[()=>m(T(f)),()=>m(T(u).oldest),()=>m(T(u).newest)]),mt("click",V,v),ll(g,()=>T(r),Je=>te(r,Je)),mt("click",$,_),mt("input",ne,b),sa(ne,()=>T(a),Je=>te(a,Je)),qe(M,x)},O=M=>{var x=Qp();mt("click",x,_),qe(M,x)};pt(c,M=>{T(n)?M(l):M(O,!1)})}qe(e,A),Yn()}pa(["click","input"]);var eh=$e('
'),th=$e('
FSRS accessibility
');function nh(e,t){Xn(t,!1);const n=["active","dormant","silent","unavailable"];cl();var i=th(),r=fe(oe(i),2);ni(r,1,()=>n,a=>a,(a,o)=>{var s=eh(),u=oe(s),f=fe(u,2),m=oe(f,!0);ae(f);var _=fe(f,2),v=oe(_,!0);ae(_),ae(s),Et(p=>{di(u,`background: ${nr[T(o)]??""}; box-shadow: 0 0 6px ${nr[T(o)]??""}55;`),tt(m,T(o)),tt(v,p)},[()=>{var p;return((p=$s[T(o)].match(/\(([^)]+)\)/))==null?void 0:p[1])??""}]),qe(a,s)}),ae(i),qe(e,i),Yn()}const yt=new Te,ih=new Te(0,1,0),ah=new Te(0,0,0);class rh{constructor(t,n,i,r,a={},o={}){Ve(this,"camera");Ve(this,"target");Ve(this,"positions");Ve(this,"path");Ve(this,"cb");Ve(this,"opts");Ve(this,"phase","idle");Ve(this,"beatIndex",0);Ve(this,"phaseElapsed",0);Ve(this,"fromPos",new Te);Ve(this,"toPos",new Te);Ve(this,"fromTarget",new Te);Ve(this,"toTarget",new Te);this.camera=t,this.target=n,this.positions=i,this.path=r,this.cb=a,this.opts={flightSeconds:o.flightSeconds??2.4,dwellSeconds:o.dwellSeconds??3.2,standoff:o.standoff??26,reducedMotion:o.reducedMotion??!1,shots:o.shots??[],centerOnOrigin:o.centerOnOrigin??!1}}shotAt(t){return this.opts.shots[t]??null}flightSecondsAt(t){var n;return((n=this.shotAt(t))==null?void 0:n.flightSeconds)??this.opts.flightSeconds}dwellSecondsAt(t){var n;return((n=this.shotAt(t))==null?void 0:n.dwellSeconds)??this.opts.dwellSeconds}get totalBeats(){return this.path.beats.length}get isRunning(){return this.phase!=="idle"&&this.phase!=="done"}start(){var t,n;if(this.path.beats.length===0){this.phase="done",(n=(t=this.cb).onComplete)==null||n.call(t);return}this.beatIndex=0,this.beginFlightTo(0)}stop(){this.phase="done"}focalPoint(t){return this.opts.centerOnOrigin?ah:this.positions.get(t.nodeId)??null}framePosition(t,n,i){const r=this.focalPoint(t);if(!r)return i.copy(this.camera.position);const a=this.shotAt(n);yt.copy(this.camera.position).sub(r),yt.lengthSq()<1e-4&&yt.set(0,.4,1),yt.normalize();let o=.35;a&&(a.angle==="low"?o=-.45:a.angle==="high"&&(o=.7)),yt.addScaledVector(ih,o).normalize();let s=(a==null?void 0:a.standoff)??this.opts.standoff;return a&&(a.move==="push_in"?s*=.7:a.move==="pull_back"?s*=1.5:a.move==="crane"&&(s*=1.8)),this.opts.centerOnOrigin&&(s=Math.max(31,Math.min(43,s))),i.copy(r).addScaledVector(yt,s)}beginFlightTo(t){var o,s;const n=this.path.beats[t],i=this.focalPoint(n),r=this.shotAt(t);this.fromPos.copy(this.camera.position),this.fromTarget.copy(this.target),this.framePosition(n,t,this.toPos),this.toTarget.copy(i??this.target),this.phaseElapsed=0,this.opts.reducedMotion||(r==null?void 0:r.cut)==="hard_cut"||(r==null?void 0:r.cut)==="match_cut"?(this.camera.position.copy(this.toPos),this.target.copy(this.toTarget),this.phase="dwelling",(s=(o=this.cb).onBeat)==null||s.call(o,n,t,r)):this.phase="flying"}update(t){var s,u,f,m,_,v,p,b,A;if(this.phase==="idle"||this.phase==="done")return;const n=Math.max(0,Math.min(t,.05));this.phaseElapsed+=n;const i=this.flightSecondsAt(this.beatIndex),r=this.dwellSecondsAt(this.beatIndex);if(this.phase==="flying"){const c=Math.min(1,this.phaseElapsed/i),l=oh(c);this.camera.position.lerpVectors(this.fromPos,this.toPos,l),this.target.lerpVectors(this.fromTarget,this.toTarget,l),this.applyDutch(this.beatIndex,l),c>=1&&(this.phase="dwelling",this.phaseElapsed=0,(u=(s=this.cb).onBeat)==null||u.call(s,this.path.beats[this.beatIndex],this.beatIndex,this.shotAt(this.beatIndex)))}else if(this.phase==="dwelling"){if(!this.opts.reducedMotion){const c=this.focalPoint(this.path.beats[this.beatIndex]);c&&(this.target.lerp(c,.02),((f=this.shotAt(this.beatIndex))==null?void 0:f.move)==="orbit"&&this.orbitAround(c,n*.35))}if(this.phaseElapsed>=r){const c=this.beatIndex+1;if(c>=this.path.beats.length){this.phase="done",(_=(m=this.cb).onProgress)==null||_.call(m,1),(p=(v=this.cb).onComplete)==null||p.call(v);return}this.beatIndex=c,this.beginFlightTo(c)}}const a=this.path.beats.length>0?1/this.path.beats.length:0,o=this.phase==="flying"?Math.min(1,this.phaseElapsed/i)*.5:.5+Math.min(1,this.phaseElapsed/r)*.5;(A=(b=this.cb).onProgress)==null||A.call(b,Math.min(1,this.beatIndex*a+o*a))}orbitAround(t,n){yt.copy(this.camera.position).sub(t);const i=Math.cos(n),r=Math.sin(n),a=yt.x*i-yt.z*r,o=yt.x*r+yt.z*i;yt.x=a,yt.z=o,this.camera.position.copy(t).add(yt)}applyDutch(t,n){var a;const r=(((a=this.shotAt(t))==null?void 0:a.dutch)??0)*n;yt.set(0,0,-1).applyQuaternion(this.camera.quaternion),this.camera.up.set(0,1,0).applyAxisAngle(yt,r)}}function oh(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}const fa={origin:"Origin",connection:"Connection",contradiction:"Tension",recent:"Now",bridge:"Jump",surprise:"Surprise"};function sh(e,t=90){const n=(e??"").replace(/\s+/g," ").trim();return n.length<=t?n:n.slice(0,t-1).trimEnd()+"…"}function Yi(e){const t=(e??"memory").toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function ho(e){return{source:"local-captions",beats:e.beats.map((n,i)=>{var s,u;const r=n.node,a=sh(r.label||`(${Yi(r.type)} memory)`);let o;switch(n.kind){case"origin":o=`We begin at a ${Yi(r.type).toLowerCase()} the graph is centered on — "${a}".`;break;case"contradiction":{o=`This is held in tension with the last memory through ${(s=n.viaEdge)!=null&&s.type?n.viaEdge.type.replace(/_/g," "):"a conflict"}: "${a}".`;break}case"recent":o=`And where the mind is now — a recent memory: "${a}".`;break;case"bridge":o=`Crossing to a separate cluster — "${a}".`;break;default:{const f=((u=n.viaEdge)==null?void 0:u.weight)??0;o=`${f>.66?"strongly":f>.33?"closely":"loosely"} connected from there: a ${Yi(r.type).toLowerCase()} — "${a}".`}}return r.tags&&r.tags.length>0&&i>0&&(o+=` [${r.tags.slice(0,3).join(", ")}]`),{nodeId:n.nodeId,text:o,chip:fa[n.kind]}})}}async function lh(e,t){const n=ho(e);if(!t)return n;let i;try{const r=await Promise.race([t(),new Promise(u=>{i=setTimeout(()=>u(null),6e3)})]),a=Array.isArray(r)?r.filter(u=>!!u&&typeof u.nodeId=="string"&&typeof u.text=="string"&&u.text.trim().length>0):[];if(a.length===0)return n;const o=new Map(a.map(u=>[u.nodeId,u]));return{source:"backend-llm",beats:e.beats.map((u,f)=>{const m=o.get(u.nodeId);if(m){const _=typeof m.chip=="string"&&m.chip.trim()?m.chip:fa[u.kind];return{nodeId:u.nodeId,text:m.text,chip:_}}return n.beats[f]??{nodeId:u.nodeId,text:u.node.label||"(unlabeled memory)",chip:fa[u.kind]}})}}catch{return n}finally{i&&clearTimeout(i)}}function ch(e){const t=(e.type??"").toLowerCase();return t.includes("merge")||t.includes("supersede")||t.includes("duplicate")}function dh(e,t){const n=new Map;for(const i of e)n.set(i,0);for(const i of e){const r=[],a=new Map,o=new Map,s=new Map;for(const _ of e)a.set(_,[]),o.set(_,0),s.set(_,-1);o.set(i,1),s.set(i,0);const u=[i];let f=0;for(;f0;){const _=r.pop();for(const v of a.get(_)??[]){const p=(o.get(v)??0)/(o.get(_)||1)*(1+(m.get(_)??0));m.set(v,(m.get(v)??0)+p)}_!==i&&n.set(_,(n.get(_)??0)+(m.get(_)??0))}}return n}function fh(e,t){const n=new Map;for(const u of e)n.set(u,u);const i=u=>{let f=u;for(;n.get(f)!==f;)f=n.get(f);let m=u;for(;n.get(m)!==f;){const _=n.get(m);n.set(m,f),m=_}return f},r=(u,f)=>{const m=i(u),_=i(f);m!==_&&n.set(m,_)};for(const u of t)n.has(u.source)&&n.has(u.target)&&r(u.source,u.target);const a=new Map,o=new Map;let s=0;for(const u of e){const f=i(u);a.has(f)||a.set(f,s++),o.set(u,a.get(f))}return{clusterOf:o,count:s}}function uh(e,t){var O;const n=e.map(M=>M.id),i=Qs(t),r=[...e].sort((M,x)=>ir(M)-ir(x)),a=new Map;r.forEach((M,x)=>a.set(M.id,e.length>1?x/(e.length-1):1));const o=600;let s=n;n.length>o&&(s=[...n].sort((M,x)=>{var y,U;return(((y=i[x])==null?void 0:y.length)??0)-(((U=i[M])==null?void 0:U.length)??0)}).slice(0,o));const u=dh(s,i);let f=0;for(const M of u.values())f=Math.max(f,M);const{clusterOf:m,count:_}=fh(n,t),v=Math.max(1,...e.map(M=>M.suppression_count??0)),p=new Map;let b=n[0]??"",A=-1;for(const M of e){const x=f>0?(u.get(M.id)??0)/f:0;x>A&&(A=x,b=M.id),p.set(M.id,{nodeId:M.id,degree:((O=i[M.id])==null?void 0:O.length)??0,betweenness:x,clusterId:m.get(M.id)??0,recencyRank:a.get(M.id)??0,retention:gi(M.retention??0),suppression:gi((M.suppression_count??0)/v)})}const c=new Map;for(const M of n)c.set(M,new Set((i[M]??[]).map(x=>x.otherId)));const l=t.map(M=>{const x=c.get(M.source),y=c.get(M.target);let U=0;if(x&&y){const[g,D]=x.size{const m=n>1?f/(n-1):0,_=Mh(m),v=t.nodes.get(u.nodeId),p=u.nodeId===t.peakBetweennessId,b=f===n-1,A=f===0;let c={nodeId:u.nodeId,move:"push_in",angle:"eye",cut:"fly",stormMode:"connection",tone:"curious",scoreCue:"motif",act:_,intensity:.6,tension:.3,why:"a connected memory"};return A&&(c={...c,move:"push_in",tone:"curious",tension:.25,stormMode:"anchor",why:"opening on the focal memory"}),(p||v&&v.betweenness>.6)&&(c={...c,move:"orbit",angle:"low",stormMode:"anchor",intensity:.75,tension:.45,tone:"awe",why:"low-angle orbit — the most load-bearing memory in the graph"}),u.kind==="contradiction"&&(c={...c,move:"push_in",angle:"eye",dutch:.28,cut:"hard_cut",stormMode:"contradiction",intensity:1,tension:.95,tone:"tense",scoreCue:"minor_drop",viaEdgeKey:u.viaEdge?`${u.viaEdge.source}->${u.viaEdge.target}`:void 0,why:"two memories in tension — a Dutch two-shot collision"}),u.kind==="surprise"&&(c={...c,move:"orbit",stormMode:"surprise",intensity:.85,tension:.6,tone:"awe",scoreCue:"motif",why:"a surprising, distant-but-plausible connection"}),v&&(v.retention<.35||v.suppression>.5)&&(c={...c,angle:"high",move:"pull_back",tone:"neutral",intensity:.4,why:"a fading memory — high-angle drift"}),u.kind==="recent"&&(c={...c,move:"push_in",tone:"resolved",tension:.4,why:"where the memory is now"}),b&&(c={...c,move:"crane",cut:"fly",stormMode:"anchor",tone:"awe",tension:.5,scoreCue:"major_resolve",why:"crane pull-back over the whole cluster — resolution"}),c}),r=e.beats.some(u=>u.kind==="contradiction")?"man_in_hole":"rags_to_riches";return{source:"deterministic",logline:`A short film about ${((s=e.beats[0])==null?void 0:s.node.label)??"a memory"} — ${n} shots through the graph${r==="man_in_hole"?", through a contradiction and out the other side":""}.`,arc:r,shots:i}}var bh=$e(''),Ah=$e(' '),Rh=$e(' '),wh=$e('WebGPU'),yh=$e(' '),Ch=$e(`
Director's plan

`),Ph=$e('
'),Dh=$e('

'),Lh=$e('∞ dreaming'),Uh=$e(''),Ih=$e('

',1),Nh=$e(''),Oh=$e(' ',1);function Fh(e,t){Xn(t,!0);let n=He(!1),i=He("idle"),r=He(""),a=He(""),o=He(0),s=He(0),u=He(0),f=He(null),m=He(!1),_=He(!1),v=He(!1),p=He(!0),b=He(""),A=He(""),c=He("I"),l=He(0),O=He(""),M=He(null),x=He(void 0),y=null,U=null,F=null,V=null,E=0,g=0,D=null,Z=0,k=He(null);const Y=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,J=(B,W,G,re)=>B+(W-B)*(1-Math.exp(-G*re)),$={x:0,y:0},ne={yaw:0,pitch:0};let X=0,xe=0,Ce=0;const Ne=2500,je=.35,Je=.22,Q=()=>{Ce=performance.now()},de=14;function Me(B){const W=new Map,G=B.beats.length;for(let re=0;re1?re/(G-1):.5)*2,Pe=Math.sqrt(Math.max(0,1-le*le)),q=re*2.399963;W.set(B.beats[re].nodeId,new Te(Math.cos(q)*Pe*de,le*de*.5,Math.sin(q)*Pe*de))}return W}function he(B){if(!(!T(_)||typeof speechSynthesis>"u"))try{speechSynthesis.cancel();const W=new SpeechSynthesisUtterance(B);W.rate=.98,W.pitch=1,speechSynthesis.speak(W)}catch{}}function Le(B){if(D&&clearInterval(D),te(r,""),Y){te(r,B,!0);return}let W=0;D=setInterval(()=>{te(r,B.slice(0,++W),!0),W>=B.length&&D&&(clearInterval(D),D=null)},18)}function Ie(B){return B==="surprise"?"connection":B}function ke(B,W,G){var ie,le;te(s,W+1);const re=((ie=V==null?void 0:V.beats[W])==null?void 0:ie.text)??B.node.label??"";if(te(a,((le=V==null?void 0:V.beats[W])==null?void 0:le.chip)??"",!0),Le(re),he(re),G&&(te(A,G.why,!0),te(c,G.act,!0),te(l,G.tension,!0)),y&&T(m)){const Pe=nt==null?void 0:nt.get(B.nodeId);if(Pe){const ce=(G==null?void 0:G.stormMode)??"connection";y.transitionTo(Ie(ce),Pe,(G==null?void 0:G.act)??"I",W)}const q=(G==null?void 0:G.tension)??0;y.setFlythrough(Y?0:q*.8)}}let nt=null;async function Ke(){var le,Pe;if(cancelAnimationFrame(E),gt(),D&&clearInterval(D),U==null||U.stop(),y==null||y.dispose(),y=null,U=null,V=null,Z=0,te(A,""),te(O,""),te(M,null),te(c,"I"),te(l,0),te(n,!0),te(i,"planning"),te(b,"Planning a path through your memory…"),te(r,""),te(a,""),te(o,0),te(s,0),F=el(t.nodes,t.edges,t.centerId,7),te(u,F.beats.length,!0),T(u)===0){te(b,"Not enough memory to compose a tour yet."),te(i,"done");return}nt=Me(F);const B=uh(t.nodes,t.edges);te(M,Th(F,B),!0),te(O,T(M).logline,!0);const W=xh(T(M),F);if(te(c,((le=W[0])==null?void 0:le.act)??"I",!0),te(l,((Pe=W[0])==null?void 0:Pe.tension)??0,!0),V=await lh(F,T(v)?et():t.fetchBackendNarration),te(f,V.source,!0),te(m,!1),T(x))try{const{CinemaSandbox:q,isWebGPUSupported:ce}=await dl(async()=>{const{CinemaSandbox:_e,isWebGPUSupported:Re}=await import("../chunks/kcrnba3G.js");return{CinemaSandbox:_e,isWebGPUSupported:Re}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]),import.meta.url);ce()&&(y=new q(T(x)),await y.boot(),te(m,!0))}catch(q){console.warn("[cinema] WebGPU sandbox unavailable, camera-only mode:",q),y=null,te(m,!1)}const G=T(x)&&T(x).clientHeight>0?T(x).clientWidth/T(x).clientHeight:16/9,re=(y==null?void 0:y.cameraRef)??new Bn(60,G,.1,2e3),ie=(y==null?void 0:y.target)??new Te;U=new rh(re,ie,nt,F,{onBeat:ke,onProgress:q=>te(o,q,!0),onComplete:()=>{te(i,"done"),te(b,Y||!T(m)?"End of tour.":"∞ Dreaming — endless generative figures",!0),R()}},{reducedMotion:Y,shots:W,centerOnOrigin:T(m)}),te(i,"playing"),te(b,T(m)?"Rendering 150k-particle semantic storm on WebGPU…":"Cinematic flythrough (captions mode).",!0),g=performance.now(),U.start(),dt()}async function dt(){const B=performance.now(),W=Math.max(0,Math.min(.05,(B-g)/1e3));g=B;try{U==null||U.update(W)}catch(re){console.warn("[cinema] director error:",re)}if(!Y&&y&&T(m)){const re=y.cameraRef,ie=performance.now()-Ce>Ne,le=ie?0:$.x*je,Pe=ie?0:$.y*Je,q=ie?1.5:9;ne.yaw=J(ne.yaw,le,q,W),ne.pitch=J(ne.pitch,Pe,q,W),ie&&(X=J(X,0,1.2,W)),xe=J(xe,X,8,W);const ce=re.position.clone(),_e=new aa().setFromVector3(ce);_e.theta+=ne.yaw,_e.phi=no.clamp(_e.phi+ne.pitch,.2,Math.PI-.2),_e.radius*=1-xe*.35,ce.setFromSpherical(_e),re.position.copy(ce)}const G=y;if(G&&T(m))try{await G.render(W),Z=0}catch(re){++Z>=3&&y===G&&(console.warn("[cinema] WebGPU render failing, dropping to camera-only:",re),te(m,!1),G.dispose(),y=null)}E=requestAnimationFrame(dt)}function R(){Y||!y||!T(m)||(gt(),Y||y==null||y.setFlythrough(.6),y==null||y.dreamBeat(),te(r,""),te(a,"Dreaming"),te(k,setInterval(()=>{if(!y||!T(m)){gt();return}y.dreamBeat()},5500),!0))}function gt(){T(k)&&(clearInterval(T(k)),te(k,null))}function ze(){var B;cancelAnimationFrame(E),gt(),D&&clearInterval(D),typeof speechSynthesis<"u"&&speechSynthesis.cancel(),y&&((B=y.setFlythrough)==null||B.call(y,0)),ne.yaw=ne.pitch=0,X=xe=0,U==null||U.stop(),y==null||y.dispose(),y=null,U=null,te(n,!1),te(i,"idle"),te(m,!1)}let We=He(void 0);function we(B){B.key==="Escape"?(B.preventDefault(),ze()):(B.key==="h"||B.key==="H")&&(B.preventDefault(),te(p,!T(p)))}ei(()=>{T(n)&&T(We)&&T(We).focus()}),ei(()=>{if(!(typeof document>"u"))return document.body.classList.toggle("cinema-open",T(n)),()=>document.body.classList.remove("cinema-open")}),ei(()=>{if(!T(n)||Y||!T(x))return;const B=T(x),W=(q,ce,_e)=>Math.min(_e,Math.max(ce,q));B.style.touchAction="none";const G=q=>{$.x=q.clientX/window.innerWidth*2-1,$.y=-(q.clientY/window.innerHeight)*2+1,Q()},re=q=>{q.preventDefault(),X=W(X+q.deltaY*8e-4,-1,1),Q()};let ie=null;const le=q=>{if(q.touches.length===2){const ce=q.touches[0].clientX-q.touches[1].clientX,_e=q.touches[0].clientY-q.touches[1].clientY,Re=Math.hypot(ce,_e);ie!==null&&(X=W(X+(Re-ie)*.002,-1,1)),ie=Re,Q()}},Pe=()=>{ie=null};return B.addEventListener("pointermove",G,{passive:!0}),B.addEventListener("wheel",re,{passive:!1}),B.addEventListener("touchmove",le,{passive:!0}),B.addEventListener("touchend",Pe),()=>{B.removeEventListener("pointermove",G),B.removeEventListener("wheel",re),B.removeEventListener("touchmove",le),B.removeEventListener("touchend",Pe)}});function et(){return async()=>{var B,W;if(!F)return null;try{te(b,"Loading on-device model (first run downloads weights)…");const re=await import("@huggingface/transformers").catch(()=>null);if(!(re!=null&&re.pipeline))return null;const ie=await re.pipeline("text-generation","onnx-community/Qwen2.5-0.5B-Instruct",{device:"webgpu",dtype:"q4"}),le=ho(F);te(b,"Narrating with the on-device model…");const Pe=[];for(const q of le.beats){const ce=`You are narrating a cinematic tour of an AI's memory graph. In one vivid sentence, narrate this beat: "${q.text}"`,_e=await ie(ce,{max_new_tokens:48,temperature:.7,do_sample:!0}),Re=(W=(B=_e==null?void 0:_e[0])==null?void 0:B.generated_text)==null?void 0:W.replace(ce,"").trim();Pe.push({nodeId:q.nodeId,chip:q.chip,text:Re&&Re.length>4?Re:q.text})}return Pe}catch(G){return console.warn("[cinema] on-device narration failed, using local captions:",G),null}}}ua(ze);var be=Oh(),S=Tn(be),d=fe(S,2);{var H=B=>{var W=Nh(),G=oe(W);Ki(G,q=>te(x,q),()=>T(x));var re=fe(G,2);{var ie=q=>{var ce=bh();mt("click",ce,()=>te(p,!0)),qe(q,ce)};pt(re,q=>{T(p)||q(ie)})}var le=fe(re,2);{var Pe=q=>{var ce=Ih(),_e=Tn(ce),Re=oe(_e),ge=oe(Re);let Xe;var Ge=fe(ge,2),rt=oe(Ge,!0);ae(Ge);var I=fe(Ge,2);{var ue=w=>{var L=Ah(),P=oe(L,!0);ae(L),Et(()=>tt(P,T(M).source==="deterministic"?"Auteur (local)":"Auteur (AI)")),qe(w,L)};pt(I,w=>{T(M)&&w(ue)})}var K=fe(I,2);{var C=w=>{var L=Rh(),P=oe(L,!0);ae(L),Et(()=>tt(P,T(f)==="backend-llm"?"AI narration":"Live captions")),qe(w,L)};pt(K,w=>{T(f)&&w(C)})}var z=fe(K,2);{var j=w=>{var L=wh();qe(w,L)};pt(z,w=>{T(m)&&w(j)})}var se=fe(z,2);{var ve=w=>{var L=yh(),P=oe(L);ae(L),Et(()=>tt(P,`Act ${T(c)??""}`)),qe(w,L)};pt(se,w=>{T(i)==="playing"&&w(ve)})}ae(Re);var Oe=fe(Re,2),ye=oe(Oe),ot=oe(ye);ci(ot),Fn(),ae(ye);var ft=fe(ye,2),Pt=oe(ft);ci(Pt),Fn(),ae(ft);var Ht=fe(ft,2);Ki(Ht,w=>te(We,w),()=>T(We)),ae(Oe),ae(_e);var vt=fe(_e,2);{var Wt=w=>{var L=Ch(),P=fe(oe(L),2),ee=oe(P,!0);ae(P),ae(L),Et(()=>tt(ee,T(O))),qe(w,L)};pt(vt,w=>{T(i)==="planning"&&T(O)&&w(Wt)})}var dn=fe(vt,2),$t=oe(dn);{var Yt=w=>{var L=Ph(),P=oe(L,!0);ae(L),Et(()=>tt(P,T(a))),qe(w,L)};pt($t,w=>{T(a)&&w(Yt)})}var nn=fe($t,2),qt=oe(nn,!0);ae(nn);var fn=fe(nn,2);{var un=w=>{var L=Dh(),P=oe(L);ae(L),Et(()=>tt(P,`▸ ${T(A)??""}`)),qe(w,L)};pt(fn,w=>{T(A)&&T(i)==="playing"&&w(un)})}var pn=fe(fn,2),Rn=oe(pn);ae(pn);var wn=fe(pn,2),an=oe(wn);{var yn=w=>{var L=Lh();qe(w,L)},Kn=w=>{var L=go();Et(()=>tt(L,`Beat ${T(s)??""} / ${T(u)??""}`)),qe(w,L)};pt(an,w=>{T(i)==="done"&&T(k)?w(yn):T(u)>0&&w(Kn,1)})}var h=fe(an,2);{var N=w=>{var L=Uh();mt("click",L,Ke),qe(w,L)};pt(h,w=>{T(i)==="done"&&w(N)})}ae(wn),ae(dn),Et(()=>{Xe=on(ge,1,"cinema-dot svelte-1uwqs3k",null,Xe,{active:T(i)==="playing"}),tt(rt,T(b)),tt(qt,T(r)),di(Rn,`width:${T(o)*100}%; --tension:${T(l)??""}`)}),rr(ot,()=>T(_),w=>te(_,w)),rr(Pt,()=>T(v),w=>te(v,w)),mt("click",Ht,ze),qe(q,ce)};pt(le,q=>{T(p)&&q(Pe)})}ae(W),mt("keydown",W,we),qe(B,W)};pt(d,B=>{T(n)&&B(H)})}mt("click",S,Ke),qe(e,be),Yn()}pa(["click","keydown"]);var Bh=$e('

Weaving your memory graph…

'),Hh=$e(`

MCP Backend Offline

The Vestige MCP server isn't reachable on :3927. + [&::-webkit-slider-thumb]:shadow-[0_0_8px_rgba(129,140,248,0.4)]"/>

`),Qp=$e('');function Jp(e,t){Yn(t,!0);let n=He(!1),i=He(!1),r=He(1),a=He(100),o,s=0,u=en(()=>jp(t.nodes)),f=en(()=>{const M=T(u).oldest.getTime(),y=T(u).newest.getTime()-M||1;return new Date(M+T(a)/100*y)});function m(M){return M.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function _(){te(n,!T(n)),t.onToggle(T(n)),T(n)&&(te(a,100),t.onDateChange(T(f)))}function v(){te(i,!T(i)),T(i)?(te(a,0),s=performance.now(),p()):cancelAnimationFrame(o)}function p(){T(i)&&(o=requestAnimationFrame(M=>{const x=(M-s)/1e3;s=M;const y=T(u).oldest.getTime(),F=(T(u).newest.getTime()-y)/(1440*60*1e3)||1,V=T(r)/F*100;if(te(a,Math.min(100,T(a)+V*x),!0),t.onDateChange(T(f)),T(a)>=100){te(i,!1);return}p()}))}function b(){t.onDateChange(T(f))}ua(()=>{te(i,!1),cancelAnimationFrame(o)});var A=Or(),c=Tn(A);{var l=M=>{var x=$p(),y=oe(x),U=oe(y),F=oe(U),V=oe(F),E=oe(V,!0);ae(V);var g=fe(V,2),D=oe(g);D.value=D.__value=1;var Z=fe(D);Z.value=Z.__value=7;var k=fe(Z);k.value=k.__value=30,ae(g),ae(F);var Y=fe(F,2),J=oe(Y,!0);ae(Y);var $=fe(Y,2);ae(U);var ne=fe(U,2);ci(ne);var X=fe(ne,2),xe=oe(X),Ce=oe(xe,!0);ae(xe);var Ne=fe(xe,2),je=oe(Ne,!0);ae(Ne),ae(X),ae(y),ae(x),Et((Je,Q,de)=>{tt(E,T(i)?"⏸":"▶"),tt(J,Je),tt(Ce,Q),tt(je,de)},[()=>m(T(f)),()=>m(T(u).oldest),()=>m(T(u).newest)]),mt("click",V,v),ll(g,()=>T(r),Je=>te(r,Je)),mt("click",$,_),mt("input",ne,b),sa(ne,()=>T(a),Je=>te(a,Je)),qe(M,x)},O=M=>{var x=Qp();mt("click",x,_),qe(M,x)};pt(c,M=>{T(n)?M(l):M(O,!1)})}qe(e,A),qn()}pa(["click","input"]);var eh=$e('
'),th=$e('
FSRS accessibility
');function nh(e,t){Yn(t,!1);const n=["active","dormant","silent","unavailable"];cl();var i=th(),r=fe(oe(i),2);ni(r,1,()=>n,a=>a,(a,o)=>{var s=eh(),u=oe(s),f=fe(u,2),m=oe(f,!0);ae(f);var _=fe(f,2),v=oe(_,!0);ae(_),ae(s),Et(p=>{di(u,`background: ${nr[T(o)]??""}; box-shadow: 0 0 6px ${nr[T(o)]??""}55;`),tt(m,T(o)),tt(v,p)},[()=>{var p;return((p=$s[T(o)].match(/\(([^)]+)\)/))==null?void 0:p[1])??""}]),qe(a,s)}),ae(i),qe(e,i),qn()}const yt=new Te,ih=new Te(0,1,0),ah=new Te(0,0,0);class rh{constructor(t,n,i,r,a={},o={}){Ve(this,"camera");Ve(this,"target");Ve(this,"positions");Ve(this,"path");Ve(this,"cb");Ve(this,"opts");Ve(this,"phase","idle");Ve(this,"beatIndex",0);Ve(this,"phaseElapsed",0);Ve(this,"fromPos",new Te);Ve(this,"toPos",new Te);Ve(this,"fromTarget",new Te);Ve(this,"toTarget",new Te);this.camera=t,this.target=n,this.positions=i,this.path=r,this.cb=a,this.opts={flightSeconds:o.flightSeconds??2.4,dwellSeconds:o.dwellSeconds??3.2,standoff:o.standoff??26,reducedMotion:o.reducedMotion??!1,shots:o.shots??[],centerOnOrigin:o.centerOnOrigin??!1}}shotAt(t){return this.opts.shots[t]??null}flightSecondsAt(t){var n;return((n=this.shotAt(t))==null?void 0:n.flightSeconds)??this.opts.flightSeconds}dwellSecondsAt(t){var n;return((n=this.shotAt(t))==null?void 0:n.dwellSeconds)??this.opts.dwellSeconds}get totalBeats(){return this.path.beats.length}get isRunning(){return this.phase!=="idle"&&this.phase!=="done"}start(){var t,n;if(this.path.beats.length===0){this.phase="done",(n=(t=this.cb).onComplete)==null||n.call(t);return}this.beatIndex=0,this.beginFlightTo(0)}stop(){this.phase="done"}focalPoint(t){return this.opts.centerOnOrigin?ah:this.positions.get(t.nodeId)??null}framePosition(t,n,i){const r=this.focalPoint(t);if(!r)return i.copy(this.camera.position);const a=this.shotAt(n);yt.copy(this.camera.position).sub(r),yt.lengthSq()<1e-4&&yt.set(0,.4,1),yt.normalize();let o=.35;a&&(a.angle==="low"?o=-.45:a.angle==="high"&&(o=.7)),yt.addScaledVector(ih,o).normalize();let s=(a==null?void 0:a.standoff)??this.opts.standoff;return a&&(a.move==="push_in"?s*=.7:a.move==="pull_back"?s*=1.5:a.move==="crane"&&(s*=1.8)),this.opts.centerOnOrigin&&(s=Math.max(31,Math.min(43,s))),i.copy(r).addScaledVector(yt,s)}beginFlightTo(t){var o,s;const n=this.path.beats[t],i=this.focalPoint(n),r=this.shotAt(t);this.fromPos.copy(this.camera.position),this.fromTarget.copy(this.target),this.framePosition(n,t,this.toPos),this.toTarget.copy(i??this.target),this.phaseElapsed=0,this.opts.reducedMotion||(r==null?void 0:r.cut)==="hard_cut"||(r==null?void 0:r.cut)==="match_cut"?(this.camera.position.copy(this.toPos),this.target.copy(this.toTarget),this.phase="dwelling",(s=(o=this.cb).onBeat)==null||s.call(o,n,t,r)):this.phase="flying"}update(t){var s,u,f,m,_,v,p,b,A;if(this.phase==="idle"||this.phase==="done")return;const n=Math.max(0,Math.min(t,.05));this.phaseElapsed+=n;const i=this.flightSecondsAt(this.beatIndex),r=this.dwellSecondsAt(this.beatIndex);if(this.phase==="flying"){const c=Math.min(1,this.phaseElapsed/i),l=oh(c);this.camera.position.lerpVectors(this.fromPos,this.toPos,l),this.target.lerpVectors(this.fromTarget,this.toTarget,l),this.applyDutch(this.beatIndex,l),c>=1&&(this.phase="dwelling",this.phaseElapsed=0,(u=(s=this.cb).onBeat)==null||u.call(s,this.path.beats[this.beatIndex],this.beatIndex,this.shotAt(this.beatIndex)))}else if(this.phase==="dwelling"){if(!this.opts.reducedMotion){const c=this.focalPoint(this.path.beats[this.beatIndex]);c&&(this.target.lerp(c,.02),((f=this.shotAt(this.beatIndex))==null?void 0:f.move)==="orbit"&&this.orbitAround(c,n*.35))}if(this.phaseElapsed>=r){const c=this.beatIndex+1;if(c>=this.path.beats.length){this.phase="done",(_=(m=this.cb).onProgress)==null||_.call(m,1),(p=(v=this.cb).onComplete)==null||p.call(v);return}this.beatIndex=c,this.beginFlightTo(c)}}const a=this.path.beats.length>0?1/this.path.beats.length:0,o=this.phase==="flying"?Math.min(1,this.phaseElapsed/i)*.5:.5+Math.min(1,this.phaseElapsed/r)*.5;(A=(b=this.cb).onProgress)==null||A.call(b,Math.min(1,this.beatIndex*a+o*a))}orbitAround(t,n){yt.copy(this.camera.position).sub(t);const i=Math.cos(n),r=Math.sin(n),a=yt.x*i-yt.z*r,o=yt.x*r+yt.z*i;yt.x=a,yt.z=o,this.camera.position.copy(t).add(yt)}applyDutch(t,n){var a;const r=(((a=this.shotAt(t))==null?void 0:a.dutch)??0)*n;yt.set(0,0,-1).applyQuaternion(this.camera.quaternion),this.camera.up.set(0,1,0).applyAxisAngle(yt,r)}}function oh(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}const fa={origin:"Origin",connection:"Connection",contradiction:"Tension",recent:"Now",bridge:"Jump",surprise:"Surprise"};function sh(e,t=90){const n=(e??"").replace(/\s+/g," ").trim();return n.length<=t?n:n.slice(0,t-1).trimEnd()+"…"}function Yi(e){const t=(e??"memory").toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function ho(e){return{source:"local-captions",beats:e.beats.map((n,i)=>{var s,u;const r=n.node,a=sh(r.label||`(${Yi(r.type)} memory)`);let o;switch(n.kind){case"origin":o=`We begin at a ${Yi(r.type).toLowerCase()} the graph is centered on — "${a}".`;break;case"contradiction":{o=`This is held in tension with the last memory through ${(s=n.viaEdge)!=null&&s.type?n.viaEdge.type.replace(/_/g," "):"a conflict"}: "${a}".`;break}case"recent":o=`And where the mind is now — a recent memory: "${a}".`;break;case"bridge":o=`Crossing to a separate cluster — "${a}".`;break;default:{const f=((u=n.viaEdge)==null?void 0:u.weight)??0;o=`${f>.66?"strongly":f>.33?"closely":"loosely"} connected from there: a ${Yi(r.type).toLowerCase()} — "${a}".`}}return r.tags&&r.tags.length>0&&i>0&&(o+=` [${r.tags.slice(0,3).join(", ")}]`),{nodeId:n.nodeId,text:o,chip:fa[n.kind]}})}}async function lh(e,t){const n=ho(e);if(!t)return n;let i;try{const r=await Promise.race([t(),new Promise(u=>{i=setTimeout(()=>u(null),6e3)})]),a=Array.isArray(r)?r.filter(u=>!!u&&typeof u.nodeId=="string"&&typeof u.text=="string"&&u.text.trim().length>0):[];if(a.length===0)return n;const o=new Map(a.map(u=>[u.nodeId,u]));return{source:"backend-llm",beats:e.beats.map((u,f)=>{const m=o.get(u.nodeId);if(m){const _=typeof m.chip=="string"&&m.chip.trim()?m.chip:fa[u.kind];return{nodeId:u.nodeId,text:m.text,chip:_}}return n.beats[f]??{nodeId:u.nodeId,text:u.node.label||"(unlabeled memory)",chip:fa[u.kind]}})}}catch{return n}finally{i&&clearTimeout(i)}}function ch(e){const t=(e.type??"").toLowerCase();return t.includes("merge")||t.includes("supersede")||t.includes("duplicate")}function dh(e,t){const n=new Map;for(const i of e)n.set(i,0);for(const i of e){const r=[],a=new Map,o=new Map,s=new Map;for(const _ of e)a.set(_,[]),o.set(_,0),s.set(_,-1);o.set(i,1),s.set(i,0);const u=[i];let f=0;for(;f0;){const _=r.pop();for(const v of a.get(_)??[]){const p=(o.get(v)??0)/(o.get(_)||1)*(1+(m.get(_)??0));m.set(v,(m.get(v)??0)+p)}_!==i&&n.set(_,(n.get(_)??0)+(m.get(_)??0))}}return n}function fh(e,t){const n=new Map;for(const u of e)n.set(u,u);const i=u=>{let f=u;for(;n.get(f)!==f;)f=n.get(f);let m=u;for(;n.get(m)!==f;){const _=n.get(m);n.set(m,f),m=_}return f},r=(u,f)=>{const m=i(u),_=i(f);m!==_&&n.set(m,_)};for(const u of t)n.has(u.source)&&n.has(u.target)&&r(u.source,u.target);const a=new Map,o=new Map;let s=0;for(const u of e){const f=i(u);a.has(f)||a.set(f,s++),o.set(u,a.get(f))}return{clusterOf:o,count:s}}function uh(e,t){var O;const n=e.map(M=>M.id),i=Qs(t),r=[...e].sort((M,x)=>ir(M)-ir(x)),a=new Map;r.forEach((M,x)=>a.set(M.id,e.length>1?x/(e.length-1):1));const o=600;let s=n;n.length>o&&(s=[...n].sort((M,x)=>{var y,U;return(((y=i[x])==null?void 0:y.length)??0)-(((U=i[M])==null?void 0:U.length)??0)}).slice(0,o));const u=dh(s,i);let f=0;for(const M of u.values())f=Math.max(f,M);const{clusterOf:m,count:_}=fh(n,t),v=Math.max(1,...e.map(M=>M.suppression_count??0)),p=new Map;let b=n[0]??"",A=-1;for(const M of e){const x=f>0?(u.get(M.id)??0)/f:0;x>A&&(A=x,b=M.id),p.set(M.id,{nodeId:M.id,degree:((O=i[M.id])==null?void 0:O.length)??0,betweenness:x,clusterId:m.get(M.id)??0,recencyRank:a.get(M.id)??0,retention:gi(M.retention??0),suppression:gi((M.suppression_count??0)/v)})}const c=new Map;for(const M of n)c.set(M,new Set((i[M]??[]).map(x=>x.otherId)));const l=t.map(M=>{const x=c.get(M.source),y=c.get(M.target);let U=0;if(x&&y){const[g,D]=x.size{const m=n>1?f/(n-1):0,_=Mh(m),v=t.nodes.get(u.nodeId),p=u.nodeId===t.peakBetweennessId,b=f===n-1,A=f===0;let c={nodeId:u.nodeId,move:"push_in",angle:"eye",cut:"fly",stormMode:"connection",tone:"curious",scoreCue:"motif",act:_,intensity:.6,tension:.3,why:"a connected memory"};return A&&(c={...c,move:"push_in",tone:"curious",tension:.25,stormMode:"anchor",why:"opening on the focal memory"}),(p||v&&v.betweenness>.6)&&(c={...c,move:"orbit",angle:"low",stormMode:"anchor",intensity:.75,tension:.45,tone:"awe",why:"low-angle orbit — the most load-bearing memory in the graph"}),u.kind==="contradiction"&&(c={...c,move:"push_in",angle:"eye",dutch:.28,cut:"hard_cut",stormMode:"contradiction",intensity:1,tension:.95,tone:"tense",scoreCue:"minor_drop",viaEdgeKey:u.viaEdge?`${u.viaEdge.source}->${u.viaEdge.target}`:void 0,why:"two memories in tension — a Dutch two-shot collision"}),u.kind==="surprise"&&(c={...c,move:"orbit",stormMode:"surprise",intensity:.85,tension:.6,tone:"awe",scoreCue:"motif",why:"a surprising, distant-but-plausible connection"}),v&&(v.retention<.35||v.suppression>.5)&&(c={...c,angle:"high",move:"pull_back",tone:"neutral",intensity:.4,why:"a fading memory — high-angle drift"}),u.kind==="recent"&&(c={...c,move:"push_in",tone:"resolved",tension:.4,why:"where the memory is now"}),b&&(c={...c,move:"crane",cut:"fly",stormMode:"anchor",tone:"awe",tension:.5,scoreCue:"major_resolve",why:"crane pull-back over the whole cluster — resolution"}),c}),r=e.beats.some(u=>u.kind==="contradiction")?"man_in_hole":"rags_to_riches";return{source:"deterministic",logline:`A short film about ${((s=e.beats[0])==null?void 0:s.node.label)??"a memory"} — ${n} shots through the graph${r==="man_in_hole"?", through a contradiction and out the other side":""}.`,arc:r,shots:i}}var bh=$e(''),Ah=$e(' '),Rh=$e(' '),wh=$e('WebGPU'),yh=$e(' '),Ch=$e(`
Director's plan

`),Ph=$e('
'),Dh=$e('

'),Lh=$e('∞ dreaming'),Uh=$e(''),Ih=$e('

',1),Nh=$e(''),Oh=$e(' ',1);function Fh(e,t){Yn(t,!0);let n=He(!1),i=He("idle"),r=He(""),a=He(""),o=He(0),s=He(0),u=He(0),f=He(null),m=He(!1),_=He(!1),v=He(!1),p=He(!0),b=He(""),A=He(""),c=He("I"),l=He(0),O=He(""),M=He(null),x=He(void 0),y=null,U=null,F=null,V=null,E=0,g=0,D=null,Z=0,k=He(null);const Y=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,J=(B,W,G,re)=>B+(W-B)*(1-Math.exp(-G*re)),$={x:0,y:0},ne={yaw:0,pitch:0};let X=0,xe=0,Ce=0;const Ne=2500,je=.35,Je=.22,Q=()=>{Ce=performance.now()},de=14;function Me(B){const W=new Map,G=B.beats.length;for(let re=0;re1?re/(G-1):.5)*2,Pe=Math.sqrt(Math.max(0,1-le*le)),q=re*2.399963;W.set(B.beats[re].nodeId,new Te(Math.cos(q)*Pe*de,le*de*.5,Math.sin(q)*Pe*de))}return W}function he(B){if(!(!T(_)||typeof speechSynthesis>"u"))try{speechSynthesis.cancel();const W=new SpeechSynthesisUtterance(B);W.rate=.98,W.pitch=1,speechSynthesis.speak(W)}catch{}}function Le(B){if(D&&clearInterval(D),te(r,""),Y){te(r,B,!0);return}let W=0;D=setInterval(()=>{te(r,B.slice(0,++W),!0),W>=B.length&&D&&(clearInterval(D),D=null)},18)}function Ie(B){return B==="surprise"?"connection":B}function ke(B,W,G){var ie,le;te(s,W+1);const re=((ie=V==null?void 0:V.beats[W])==null?void 0:ie.text)??B.node.label??"";if(te(a,((le=V==null?void 0:V.beats[W])==null?void 0:le.chip)??"",!0),Le(re),he(re),G&&(te(A,G.why,!0),te(c,G.act,!0),te(l,G.tension,!0)),y&&T(m)){const Pe=nt==null?void 0:nt.get(B.nodeId);if(Pe){const ce=(G==null?void 0:G.stormMode)??"connection";y.transitionTo(Ie(ce),Pe,(G==null?void 0:G.act)??"I",W)}const q=(G==null?void 0:G.tension)??0;y.setFlythrough(Y?0:q*.8)}}let nt=null;async function Ke(){var le,Pe;if(cancelAnimationFrame(E),gt(),D&&clearInterval(D),U==null||U.stop(),y==null||y.dispose(),y=null,U=null,V=null,Z=0,te(A,""),te(O,""),te(M,null),te(c,"I"),te(l,0),te(n,!0),te(i,"planning"),te(b,"Planning a path through your memory…"),te(r,""),te(a,""),te(o,0),te(s,0),F=el(t.nodes,t.edges,t.centerId,7),te(u,F.beats.length,!0),T(u)===0){te(b,"Not enough memory to compose a tour yet."),te(i,"done");return}nt=Me(F);const B=uh(t.nodes,t.edges);te(M,Th(F,B),!0),te(O,T(M).logline,!0);const W=xh(T(M),F);if(te(c,((le=W[0])==null?void 0:le.act)??"I",!0),te(l,((Pe=W[0])==null?void 0:Pe.tension)??0,!0),V=await lh(F,T(v)?et():t.fetchBackendNarration),te(f,V.source,!0),te(m,!1),T(x))try{const{CinemaSandbox:q,isWebGPUSupported:ce}=await dl(async()=>{const{CinemaSandbox:_e,isWebGPUSupported:Re}=await import("../chunks/kcrnba3G.js");return{CinemaSandbox:_e,isWebGPUSupported:Re}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]),import.meta.url);ce()&&(y=new q(T(x)),await y.boot(),te(m,!0))}catch(q){console.warn("[cinema] WebGPU sandbox unavailable, camera-only mode:",q),y=null,te(m,!1)}const G=T(x)&&T(x).clientHeight>0?T(x).clientWidth/T(x).clientHeight:16/9,re=(y==null?void 0:y.cameraRef)??new Hn(60,G,.1,2e3),ie=(y==null?void 0:y.target)??new Te;U=new rh(re,ie,nt,F,{onBeat:ke,onProgress:q=>te(o,q,!0),onComplete:()=>{te(i,"done"),te(b,Y||!T(m)?"End of tour.":"∞ Dreaming — endless generative figures",!0),R()}},{reducedMotion:Y,shots:W,centerOnOrigin:T(m)}),te(i,"playing"),te(b,T(m)?"Rendering 150k-particle semantic storm on WebGPU…":"Cinematic flythrough (captions mode).",!0),g=performance.now(),U.start(),dt()}async function dt(){const B=performance.now(),W=Math.max(0,Math.min(.05,(B-g)/1e3));g=B;try{U==null||U.update(W)}catch(re){console.warn("[cinema] director error:",re)}if(!Y&&y&&T(m)){const re=y.cameraRef,ie=performance.now()-Ce>Ne,le=ie?0:$.x*je,Pe=ie?0:$.y*Je,q=ie?1.5:9;ne.yaw=J(ne.yaw,le,q,W),ne.pitch=J(ne.pitch,Pe,q,W),ie&&(X=J(X,0,1.2,W)),xe=J(xe,X,8,W);const ce=re.position.clone(),_e=new aa().setFromVector3(ce);_e.theta+=ne.yaw,_e.phi=no.clamp(_e.phi+ne.pitch,.2,Math.PI-.2),_e.radius*=1-xe*.35,ce.setFromSpherical(_e),re.position.copy(ce)}const G=y;if(G&&T(m))try{await G.render(W),Z=0}catch(re){++Z>=3&&y===G&&(console.warn("[cinema] WebGPU render failing, dropping to camera-only:",re),te(m,!1),G.dispose(),y=null)}E=requestAnimationFrame(dt)}function R(){Y||!y||!T(m)||(gt(),Y||y==null||y.setFlythrough(.6),y==null||y.dreamBeat(),te(r,""),te(a,"Dreaming"),te(k,setInterval(()=>{if(!y||!T(m)){gt();return}y.dreamBeat()},5500),!0))}function gt(){T(k)&&(clearInterval(T(k)),te(k,null))}function ze(){var B;cancelAnimationFrame(E),gt(),D&&clearInterval(D),typeof speechSynthesis<"u"&&speechSynthesis.cancel(),y&&((B=y.setFlythrough)==null||B.call(y,0)),ne.yaw=ne.pitch=0,X=xe=0,U==null||U.stop(),y==null||y.dispose(),y=null,U=null,te(n,!1),te(i,"idle"),te(m,!1)}let We=He(void 0);function we(B){B.key==="Escape"?(B.preventDefault(),ze()):(B.key==="h"||B.key==="H")&&(B.preventDefault(),te(p,!T(p)))}Fn(()=>{T(n)&&T(We)&&T(We).focus()}),Fn(()=>{if(!(typeof document>"u"))return document.body.classList.toggle("cinema-open",T(n)),()=>document.body.classList.remove("cinema-open")}),Fn(()=>{if(!T(n)||Y||!T(x))return;const B=T(x),W=(q,ce,_e)=>Math.min(_e,Math.max(ce,q));B.style.touchAction="none";const G=q=>{$.x=q.clientX/window.innerWidth*2-1,$.y=-(q.clientY/window.innerHeight)*2+1,Q()},re=q=>{q.preventDefault(),X=W(X+q.deltaY*8e-4,-1,1),Q()};let ie=null;const le=q=>{if(q.touches.length===2){const ce=q.touches[0].clientX-q.touches[1].clientX,_e=q.touches[0].clientY-q.touches[1].clientY,Re=Math.hypot(ce,_e);ie!==null&&(X=W(X+(Re-ie)*.002,-1,1)),ie=Re,Q()}},Pe=()=>{ie=null};return B.addEventListener("pointermove",G,{passive:!0}),B.addEventListener("wheel",re,{passive:!1}),B.addEventListener("touchmove",le,{passive:!0}),B.addEventListener("touchend",Pe),()=>{B.removeEventListener("pointermove",G),B.removeEventListener("wheel",re),B.removeEventListener("touchmove",le),B.removeEventListener("touchend",Pe)}});function et(){return async()=>{var B,W;if(!F)return null;try{te(b,"Loading on-device model (first run downloads weights)…");const re=await import("@huggingface/transformers").catch(()=>null);if(!(re!=null&&re.pipeline))return null;const ie=await re.pipeline("text-generation","onnx-community/Qwen2.5-0.5B-Instruct",{device:"webgpu",dtype:"q4"}),le=ho(F);te(b,"Narrating with the on-device model…");const Pe=[];for(const q of le.beats){const ce=`You are narrating a cinematic tour of an AI's memory graph. In one vivid sentence, narrate this beat: "${q.text}"`,_e=await ie(ce,{max_new_tokens:48,temperature:.7,do_sample:!0}),Re=(W=(B=_e==null?void 0:_e[0])==null?void 0:B.generated_text)==null?void 0:W.replace(ce,"").trim();Pe.push({nodeId:q.nodeId,chip:q.chip,text:Re&&Re.length>4?Re:q.text})}return Pe}catch(G){return console.warn("[cinema] on-device narration failed, using local captions:",G),null}}}ua(ze);var be=Oh(),S=Tn(be),d=fe(S,2);{var H=B=>{var W=Nh(),G=oe(W);Ki(G,q=>te(x,q),()=>T(x));var re=fe(G,2);{var ie=q=>{var ce=bh();mt("click",ce,()=>te(p,!0)),qe(q,ce)};pt(re,q=>{T(p)||q(ie)})}var le=fe(re,2);{var Pe=q=>{var ce=Ih(),_e=Tn(ce),Re=oe(_e),ge=oe(Re);let Xe;var Ge=fe(ge,2),rt=oe(Ge,!0);ae(Ge);var I=fe(Ge,2);{var ue=w=>{var L=Ah(),P=oe(L,!0);ae(L),Et(()=>tt(P,T(M).source==="deterministic"?"Auteur (local)":"Auteur (AI)")),qe(w,L)};pt(I,w=>{T(M)&&w(ue)})}var K=fe(I,2);{var C=w=>{var L=Rh(),P=oe(L,!0);ae(L),Et(()=>tt(P,T(f)==="backend-llm"?"AI narration":"Live captions")),qe(w,L)};pt(K,w=>{T(f)&&w(C)})}var z=fe(K,2);{var j=w=>{var L=wh();qe(w,L)};pt(z,w=>{T(m)&&w(j)})}var se=fe(z,2);{var ve=w=>{var L=yh(),P=oe(L);ae(L),Et(()=>tt(P,`Act ${T(c)??""}`)),qe(w,L)};pt(se,w=>{T(i)==="playing"&&w(ve)})}ae(Re);var Oe=fe(Re,2),ye=oe(Oe),ot=oe(ye);ci(ot),Bn(),ae(ye);var ft=fe(ye,2),Pt=oe(ft);ci(Pt),Bn(),ae(ft);var Ht=fe(ft,2);Ki(Ht,w=>te(We,w),()=>T(We)),ae(Oe),ae(_e);var vt=fe(_e,2);{var Wt=w=>{var L=Ch(),P=fe(oe(L),2),ee=oe(P,!0);ae(P),ae(L),Et(()=>tt(ee,T(O))),qe(w,L)};pt(vt,w=>{T(i)==="planning"&&T(O)&&w(Wt)})}var dn=fe(vt,2),$t=oe(dn);{var Yt=w=>{var L=Ph(),P=oe(L,!0);ae(L),Et(()=>tt(P,T(a))),qe(w,L)};pt($t,w=>{T(a)&&w(Yt)})}var nn=fe($t,2),qt=oe(nn,!0);ae(nn);var fn=fe(nn,2);{var un=w=>{var L=Dh(),P=oe(L);ae(L),Et(()=>tt(P,`▸ ${T(A)??""}`)),qe(w,L)};pt(fn,w=>{T(A)&&T(i)==="playing"&&w(un)})}var pn=fe(fn,2),Rn=oe(pn);ae(pn);var wn=fe(pn,2),an=oe(wn);{var yn=w=>{var L=Lh();qe(w,L)},Zn=w=>{var L=go();Et(()=>tt(L,`Beat ${T(s)??""} / ${T(u)??""}`)),qe(w,L)};pt(an,w=>{T(i)==="done"&&T(k)?w(yn):T(u)>0&&w(Zn,1)})}var h=fe(an,2);{var N=w=>{var L=Uh();mt("click",L,Ke),qe(w,L)};pt(h,w=>{T(i)==="done"&&w(N)})}ae(wn),ae(dn),Et(()=>{Xe=on(ge,1,"cinema-dot svelte-1uwqs3k",null,Xe,{active:T(i)==="playing"}),tt(rt,T(b)),tt(qt,T(r)),di(Rn,`width:${T(o)*100}%; --tension:${T(l)??""}`)}),rr(ot,()=>T(_),w=>te(_,w)),rr(Pt,()=>T(v),w=>te(v,w)),mt("click",Ht,ze),qe(q,ce)};pt(le,q=>{T(p)&&q(Pe)})}ae(W),mt("keydown",W,we),qe(B,W)};pt(d,B=>{T(n)&&B(H)})}mt("click",S,Ke),qe(e,be),qn()}pa(["click","keydown"]);var Bh=$e('

Weaving your memory graph…

'),Hh=$e(`

MCP Backend Offline

The Vestige MCP server isn't reachable on :3927. The dashboard is running but has nothing to query.

Start the backend:
nohup bash -c 'tail -f /dev/null | VESTIGE_DASHBOARD_ENABLED=true ~/.local/bin/vestige-mcp' > /tmp/vestige.log 2>&1 & disown
`),Gh=$e('

Your Mind Awaits

No memories yet — the moment Vestige starts remembering, your constellation will bloom here.

'),kh=$e('

Your Mind Awaits

'),Vh=$e('
'),zh=$e(`
`),Wh=$e('
',1),Xh=$e(' · · ',1),Yh=$e('
'),qh=$e('
'),Kh=$e('
AhaGraph
'),Zh=$e(' '),jh=$e('
'),$h=$e("
"),Qh=$e(`

Memory Detail

Retention Forecast
Explore Connections
`),Jh=$e('
'),em=$e(`
`,1);function Tm(e,t){Xn(t,!0);const n=()=>ol(ul,"$eventFeed",i),[i,r]=rl();let a=He(null),o=null;function s(){var j;const z=(((j=T(a))==null?void 0:j.nodes)??[]).slice(0,600).map(se=>{const ve=u(se.retention);return{id:se.id,score:ve,hue:ml(ve),energy:.35+.65*ve,selected:!!se.isCenter,scar:(se.suppression_count??0)>0,metric2:ve,kind:"graph-node",payload:se}});return hl(z,{maxRadius:.98,minCellR:.008,maxCellR:.036})}function u(C){return Math.min(1,Math.max(0,Number.isFinite(C)?C:0))}function f(C){const z=new pl(C);o=z,z.setCells(s()),C.addPass(z)}ei(()=>{var C;(C=T(a))==null||C.nodes.length,o==null||o.setCells(s())});let m=He(null),_=He(!0),v=He(""),p=He(!1),b=He(""),A=He(150);const c=[{value:"50",label:"50 nodes"},{value:"100",label:"100 nodes"},{value:"150",label:"150 nodes"},{value:"200",label:"200 nodes"}];let l=He("150");function O(C){te(A,parseInt(C,10),!0),X()}let M=He(!1),x=He(qi(new Date)),y=He("type");const U=Object.entries(il);let F=He(0),V=He(0),E=He(!1),g=He("recall-path");const D="vestige-graph-renderer";let Z=He("classic");function k(C){te(Z,C,!0);try{localStorage.setItem(D,C)}catch{}}let Y=en(()=>T(a)?T(M)?Ir(T(a).nodes,T(a).edges,T(x)).visibleNodes:T(a).nodes:[]),J=en(()=>T(a)?T(M)?Ir(T(a).nodes,T(a).edges,T(x)).visibleEdges:T(a).edges:[]);function $(C){if(T(a))switch(C.type){case"nodeAdded":T(a).nodes=[...T(a).nodes,C.node],T(a).nodeCount=T(a).nodes.length,te(F,T(a).nodeCount,!0);break;case"nodeRemoved":T(a).nodes=T(a).nodes.filter(z=>z.id!==C.nodeId),T(a).nodeCount=T(a).nodes.length,te(F,T(a).nodeCount,!0);break;case"edgeAdded":T(a).edges=[...T(a).edges,C.edge],T(a).edgeCount=T(a).edges.length,te(V,T(a).edgeCount,!0);break;case"edgesRemoved":T(a).edges=T(a).edges.filter(z=>z.source!==C.nodeId&&z.target!==C.nodeId),T(a).edgeCount=T(a).edges.length,te(V,T(a).edgeCount,!0);break;case"nodeUpdated":{const z=T(a).nodes.find(j=>j.id===C.nodeId);z&&(z.retention=C.retention);break}}}Nr(()=>{const C=typeof navigator<"u"&&"gpu"in navigator;let z=null;try{z=localStorage.getItem(D)}catch{}te(Z,C?z==="classic"?"classic":"field":"classic",!0);const j=new URLSearchParams(window.location.search),se=j.get("colorMode");ne(se)&&te(y,se,!0);const ve=j.get("center");X(void 0,ve||void 0)});function ne(C){return C==="type"||C==="state"||C==="ahagraph"}async function X(C,z){var j;te(_,!0),te(v,"");try{const se=!C&&!z;if(te(a,await Pn.graph({max_nodes:T(A),depth:3,query:C||void 0,center_id:z||void 0,sort:se?"recent":void 0}),!0),se&&T(a)&&T(a).nodeCount<=1&&T(a).edgeCount===0){const ve=await Pn.graph({max_nodes:T(A),depth:3,sort:"connected"});ve&&ve.nodeCount>T(a).nodeCount&&te(a,ve,!0)}T(a)&&(te(F,T(a).nodeCount,!0),te(V,T(a).edgeCount,!0))}catch(se){const ve=se instanceof Error?se.message:String(se),Oe=ve.replace(/\/[\w./-]+\.(sqlite|rs|db|toml|lock)\b/g,"[path]").slice(0,200),ye=se instanceof TypeError||/failed to fetch|NetworkError|load failed/i.test(ve)||/^API 500:?\s*(Internal Server Error)?\s*$/i.test(ve.trim()),ot=(((j=T(a))==null?void 0:j.nodeCount)??0)===0&&/not found|404|empty|no memor/i.test(ve);ye?te(v,"OFFLINE"):ot?te(v,"EMPTY"):te(v,`Failed to load graph: ${Oe}`)}finally{te(_,!1)}}async function xe(){te(p,!0);try{await Pn.dream(),await X()}catch{}finally{te(p,!1)}}async function Ce(C){try{te(m,await Pn.memories.get(C),!0)}catch{te(m,null)}}function Ne(){T(b).trim()&&X(T(b))}var je=em(),Je=Tn(je),Q=oe(Je);{var de=C=>{var z=Bh();qe(C,z)},Me=C=>{var z=Hh(),j=oe(z),se=oe(j),ve=oe(se);mn(ve,{name:"activation",size:52,strokeWidth:1.2}),ae(se);var Oe=fe(se,8),ye=oe(Oe),ot=fe(ye,2);ae(Oe),ae(j),ae(z),Et(()=>_t(ot,"href",`${or??""}/settings`)),mt("click",ye,()=>X()),qe(C,z)},he=C=>{var z=Gh(),j=oe(z),se=oe(j),ve=oe(se);mn(ve,{name:"graph",size:52,strokeWidth:1.2}),ae(se),Fn(4),ae(j),ae(z),qe(C,z)},Le=C=>{var z=kh(),j=oe(z),se=oe(j),ve=oe(se);mn(ve,{name:"graph",size:52,strokeWidth:1.2}),ae(se);var Oe=fe(se,4),ye=oe(Oe,!0);ae(Oe),ae(j),ae(z),Et(()=>tt(ye,T(v))),qe(C,z)},Ie=C=>{var z=Or(),j=Tn(z);{var se=Oe=>{var ye=Vh(),ot=oe(ye);ar(ot,{embedded:!0,live:!0,chrome:"none",demo:"recall-path",showSwitcher:!1,onpick:Ce,onready:f}),ae(ye),qe(Oe,ye)},ve=Oe=>{Yp(Oe,{get nodes(){return T(Y)},get edges(){return T(J)},get centerId(){return T(a).center_id},get events(){return n()},get isDreaming(){return T(p)},get colorMode(){return T(y)},onSelect:Ce,onGraphMutation:$})};pt(j,Oe=>{T(Z)==="field"?Oe(se):Oe(ve,!1)})}qe(C,z)};pt(Q,C=>{T(_)?C(de):T(v)==="OFFLINE"?C(Me,1):T(v)==="EMPTY"?C(he,2):T(v)?C(Le,3):T(a)&&C(Ie,4)})}var ke=fe(Q,2),nt=oe(ke);{var Ke=C=>{var z=zh(),j=oe(z);ci(j);var se=fe(j,2);ae(z),mt("keydown",j,ve=>ve.key==="Enter"&&Ne()),sa(j,()=>T(b),ve=>te(b,ve)),mt("click",se,Ne),qe(C,z)};pt(nt,C=>{T(Z)==="classic"&&C(Ke)})}var dt=fe(nt,2),R=oe(dt),gt=oe(R),ze=fe(gt,2);ae(R);var We=fe(R,2);{var we=C=>{var z=Wh(),j=Tn(z),se=oe(j),ve=fe(se,2),Oe=fe(ve,2);ae(j);var ye=fe(j,2);fl(ye,{get options(){return c},icon:"graph",class:"shrink-0",onChange:O,get value(){return T(l)},set value(vt){te(l,vt,!0)}});var ot=fe(ye,2),ft=fe(oe(ot),2);ci(ft);var Pt=fe(ft,2),Ht=oe(Pt);ae(Pt),ae(ot),Et((vt,Wt)=>{_t(se,"aria-checked",T(y)==="type"),on(se,1,`min-h-9 px-3 py-1.5 rounded-lg transition ${T(y)==="type"?"bg-synapse/25 text-synapse-glow":"text-dim hover:text-text"}`),_t(ve,"aria-checked",T(y)==="state"),on(ve,1,`min-h-9 px-3 py-1.5 rounded-lg transition ${T(y)==="state"?"bg-synapse/25 text-synapse-glow":"text-dim hover:text-text"}`),_t(Oe,"aria-checked",T(y)==="ahagraph"),on(Oe,1,`min-h-9 px-3 py-1.5 rounded-lg transition ${T(y)==="ahagraph"?"bg-synapse/25 text-synapse-glow":"text-dim hover:text-text"}`),_t(ot,"title",`Adjust graph brightness (${vt??""}x). Combines with auto distance compensation.`),_t(ft,"min",xn.brightnessMin),_t(ft,"max",xn.brightnessMax),tt(Ht,`${Wt??""}x`)},[()=>xn.brightness.toFixed(1),()=>xn.brightness.toFixed(1)]),mt("click",se,()=>te(y,"type")),mt("click",ve,()=>te(y,"state")),mt("click",Oe,()=>te(y,"ahagraph")),sa(ft,()=>xn.brightness,vt=>xn.brightness=vt),qe(C,z)};pt(We,C=>{T(Z)==="classic"&&C(we)})}var et=fe(We,2),be=oe(et),S=oe(be);mn(S,{name:"dreams",size:16}),ae(be);var d=fe(be);ae(et);var H=fe(et,2),B=oe(H);mn(B,{name:"sparkle",size:16}),Fn(),ae(H);var W=fe(H,2);{var G=C=>{{let z=en(()=>{var j;return((j=T(a))==null?void 0:j.center_id)??""});Fh(C,{get nodes(){return T(Y)},get edges(){return T(J)},get centerId(){return T(z)}})}};pt(W,C=>{T(Y).length>0&&C(G)})}var re=fe(W,2),ie=oe(re);mn(ie,{name:"pulse",size:16}),ae(re),ae(dt),ae(ke);var le=fe(ke,2),Pe=oe(le);{var q=C=>{var z=Xh(),j=Tn(z),se=oe(j);ae(j);var ve=fe(j,4),Oe=oe(ve);ae(ve);var ye=fe(ve,4),ot=oe(ye);ae(ye),Et(()=>{tt(se,`${T(F)??""} nodes`),tt(Oe,`${T(V)??""} edges`),tt(ot,`depth ${T(a).depth??""}`)}),qe(C,z)};pt(Pe,C=>{T(a)&&C(q)})}ae(le);var ce=fe(le,2);{var _e=C=>{var z=Yh(),j=oe(z);nh(j,{}),ae(z),qe(C,z)};pt(ce,C=>{T(Z)==="classic"&&T(y)==="state"&&C(_e)})}var Re=fe(ce,2);{var ge=C=>{var z=Kh(),j=fe(oe(z),2);ni(j,21,()=>U,Si,(se,ve)=>{var Oe=en(()=>vo(T(ve),2));let ye=()=>T(Oe)[0],ot=()=>T(Oe)[1];var ft=qh(),Pt=oe(ft),Ht=fe(Pt,2),vt=oe(Ht,!0);ae(Ht),ae(ft),Et(()=>{di(Pt,`background: ${ot()??""}`),tt(vt,tl[ye()])}),qe(se,ft)}),ae(j),ae(z),qe(C,z)};pt(Re,C=>{T(Z)==="classic"&&T(y)==="ahagraph"&&C(ge)})}var Xe=fe(Re,2);{var Ge=C=>{Jp(C,{get nodes(){return T(a).nodes},onDateChange:z=>{te(x,z,!0)},onToggle:z=>{te(M,z,!0)}})};pt(Xe,C=>{T(a)&&T(Z)==="classic"&&C(Ge)})}var rt=fe(Xe,2);{var I=C=>{var z=Qh(),j=oe(z),se=fe(oe(j),2);ae(j);var ve=fe(j,2),Oe=oe(ve),ye=oe(Oe),ot=oe(ye,!0);ae(ye);var ft=fe(ye,2);ni(ft,17,()=>T(m).tags,Si,(w,L)=>{var P=Zh(),ee=oe(P,!0);ae(P),Et(()=>tt(ee,T(L))),qe(w,P)}),ae(Oe);var Pt=fe(Oe,2),Ht=oe(Pt,!0);ae(Pt);var vt=fe(Pt,2);ni(vt,21,()=>[{label:"Retention",value:T(m).retentionStrength},{label:"Storage",value:T(m).storageStrength},{label:"Retrieval",value:T(m).retrievalStrength}],Si,(w,L)=>{var P=jh(),ee=oe(P),pe=oe(ee),Se=oe(pe,!0);ae(pe);var Ee=fe(pe,2),Fe=oe(Ee);ae(Ee),ae(ee);var Be=fe(ee,2),De=oe(Be);ae(Be),ae(P),Et(Qe=>{tt(Se,T(L).label),tt(Fe,`${Qe??""}%`),di(De,`width: ${T(L).value*100}%; background: ${T(L).value>.7?"#10b981":T(L).value>.4?"#f59e0b":"#ef4444"}`)},[()=>(T(L).value*100).toFixed(1)]),qe(w,P)}),ae(vt);var Wt=fe(vt,2),dn=fe(oe(Wt),2);{let w=en(()=>T(m).storageStrength*30);Zp(dn,{get retention(){return T(m).retentionStrength},get stability(){return T(w)}})}ae(Wt);var $t=fe(Wt,2),Yt=oe($t),nn=oe(Yt);ae(Yt);var qt=fe(Yt,2),fn=oe(qt);ae(qt);var un=fe(qt,2);{var pn=w=>{var L=$h(),P=oe(L);ae(L),Et(ee=>tt(P,`Accessed: ${ee??""}`),[()=>new Date(T(m).lastAccessedAt).toLocaleString()]),qe(w,L)};pt(un,w=>{T(m).lastAccessedAt&&w(pn)})}var Rn=fe(un,2),wn=oe(Rn);ae(Rn),ae($t);var an=fe($t,2),yn=oe(an),Kn=fe(yn,2);ae(an);var h=fe(an,2),N=oe(h);mn(N,{name:"explore",size:14}),Fn(),ae(h),ae(ve),ae(z),Et((w,L)=>{tt(ot,T(m).nodeType),tt(Ht,T(m).content),tt(nn,`Created: ${w??""}`),tt(fn,`Updated: ${L??""}`),tt(wn,`Reviews: ${T(m).reviewCount??0??""}`),_t(h,"href",`${or??""}/explore`)},[()=>new Date(T(m).createdAt).toLocaleString(),()=>new Date(T(m).updatedAt).toLocaleString()]),mt("click",se,()=>te(m,null)),mt("click",yn,()=>{T(m)&&Pn.memories.promote(T(m).id)}),mt("click",Kn,()=>{T(m)&&Pn.memories.demote(T(m).id)}),qe(C,z)};pt(rt,C=>{T(m)&&C(I)})}ae(Je);var ue=fe(Je,2);{var K=C=>{var z=Jh(),j=oe(z);nl(j,()=>T(g),se=>{ar(se,{get demo(){return T(g)},ondemochange:ve=>te(g,ve,!0),onexit:()=>te(E,!1)})}),ae(z),qe(C,z)};pt(ue,C=>{T(E)&&C(K)})}Et(()=>{_t(gt,"aria-checked",T(Z)==="field"),on(gt,1,`min-h-9 px-3 py-1.5 rounded-lg transition ${T(Z)==="field"?"bg-[#5dcaa5]/25 text-[#7fe6c0]":"text-dim hover:text-text"}`),_t(ze,"aria-checked",T(Z)==="classic"),on(ze,1,`min-h-9 px-3 py-1.5 rounded-lg transition ${T(Z)==="classic"?"bg-synapse/25 text-synapse-glow":"text-dim hover:text-text"}`),et.disabled=T(p),on(et,1,`shrink-0 inline-flex items-center gap-2 min-h-10 px-4 py-2 rounded-xl bg-dream/20 border border-dream/40 text-dream-glow text-sm + hover:bg-[#5dcaa5]/25 transition-all backdrop-blur-sm" title="Open the Cognitive Observatory"> Observatory
`,1);function Tm(e,t){Yn(t,!0);const n=()=>ol(ul,"$eventFeed",i),[i,r]=rl();let a=He(null),o=null;function s(){var j;const z=(((j=T(a))==null?void 0:j.nodes)??[]).slice(0,600).map(se=>{const ve=u(se.retention);return{id:se.id,score:ve,hue:ml(ve),energy:.35+.65*ve,selected:!!se.isCenter,scar:(se.suppression_count??0)>0,metric2:ve,kind:"graph-node",payload:se}});return pl(z,{maxRadius:.98,minCellR:.008,maxCellR:.036})}function u(C){return Math.min(1,Math.max(0,Number.isFinite(C)?C:0))}function f(C){const z=new hl(C);o=z,z.setCells(s()),C.addPass(z)}Fn(()=>{T(Z)!=="field"&&(o=null)}),Fn(()=>{var C;(C=T(a))==null||C.nodes.length,T(Z)==="field"&&(o==null||o.setCells(s()))});let m=He(null),_=He(!0),v=He(""),p=He(!1),b=He(""),A=He(150);const c=[{value:"50",label:"50 nodes"},{value:"100",label:"100 nodes"},{value:"150",label:"150 nodes"},{value:"200",label:"200 nodes"}];let l=He("150");function O(C){te(A,parseInt(C,10),!0),X()}let M=He(!1),x=He(qi(new Date)),y=He("type");const U=Object.entries(il);let F=He(0),V=He(0),E=He(!1),g=He("recall-path");const D="vestige-graph-renderer";let Z=He("classic");function k(C){te(Z,C,!0);try{localStorage.setItem(D,C)}catch{}}let Y=en(()=>T(a)?T(M)?Ir(T(a).nodes,T(a).edges,T(x)).visibleNodes:T(a).nodes:[]),J=en(()=>T(a)?T(M)?Ir(T(a).nodes,T(a).edges,T(x)).visibleEdges:T(a).edges:[]);function $(C){if(T(a))switch(C.type){case"nodeAdded":T(a).nodes=[...T(a).nodes,C.node],T(a).nodeCount=T(a).nodes.length,te(F,T(a).nodeCount,!0);break;case"nodeRemoved":T(a).nodes=T(a).nodes.filter(z=>z.id!==C.nodeId),T(a).nodeCount=T(a).nodes.length,te(F,T(a).nodeCount,!0);break;case"edgeAdded":T(a).edges=[...T(a).edges,C.edge],T(a).edgeCount=T(a).edges.length,te(V,T(a).edgeCount,!0);break;case"edgesRemoved":T(a).edges=T(a).edges.filter(z=>z.source!==C.nodeId&&z.target!==C.nodeId),T(a).edgeCount=T(a).edges.length,te(V,T(a).edgeCount,!0);break;case"nodeUpdated":{const z=T(a).nodes.find(j=>j.id===C.nodeId);z&&(z.retention=C.retention);break}}}Nr(()=>{const C=typeof navigator<"u"&&"gpu"in navigator;let z=null;try{z=localStorage.getItem(D)}catch{}te(Z,C?z==="classic"?"classic":"field":"classic",!0);const j=new URLSearchParams(window.location.search),se=j.get("colorMode");ne(se)&&te(y,se,!0);const ve=j.get("center");X(void 0,ve||void 0)});function ne(C){return C==="type"||C==="state"||C==="ahagraph"}async function X(C,z){var j;te(_,!0),te(v,"");try{const se=!C&&!z;if(te(a,await Pn.graph({max_nodes:T(A),depth:3,query:C||void 0,center_id:z||void 0,sort:se?"recent":void 0}),!0),se&&T(a)&&T(a).nodeCount<=1&&T(a).edgeCount===0){const ve=await Pn.graph({max_nodes:T(A),depth:3,sort:"connected"});ve&&ve.nodeCount>T(a).nodeCount&&te(a,ve,!0)}T(a)&&(te(F,T(a).nodeCount,!0),te(V,T(a).edgeCount,!0))}catch(se){const ve=se instanceof Error?se.message:String(se),Oe=ve.replace(/\/[\w./-]+\.(sqlite|rs|db|toml|lock)\b/g,"[path]").slice(0,200),ye=se instanceof TypeError||/failed to fetch|NetworkError|load failed/i.test(ve)||/^API 500:?\s*(Internal Server Error)?\s*$/i.test(ve.trim()),ot=(((j=T(a))==null?void 0:j.nodeCount)??0)===0&&/not found|404|empty|no memor/i.test(ve);ye?te(v,"OFFLINE"):ot?te(v,"EMPTY"):te(v,`Failed to load graph: ${Oe}`)}finally{te(_,!1)}}async function xe(){te(p,!0);try{await Pn.dream(),await X()}catch{}finally{te(p,!1)}}async function Ce(C){try{te(m,await Pn.memories.get(C),!0)}catch{te(m,null)}}function Ne(){T(b).trim()&&X(T(b))}var je=em(),Je=Tn(je),Q=oe(Je);{var de=C=>{var z=Bh();qe(C,z)},Me=C=>{var z=Hh(),j=oe(z),se=oe(j),ve=oe(se);mn(ve,{name:"activation",size:52,strokeWidth:1.2}),ae(se);var Oe=fe(se,8),ye=oe(Oe),ot=fe(ye,2);ae(Oe),ae(j),ae(z),Et(()=>_t(ot,"href",`${or??""}/settings`)),mt("click",ye,()=>X()),qe(C,z)},he=C=>{var z=Gh(),j=oe(z),se=oe(j),ve=oe(se);mn(ve,{name:"graph",size:52,strokeWidth:1.2}),ae(se),Bn(4),ae(j),ae(z),qe(C,z)},Le=C=>{var z=kh(),j=oe(z),se=oe(j),ve=oe(se);mn(ve,{name:"graph",size:52,strokeWidth:1.2}),ae(se);var Oe=fe(se,4),ye=oe(Oe,!0);ae(Oe),ae(j),ae(z),Et(()=>tt(ye,T(v))),qe(C,z)},Ie=C=>{var z=Or(),j=Tn(z);{var se=Oe=>{var ye=Vh(),ot=oe(ye);ar(ot,{embedded:!0,live:!0,chrome:"none",demo:"recall-path",showSwitcher:!1,onpick:Ce,onready:f}),ae(ye),qe(Oe,ye)},ve=Oe=>{Yp(Oe,{get nodes(){return T(Y)},get edges(){return T(J)},get centerId(){return T(a).center_id},get events(){return n()},get isDreaming(){return T(p)},get colorMode(){return T(y)},onSelect:Ce,onGraphMutation:$})};pt(j,Oe=>{T(Z)==="field"?Oe(se):Oe(ve,!1)})}qe(C,z)};pt(Q,C=>{T(_)?C(de):T(v)==="OFFLINE"?C(Me,1):T(v)==="EMPTY"?C(he,2):T(v)?C(Le,3):T(a)&&C(Ie,4)})}var ke=fe(Q,2),nt=oe(ke);{var Ke=C=>{var z=zh(),j=oe(z);ci(j);var se=fe(j,2);ae(z),mt("keydown",j,ve=>ve.key==="Enter"&&Ne()),sa(j,()=>T(b),ve=>te(b,ve)),mt("click",se,Ne),qe(C,z)};pt(nt,C=>{T(Z)==="classic"&&C(Ke)})}var dt=fe(nt,2),R=oe(dt),gt=oe(R),ze=fe(gt,2);ae(R);var We=fe(R,2);{var we=C=>{var z=Wh(),j=Tn(z),se=oe(j),ve=fe(se,2),Oe=fe(ve,2);ae(j);var ye=fe(j,2);fl(ye,{get options(){return c},icon:"graph",class:"shrink-0",onChange:O,get value(){return T(l)},set value(vt){te(l,vt,!0)}});var ot=fe(ye,2),ft=fe(oe(ot),2);ci(ft);var Pt=fe(ft,2),Ht=oe(Pt);ae(Pt),ae(ot),Et((vt,Wt)=>{_t(se,"aria-checked",T(y)==="type"),on(se,1,`min-h-9 px-3 py-1.5 rounded-lg transition ${T(y)==="type"?"bg-synapse/25 text-synapse-glow":"text-dim hover:text-text"}`),_t(ve,"aria-checked",T(y)==="state"),on(ve,1,`min-h-9 px-3 py-1.5 rounded-lg transition ${T(y)==="state"?"bg-synapse/25 text-synapse-glow":"text-dim hover:text-text"}`),_t(Oe,"aria-checked",T(y)==="ahagraph"),on(Oe,1,`min-h-9 px-3 py-1.5 rounded-lg transition ${T(y)==="ahagraph"?"bg-synapse/25 text-synapse-glow":"text-dim hover:text-text"}`),_t(ot,"title",`Adjust graph brightness (${vt??""}x). Combines with auto distance compensation.`),_t(ft,"min",xn.brightnessMin),_t(ft,"max",xn.brightnessMax),tt(Ht,`${Wt??""}x`)},[()=>xn.brightness.toFixed(1),()=>xn.brightness.toFixed(1)]),mt("click",se,()=>te(y,"type")),mt("click",ve,()=>te(y,"state")),mt("click",Oe,()=>te(y,"ahagraph")),sa(ft,()=>xn.brightness,vt=>xn.brightness=vt),qe(C,z)};pt(We,C=>{T(Z)==="classic"&&C(we)})}var et=fe(We,2),be=oe(et),S=oe(be);mn(S,{name:"dreams",size:16}),ae(be);var d=fe(be);ae(et);var H=fe(et,2),B=oe(H);mn(B,{name:"sparkle",size:16}),Bn(),ae(H);var W=fe(H,2);{var G=C=>{{let z=en(()=>{var j;return((j=T(a))==null?void 0:j.center_id)??""});Fh(C,{get nodes(){return T(Y)},get edges(){return T(J)},get centerId(){return T(z)}})}};pt(W,C=>{T(Y).length>0&&C(G)})}var re=fe(W,2),ie=oe(re);mn(ie,{name:"pulse",size:16}),ae(re),ae(dt),ae(ke);var le=fe(ke,2),Pe=oe(le);{var q=C=>{var z=Xh(),j=Tn(z),se=oe(j);ae(j);var ve=fe(j,4),Oe=oe(ve);ae(ve);var ye=fe(ve,4),ot=oe(ye);ae(ye),Et(()=>{tt(se,`${T(F)??""} nodes`),tt(Oe,`${T(V)??""} edges`),tt(ot,`depth ${T(a).depth??""}`)}),qe(C,z)};pt(Pe,C=>{T(a)&&C(q)})}ae(le);var ce=fe(le,2);{var _e=C=>{var z=Yh(),j=oe(z);nh(j,{}),ae(z),qe(C,z)};pt(ce,C=>{T(Z)==="classic"&&T(y)==="state"&&C(_e)})}var Re=fe(ce,2);{var ge=C=>{var z=Kh(),j=fe(oe(z),2);ni(j,21,()=>U,Si,(se,ve)=>{var Oe=en(()=>vo(T(ve),2));let ye=()=>T(Oe)[0],ot=()=>T(Oe)[1];var ft=qh(),Pt=oe(ft),Ht=fe(Pt,2),vt=oe(Ht,!0);ae(Ht),ae(ft),Et(()=>{di(Pt,`background: ${ot()??""}`),tt(vt,tl[ye()])}),qe(se,ft)}),ae(j),ae(z),qe(C,z)};pt(Re,C=>{T(Z)==="classic"&&T(y)==="ahagraph"&&C(ge)})}var Xe=fe(Re,2);{var Ge=C=>{Jp(C,{get nodes(){return T(a).nodes},onDateChange:z=>{te(x,z,!0)},onToggle:z=>{te(M,z,!0)}})};pt(Xe,C=>{T(a)&&T(Z)==="classic"&&C(Ge)})}var rt=fe(Xe,2);{var I=C=>{var z=Qh(),j=oe(z),se=fe(oe(j),2);ae(j);var ve=fe(j,2),Oe=oe(ve),ye=oe(Oe),ot=oe(ye,!0);ae(ye);var ft=fe(ye,2);ni(ft,17,()=>T(m).tags,Si,(w,L)=>{var P=Zh(),ee=oe(P,!0);ae(P),Et(()=>tt(ee,T(L))),qe(w,P)}),ae(Oe);var Pt=fe(Oe,2),Ht=oe(Pt,!0);ae(Pt);var vt=fe(Pt,2);ni(vt,21,()=>[{label:"Retention",value:T(m).retentionStrength},{label:"Storage",value:T(m).storageStrength},{label:"Retrieval",value:T(m).retrievalStrength}],Si,(w,L)=>{var P=jh(),ee=oe(P),pe=oe(ee),Se=oe(pe,!0);ae(pe);var Ee=fe(pe,2),Fe=oe(Ee);ae(Ee),ae(ee);var Be=fe(ee,2),De=oe(Be);ae(Be),ae(P),Et(Qe=>{tt(Se,T(L).label),tt(Fe,`${Qe??""}%`),di(De,`width: ${T(L).value*100}%; background: ${T(L).value>.7?"#10b981":T(L).value>.4?"#f59e0b":"#ef4444"}`)},[()=>(T(L).value*100).toFixed(1)]),qe(w,P)}),ae(vt);var Wt=fe(vt,2),dn=fe(oe(Wt),2);{let w=en(()=>T(m).storageStrength*30);Zp(dn,{get retention(){return T(m).retentionStrength},get stability(){return T(w)}})}ae(Wt);var $t=fe(Wt,2),Yt=oe($t),nn=oe(Yt);ae(Yt);var qt=fe(Yt,2),fn=oe(qt);ae(qt);var un=fe(qt,2);{var pn=w=>{var L=$h(),P=oe(L);ae(L),Et(ee=>tt(P,`Accessed: ${ee??""}`),[()=>new Date(T(m).lastAccessedAt).toLocaleString()]),qe(w,L)};pt(un,w=>{T(m).lastAccessedAt&&w(pn)})}var Rn=fe(un,2),wn=oe(Rn);ae(Rn),ae($t);var an=fe($t,2),yn=oe(an),Zn=fe(yn,2);ae(an);var h=fe(an,2),N=oe(h);mn(N,{name:"explore",size:14}),Bn(),ae(h),ae(ve),ae(z),Et((w,L)=>{tt(ot,T(m).nodeType),tt(Ht,T(m).content),tt(nn,`Created: ${w??""}`),tt(fn,`Updated: ${L??""}`),tt(wn,`Reviews: ${T(m).reviewCount??0??""}`),_t(h,"href",`${or??""}/explore`)},[()=>new Date(T(m).createdAt).toLocaleString(),()=>new Date(T(m).updatedAt).toLocaleString()]),mt("click",se,()=>te(m,null)),mt("click",yn,()=>{T(m)&&Pn.memories.promote(T(m).id)}),mt("click",Zn,()=>{T(m)&&Pn.memories.demote(T(m).id)}),qe(C,z)};pt(rt,C=>{T(m)&&C(I)})}ae(Je);var ue=fe(Je,2);{var K=C=>{var z=Jh(),j=oe(z);nl(j,()=>T(g),se=>{ar(se,{get demo(){return T(g)},ondemochange:ve=>te(g,ve,!0),onexit:()=>te(E,!1)})}),ae(z),qe(C,z)};pt(ue,C=>{T(E)&&C(K)})}Et(()=>{_t(gt,"aria-checked",T(Z)==="field"),on(gt,1,`min-h-9 px-3 py-1.5 rounded-lg transition ${T(Z)==="field"?"bg-[#5dcaa5]/25 text-[#7fe6c0]":"text-dim hover:text-text"}`),_t(ze,"aria-checked",T(Z)==="classic"),on(ze,1,`min-h-9 px-3 py-1.5 rounded-lg transition ${T(Z)==="classic"?"bg-synapse/25 text-synapse-glow":"text-dim hover:text-text"}`),et.disabled=T(p),on(et,1,`shrink-0 inline-flex items-center gap-2 min-h-10 px-4 py-2 rounded-xl bg-dream/20 border border-dream/40 text-dream-glow text-sm hover:bg-dream/30 transition-all backdrop-blur-sm disabled:opacity-50 - ${T(p)?"glow-dream animate-pulse-glow":""}`),on(be,1,al(T(p)?"breathe":"")),tt(d,` ${T(p)?"Dreaming…":"Dream"}`)}),mt("click",gt,()=>k("field")),mt("click",ze,()=>k("classic")),mt("click",et,xe),mt("click",H,()=>te(E,!0)),mt("click",re,()=>X()),qe(e,je),Yn(),r()}pa(["click","keydown"]);export{Tm as component}; + ${T(p)?"glow-dream animate-pulse-glow":""}`),on(be,1,al(T(p)?"breathe":"")),tt(d,` ${T(p)?"Dreaming…":"Dream"}`)}),mt("click",gt,()=>k("field")),mt("click",ze,()=>k("classic")),mt("click",et,xe),mt("click",H,()=>te(E,!0)),mt("click",re,()=>X()),qe(e,je),qn(),r()}pa(["click","keydown"]);export{Tm as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/12.CRVOD7oJ.js.br b/apps/dashboard/build/_app/immutable/nodes/12.CRVOD7oJ.js.br new file mode 100644 index 0000000..c76ffb6 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/12.CRVOD7oJ.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/12.CRVOD7oJ.js.gz b/apps/dashboard/build/_app/immutable/nodes/12.CRVOD7oJ.js.gz new file mode 100644 index 0000000..0c61347 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/12.CRVOD7oJ.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/12.CuFt2FF9.js.br b/apps/dashboard/build/_app/immutable/nodes/12.CuFt2FF9.js.br deleted file mode 100644 index 32caf97..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/12.CuFt2FF9.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/12.CuFt2FF9.js.gz b/apps/dashboard/build/_app/immutable/nodes/12.CuFt2FF9.js.gz deleted file mode 100644 index 6b43664..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/12.CuFt2FF9.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/13.UdclNjnS.js b/apps/dashboard/build/_app/immutable/nodes/13.UdclNjnS.js new file mode 100644 index 0000000..d48978d --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/13.UdclNjnS.js @@ -0,0 +1 @@ +import"../chunks/Bzak7iHL.js";import{d as Q,o as Z,a as tt,b as $,e as et}from"../chunks/DAau0uzT.js";import{p as nt,d as E,e as ot,a as rt,b as it,h as at,g as i,f as st,u as ct,c as lt,s as c,$ as mt,r as ut}from"../chunks/CGq8RnJq.js";import{h as dt}from"../chunks/De_e6MzK.js";import{b as pt}from"../chunks/Ccqjq5DS.js";import{r as R,O as ht}from"../chunks/BMB5u1EX.js";import{a as N}from"../chunks/D35IQVqe.js";import{T as ft}from"../chunks/D7ozXiSB.js";import{L as yt,F as D,l as gt}from"../chunks/DETSv_kY.js";var Et=st('
');function Ot(b,k){nt(k,!0);const O=[...R("#22C7DE"),1],_=[...R("#FF3B30"),.92],A=[...R("#29F2A9"),.62],P=[...R("#FFB020"),.86],B=36,L=30,U=-1e5,W=.62;let m=E(null),u=null,r=null,l=null,M=null,d=E(ot([])),C=E(0),v=E(!0),f=E(null),I=null;Z(()=>{V()});let x=null;tt(()=>{x==null||x(),r==null||r.dispose(),l==null||l.dispose(),r=null,l=null,u=null});function Y(t){if(typeof window>"u")return()=>{};const e=window.matchMedia("(prefers-reduced-motion: reduce)");t.setPaused(e.matches);const n=o=>t.setPaused(o.matches);return e.addEventListener("change",n),()=>e.removeEventListener("change",n)}async function z(t){u=t,x=Y(t);const e=new yt(t);l=e,e.setCells(S()),t.addPass(e);const n=new ft(t);r=n,await n.init(),n.setText(g()),t.addPass(n),t.demoClock.reset()}async function V(){c(v,!0),c(f,null),r==null||r.setText(g());try{const t=await N.memories.list({limit:String(B)});c(C,t.total,!0);const e=await Promise.allSettled(t.memories.map(async n=>({memory:n,score:await N.importance(n.content)})));c(d,e.filter(n=>n.status==="fulfilled").map(n=>n.value).sort((n,o)=>o.score.composite-n.score.composite),!0),t.memories.length>0&&i(d).length===0&&c(f,"API IMPORTANCE RETURNED NO SCORES")}catch(t){c(d,[],!0),c(C,0),c(f,t instanceof Error?t.message:"UNKNOWN IMPORTANCE FETCH ERROR",!0)}finally{c(v,!1),r==null||r.setText(g()),l==null||l.setCells(S()),u==null||u.demoClock.reset()}}function S(){const t=i(d).map(e=>({id:e.memory.id,score:y(e.score.composite),hue:e.score.recommendation==="save"?D.oxygen:D.caution,energy:Math.max(.35,y(e.score.composite)),metric2:y(e.memory.retentionStrength),kind:"importance",payload:e}));return gt(t,{maxRadius:.9,minCellR:.04,maxCellR:.1})}function w(t){return typeof t!="string"?"":t.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function G(t){const{memory:e,score:n}=t,o=w(e.content??"").replace(/\s+/g," ").trim().slice(0,44),s=H(n);return w(`${o} | ${e.id.slice(0,8)} | ${Math.round(n.composite*100)}% | ${Math.round(e.retentionStrength*100)}% | ${n.recommendation} | ${s}`)}function H(t){return Object.entries(t.channels).sort((e,n)=>n[1]-e[1])[0][0]}function y(t){return Math.min(1,Math.max(0,Number.isFinite(t)?t:.5))}function T(t,e=A){return{id:"importance:status",kind:"importance-status",text:w(t),x:-.58,y:.02,size:.044,color:e,depth:.78,weight:.62,revealSpan:32,maxWidthEm:50}}function g(){if(i(v))return[T("LOADING IMPORTANCE FIELD...",O)];if(i(f))return[T(`ERROR - ${i(f)}`.slice(0,72),_)];if(i(d).length===0)return[T("EMPTY IMPORTANCE FIELD",A)];const t=i(d).slice(0,L),e=.72,n=1.5/Math.max(1,L-1);return t.map((o,s)=>{const a=Math.max(W,y(o.score.composite)),p=y(o.memory.retentionStrength);return{id:`importance:${o.memory.id}`,kind:"importance",memoryId:o.memory.id,text:G(o),x:-.9,y:e-s*n,size:.025,color:o.score.recommendation==="save"?O:P,depth:a,weight:p,startFrame:U+s*2,revealSpan:1,maxWidthEm:54,hitPadX:.03,hitPadY:.018}})}function F(t){if(!i(m))return null;const e=i(m).getBoundingClientRect();return e.width<=0||e.height<=0?null:{x:(t.clientX-e.left)/e.width*2-1,y:-((t.clientY-e.top)/e.height*2-1)}}function K(t){if(!i(m)||!u)return;const e=i(m).getBoundingClientRect(),n=Math.max(1e-4,e.width/Math.max(1,e.height)),o={x:t.x*Math.max(n,1),y:t.y/Math.min(n,1)},s=M??o,a={x:s.x+(o.x-s.x)*.35,y:s.y+(o.y-s.y)*.35};M=a,u.setCursorPreNdc(a.x,a.y,a.x-s.x,a.y-s.y)}function X(t){const e=F(t);if(!e)return;K(e);const n=(r==null?void 0:r.pickAt(e.x,e.y))??null,o=(n==null?void 0:n.kind)==="importance"?n.id:null;o!==I&&(I=o,r==null||r.setRunDepth(o,1)),i(m)&&(i(m).style.cursor=o?"crosshair":"default")}function j(){M=null,I=null,u==null||u.setCursorPreNdc(999,999,0,0),r==null||r.setRunDepth(null),i(m)&&(i(m).style.cursor="default")}async function q(t){var s;const e=F(t);if(!e||!r)return;let n;const o=r.pickAt(e.x,e.y);if((o==null?void 0:o.kind)==="importance")n=o.payload.memoryId;else{const a=l==null?void 0:l.pickAt(e.x,e.y);(a==null?void 0:a.kind)==="importance"&&(n=(s=a.payload.memory)==null?void 0:s.id)}if(n)try{const a=await N.memories.promote(n);c(d,i(d).map(p=>p.memory.id===a.id?{...p,memory:{...p.memory,retentionStrength:a.retentionStrength??p.memory.retentionStrength}}:p),!0),r.setText(g())}catch(a){c(f,a instanceof Error?a.message:"UNKNOWN IMPORTANCE PROMOTE ERROR",!0),r.setText(g())}}var h=Et();dt("mhrd3u",t=>{at(()=>{mt.title="Importance · Vestige"})});var J=lt(h);{let t=ct(()=>`real-importance-field:${i(C)}`);ht(J,{demo:"recall-path",get seed(){return i(t)},onready:z})}ut(h),pt(h,t=>c(m,t),()=>i(m)),$("pointerdown",h,q),$("pointermove",h,X),et("pointerleave",h,j),rt(b,h),it()}Q(["pointerdown","pointermove"]);export{Ot as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/13.UdclNjnS.js.br b/apps/dashboard/build/_app/immutable/nodes/13.UdclNjnS.js.br new file mode 100644 index 0000000..930c2cc Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/13.UdclNjnS.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/13.UdclNjnS.js.gz b/apps/dashboard/build/_app/immutable/nodes/13.UdclNjnS.js.gz new file mode 100644 index 0000000..d3ef253 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/13.UdclNjnS.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/13.z1_JLKKx.js b/apps/dashboard/build/_app/immutable/nodes/13.z1_JLKKx.js deleted file mode 100644 index 2e065ed..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/13.z1_JLKKx.js +++ /dev/null @@ -1 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{d as q,o as J,a as Q,b as F,e as Z}from"../chunks/DAau0uzT.js";import{p as tt,d as g,e as et,a as nt,b as ot,h as rt,g as i,f as it,u as st,c as at,s as l,$ as lt,r as ct}from"../chunks/CGq8RnJq.js";import{h as mt}from"../chunks/De_e6MzK.js";import{b as ut}from"../chunks/Ccqjq5DS.js";import{r as E,O as pt}from"../chunks/BMB5u1EX.js";import{a as v}from"../chunks/D35IQVqe.js";import{T as dt}from"../chunks/D7ozXiSB.js";import{L as ht,F as L,l as ft}from"../chunks/BeGBxCGK.js";var yt=it('
');function Nt($,D){tt(D,!0);const N=[...E("#22C7DE"),1],b=[...E("#FF3B30"),.92],O=[...E("#29F2A9"),.62],_=[...E("#FFB020"),.86],k=36,w=30,P=-1e5,B=.62;let c=g(null),m=null,o=null,u=null,x=null,p=g(et([])),R=g(0),M=g(!0),h=g(null),C=null;J(()=>{W()}),Q(()=>{o==null||o.dispose(),u==null||u.dispose(),o=null,u=null,m=null});async function U(t){m=t;const e=new ht(t);u=e,e.setCells(A()),t.addPass(e);const n=new dt(t);o=n,await n.init(),n.setText(y()),t.addPass(n),t.demoClock.reset()}async function W(){l(M,!0),l(h,null),o==null||o.setText(y());try{const t=await v.memories.list({limit:String(k)});l(R,t.total,!0);const e=await Promise.allSettled(t.memories.map(async n=>({memory:n,score:await v.importance(n.content)})));l(p,e.filter(n=>n.status==="fulfilled").map(n=>n.value).sort((n,r)=>r.score.composite-n.score.composite),!0),t.memories.length>0&&i(p).length===0&&l(h,"API IMPORTANCE RETURNED NO SCORES")}catch(t){l(p,[],!0),l(R,0),l(h,t instanceof Error?t.message:"UNKNOWN IMPORTANCE FETCH ERROR",!0)}finally{l(M,!1),o==null||o.setText(y()),u==null||u.setCells(A()),m==null||m.demoClock.reset()}}function A(){const t=i(p).map(e=>({id:e.memory.id,score:f(e.score.composite),hue:e.score.recommendation==="save"?L.oxygen:L.caution,energy:Math.max(.35,f(e.score.composite)),metric2:f(e.memory.retentionStrength),kind:"importance",payload:e}));return ft(t,{maxRadius:.9,minCellR:.04,maxCellR:.1})}function I(t){return typeof t!="string"?"":t.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function Y(t){const{memory:e,score:n}=t,r=I(e.content??"").replace(/\s+/g," ").trim().slice(0,44),s=H(n);return I(`${r} | ${e.id.slice(0,8)} | ${Math.round(n.composite*100)}% | ${Math.round(e.retentionStrength*100)}% | ${n.recommendation} | ${s}`)}function H(t){return Object.entries(t.channels).sort((e,n)=>n[1]-e[1])[0][0]}function f(t){return Math.min(1,Math.max(0,Number.isFinite(t)?t:.5))}function T(t,e=O){return{id:"importance:status",kind:"importance-status",text:I(t),x:-.58,y:.02,size:.044,color:e,depth:.78,weight:.62,revealSpan:32,maxWidthEm:50}}function y(){if(i(M))return[T("LOADING IMPORTANCE FIELD...",N)];if(i(h))return[T(`ERROR - ${i(h)}`.slice(0,72),b)];if(i(p).length===0)return[T("EMPTY IMPORTANCE FIELD",O)];const t=i(p).slice(0,w),e=.72,n=1.5/Math.max(1,w-1);return t.map((r,s)=>{const a=Math.max(B,f(r.score.composite)),j=f(r.memory.retentionStrength);return{id:`importance:${r.memory.id}`,kind:"importance",memoryId:r.memory.id,text:Y(r),x:-.9,y:e-s*n,size:.025,color:r.score.recommendation==="save"?N:_,depth:a,weight:j,startFrame:P+s*2,revealSpan:1,maxWidthEm:54,hitPadX:.03,hitPadY:.018}})}function S(t){if(!i(c))return null;const e=i(c).getBoundingClientRect();return e.width<=0||e.height<=0?null:{x:(t.clientX-e.left)/e.width*2-1,y:-((t.clientY-e.top)/e.height*2-1)}}function z(t){if(!i(c)||!m)return;const e=i(c).getBoundingClientRect(),n=Math.max(1e-4,e.width/Math.max(1,e.height)),r={x:t.x*Math.max(n,1),y:t.y/Math.min(n,1)},s=x??r,a={x:s.x+(r.x-s.x)*.35,y:s.y+(r.y-s.y)*.35};x=a,m.setCursorPreNdc(a.x,a.y,a.x-s.x,a.y-s.y)}function V(t){const e=S(t);if(!e)return;z(e);const n=(o==null?void 0:o.pickAt(e.x,e.y))??null,r=(n==null?void 0:n.kind)==="importance"?n.id:null;r!==C&&(C=r,o==null||o.setRunDepth(r,1)),i(c)&&(i(c).style.cursor=r?"crosshair":"default")}function G(){x=null,C=null,m==null||m.setCursorPreNdc(999,999,0,0),o==null||o.setRunDepth(null),i(c)&&(i(c).style.cursor="default")}async function K(t){const e=S(t);if(!e||!o)return;const n=o.pickAt(e.x,e.y);if((n==null?void 0:n.kind)!=="importance")return;const r=n.payload;if(r.memoryId)try{const s=await v.memories.promote(r.memoryId);l(p,i(p).map(a=>a.memory.id===s.id?{...a,memory:{...a.memory,retentionStrength:s.retentionStrength??a.memory.retentionStrength}}:a),!0),o.setText(y())}catch(s){l(h,s instanceof Error?s.message:"UNKNOWN IMPORTANCE PROMOTE ERROR",!0),o.setText(y())}}var d=yt();mt("mhrd3u",t=>{rt(()=>{lt.title="Importance · Vestige"})});var X=at(d);{let t=st(()=>`real-importance-field:${i(R)}`);pt(X,{demo:"recall-path",get seed(){return i(t)},onready:U})}ct(d),ut(d,t=>l(c,t),()=>i(c)),F("pointerdown",d,K),F("pointermove",d,V),Z("pointerleave",d,G),nt($,d),ot()}q(["pointerdown","pointermove"]);export{Nt as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/13.z1_JLKKx.js.br b/apps/dashboard/build/_app/immutable/nodes/13.z1_JLKKx.js.br deleted file mode 100644 index 48668cb..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/13.z1_JLKKx.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/13.z1_JLKKx.js.gz b/apps/dashboard/build/_app/immutable/nodes/13.z1_JLKKx.js.gz deleted file mode 100644 index ee3c308..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/13.z1_JLKKx.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/14.B4QyiRph.js b/apps/dashboard/build/_app/immutable/nodes/14.B4QyiRph.js deleted file mode 100644 index fbebb93..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/14.B4QyiRph.js +++ /dev/null @@ -1 +0,0 @@ -var J=Object.defineProperty;var K=(d,c,p)=>c in d?J(d,c,{enumerable:!0,configurable:!0,writable:!0,value:p}):d[c]=p;var S=(d,c,p)=>K(d,typeof c!="symbol"?c+"":c,p);import"../chunks/Bzak7iHL.js";import{o as X,a as q}from"../chunks/DAau0uzT.js";import{p as Q,d as g,e as w,b as Z,h as ee,g as r,s as i,u as v,$ as te}from"../chunks/CGq8RnJq.js";import{h as re}from"../chunks/De_e6MzK.js";import{a as D}from"../chunks/D35IQVqe.js";import{R as se}from"../chunks/Cqe0su6e.js";import{r as R,C as ne,R as P,I as ie}from"../chunks/BMB5u1EX.js";import{T as ae}from"../chunks/D7ozXiSB.js";import{L as oe,F as ce,l as le}from"../chunks/BeGBxCGK.js";function Te(d,c){Q(c,!0);const p=[...R(ne.forward),1],U=[...R(P.luciferin),.88],z=[...R(ie.veto),.92],C=[...R(P.recall),.62],b=36,I="active",F="all";let a=g(w([])),N=g(w([])),y=g(0),m=g(I),T=g(!0),f=g(null),E=g(null),u=null;X(()=>{A(I)}),q(()=>{u==null||u.dispose(),u=null});async function A(e=r(m)){i(m,e,!0),i(T,!0),i(f,null),L();try{const[t,n]=await Promise.all([D.intentions(e),D.predict()]);i(a,t.intentions||[],!0),i(N,n.predictions??[],!0),i(y,t.total??r(a).length,!0)}catch(t){i(a,[],!0),i(N,[],!0),i(y,0),i(f,t instanceof Error?t.message:"UNKNOWN INTENTION FETCH ERROR",!0)}finally{i(T,!1),L()}}function W(e,t){const n=new Y(e);n.uploadScene(t);const s=new ae(e);return u=s,s.init().then(()=>L()),s.setText(O()),[n,s]}class Y{constructor(t){S(this,"field");this.field=new oe(t)}uploadScene(t){const n=t.nodes.map(o=>({id:o.source.id,score:o.activation??o.retention,hue:ce.forward,energy:o.activation,metric2:o.retention,selected:o.source.id===r(E),kind:"intention",payload:o})),s=n.length<4;this.field.setCells(le(n,{maxRadius:.82,minCellR:s?.24:.025,maxCellR:s?.32:.075}))}compute(t){this.field.compute(t)}render(t){this.field.render(t)}pickAt(t,n){return this.field.pickAt(t,n)}dispose(){this.field.dispose()}}function L(){u==null||u.setText(O())}function l(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function h(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}function k(e,t){return typeof e=="number"?h(e):t}function M(e){const t=k(e.retention??e.retentionStrength,Number.NaN);if(Number.isFinite(t))return t;const n=typeof e.reminder_count=="number"?e.reminder_count:0,s=Array.isArray(e.related_memories)?e.related_memories.length:0;return h((n+s+1)/6)}function $(e){return k(e.confidence,h((e.priority||2)/4))}function G(e){try{const t=JSON.parse(e.trigger_data||"{}"),n=t.condition??t.topic??t.at??t.in_minutes??t.inMinutes??t.codebase;return l(String(n??e.trigger_type)).replace(/\s+/g," ").slice(0,26)}catch{return l(e.trigger_type).slice(0,26)}}function H(e){const t=l(e.content).replace(/\s+/g," ").trim().slice(0,48),n=l(e.status).slice(0,12),s=G(e);return l(`${t} | ${e.id.slice(0,8)} | p${e.priority} | ${n} | ${s}`)}function x(e,t=C){return{id:"intentions:status",kind:"intention-status",text:l(e),x:-.58,y:.02,size:.044,color:t,depth:.78,weight:.62,revealSpan:32,maxWidthEm:50}}function O(){if(r(T))return[x("LOADING INTENTION FIELD...",p)];if(r(f))return[x(`ERROR - ${r(f)}`.slice(0,72),z)];if(r(a).length===0)return[x(`EMPTY ${r(m).toUpperCase()} INTENTION FIELD`,C)];const e=r(a).slice(0,b),t=.72,n=1.5/Math.max(1,b-1);return e.map((s,o)=>{const B=`intent:${s.id}`,_=r(E)===s.id;return{id:B,kind:"intention",intentionId:s.id,text:H(s),x:-.88,y:t-o*n,size:_?.031:.026,color:_?U:p,depth:_?1:$(s),weight:M(s),startFrame:o*2,revealSpan:20,maxWidthEm:52,hitPadX:.03,hitPadY:.015}})}const V=v(()=>({organ:"intentions",nodes:[...r(a).map((e,t)=>({source:{kind:"receipt",id:e.id},index:t,label:l(e.content).slice(0,48),retention:M(e),activation:$(e),trust:$(e),tags:e.tags??[e.status,e.trigger_type].filter(Boolean),type:e.trigger_type})),...r(N).map((e,t)=>({source:{kind:"memory",id:e.id},index:r(a).length+t,label:l(e.content).slice(0,48),retention:h(e.retention),activation:e.predictedNeed==="high"?1:e.predictedNeed==="medium"?.65:.35,trust:h(e.retention),tags:[e.predictedNeed],type:e.nodeType}))],edges:[],events:[],receipts:r(a).map((e,t)=>({source:{kind:"receipt",id:e.id},label:l(e.status),nodeIndices:[t]})),scalars:{total:r(y),visible:r(a).length,predicted:r(N).length,filter:r(m)===F?1:0},alive:r(a).length>0}));function j(e){if(e.kind!=="intention")return;const t=e.payload;i(E,t.intentionId??null,!0),L(),A(r(m)===I?F:I)}re("16y0tkj",e=>{ee(()=>{te.title="Intentions · Vestige"})});{let e=v(()=>`real-intention-field:${r(m)}:${r(y)}:${r(E)??"none"}`),t=v(()=>`EMPTY ${r(m).toUpperCase()} INTENTION FIELD`);se(d,{organ:"intentions",get seed(){return r(e)},get scene(){return r(V)},passes:W,get loading(){return r(T)},get error(){return r(f)},get emptyLabel(){return r(t)},onpick:j})}Z()}export{Te as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/14.B4QyiRph.js.br b/apps/dashboard/build/_app/immutable/nodes/14.B4QyiRph.js.br deleted file mode 100644 index 4550117..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/14.B4QyiRph.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/14.B4QyiRph.js.gz b/apps/dashboard/build/_app/immutable/nodes/14.B4QyiRph.js.gz deleted file mode 100644 index d3504fe..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/14.B4QyiRph.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/14.CuNExVd0.js b/apps/dashboard/build/_app/immutable/nodes/14.CuNExVd0.js new file mode 100644 index 0000000..ca7d60f --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/14.CuNExVd0.js @@ -0,0 +1 @@ +var Q=Object.defineProperty;var Z=(p,c,m)=>c in p?Q(p,c,{enumerable:!0,configurable:!0,writable:!0,value:m}):p[c]=m;var P=(p,c,m)=>Z(p,typeof c!="symbol"?c+"":c,m);import"../chunks/Bzak7iHL.js";import{o as ee,a as te}from"../chunks/DAau0uzT.js";import{p as re,d as g,e as D,b as ne,h as ie,g as r,s as o,u as v,$ as se}from"../chunks/CGq8RnJq.js";import{h as oe}from"../chunks/De_e6MzK.js";import{a as U}from"../chunks/D35IQVqe.js";import{R as ae}from"../chunks/BpEKQwpr.js";import{r as y,C as ce,R as W,I as z}from"../chunks/BMB5u1EX.js";import{T as le}from"../chunks/D7ozXiSB.js";import{L as ue,F as de,l as pe}from"../chunks/DETSv_kY.js";function Ce(p,c){re(c,!0);const m=[...y(ce.forward),1],Y=[...y(W.luciferin),.88],G=[...y(z.veto),.92],F=[...y(W.recall),.62],H=[...y(z.caution),.9],_=36,h="active",O="all";let a=g(D([])),E=g(D([])),T=g(0),u=g(h),L=g(!0),I=g(null),C=g(null),d=null;ee(()=>{b(h)}),te(()=>{d==null||d.dispose(),d=null});async function b(e=r(u)){o(u,e,!0),o(L,!0),o(I,null),R();try{const[t,n]=await Promise.all([U.intentions(e),U.predict()]);o(a,t.intentions||[],!0),o(E,n.predictions??[],!0),o(T,t.total??r(a).length,!0)}catch(t){o(a,[],!0),o(E,[],!0),o(T,0),o(I,t instanceof Error?t.message:"UNKNOWN INTENTION FETCH ERROR",!0)}finally{o(L,!1),R()}}function V(e,t){const n=new K(e);n.uploadScene(t);const i=new le(e);return d=i,i.init().then(()=>R()),i.setText(w()),[n,i]}class K{constructor(t){P(this,"field");this.field=new ue(t)}uploadScene(t){const n=t.nodes.map(s=>({id:s.source.id,score:s.activation??s.retention,hue:de.forward,energy:s.activation,metric2:s.retention,selected:s.source.id===r(C),kind:"intention",payload:s})),i=n.length<4;this.field.setCells(pe(n,{maxRadius:.82,minCellR:i?.22:.025,maxCellR:i?.3:.075}))}compute(t){this.field.compute(t)}render(t){this.field.render(t)}pickAt(t,n){return this.field.pickAt(t,n)}dispose(){this.field.dispose()}}function R(){d==null||d.setText(w())}function l(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function N(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}function S(e,t){return typeof e=="number"?N(e):t}function k(e){const t=S(e.retention??e.retentionStrength,Number.NaN);if(Number.isFinite(t))return t;const n=typeof e.reminder_count=="number"?e.reminder_count:0,i=Array.isArray(e.related_memories)?e.related_memories.length:0;return N((n+i+1)/6)}function x(e){return S(e.confidence,N((e.priority||2)/4))}function B(e){try{const t=JSON.parse(e.trigger_data||"{}"),n=t.condition??t.topic??t.at??t.in_minutes??t.inMinutes??t.codebase;return l(String(n??e.trigger_type)).replace(/\s+/g," ").slice(0,26)}catch{return l(e.trigger_type).slice(0,26)}}function X(e){const t=l(e.content).replace(/\s+/g," ").trim().slice(0,48),n=l(e.status).slice(0,12),i=B(e);return l(`${t} | ${e.id.slice(0,8)} | p${e.priority} | ${n} | ${i}`)}function $(e,t=F){return{id:"intentions:status",kind:"intention-status",text:l(e),x:-.58,y:.02,size:.044,color:t,depth:.78,weight:.62,revealSpan:32,maxWidthEm:50}}function M(){return{id:"intentions:filter",kind:"intention-filter",text:r(u)===h?"[ SHOWING: ACTIVE - CLICK FOR ALL ]":"[ SHOWING: ALL - CLICK FOR ACTIVE ]",x:-.94,y:.9,size:.024,color:H,depth:1,weight:.7,revealSpan:12,maxWidthEm:40,hitPadX:.03,hitPadY:.03}}function w(){if(r(L))return[$("LOADING INTENTION FIELD...",m)];if(r(I))return[$(`ERROR - ${r(I)}`.slice(0,72),G)];if(r(a).length===0)return[M(),$(`EMPTY ${r(u).toUpperCase()} INTENTION FIELD`,F)];const e=[M()],t=r(a).slice(0,_),n=.72,i=1.5/Math.max(1,_-1);for(let s=0;s({organ:"intentions",nodes:[...r(a).map((e,t)=>({source:{kind:"receipt",id:e.id},index:t,label:l(e.content).slice(0,48),retention:k(e),activation:x(e),trust:x(e),tags:e.tags??[e.status,e.trigger_type].filter(Boolean),type:e.trigger_type})),...r(E).map((e,t)=>({source:{kind:"memory",id:e.id},index:r(a).length+t,label:l(e.content).slice(0,48),retention:N(e.retention),activation:e.predictedNeed==="high"?1:e.predictedNeed==="medium"?.65:.35,trust:N(e.retention),tags:[e.predictedNeed],type:e.nodeType}))],edges:[],events:[],receipts:r(a).map((e,t)=>({source:{kind:"receipt",id:e.id},label:l(e.status),nodeIndices:[t]})),scalars:{total:r(T),visible:r(a).length,predicted:r(E).length,filter:r(u)===O?1:0},alive:r(a).length>0}));function J(e){var n;if(e.kind==="intention-filter"){b(r(u)===h?O:h);return}if(e.kind!=="intention")return;const t=e.payload;o(C,t.intentionId??((n=t.source)==null?void 0:n.id)??null,!0),R()}oe("16y0tkj",e=>{ie(()=>{se.title="Intentions · Vestige"})});{let e=v(()=>`real-intention-field:${r(u)}:${r(T)}:${r(C)??"none"}`),t=v(()=>`EMPTY ${r(u).toUpperCase()} INTENTION FIELD`);ae(p,{organ:"intentions",get seed(){return r(e)},get scene(){return r(j)},passes:V,get loading(){return r(L)},get error(){return r(I)},get emptyLabel(){return r(t)},onpick:J})}ne()}export{Ce as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/14.CuNExVd0.js.br b/apps/dashboard/build/_app/immutable/nodes/14.CuNExVd0.js.br new file mode 100644 index 0000000..8c65e6d Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/14.CuNExVd0.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/14.CuNExVd0.js.gz b/apps/dashboard/build/_app/immutable/nodes/14.CuNExVd0.js.gz new file mode 100644 index 0000000..04eb420 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/14.CuNExVd0.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/15.-ohAmwvw.js b/apps/dashboard/build/_app/immutable/nodes/15.-ohAmwvw.js deleted file mode 100644 index af1104e..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/15.-ohAmwvw.js +++ /dev/null @@ -1 +0,0 @@ -import"../chunks/Bzak7iHL.js";import{d as j,o as J,a as Q,b as $,e as Z}from"../chunks/DAau0uzT.js";import{p as P,d as f,e as b,a as ee,b as te,h as re,g as i,f as ne,u as oe,c as ie,s as a,$ as se,r as ae}from"../chunks/CGq8RnJq.js";import{h as le}from"../chunks/De_e6MzK.js";import{b as ue}from"../chunks/Ccqjq5DS.js";import{r as T,O as ce,a as de}from"../chunks/BMB5u1EX.js";import{a as M}from"../chunks/D35IQVqe.js";import{T as me}from"../chunks/D7ozXiSB.js";import{L as pe,l as he}from"../chunks/BeGBxCGK.js";var fe=ne('
');function Ie(k,A){P(A,!0);const O=[...T("#22C7DE"),1],F=[...T("#FF3B30"),.92],N=[...T("#29F2A9"),.62],Y=40,L=36,_=.62,W=-1e5;let c=f(null),d=null,r=null,l=null,E=null,y=f(b(new Set)),m=f(b([])),R=f(0),v=f(!0),h=f(null),w=null;J(()=>{K()}),Q(()=>{r==null||r.dispose(),l==null||l.dispose(),r=null,l=null,d=null});async function B(e){d=e;const t=new pe(e);l=t,t.setCells(C()),e.addPass(t);const n=new me(e);r=n,await n.init(),n.setText(x()),e.addPass(n),e.demoClock.reset()}function C(){const e=i(m).map(t=>{const n=g(t.retentionStrength);return{id:t.id,score:g(t.retrievalStrength??n),hue:de(n),energy:.4+.6*g(t.retrievalStrength??n),metric2:n,scar:i(y).has(t.id),kind:"memory",payload:t}});return he(e,{maxRadius:.95,minCellR:.014,maxCellR:.05})}async function K(){a(v,!0),a(h,null),r==null||r.setText(x());try{const e=await M.memories.list({limit:String(Y)});a(m,e.memories,!0),a(R,e.total,!0)}catch(e){a(m,[],!0),a(R,0),a(h,e instanceof Error?e.message:"UNKNOWN MEMORY FETCH ERROR",!0)}finally{a(v,!1),r==null||r.setText(x()),l==null||l.setCells(C()),d==null||d.demoClock.reset()}}function I(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function z(e){const t=I(e.content).replace(/\s+/g," ").trim().slice(0,52);return I(`${t} | ${e.id.slice(0,8)} | ${Math.round(e.retentionStrength*100)}%`)}function g(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}function S(e,t=N){return{id:"memories:status",kind:"memory-status",text:I(e),x:-.58,y:.02,size:.044,color:t,depth:.78,weight:.62,revealSpan:32,maxWidthEm:50}}function x(){if(i(v))return[S("LOADING MEMORY FIELD...",O)];if(i(h))return[S(`ERROR - ${i(h)}`.slice(0,72),F)];if(i(m).length===0)return[S("EMPTY MEMORY FIELD",N)];const e=i(m).slice(0,L),t=.72,n=1.5/Math.max(1,L-1);return e.map((o,s)=>{const u=g(o.retrievalStrength),q=g(o.retentionStrength);return{id:`mem:${o.id}`,kind:"memory",memoryId:o.id,text:z(o),x:-.88,y:t-s*n,size:.026,color:O,depth:Math.max(_,u),weight:q,startFrame:W+s*2,revealSpan:20,maxWidthEm:46,hitPadX:.03,hitPadY:.015}})}function D(e){if(!i(c))return null;const t=i(c).getBoundingClientRect();return t.width<=0||t.height<=0?null:{x:(e.clientX-t.left)/t.width*2-1,y:-((e.clientY-t.top)/t.height*2-1)}}function H(e){if(!i(c)||!d)return;const t=i(c).getBoundingClientRect(),n=Math.max(1e-4,t.width/Math.max(1,t.height)),o={x:e.x*Math.max(n,1),y:e.y/Math.min(n,1)},s=E??o,u={x:s.x+(o.x-s.x)*.35,y:s.y+(o.y-s.y)*.35};E=u,d.setCursorPreNdc(u.x,u.y,u.x-s.x,u.y-s.y)}function U(e){const t=D(e);if(!t)return;H(t);const n=(r==null?void 0:r.pickAt(t.x,t.y))??null,o=(n==null?void 0:n.kind)==="memory"?n.id:null;o!==w&&(w=o,r==null||r.setRunDepth(o,1)),i(c)&&(i(c).style.cursor=o?"crosshair":"default")}function V(){E=null,w=null,d==null||d.setCursorPreNdc(999,999,0,0),r==null||r.setRunDepth(null),i(c)&&(i(c).style.cursor="default")}async function G(e){const t=D(e);if(!t||!r)return;const n=r.pickAt(t.x,t.y);if((n==null?void 0:n.kind)!=="memory")return;const o=n.payload;if(o.memoryId)try{if(e.shiftKey)await M.memories.suppress(o.memoryId,"suppressed from memories field"),a(y,new Set(i(y)).add(o.memoryId),!0);else if(e.altKey){await M.memories.unsuppress(o.memoryId);const s=new Set(i(y));s.delete(o.memoryId),a(y,s,!0)}else{const s=await M.memories.promote(o.memoryId);a(m,i(m).map(u=>u.id===s.id?{...u,retentionStrength:s.retentionStrength}:u),!0)}a(h,null),r.setText(x()),l==null||l.setCells(C())}catch(s){a(h,s instanceof Error?s.message:"UNKNOWN MEMORY ACTION ERROR",!0),r.setText(x())}}var p=fe();le("1mq4kpt",e=>{re(()=>{se.title="Memories · Vestige"})});var X=ie(p);{let e=oe(()=>`real-memory-field:${i(R)}`);ce(X,{demo:"recall-path",get seed(){return i(e)},onready:B})}ae(p),ue(p,e=>a(c,e),()=>i(c)),$("pointerdown",p,G),$("pointermove",p,U),Z("pointerleave",p,V),ee(k,p),te()}j(["pointerdown","pointermove"]);export{Ie as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/15.-ohAmwvw.js.br b/apps/dashboard/build/_app/immutable/nodes/15.-ohAmwvw.js.br deleted file mode 100644 index a95a7fd..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/15.-ohAmwvw.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/15.-ohAmwvw.js.gz b/apps/dashboard/build/_app/immutable/nodes/15.-ohAmwvw.js.gz deleted file mode 100644 index 1dec454..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/15.-ohAmwvw.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/15.D2EVaO6c.js b/apps/dashboard/build/_app/immutable/nodes/15.D2EVaO6c.js new file mode 100644 index 0000000..973fbf2 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/15.D2EVaO6c.js @@ -0,0 +1 @@ +import"../chunks/Bzak7iHL.js";import{d as Q,o as Z,a as P,b,e as ee}from"../chunks/DAau0uzT.js";import{p as te,d as f,e as k,a as re,b as ne,h as oe,g as s,f as se,u as ie,c as ae,s as l,$ as le,r as ue}from"../chunks/CGq8RnJq.js";import{h as ce}from"../chunks/De_e6MzK.js";import{b as de}from"../chunks/Ccqjq5DS.js";import{r as L,O as me,a as pe}from"../chunks/BMB5u1EX.js";import{a as v}from"../chunks/D35IQVqe.js";import{T as he}from"../chunks/D7ozXiSB.js";import{L as fe,l as ye}from"../chunks/DETSv_kY.js";var ge=se('
');function Te(A,F){te(F,!0);const O=[...L("#22C7DE"),1],Y=[...L("#FF3B30"),.92],N=[...L("#29F2A9"),.62],_=40,D=36,W=.62,B=-1e5;let c=f(null),d=null,n=null,u=null,E=null,y=f(k(new Set)),m=f(k([])),w=f(0),R=f(!0),h=f(null),C=null,M=null;Z(()=>{H()}),P(()=>{M==null||M(),n==null||n.dispose(),u==null||u.dispose(),n=null,u=null,d=null});function K(e){if(typeof window>"u")return()=>{};const t=window.matchMedia("(prefers-reduced-motion: reduce)");e.setPaused(t.matches);const r=o=>e.setPaused(o.matches);return t.addEventListener("change",r),()=>t.removeEventListener("change",r)}async function z(e){d=e,M=K(e);const t=new fe(e);u=t,t.setCells(I()),e.addPass(t);const r=new he(e);n=r,await r.init(),r.setText(x()),e.addPass(r),e.demoClock.reset()}function I(){const e=s(m).map(t=>{const r=g(t.retentionStrength);return{id:t.id,score:g(t.retrievalStrength??r),hue:pe(r),energy:.4+.6*g(t.retrievalStrength??r),metric2:r,scar:s(y).has(t.id),kind:"memory",payload:t}});return ye(e,{maxRadius:.95,minCellR:.014,maxCellR:.05})}async function H(){l(R,!0),l(h,null),n==null||n.setText(x());try{const e=await v.memories.list({limit:String(_)});l(m,e.memories,!0),l(w,e.total,!0)}catch(e){l(m,[],!0),l(w,0),l(h,e instanceof Error?e.message:"UNKNOWN MEMORY FETCH ERROR",!0)}finally{l(R,!1),n==null||n.setText(x()),u==null||u.setCells(I()),d==null||d.demoClock.reset()}}function S(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function U(e){const t=S(e.content).replace(/\s+/g," ").trim().slice(0,52);return S(`${t} | ${e.id.slice(0,8)} | ${Math.round(e.retentionStrength*100)}%`)}function g(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}function T(e,t=N){return{id:"memories:status",kind:"memory-status",text:S(e),x:-.58,y:.02,size:.044,color:t,depth:.78,weight:.62,revealSpan:32,maxWidthEm:50}}function x(){if(s(R))return[T("LOADING MEMORY FIELD...",O)];if(s(h))return[T(`ERROR - ${s(h)}`.slice(0,72),Y)];if(s(m).length===0)return[T("EMPTY MEMORY FIELD",N)];const e=s(m).slice(0,D),t=.72,r=1.5/Math.max(1,D-1);return e.map((o,i)=>{const a=g(o.retrievalStrength),J=g(o.retentionStrength);return{id:`mem:${o.id}`,kind:"memory",memoryId:o.id,text:U(o),x:-.88,y:t-i*r,size:.026,color:O,depth:Math.max(W,a),weight:J,startFrame:B+i*2,revealSpan:20,maxWidthEm:46,hitPadX:.03,hitPadY:.015}})}function $(e){if(!s(c))return null;const t=s(c).getBoundingClientRect();return t.width<=0||t.height<=0?null:{x:(e.clientX-t.left)/t.width*2-1,y:-((e.clientY-t.top)/t.height*2-1)}}function V(e){if(!s(c)||!d)return;const t=s(c).getBoundingClientRect(),r=Math.max(1e-4,t.width/Math.max(1,t.height)),o={x:e.x*Math.max(r,1),y:e.y/Math.min(r,1)},i=E??o,a={x:i.x+(o.x-i.x)*.35,y:i.y+(o.y-i.y)*.35};E=a,d.setCursorPreNdc(a.x,a.y,a.x-i.x,a.y-i.y)}function q(e){const t=$(e);if(!t)return;V(t);const r=(n==null?void 0:n.pickAt(t.x,t.y))??null,o=(r==null?void 0:r.kind)==="memory"?r.id:null;o!==C&&(C=o,n==null||n.setRunDepth(o,1)),s(c)&&(s(c).style.cursor=o?"crosshair":"default")}function G(){E=null,C=null,d==null||d.setCursorPreNdc(999,999,0,0),n==null||n.setRunDepth(null),s(c)&&(s(c).style.cursor="default")}async function X(e){const t=$(e);if(!t||!n)return;const r=n.pickAt(t.x,t.y);if((r==null?void 0:r.kind)!=="memory")return;const o=r.payload;if(o.memoryId)try{if(e.shiftKey)await v.memories.suppress(o.memoryId,"suppressed from memories field"),l(y,new Set(s(y)).add(o.memoryId),!0);else if(e.altKey){if(!(await v.memories.unsuppress(o.memoryId)).stillSuppressed){const a=new Set(s(y));a.delete(o.memoryId),l(y,a,!0)}}else{const i=await v.memories.promote(o.memoryId);l(m,s(m).map(a=>a.id===i.id?{...a,retentionStrength:i.retentionStrength}:a),!0)}l(h,null),n.setText(x()),u==null||u.setCells(I())}catch(i){l(h,i instanceof Error?i.message:"UNKNOWN MEMORY ACTION ERROR",!0),n.setText(x())}}var p=ge();ce("1mq4kpt",e=>{oe(()=>{le.title="Memories · Vestige"})});var j=ae(p);{let e=ie(()=>`real-memory-field:${s(w)}`);me(j,{demo:"recall-path",get seed(){return s(e)},onready:z})}ue(p),de(p,e=>l(c,e),()=>s(c)),b("pointerdown",p,X),b("pointermove",p,q),ee("pointerleave",p,G),re(A,p),ne()}Q(["pointerdown","pointermove"]);export{Te as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/15.D2EVaO6c.js.br b/apps/dashboard/build/_app/immutable/nodes/15.D2EVaO6c.js.br new file mode 100644 index 0000000..b5f8821 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/15.D2EVaO6c.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/15.D2EVaO6c.js.gz b/apps/dashboard/build/_app/immutable/nodes/15.D2EVaO6c.js.gz new file mode 100644 index 0000000..d24ad21 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/15.D2EVaO6c.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/16.BHQZgsg5.js b/apps/dashboard/build/_app/immutable/nodes/16.BHQZgsg5.js new file mode 100644 index 0000000..49a86f4 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/16.BHQZgsg5.js @@ -0,0 +1 @@ +var Y=Object.defineProperty;var z=(m,c,u)=>c in m?Y(m,c,{enumerable:!0,configurable:!0,writable:!0,value:u}):m[c]=u;var I=(m,c,u)=>z(m,typeof c!="symbol"?c+"":c,u);import"../chunks/Bzak7iHL.js";import{o as j}from"../chunks/DAau0uzT.js";import{p as H,d as g,e as b,j as K,b as V,s as a,h as B,g as i,u as O,$ as G}from"../chunks/CGq8RnJq.js";import{h as X}from"../chunks/De_e6MzK.js";import{a as q,s as J}from"../chunks/DV6OI5iy.js";import{a as T}from"../chunks/D35IQVqe.js";import{m as Q}from"../chunks/Ch9vNiEl.js";import{R as Z}from"../chunks/BpEKQwpr.js";import{r as P,I as ee,R as te}from"../chunks/BMB5u1EX.js";import{T as re}from"../chunks/D7ozXiSB.js";import{L as se,F as ne,l as ie}from"../chunks/DETSv_kY.js";function Re(m,c){H(c,!0);const u=()=>q(Q,"$memoryPrEvents",k),[k,_]=J(),v=[...P("#22C7DE"),1],F=[...P(ee.caution),.9],S=[...P(te.recall),.62],f=28,A=100,$=-1e5;let l=g(b([])),d=g(b([])),R=g(!0),y=g(null);j(()=>{x()});async function x(){a(R,!0),a(y,null);try{const e=await T.memoryPrs.list(void 0,A);a(l,e.prs,!0),a(d,[],!0)}catch(e){a(l,[],!0),a(d,[],!0),a(y,e instanceof Error?e.message:"UNKNOWN MEMORY PR FETCH ERROR",!0)}finally{a(R,!1)}}K(()=>{u().length&&x()});function h(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function C(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}function M(e,t){if(typeof e=="number"&&Number.isFinite(e))return e;if(!e||typeof e!="object")return null;const n=e;for(const r of t){const s=n[r];if(typeof s=="number"&&Number.isFinite(s))return s}for(const r of Object.values(n)){const s=M(r,t);if(s!==null)return s}return null}function E(e){const t=M(e.diff,["confidence","trust","contradictsTrust","contradicts_trust"]);return t!==null?C(t>1?t/100:t):.5}function w(e){return h(`${e.title} | ${e.id.slice(0,8)} | ${e.status}`).replace(/\s+/g," ").trim().slice(0,96)}function N(){const e=i(l).slice(0,f),t=.74,n=1.46/Math.max(1,f-1),r=e.map((o,p)=>({id:`memory-pr:${o.id}`,kind:"memory-pr",prId:o.id,text:w(o),x:-.9,y:t-p*n,size:.025,color:o.status==="pending"?v:S,depth:E(o),weight:1,startFrame:$+p*2,revealSpan:20,maxWidthEm:54,hitPadX:.03,hitPadY:.019})),s=i(d).slice(0,5).map((o,p)=>({id:`memory-pr-why:${o.code}:${p}`,kind:"memory-pr-why",text:h(`${o.code}: ${o.detail}`).replace(/\s+/g," ").trim().slice(0,86),x:-.82,y:-.76-p*.052,size:.02,color:F,depth:.72,weight:.8,startFrame:$+(e.length+p)*2,revealSpan:18,maxWidthEm:56}));return[...r,...s]}let L=O(()=>({organ:"memory-prs",nodes:i(l).slice(0,f).map((e,t)=>({source:{kind:"pr",id:e.id},index:t,label:w(e),retention:1,activation:E(e),trust:E(e),tags:e.signals.map(n=>h(n.code)),type:h(e.kind)})),edges:[],events:[],receipts:[],scalars:{visiblePrs:Math.min(i(l).length,f),whySignals:i(d).length},alive:i(l).length>0}));function D(e,t){const n=new U(e);n.uploadScene(t);const r=new re(e);return r.init().then(()=>r.setText(N())),[n,{render:s=>r.render(s),uploadScene:()=>r.setText(N()),pickAt:(s,o)=>r.pickAt(s,o),dispose:()=>r.dispose()}]}class U{constructor(t){I(this,"field");this.field=new se(t)}uploadScene(t){const n=t.nodes.map(r=>{var s;return{id:r.source.id,score:r.activation??.5,hue:ne.caution,energy:r.activation,metric2:r.trust,scar:(((s=r.tags)==null?void 0:s.length)??0)>1,kind:"memory-pr",payload:r}});this.field.setCells(ie(n,{maxRadius:.9,minCellR:.035,maxCellR:.09}))}compute(t){this.field.compute(t)}render(t){this.field.render(t)}pickAt(t,n){return this.field.pickAt(t,n)}dispose(){this.field.dispose()}}async function W(e){var r;if(e.kind!=="memory-pr")return;const t=e.payload,n=t.prId??((r=t.source)==null?void 0:r.id);if(n)try{const s=await T.memoryPrs.act(n,"ask_agent_why");a(d,s.why??[],!0)}catch(s){a(y,s instanceof Error?s.message:"UNKNOWN MEMORY PR ACTION ERROR",!0)}}X("c1wbiz",e=>{B(()=>{G.title="Memory PRs · Vestige"})});{let e=O(()=>`memory-pr-field:${i(l).length}:${i(d).length}`);Z(m,{organ:"memory-prs",get seed(){return i(e)},get scene(){return i(L)},passes:D,get loading(){return i(R)},get error(){return i(y)},emptyLabel:"NO MEMORY PRS",onpick:W})}V(),_()}export{Re as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/16.BHQZgsg5.js.br b/apps/dashboard/build/_app/immutable/nodes/16.BHQZgsg5.js.br new file mode 100644 index 0000000..aee9abb Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/16.BHQZgsg5.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/16.BHQZgsg5.js.gz b/apps/dashboard/build/_app/immutable/nodes/16.BHQZgsg5.js.gz new file mode 100644 index 0000000..5ffa64b Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/16.BHQZgsg5.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/16.Dp0Kyz4w.js b/apps/dashboard/build/_app/immutable/nodes/16.Dp0Kyz4w.js deleted file mode 100644 index 0825c49..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/16.Dp0Kyz4w.js +++ /dev/null @@ -1 +0,0 @@ -var Y=Object.defineProperty;var z=(m,c,u)=>c in m?Y(m,c,{enumerable:!0,configurable:!0,writable:!0,value:u}):m[c]=u;var I=(m,c,u)=>z(m,typeof c!="symbol"?c+"":c,u);import"../chunks/Bzak7iHL.js";import{o as j}from"../chunks/DAau0uzT.js";import{p as H,d as g,e as b,j as K,b as V,s as a,h as B,g as i,u as O,$ as G}from"../chunks/CGq8RnJq.js";import{h as X}from"../chunks/De_e6MzK.js";import{a as q,s as J}from"../chunks/DV6OI5iy.js";import{a as T}from"../chunks/D35IQVqe.js";import{m as Q}from"../chunks/Ch9vNiEl.js";import{R as Z}from"../chunks/Cqe0su6e.js";import{r as P,I as ee,R as te}from"../chunks/BMB5u1EX.js";import{T as re}from"../chunks/D7ozXiSB.js";import{L as se,F as ne,l as ie}from"../chunks/BeGBxCGK.js";function Re(m,c){H(c,!0);const u=()=>q(Q,"$memoryPrEvents",k),[k,_]=J(),v=[...P("#22C7DE"),1],F=[...P(ee.caution),.9],S=[...P(te.recall),.62],f=28,A=100,$=-1e5;let l=g(b([])),d=g(b([])),R=g(!0),h=g(null);j(()=>{x()});async function x(){a(R,!0),a(h,null);try{const e=await T.memoryPrs.list(void 0,A);a(l,e.prs,!0),a(d,[],!0)}catch(e){a(l,[],!0),a(d,[],!0),a(h,e instanceof Error?e.message:"UNKNOWN MEMORY PR FETCH ERROR",!0)}finally{a(R,!1)}}K(()=>{u().length&&x()});function y(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function C(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}function M(e,t){if(typeof e=="number"&&Number.isFinite(e))return e;if(!e||typeof e!="object")return null;const s=e;for(const r of t){const n=s[r];if(typeof n=="number"&&Number.isFinite(n))return n}for(const r of Object.values(s)){const n=M(r,t);if(n!==null)return n}return null}function E(e){const t=M(e.diff,["confidence","trust","contradictsTrust","contradicts_trust"]);return t!==null?C(t>1?t/100:t):.5}function w(e){return y(`${e.title} | ${e.id.slice(0,8)} | ${e.status}`).replace(/\s+/g," ").trim().slice(0,96)}function N(){const e=i(l).slice(0,f),t=.74,s=1.46/Math.max(1,f-1),r=e.map((o,p)=>({id:`memory-pr:${o.id}`,kind:"memory-pr",prId:o.id,text:w(o),x:-.9,y:t-p*s,size:.025,color:o.status==="pending"?v:S,depth:E(o),weight:1,startFrame:$+p*2,revealSpan:20,maxWidthEm:54,hitPadX:.03,hitPadY:.019})),n=i(d).slice(0,5).map((o,p)=>({id:`memory-pr-why:${o.code}:${p}`,kind:"memory-pr-why",text:y(`${o.code}: ${o.detail}`).replace(/\s+/g," ").trim().slice(0,86),x:-.82,y:-.76-p*.052,size:.02,color:F,depth:.72,weight:.8,startFrame:$+(e.length+p)*2,revealSpan:18,maxWidthEm:56}));return[...r,...n]}let L=O(()=>({organ:"memory-prs",nodes:i(l).slice(0,f).map((e,t)=>({source:{kind:"pr",id:e.id},index:t,label:w(e),retention:1,activation:E(e),trust:E(e),tags:e.signals.map(s=>y(s.code)),type:y(e.kind)})),edges:[],events:[],receipts:[],scalars:{visiblePrs:Math.min(i(l).length,f),whySignals:i(d).length},alive:i(l).length>0}));function D(e,t){const s=new U(e);s.uploadScene(t);const r=new re(e);return r.init().then(()=>r.setText(N())),[s,{render:n=>r.render(n),uploadScene:()=>r.setText(N()),pickAt:(n,o)=>r.pickAt(n,o),dispose:()=>r.dispose()}]}class U{constructor(t){I(this,"field");this.field=new se(t)}uploadScene(t){const s=t.nodes.map(r=>{var n;return{id:r.source.id,score:r.activation??.5,hue:ne.caution,energy:r.activation,metric2:r.trust,scar:(((n=r.tags)==null?void 0:n.length)??0)>1,kind:"memory-pr",payload:r}});this.field.setCells(ie(s,{maxRadius:.9,minCellR:.035,maxCellR:.09}))}compute(t){this.field.compute(t)}render(t){this.field.render(t)}pickAt(t,s){return this.field.pickAt(t,s)}dispose(){this.field.dispose()}}async function W(e){if(e.kind!=="memory-pr")return;const t=e.payload;if(t.prId)try{const s=await T.memoryPrs.act(t.prId,"ask_agent_why");a(d,s.why??[],!0)}catch(s){a(h,s instanceof Error?s.message:"UNKNOWN MEMORY PR ACTION ERROR",!0)}}X("c1wbiz",e=>{B(()=>{G.title="Memory PRs · Vestige"})});{let e=O(()=>`memory-pr-field:${i(l).length}:${i(d).length}`);Z(m,{organ:"memory-prs",get seed(){return i(e)},get scene(){return i(L)},passes:D,get loading(){return i(R)},get error(){return i(h)},emptyLabel:"NO MEMORY PRS",onpick:W})}V(),_()}export{Re as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/16.Dp0Kyz4w.js.br b/apps/dashboard/build/_app/immutable/nodes/16.Dp0Kyz4w.js.br deleted file mode 100644 index 831018d..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/16.Dp0Kyz4w.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/16.Dp0Kyz4w.js.gz b/apps/dashboard/build/_app/immutable/nodes/16.Dp0Kyz4w.js.gz deleted file mode 100644 index 4b7fce6..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/16.Dp0Kyz4w.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/17.DAadB7bO.js.br b/apps/dashboard/build/_app/immutable/nodes/17.DAadB7bO.js.br deleted file mode 100644 index 68571fb..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/17.DAadB7bO.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/17.DAadB7bO.js.gz b/apps/dashboard/build/_app/immutable/nodes/17.DAadB7bO.js.gz deleted file mode 100644 index 0ddf6ec..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/17.DAadB7bO.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/17.DAadB7bO.js b/apps/dashboard/build/_app/immutable/nodes/17.DpD2KkS8.js similarity index 98% rename from apps/dashboard/build/_app/immutable/nodes/17.DAadB7bO.js rename to apps/dashboard/build/_app/immutable/nodes/17.DpD2KkS8.js index 273e9c0..e6366f5 100644 --- a/apps/dashboard/build/_app/immutable/nodes/17.DAadB7bO.js +++ b/apps/dashboard/build/_app/immutable/nodes/17.DpD2KkS8.js @@ -1 +1 @@ -import"../chunks/Bzak7iHL.js";import{d as ie,o as le,a as ce,b as z,e as ue}from"../chunks/DAau0uzT.js";import{p as de,d as v,e as me,a as pe,b as he,h as fe,f as ye,g as a,s as p,$ as ge,c as xe,r as ve}from"../chunks/CGq8RnJq.js";import{fB as be,fC as Ce}from"../chunks/Bo4EDkTQ.js";import{h as Ee}from"../chunks/De_e6MzK.js";import{b as we}from"../chunks/Ccqjq5DS.js";import{g as G}from"../chunks/DJDK-KWF.js";import{b as W}from"../chunks/DY7cP31Q.js";import{i as Me,r as b,C as Re,R as Y,I as U,D as Ne,a as Se}from"../chunks/BMB5u1EX.js";import{T as $e}from"../chunks/D7ozXiSB.js";import{l as De,L as Oe}from"../chunks/BeGBxCGK.js";import{a as Te}from"../chunks/D35IQVqe.js";const Le=!1,ke=!1,Ve=Object.freeze(Object.defineProperty({__proto__:null,prerender:ke,ssr:Le},Symbol.toStringTag,{value:"Module"}));var _e=ye('
');function je(B,P){de(P,!0);const R=new URLSearchParams(window.location.search),k=R.get("demo")??"recall-path";let h=v(me(Me(k)?k:"recall-path"));const X=R.get("seed")??"vestige-observatory-v1",N=R.get("frame"),H=N!==null&&N!==""?Number(N):null,S=[...b(Re.forward),1],_=[...b(Y.recall),.76],$=[...b(Y.luciferin),.9],V=[...b(U.veto),.92],j=[...b(U.caution),.82],I=18;let l=v(null),i=null,n=null,d=null,C=v(null),D=v(!0),E=v(null),O=null,T=null;le(()=>{q()}),ce(()=>{n==null||n.dispose(),d==null||d.dispose(),n=null,d=null,i=null});async function K(e){i=e;const t=new Oe(e);d=t,t.setCells(A()),e.addPass(t);const r=new $e(e);n=r,await r.init(),r.setText(M()),e.addPass(r),e.demoClock.reset()}function A(){var r;const t=(((r=a(C))==null?void 0:r.nodes)??[]).map(o=>({id:o.id,score:c(o.retention),hue:Se(c(o.retention)),energy:.4+.6*c(o.retention),selected:!!o.isCenter,scar:(o.suppression_count??0)>0,metric2:c(o.retention),kind:"observatory-cell",payload:o}));return De(t,{maxRadius:.95,minCellR:.01,maxCellR:.038})}async function q(){p(D,!0),p(E,null),n==null||n.setText(M());try{p(C,await Te.graph({max_nodes:200,depth:3,sort:"connected"}),!0)}catch(e){p(C,null),p(E,e instanceof Error?e.message:"UNKNOWN OBSERVATORY GRAPH ERROR",!0)}finally{p(D,!1),n==null||n.setText(M()),d==null||d.setCells(A()),i==null||i.demoClock.reset()}}function m(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function c(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}function J(e){const[t]=e.split("-");return m(t.toUpperCase())}function w(e,t){return c(t<=0?0:e/t)}function Q(e){const t=m(e.label).replace(/\s+/g," ").trim().slice(0,44),r=e.tags[0]?m(e.tags[0]).slice(0,14):m(e.type);return m(`${t} | ${e.id.slice(0,8)} | ${r} | ${Math.round(c(e.retention)*100)}%`)}function L(e,t=$){return{id:"observatory:status",kind:"observatory-status",text:m(e),x:-.48,y:.02,size:.044,color:t,depth:.76,weight:.66,revealSpan:32,maxWidthEm:52}}function M(){const e=[],t=a(C),r=t?w(t.nodeCount,Math.max(1,t.nodes.length,200)):.5,o=t?w(t.edgeCount,Math.max(1,t.nodeCount*8)):.5;if(Ne.forEach((s,u)=>{e.push({id:`observatory:demo:${s}`,kind:"observatory-demo",action:"demo",demo:s,text:J(s),x:-.91,y:.76-u*.075,size:.03,color:s===a(h)?$:_,depth:s===a(h)?1:r,weight:s===a(h)?.9:o,startFrame:u*2,revealSpan:14,maxWidthEm:18,hitPadX:.03,hitPadY:.026})}),e.push({id:"observatory:exit",kind:"observatory-exit",action:"exit",text:m("EXIT"),x:.75,y:.82,size:.03,color:j,depth:r,weight:o,revealSpan:10,maxWidthEm:12,hitPadX:.03,hitPadY:.05}),a(D))return[...e,L("LOADING MEMORY FIELD...",S)];if(a(E))return[...e,L(`ERROR - ${a(E)}`.slice(0,76),V)];if(!t||t.nodeCount===0)return[...e,L("NO MEMORIES IN FIELD",_)];[[`NODES ${t.nodeCount}`,w(t.nodeCount,Math.max(1,t.nodes.length,200))],[`EDGES ${t.edgeCount}`,w(t.edgeCount,Math.max(1,t.nodeCount*8))],[`DEPTH ${t.depth}`,c(t.depth/4)],[`CENTER ${t.center_id.slice(0,12)}`,1]].forEach(([s,u],x)=>{e.push({id:`observatory:telemetry:${x}`,kind:"observatory-telemetry",text:m(s),x:.39,y:.72-x*.045,size:.022,color:S,depth:u,weight:o,startFrame:8+x*2,revealSpan:10,maxWidthEm:24})});const g=[...t.nodes].sort((s,u)=>Number(u.isCenter)-Number(s.isCenter)||c(u.retention)-c(s.retention)).slice(0,I),ae=.47,se=1.06/Math.max(1,I-1);return g.forEach((s,u)=>{const x=c(s.retention);e.push({id:`observatory:node:${s.id}`,kind:"observatory-node",text:Q(s),x:-.67,y:ae-u*se,size:.024,color:s.isCenter?$:S,depth:s.isCenter?1:x,weight:x,startFrame:18+u*2,revealSpan:18,maxWidthEm:54})}),e}function Z(e){if(e===a(h))return;p(h,e,!0);const t=new URL(window.location.href);t.searchParams.set("demo",e),history.replaceState(history.state,"",t),n==null||n.setText(M()),i==null||i.demoClock.reset()}function F(e){if(!a(l))return null;const t=a(l).getBoundingClientRect();return t.width<=0||t.height<=0?null:{x:(e.clientX-t.left)/t.width*2-1,y:-((e.clientY-t.top)/t.height*2-1)}}function ee(e){if(!a(l)||!i)return;const t=a(l).getBoundingClientRect(),r=Math.max(1e-4,t.width/Math.max(1,t.height)),o={x:e.x*Math.max(r,1),y:e.y/Math.min(r,1)},y=T??o,g={x:y.x+(o.x-y.x)*.35,y:y.y+(o.y-y.y)*.35};T=g,i.setCursorPreNdc(g.x,g.y,g.x-y.x,g.y-y.y)}function te(e){const t=F(e);if(!t)return;ee(t);const r=(n==null?void 0:n.pickAt(t.x,t.y))??null,o=(r==null?void 0:r.kind)==="observatory-demo"||(r==null?void 0:r.kind)==="observatory-exit"?r.id:null;o!==O&&(O=o,n==null||n.setRunDepth(o,1)),a(l)&&(a(l).style.cursor=o?"crosshair":"default")}function oe(){T=null,O=null,i==null||i.setCursorPreNdc(999,999,0,0),n==null||n.setRunDepth(null),a(l)&&(a(l).style.cursor="default")}async function re(e){const t=F(e);if(!t||!n)return;const r=n.pickAt(t.x,t.y),o=r==null?void 0:r.payload;(o==null?void 0:o.action)==="demo"&&o.demo?Z(o.demo):(o==null?void 0:o.action)==="exit"&&await G(`${W}/graph`)}var f=_e();Ee("2ll0b2",e=>{fe(()=>{ge.title="Observatory · Vestige"})});var ne=xe(f);be(ne,()=>a(h),e=>{Ce(e,{get demo(){return a(h)},get seed(){return X},get freezeFrame(){return H},capture:!0,showSwitcher:!1,chrome:"none",onready:K,onexit:()=>G(`${W}/graph`)})}),ve(f),we(f,e=>p(l,e),()=>a(l)),z("pointerdown",f,re),z("pointermove",f,te),ue("pointerleave",f,oe),pe(B,f),he()}ie(["pointerdown","pointermove"]);export{je as component,Ve as universal}; +import"../chunks/Bzak7iHL.js";import{d as ie,o as le,a as ce,b as z,e as ue}from"../chunks/DAau0uzT.js";import{p as de,d as v,e as me,a as pe,b as he,h as fe,f as ye,g as a,s as p,$ as ge,c as xe,r as ve}from"../chunks/CGq8RnJq.js";import{fB as be,fC as Ce}from"../chunks/Bo4EDkTQ.js";import{h as Ee}from"../chunks/De_e6MzK.js";import{b as we}from"../chunks/Ccqjq5DS.js";import{g as G}from"../chunks/DJDK-KWF.js";import{b as W}from"../chunks/DY7cP31Q.js";import{i as Me,r as b,C as Re,R as Y,I as U,D as Ne,a as Se}from"../chunks/BMB5u1EX.js";import{T as $e}from"../chunks/D7ozXiSB.js";import{l as De,L as Oe}from"../chunks/DETSv_kY.js";import{a as Te}from"../chunks/D35IQVqe.js";const Le=!1,ke=!1,Ve=Object.freeze(Object.defineProperty({__proto__:null,prerender:ke,ssr:Le},Symbol.toStringTag,{value:"Module"}));var _e=ye('
');function je(B,P){de(P,!0);const R=new URLSearchParams(window.location.search),k=R.get("demo")??"recall-path";let h=v(me(Me(k)?k:"recall-path"));const X=R.get("seed")??"vestige-observatory-v1",N=R.get("frame"),H=N!==null&&N!==""?Number(N):null,S=[...b(Re.forward),1],_=[...b(Y.recall),.76],$=[...b(Y.luciferin),.9],V=[...b(U.veto),.92],j=[...b(U.caution),.82],I=18;let l=v(null),i=null,n=null,d=null,C=v(null),D=v(!0),E=v(null),O=null,T=null;le(()=>{q()}),ce(()=>{n==null||n.dispose(),d==null||d.dispose(),n=null,d=null,i=null});async function K(e){i=e;const t=new Oe(e);d=t,t.setCells(A()),e.addPass(t);const r=new $e(e);n=r,await r.init(),r.setText(M()),e.addPass(r),e.demoClock.reset()}function A(){var r;const t=(((r=a(C))==null?void 0:r.nodes)??[]).map(o=>({id:o.id,score:c(o.retention),hue:Se(c(o.retention)),energy:.4+.6*c(o.retention),selected:!!o.isCenter,scar:(o.suppression_count??0)>0,metric2:c(o.retention),kind:"observatory-cell",payload:o}));return De(t,{maxRadius:.95,minCellR:.01,maxCellR:.038})}async function q(){p(D,!0),p(E,null),n==null||n.setText(M());try{p(C,await Te.graph({max_nodes:200,depth:3,sort:"connected"}),!0)}catch(e){p(C,null),p(E,e instanceof Error?e.message:"UNKNOWN OBSERVATORY GRAPH ERROR",!0)}finally{p(D,!1),n==null||n.setText(M()),d==null||d.setCells(A()),i==null||i.demoClock.reset()}}function m(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function c(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}function J(e){const[t]=e.split("-");return m(t.toUpperCase())}function w(e,t){return c(t<=0?0:e/t)}function Q(e){const t=m(e.label).replace(/\s+/g," ").trim().slice(0,44),r=e.tags[0]?m(e.tags[0]).slice(0,14):m(e.type);return m(`${t} | ${e.id.slice(0,8)} | ${r} | ${Math.round(c(e.retention)*100)}%`)}function L(e,t=$){return{id:"observatory:status",kind:"observatory-status",text:m(e),x:-.48,y:.02,size:.044,color:t,depth:.76,weight:.66,revealSpan:32,maxWidthEm:52}}function M(){const e=[],t=a(C),r=t?w(t.nodeCount,Math.max(1,t.nodes.length,200)):.5,o=t?w(t.edgeCount,Math.max(1,t.nodeCount*8)):.5;if(Ne.forEach((s,u)=>{e.push({id:`observatory:demo:${s}`,kind:"observatory-demo",action:"demo",demo:s,text:J(s),x:-.91,y:.76-u*.075,size:.03,color:s===a(h)?$:_,depth:s===a(h)?1:r,weight:s===a(h)?.9:o,startFrame:u*2,revealSpan:14,maxWidthEm:18,hitPadX:.03,hitPadY:.026})}),e.push({id:"observatory:exit",kind:"observatory-exit",action:"exit",text:m("EXIT"),x:.75,y:.82,size:.03,color:j,depth:r,weight:o,revealSpan:10,maxWidthEm:12,hitPadX:.03,hitPadY:.05}),a(D))return[...e,L("LOADING MEMORY FIELD...",S)];if(a(E))return[...e,L(`ERROR - ${a(E)}`.slice(0,76),V)];if(!t||t.nodeCount===0)return[...e,L("NO MEMORIES IN FIELD",_)];[[`NODES ${t.nodeCount}`,w(t.nodeCount,Math.max(1,t.nodes.length,200))],[`EDGES ${t.edgeCount}`,w(t.edgeCount,Math.max(1,t.nodeCount*8))],[`DEPTH ${t.depth}`,c(t.depth/4)],[`CENTER ${t.center_id.slice(0,12)}`,1]].forEach(([s,u],x)=>{e.push({id:`observatory:telemetry:${x}`,kind:"observatory-telemetry",text:m(s),x:.39,y:.72-x*.045,size:.022,color:S,depth:u,weight:o,startFrame:8+x*2,revealSpan:10,maxWidthEm:24})});const g=[...t.nodes].sort((s,u)=>Number(u.isCenter)-Number(s.isCenter)||c(u.retention)-c(s.retention)).slice(0,I),ae=.47,se=1.06/Math.max(1,I-1);return g.forEach((s,u)=>{const x=c(s.retention);e.push({id:`observatory:node:${s.id}`,kind:"observatory-node",text:Q(s),x:-.67,y:ae-u*se,size:.024,color:s.isCenter?$:S,depth:s.isCenter?1:x,weight:x,startFrame:18+u*2,revealSpan:18,maxWidthEm:54})}),e}function Z(e){if(e===a(h))return;p(h,e,!0);const t=new URL(window.location.href);t.searchParams.set("demo",e),history.replaceState(history.state,"",t),n==null||n.setText(M()),i==null||i.demoClock.reset()}function F(e){if(!a(l))return null;const t=a(l).getBoundingClientRect();return t.width<=0||t.height<=0?null:{x:(e.clientX-t.left)/t.width*2-1,y:-((e.clientY-t.top)/t.height*2-1)}}function ee(e){if(!a(l)||!i)return;const t=a(l).getBoundingClientRect(),r=Math.max(1e-4,t.width/Math.max(1,t.height)),o={x:e.x*Math.max(r,1),y:e.y/Math.min(r,1)},y=T??o,g={x:y.x+(o.x-y.x)*.35,y:y.y+(o.y-y.y)*.35};T=g,i.setCursorPreNdc(g.x,g.y,g.x-y.x,g.y-y.y)}function te(e){const t=F(e);if(!t)return;ee(t);const r=(n==null?void 0:n.pickAt(t.x,t.y))??null,o=(r==null?void 0:r.kind)==="observatory-demo"||(r==null?void 0:r.kind)==="observatory-exit"?r.id:null;o!==O&&(O=o,n==null||n.setRunDepth(o,1)),a(l)&&(a(l).style.cursor=o?"crosshair":"default")}function oe(){T=null,O=null,i==null||i.setCursorPreNdc(999,999,0,0),n==null||n.setRunDepth(null),a(l)&&(a(l).style.cursor="default")}async function re(e){const t=F(e);if(!t||!n)return;const r=n.pickAt(t.x,t.y),o=r==null?void 0:r.payload;(o==null?void 0:o.action)==="demo"&&o.demo?Z(o.demo):(o==null?void 0:o.action)==="exit"&&await G(`${W}/graph`)}var f=_e();Ee("2ll0b2",e=>{fe(()=>{ge.title="Observatory · Vestige"})});var ne=xe(f);be(ne,()=>a(h),e=>{Ce(e,{get demo(){return a(h)},get seed(){return X},get freezeFrame(){return H},capture:!0,showSwitcher:!1,chrome:"none",onready:K,onexit:()=>G(`${W}/graph`)})}),ve(f),we(f,e=>p(l,e),()=>a(l)),z("pointerdown",f,re),z("pointermove",f,te),ue("pointerleave",f,oe),pe(B,f),he()}ie(["pointerdown","pointermove"]);export{je as component,Ve as universal}; diff --git a/apps/dashboard/build/_app/immutable/nodes/17.DpD2KkS8.js.br b/apps/dashboard/build/_app/immutable/nodes/17.DpD2KkS8.js.br new file mode 100644 index 0000000..6d34dff Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/17.DpD2KkS8.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/17.DpD2KkS8.js.gz b/apps/dashboard/build/_app/immutable/nodes/17.DpD2KkS8.js.gz new file mode 100644 index 0000000..ebe7a3f Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/17.DpD2KkS8.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/18.DdPknQfI.js.gz b/apps/dashboard/build/_app/immutable/nodes/18.DdPknQfI.js.gz index e4ed4b1..5e0826c 100644 Binary files a/apps/dashboard/build/_app/immutable/nodes/18.DdPknQfI.js.gz and b/apps/dashboard/build/_app/immutable/nodes/18.DdPknQfI.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/19.CLd0kemn.js b/apps/dashboard/build/_app/immutable/nodes/19.CLd0kemn.js new file mode 100644 index 0000000..1475293 --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/19.CLd0kemn.js @@ -0,0 +1 @@ +var V=Object.defineProperty;var W=(u,c,p)=>c in u?V(u,c,{enumerable:!0,configurable:!0,writable:!0,value:p}):u[c]=p;var j=(u,c,p)=>W(u,typeof c!="symbol"?c+"":c,p);import"../chunks/Bzak7iHL.js";import{o as U}from"../chunks/DAau0uzT.js";import{p as X,d as P,e as q,b as J,h as Q,g as i,s as f,u as S,$ as Z}from"../chunks/CGq8RnJq.js";import{h as ee}from"../chunks/De_e6MzK.js";import{R as te}from"../chunks/BpEKQwpr.js";import{a as w}from"../chunks/D35IQVqe.js";import{r as k}from"../chunks/BMB5u1EX.js";import{T as re}from"../chunks/D7ozXiSB.js";import{L as ne,a as M,F as v}from"../chunks/DETSv_kY.js";function pe(u,c){X(c,!0);const p=[...k("#22C7DE"),1],N=[...k("#FFB020"),.88];[...k("#FF3B30")];const y=42,b=-1e5;let m=P(q({projects:[],patterns:[]})),R=P(!0),A=P(null),d=P(null),E=[],_=null;U(()=>{L(),w.memories.list({limit:"90"}).then(e=>{E=e.memories.map(t=>{const r=a(t.retentionStrength);return{id:t.id,score:.28+.4*r,hue:v.bridge,energy:.14+.28*r,metric2:r,kind:"pattern-pool",payload:t}}),_==null||_.refresh()}).catch(()=>{})});async function L(){f(R,!0),f(A,null);try{f(m,await w.crossProjectPatterns(),!0)}catch(e){f(m,{projects:[],patterns:[]},!0),f(A,e instanceof Error?e.message:String(e),!0)}finally{f(R,!1)}}const $=S(()=>[...i(d)?i(m).patterns.filter(t=>t.category===i(d)):i(m).patterns].sort((t,r)=>r.transfer_count-t.transfer_count||r.confidence-t.confidence)),I=S(()=>O(i(m).projects,i($)));function O(e,t){const r=Math.max(1,...t.map(n=>g(n.transfer_count)));return{organ:"patterns",nodes:t.slice(0,y).map((n,l)=>{const h=a(g(n.transfer_count)/r),x=a(n.confidence);return{source:{kind:"pattern",id:C(n)},index:l,label:F(n),retention:x,activation:h,trust:x,lastAccessed:n.last_used,tags:[n.category,n.origin_project,...n.transferred_to],type:n.category}}),edges:[],events:t.slice(0,y).map((n,l)=>({source:{kind:"event",id:`patterns.${C(n)}.${n.last_used}`},type:n.category,targetIndex:l,frame:12+l*3,energy:a(n.confidence)})),receipts:[],scalars:{projectCount:e.length,patternCount:t.length,maxTransferCount:r,totalTransfers:t.reduce((n,l)=>n+g(l.transfer_count),0)},alive:t.length>0,patterns:t,projects:e,maxTransferCount:r}}const z={ErrorHandling:0,AsyncConcurrency:1,Testing:2,Architecture:3,Performance:4,Security:5};function B(e){const t=new D(e);_=t;const r=new re(e);return r.init(),[t,{render:o=>r.render(o),pickAt:(o,s)=>r.pickAt(o,s),dispose:()=>r.dispose(),uploadScene:o=>r.setText(Y(o))}]}class D{constructor(t){j(this,"field");j(this,"lastNodes",[]);this.field=new ne(t)}uploadScene(t){this.lastNodes=t.nodes,this.apply()}refresh(){this.apply()}apply(){const t=this.lastNodes;if(t.length===0){this.field.setCells(M(E,(o,s)=>s%6,{ringCount:6,maxRadius:.92,minCellR:.02,maxCellR:.05}));return}const r=t.map(o=>{const s=a(g(o.activation??0));return{id:o.source.id,score:s,hue:s>=.5?v.forward:v.bridge,energy:a(.5+.5*g(o.retention??0)),metric2:a(g(o.trust??0)),kind:"pattern",payload:o}});this.field.setCells(M(r,(o,s)=>H(t[s]),{ringCount:6,maxRadius:.92,minCellR:.055,maxCellR:.15}))}compute(t){this.field.compute(t)}render(t){this.field.render(t)}pickAt(t,r){return this.field.pickAt(t,r)}dispose(){this.field.dispose()}}function H(e){const t=e.type;return z[t]??0}function Y(e){const t=e.patterns.slice(0,y),r=.74,o=1.48/Math.max(1,y-1);return t.map((s,n)=>{const l=a(g(s.transfer_count)/e.maxTransferCount),h=a(s.confidence),x=.06*Math.sin(n*.7),K=a(.6+l*.2+(h-.5)*.4+x);return{id:`pattern:${C(s)}`,kind:"pattern",patternKey:C(s),category:s.category,text:F(s),x:-.88,y:r-n*o,size:.024+h*.005,color:i(d)&&s.category===i(d)?N:p,depth:K,weight:h,startFrame:b+n*2,revealSpan:20,maxWidthEm:58,hitPadX:.03,hitPadY:.013}})}function G(e){if(e.kind!=="pattern")return;const t=e.payload;f(d,i(d)===t.category?null:t.category??null,!0)}function F(e){return T([e.name,e.origin_project,e.transferred_to.join(","),e.category,String(e.transfer_count),String(Math.round(a(e.confidence)*100)),e.last_used].join(" | ")).slice(0,118)}function C(e){return T([e.name,e.origin_project,e.category,e.last_used].join(":")).slice(0,180)}function T(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function g(e){return Number.isFinite(e)?e:0}function a(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:0))}ee("1gg45vd",e=>{Q(()=>{Z.title="Patterns · Vestige"})});{let e=S(()=>`cross-project-patterns:${i(m).projects.length}:${i($).length}:${i(d)??"all"}`);te(u,{organ:"patterns",get seed(){return i(e)},get scene(){return i(I)},passes:B,get loading(){return i(R)},get error(){return i(A)},onpick:G})}J()}export{pe as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/19.CLd0kemn.js.br b/apps/dashboard/build/_app/immutable/nodes/19.CLd0kemn.js.br new file mode 100644 index 0000000..bb9e8c7 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/19.CLd0kemn.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/19.CLd0kemn.js.gz b/apps/dashboard/build/_app/immutable/nodes/19.CLd0kemn.js.gz new file mode 100644 index 0000000..6862ea8 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/19.CLd0kemn.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/19.DCcjdG9r.js b/apps/dashboard/build/_app/immutable/nodes/19.DCcjdG9r.js deleted file mode 100644 index f71adae..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/19.DCcjdG9r.js +++ /dev/null @@ -1 +0,0 @@ -var H=Object.defineProperty;var Y=(l,a,m)=>a in l?H(l,a,{enumerable:!0,configurable:!0,writable:!0,value:m}):l[a]=m;var $=(l,a,m)=>Y(l,typeof a!="symbol"?a+"":a,m);import"../chunks/Bzak7iHL.js";import{o as G}from"../chunks/DAau0uzT.js";import{p as K,d as x,e as V,b as W,h as U,g as o,s as f,u as R,$ as X}from"../chunks/CGq8RnJq.js";import{h as q}from"../chunks/De_e6MzK.js";import{R as J}from"../chunks/Cqe0su6e.js";import{a as Q}from"../chunks/D35IQVqe.js";import{r as j}from"../chunks/BMB5u1EX.js";import{T as Z}from"../chunks/D7ozXiSB.js";import{L as ee,F as k,a as te}from"../chunks/BeGBxCGK.js";function ge(l,a){K(a,!0);const m=[...j("#22C7DE"),1],v=[...j("#FFB020"),.88];[...j("#FF3B30")];const y=42,T=-1e5;let p=x(V({projects:[],patterns:[]})),C=x(!0),A=x(null),d=x(null);G(()=>{w()});async function w(){f(C,!0),f(A,null);try{f(p,await Q.crossProjectPatterns(),!0)}catch(e){f(p,{projects:[],patterns:[]},!0),f(A,e instanceof Error?e.message:String(e),!0)}finally{f(C,!1)}}const E=R(()=>[...o(d)?o(p).patterns.filter(t=>t.category===o(d)):o(p).patterns].sort((t,n)=>n.transfer_count-t.transfer_count||n.confidence-t.confidence)),M=R(()=>b(o(p).projects,o(E)));function b(e,t){const n=Math.max(1,...t.map(r=>g(r.transfer_count)));return{organ:"patterns",nodes:t.slice(0,y).map((r,u)=>{const h=c(g(r.transfer_count)/n),P=c(r.confidence);return{source:{kind:"pattern",id:_(r)},index:u,label:F(r),retention:P,activation:h,trust:P,lastAccessed:r.last_used,tags:[r.category,r.origin_project,...r.transferred_to],type:r.category}}),edges:[],events:t.slice(0,y).map((r,u)=>({source:{kind:"event",id:`patterns.${_(r)}.${r.last_used}`},type:r.category,targetIndex:u,frame:12+u*3,energy:c(r.confidence)})),receipts:[],scalars:{projectCount:e.length,patternCount:t.length,maxTransferCount:n,totalTransfers:t.reduce((r,u)=>r+g(u.transfer_count),0)},alive:t.length>0,patterns:t,projects:e,maxTransferCount:n}}const L={ErrorHandling:0,AsyncConcurrency:1,Testing:2,Architecture:3,Performance:4,Security:5};function I(e){const t=new N(e),n=new Z(e);return n.init(),[t,{render:i=>n.render(i),pickAt:(i,s)=>n.pickAt(i,s),dispose:()=>n.dispose(),uploadScene:i=>n.setText(z(i))}]}class N{constructor(t){$(this,"field");this.field=new ee(t)}uploadScene(t){const n=t.nodes,i=n.map(s=>{const r=c(g(s.activation??0));return{id:s.source.id,score:r,hue:r>=.5?k.forward:k.bridge,energy:c(.5+.5*g(s.retention??0)),metric2:c(g(s.trust??0)),kind:"pattern",payload:s}});this.field.setCells(te(i,(s,r)=>O(n[r]),{ringCount:6,maxRadius:.92,minCellR:.055,maxCellR:.15}))}compute(t){this.field.compute(t)}render(t){this.field.render(t)}pickAt(t,n){return this.field.pickAt(t,n)}dispose(){this.field.dispose()}}function O(e){const t=e.type;return L[t]??0}function z(e){const t=e.patterns.slice(0,y),n=.74,i=1.48/Math.max(1,y-1);return t.map((s,r)=>{const u=c(g(s.transfer_count)/e.maxTransferCount),h=c(s.confidence),P=.06*Math.sin(r*.7),D=c(.6+u*.2+(h-.5)*.4+P);return{id:`pattern:${_(s)}`,kind:"pattern",patternKey:_(s),category:s.category,text:F(s),x:-.88,y:n-r*i,size:.024+h*.005,color:o(d)&&s.category===o(d)?v:m,depth:D,weight:h,startFrame:T+r*2,revealSpan:20,maxWidthEm:58,hitPadX:.03,hitPadY:.013}})}function B(e){if(e.kind!=="pattern")return;const t=e.payload;f(d,o(d)===t.category?null:t.category??null,!0)}function F(e){return S([e.name,e.origin_project,e.transferred_to.join(","),e.category,String(e.transfer_count),String(Math.round(c(e.confidence)*100)),e.last_used].join(" | ")).slice(0,118)}function _(e){return S([e.name,e.origin_project,e.category,e.last_used].join(":")).slice(0,180)}function S(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function g(e){return Number.isFinite(e)?e:0}function c(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:0))}q("1gg45vd",e=>{U(()=>{X.title="Patterns · Vestige"})});{let e=R(()=>`cross-project-patterns:${o(p).projects.length}:${o(E).length}:${o(d)??"all"}`);J(l,{organ:"patterns",get seed(){return o(e)},get scene(){return o(M)},passes:I,get loading(){return o(C)},get error(){return o(A)},onpick:B})}W()}export{ge as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/19.DCcjdG9r.js.br b/apps/dashboard/build/_app/immutable/nodes/19.DCcjdG9r.js.br deleted file mode 100644 index 262bf8b..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/19.DCcjdG9r.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/19.DCcjdG9r.js.gz b/apps/dashboard/build/_app/immutable/nodes/19.DCcjdG9r.js.gz deleted file mode 100644 index ec693bf..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/19.DCcjdG9r.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/2.zvt29sR6.js.gz b/apps/dashboard/build/_app/immutable/nodes/2.zvt29sR6.js.gz index d18ff6a..5b0812c 100644 Binary files a/apps/dashboard/build/_app/immutable/nodes/2.zvt29sR6.js.gz and b/apps/dashboard/build/_app/immutable/nodes/2.zvt29sR6.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/20.Dqd6_QcY.js b/apps/dashboard/build/_app/immutable/nodes/20.Cj35A6gq.js similarity index 99% rename from apps/dashboard/build/_app/immutable/nodes/20.Dqd6_QcY.js rename to apps/dashboard/build/_app/immutable/nodes/20.Cj35A6gq.js index f915c89..d50db43 100644 --- a/apps/dashboard/build/_app/immutable/nodes/20.Dqd6_QcY.js +++ b/apps/dashboard/build/_app/immutable/nodes/20.Cj35A6gq.js @@ -1,4 +1,4 @@ -var Re=Object.defineProperty;var Ce=(t,e,s)=>e in t?Re(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var R=(t,e,s)=>Ce(t,typeof e!="symbol"?e+"":e,s);import"../chunks/Bzak7iHL.js";import{o as Te,e as Ie,s as ye}from"../chunks/DAau0uzT.js";import{p as $e,j as Ne,g as m,aH as Pe,Y as de,a as ue,b as Me,d as W,h as Le,X as j,s as I,f as ve,u as be,$ as Fe,c as pe,r as ie,af as Be}from"../chunks/CGq8RnJq.js";import{b as De,i as Ge}from"../chunks/Ccqjq5DS.js";import{e as Ue,r as Oe,i as We}from"../chunks/DqfV0sZu.js";import{h as Xe}from"../chunks/De_e6MzK.js";import{b as Ve}from"../chunks/DGM4cicq.js";import{a as Ye}from"../chunks/D35IQVqe.js";import{R as ze}from"../chunks/Cqe0su6e.js";import{T as He}from"../chunks/D7ozXiSB.js";import{r as qe}from"../chunks/BMB5u1EX.js";import{L as Ke,F as _e,l as je}from"../chunks/BeGBxCGK.js";const Qe={intent:"Intent classification",retrieve:"Memory retrieval",activate:"Activation expansion",evidence:"Evidence grounding",contradiction:"Contradiction check",synthesis:"Synthesis",recommendation:"Recommendation",receipt:"Composition receipt"},Je=["intent","retrieve","activate","evidence","contradiction","synthesis","recommendation","receipt"];function B(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function g(t,e=""){return typeof t=="string"?t:t==null?e:String(t)}function ee(t,e=0){return typeof t=="number"&&Number.isFinite(t)?t:e}function V(t){return Math.max(0,Math.min(1,t))}function te(t){const e=ee(t,0);return V(e>1?e/100:e)}function Ze(t){return t==="primary"||t==="supporting"||t==="contradicting"||t==="superseded"?t:"supporting"}function Q(t,e=""){const s=te(t.trust??t.trust_score??0);return{id:g(t.id??t.memory_id??e),trust:s,date:g(t.date??t.created_at??""),role:Ze(t.role),preview:g(t.preview??t.answer_preview??t.content??""),nodeType:t.node_type?g(t.node_type):t.nodeType?g(t.nodeType):void 0}}function O(t,e,s){return s?{kind:t,id:e,scalar:s}:{kind:t,id:e||`${t}:unknown`}}function P(t,e){return{kind:"scalar",id:`deep_reference.${t}`,scalar:{name:t,value:e}}}function et(t){var y,b,T,L;const e=B(t),u=(Array.isArray(e.evidence)?e.evidence.map(B):[]).map(r=>Q(r)).filter(r=>r.id.length>0),f=B(e.recommended),i=Object.keys(f).length>0||u.length>0?{answer_preview:g(f.answer_preview??((y=u[0])==null?void 0:y.preview)??""),memory_id:g(f.memory_id??((b=u[0])==null?void 0:b.id)??""),trust_score:te(f.trust_score??((T=u[0])==null?void 0:T.trust)??0),date:g(f.date??((L=u[0])==null?void 0:L.date)??"")}:null,a=(Array.isArray(e.contradictions)?e.contradictions.map(B):Array.isArray(e.claim_conflicts)?e.claim_conflicts.map(B):[]).map(r=>{const E=B(r.stronger),F=B(r.weaker);if(Object.keys(E).length>0||Object.keys(F).length>0){const re=Q(E),se=Q(F);return{stronger:re,weaker:se,topic_overlap:V(ee(r.topic_overlap,0)),summary:g(r.summary,`Trust-weighted conflict: ${re.id.slice(0,8)} over ${se.id.slice(0,8)}`)}}const U=Q({id:r.a_id,role:"contradicting"}),le=Q({id:r.b_id,role:"contradicting"});return{stronger:U,weaker:le,topic_overlap:V(ee(r.topic_overlap,0)),summary:g(r.summary??r.reason,"Trust-weighted conflict between high-FSRS memories.")}}).filter(r=>r.stronger.id||r.weaker.id),w=(Array.isArray(e.superseded)?e.superseded.map(B):[]).map(r=>r.id||r.superseded_by?{id:g(r.id),preview:g(r.preview??""),trust:te(r.trust??0),date:g(r.date??""),superseded_by:g(r.superseded_by??(i==null?void 0:i.memory_id)??""),reason:g(r.reason??"Superseded by newer memory with higher trust.")}:{id:g(r.old_id),preview:g(r.preview??""),trust:te(r.trust??0),date:g(r.date??""),superseded_by:g(r.new_id??(i==null?void 0:i.memory_id)??""),reason:g(r.reason??"Superseded by newer memory with higher trust.")}).filter(r=>r.id||r.superseded_by),c=te(e.confidence),l=ee(e.memoriesAnalyzed??e.memories_analyzed,u.length),n=ee(e.activationExpanded??e.activation_expanded,0),p=g(e.intent??""),v=g(e.reasoning??e.guidance??""),S=g(e.guidance??""),_=g(e.composition_event_id??""),A=g(e.compositionWriteStatus??e.composition_write_status??""),C=_||A,k=_.length>0,M=u.map((r,E)=>({source:O("memory",r.id),index:E,label:r.preview||r.id.slice(0,8),retention:V(r.trust),trust:V(r.trust),lastAccessed:r.date||void 0,tags:[r.role,...r.nodeType?[r.nodeType]:[]],type:r.nodeType??"memory"})),H=new Map(M.map(r=>[r.source.id,r.index])),q=a.flatMap((r,E)=>{const F=H.get(r.stronger.id),U=H.get(r.weaker.id);return F==null||U==null?[]:[{source:O("pair",`contradiction:${r.stronger.id}:${r.weaker.id}`),sourceIndex:F,targetIndex:U,weight:Math.max(.2,r.topic_overlap||.5),kind:"contradiction"}]}),K=[];a.length>0&&K.push({source:O("event",`deep_reference.contradictions.${a.length}`),type:"ReasoningContradictionInterrupt",targetIndex:-1,frame:250,energy:a.length}),w.length>0&&K.push({source:O("event",`deep_reference.superseded.${w.length}`),type:"ReasoningSupersessionInterrupt",targetIndex:-1,frame:330,energy:w.length});const ne=[];C&&ne.push({source:k?O("receipt",_):P("compositionWriteStatus",A==="persisted"?1:0),label:k?`receipt ${_.slice(0,8)}`:A,nodeIndices:M.map(r=>r.index)});const N=(r,E,F,U,le,re,se,ke="none")=>({index:r,kind:E,label:Qe[E],count:F,confidence:V(U),lit:F>0||U>0,provenance:re,exposed:le,not_exposed_by_backend:se,interrupt:ke}),o=Je.map((r,E)=>{switch(r){case"intent":return N(E,r,p?1:0,p?c:0,{intent:p},P("intent_present",p?1:0),["raw classifier trace"]);case"retrieve":return N(E,r,l||u.length,c,{memoriesAnalyzed:l,evidence_count:u.length},P("memoriesAnalyzed",l),["candidate ids discarded before evidence"]);case"activate":return N(E,r,n,n>0?c:0,{activationExpanded:n},P("activationExpanded",n),["activation path/map"]);case"evidence":return N(E,r,u.length,u.length>0?c:0,{evidence:u},P("evidence_count",u.length),["reranker discarded candidates"]);case"contradiction":return N(E,r,a.length,a.length>0?c:0,{contradictions:a,claim_conflicts:e.claim_conflicts??[]},P("contradiction_count",a.length),["full claim graph"],a.length>0?"contradiction":"none");case"synthesis":return N(E,r,v||S?1:0,v||S?c:0,{reasoning:v,guidance:S},P("synthesis_present",v||S?1:0),["token-level chain internals"]);case"recommendation":return N(E,r,i!=null&&i.memory_id?1:0,(i==null?void 0:i.trust_score)??0,{recommended:i},i!=null&&i.memory_id?O("memory",i.memory_id):P("recommended_present",0),["alternative recommendations"]);case"receipt":return N(E,r,C?1:0,C?c:0,{composition_event_id:_,compositionWriteStatus:A},k?O("receipt",_):P("compositionWriteStatus",A==="persisted"?1:0),["separate receipt field"],w.length>0?"supersession":"none")}});return{organ:"reasoning",nodes:M,edges:q,events:K,receipts:ne,scalars:{confidence:c,memoriesAnalyzed:l,activationExpanded:n,evidenceCount:u.length,contradictionCount:a.length,supersededCount:w.length,compositionPersisted:k?1:0},alive:!!(p||v||S||u.length||a.length||w.length||i!=null&&i.memory_id||C),stages:o,evidence:u,contradictions:a,superseded:w,recommended:i,raw:e}}const Y=[-.86,-.526,-.214,.074,.335,.562,.747,.86],tt=["INTENT","RETRIEVE","ACTIVATE","EVIDENCE","CHALLENGE","SYNTH","DECIDE","SEAL"],we=0,nt=3,Ee=6,rt=7,st={primary:.04,supporting:.24,contradicting:-.22,superseded:-.48},it=.052,at=6,ot=Y[nt]-.02,ct=.14;function lt(t){var c,l;if(!t||!t.alive)return null;const e=String(((c=t.raw)==null?void 0:c.query)??""),s=(t.stages??[]).slice(0,Y.length).map((n,p)=>({index:p,kind:(n==null?void 0:n.kind)??String(p),label:(n==null?void 0:n.label)??(n==null?void 0:n.kind)??"",short:tt[p]??((n==null?void 0:n.kind)??"").toUpperCase(),x:Y[p],lit:!!(n!=null&&n.lit),confidence:(n==null?void 0:n.confidence)??0,count:(n==null?void 0:n.count)??0})),u=new Map;for(const n of t.evidence??[]){const p=u.get(n.role)??[];p.push(n),u.set(n.role,p)}const f=[];for(const[n,p]of u){const v=st[n],S=p.slice(0,at);S.forEach((_,A)=>{const C=v+(A-(S.length-1)/2)*it,k=ot+A/Math.max(1,S.length-1)*ct;f.push({id:_.id,role:n,trust:_.trust,preview:_.preview,x:k,y:C})})}const i=t.recommended!=null?{x:Y[Ee],y:we,confidence:Math.max(0,Math.min(1,t.recommended.trust_score))}:null,d=i?f.map(n=>({fromX:n.x,fromY:n.y,toX:i.x,toY:i.y,trust:n.trust,role:n.role,sign:n.role==="contradicting"?-1:1})):[],a=new Map(f.map(n=>[n.id,n])),x=(t.contradictions??[]).map(n=>{const p=a.get(n.stronger.id),v=a.get(n.weaker.id);return!p||!v?null:{ax:p.x,ay:p.y,bx:v.x,by:v.y,strength:Math.max(.35,n.topic_overlap||.5)}}).filter(n=>n!==null),w=(t.superseded??[]).map(n=>{const p=a.get(n.id);return p?{x:p.x,y:p.y,toX:(i==null?void 0:i.x)??Y[Ee],toY:(i==null?void 0:i.y)??we}:null}).filter(n=>n!==null);return{query:e,gates:s,evidence:f,ribbons:d,nucleus:i,fringes:x,scars:w,receiptX:Y[rt],sourceCount:((l=t.evidence)==null?void 0:l.length)??0}}const dt=` +var Re=Object.defineProperty;var Ce=(t,e,s)=>e in t?Re(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var R=(t,e,s)=>Ce(t,typeof e!="symbol"?e+"":e,s);import"../chunks/Bzak7iHL.js";import{o as Te,e as Ie,s as ye}from"../chunks/DAau0uzT.js";import{p as $e,j as Ne,g as m,aH as Pe,Y as de,a as ue,b as Me,d as W,h as Le,X as j,s as I,f as ve,u as be,$ as Fe,c as pe,r as ie,af as Be}from"../chunks/CGq8RnJq.js";import{b as De,i as Ge}from"../chunks/Ccqjq5DS.js";import{e as Ue,r as Oe,i as We}from"../chunks/DqfV0sZu.js";import{h as Xe}from"../chunks/De_e6MzK.js";import{b as Ve}from"../chunks/DGM4cicq.js";import{a as Ye}from"../chunks/D35IQVqe.js";import{R as ze}from"../chunks/BpEKQwpr.js";import{T as He}from"../chunks/D7ozXiSB.js";import{r as qe}from"../chunks/BMB5u1EX.js";import{L as Ke,F as _e,l as je}from"../chunks/DETSv_kY.js";const Qe={intent:"Intent classification",retrieve:"Memory retrieval",activate:"Activation expansion",evidence:"Evidence grounding",contradiction:"Contradiction check",synthesis:"Synthesis",recommendation:"Recommendation",receipt:"Composition receipt"},Je=["intent","retrieve","activate","evidence","contradiction","synthesis","recommendation","receipt"];function B(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function g(t,e=""){return typeof t=="string"?t:t==null?e:String(t)}function ee(t,e=0){return typeof t=="number"&&Number.isFinite(t)?t:e}function V(t){return Math.max(0,Math.min(1,t))}function te(t){const e=ee(t,0);return V(e>1?e/100:e)}function Ze(t){return t==="primary"||t==="supporting"||t==="contradicting"||t==="superseded"?t:"supporting"}function Q(t,e=""){const s=te(t.trust??t.trust_score??0);return{id:g(t.id??t.memory_id??e),trust:s,date:g(t.date??t.created_at??""),role:Ze(t.role),preview:g(t.preview??t.answer_preview??t.content??""),nodeType:t.node_type?g(t.node_type):t.nodeType?g(t.nodeType):void 0}}function O(t,e,s){return s?{kind:t,id:e,scalar:s}:{kind:t,id:e||`${t}:unknown`}}function P(t,e){return{kind:"scalar",id:`deep_reference.${t}`,scalar:{name:t,value:e}}}function et(t){var y,b,T,L;const e=B(t),u=(Array.isArray(e.evidence)?e.evidence.map(B):[]).map(r=>Q(r)).filter(r=>r.id.length>0),f=B(e.recommended),i=Object.keys(f).length>0||u.length>0?{answer_preview:g(f.answer_preview??((y=u[0])==null?void 0:y.preview)??""),memory_id:g(f.memory_id??((b=u[0])==null?void 0:b.id)??""),trust_score:te(f.trust_score??((T=u[0])==null?void 0:T.trust)??0),date:g(f.date??((L=u[0])==null?void 0:L.date)??"")}:null,a=(Array.isArray(e.contradictions)?e.contradictions.map(B):Array.isArray(e.claim_conflicts)?e.claim_conflicts.map(B):[]).map(r=>{const E=B(r.stronger),F=B(r.weaker);if(Object.keys(E).length>0||Object.keys(F).length>0){const re=Q(E),se=Q(F);return{stronger:re,weaker:se,topic_overlap:V(ee(r.topic_overlap,0)),summary:g(r.summary,`Trust-weighted conflict: ${re.id.slice(0,8)} over ${se.id.slice(0,8)}`)}}const U=Q({id:r.a_id,role:"contradicting"}),le=Q({id:r.b_id,role:"contradicting"});return{stronger:U,weaker:le,topic_overlap:V(ee(r.topic_overlap,0)),summary:g(r.summary??r.reason,"Trust-weighted conflict between high-FSRS memories.")}}).filter(r=>r.stronger.id||r.weaker.id),w=(Array.isArray(e.superseded)?e.superseded.map(B):[]).map(r=>r.id||r.superseded_by?{id:g(r.id),preview:g(r.preview??""),trust:te(r.trust??0),date:g(r.date??""),superseded_by:g(r.superseded_by??(i==null?void 0:i.memory_id)??""),reason:g(r.reason??"Superseded by newer memory with higher trust.")}:{id:g(r.old_id),preview:g(r.preview??""),trust:te(r.trust??0),date:g(r.date??""),superseded_by:g(r.new_id??(i==null?void 0:i.memory_id)??""),reason:g(r.reason??"Superseded by newer memory with higher trust.")}).filter(r=>r.id||r.superseded_by),c=te(e.confidence),l=ee(e.memoriesAnalyzed??e.memories_analyzed,u.length),n=ee(e.activationExpanded??e.activation_expanded,0),p=g(e.intent??""),v=g(e.reasoning??e.guidance??""),S=g(e.guidance??""),_=g(e.composition_event_id??""),A=g(e.compositionWriteStatus??e.composition_write_status??""),C=_||A,k=_.length>0,M=u.map((r,E)=>({source:O("memory",r.id),index:E,label:r.preview||r.id.slice(0,8),retention:V(r.trust),trust:V(r.trust),lastAccessed:r.date||void 0,tags:[r.role,...r.nodeType?[r.nodeType]:[]],type:r.nodeType??"memory"})),H=new Map(M.map(r=>[r.source.id,r.index])),q=a.flatMap((r,E)=>{const F=H.get(r.stronger.id),U=H.get(r.weaker.id);return F==null||U==null?[]:[{source:O("pair",`contradiction:${r.stronger.id}:${r.weaker.id}`),sourceIndex:F,targetIndex:U,weight:Math.max(.2,r.topic_overlap||.5),kind:"contradiction"}]}),K=[];a.length>0&&K.push({source:O("event",`deep_reference.contradictions.${a.length}`),type:"ReasoningContradictionInterrupt",targetIndex:-1,frame:250,energy:a.length}),w.length>0&&K.push({source:O("event",`deep_reference.superseded.${w.length}`),type:"ReasoningSupersessionInterrupt",targetIndex:-1,frame:330,energy:w.length});const ne=[];C&&ne.push({source:k?O("receipt",_):P("compositionWriteStatus",A==="persisted"?1:0),label:k?`receipt ${_.slice(0,8)}`:A,nodeIndices:M.map(r=>r.index)});const N=(r,E,F,U,le,re,se,ke="none")=>({index:r,kind:E,label:Qe[E],count:F,confidence:V(U),lit:F>0||U>0,provenance:re,exposed:le,not_exposed_by_backend:se,interrupt:ke}),o=Je.map((r,E)=>{switch(r){case"intent":return N(E,r,p?1:0,p?c:0,{intent:p},P("intent_present",p?1:0),["raw classifier trace"]);case"retrieve":return N(E,r,l||u.length,c,{memoriesAnalyzed:l,evidence_count:u.length},P("memoriesAnalyzed",l),["candidate ids discarded before evidence"]);case"activate":return N(E,r,n,n>0?c:0,{activationExpanded:n},P("activationExpanded",n),["activation path/map"]);case"evidence":return N(E,r,u.length,u.length>0?c:0,{evidence:u},P("evidence_count",u.length),["reranker discarded candidates"]);case"contradiction":return N(E,r,a.length,a.length>0?c:0,{contradictions:a,claim_conflicts:e.claim_conflicts??[]},P("contradiction_count",a.length),["full claim graph"],a.length>0?"contradiction":"none");case"synthesis":return N(E,r,v||S?1:0,v||S?c:0,{reasoning:v,guidance:S},P("synthesis_present",v||S?1:0),["token-level chain internals"]);case"recommendation":return N(E,r,i!=null&&i.memory_id?1:0,(i==null?void 0:i.trust_score)??0,{recommended:i},i!=null&&i.memory_id?O("memory",i.memory_id):P("recommended_present",0),["alternative recommendations"]);case"receipt":return N(E,r,C?1:0,C?c:0,{composition_event_id:_,compositionWriteStatus:A},k?O("receipt",_):P("compositionWriteStatus",A==="persisted"?1:0),["separate receipt field"],w.length>0?"supersession":"none")}});return{organ:"reasoning",nodes:M,edges:q,events:K,receipts:ne,scalars:{confidence:c,memoriesAnalyzed:l,activationExpanded:n,evidenceCount:u.length,contradictionCount:a.length,supersededCount:w.length,compositionPersisted:k?1:0},alive:!!(p||v||S||u.length||a.length||w.length||i!=null&&i.memory_id||C),stages:o,evidence:u,contradictions:a,superseded:w,recommended:i,raw:e}}const Y=[-.86,-.526,-.214,.074,.335,.562,.747,.86],tt=["INTENT","RETRIEVE","ACTIVATE","EVIDENCE","CHALLENGE","SYNTH","DECIDE","SEAL"],we=0,nt=3,Ee=6,rt=7,st={primary:.04,supporting:.24,contradicting:-.22,superseded:-.48},it=.052,at=6,ot=Y[nt]-.02,ct=.14;function lt(t){var c,l;if(!t||!t.alive)return null;const e=String(((c=t.raw)==null?void 0:c.query)??""),s=(t.stages??[]).slice(0,Y.length).map((n,p)=>({index:p,kind:(n==null?void 0:n.kind)??String(p),label:(n==null?void 0:n.label)??(n==null?void 0:n.kind)??"",short:tt[p]??((n==null?void 0:n.kind)??"").toUpperCase(),x:Y[p],lit:!!(n!=null&&n.lit),confidence:(n==null?void 0:n.confidence)??0,count:(n==null?void 0:n.count)??0})),u=new Map;for(const n of t.evidence??[]){const p=u.get(n.role)??[];p.push(n),u.set(n.role,p)}const f=[];for(const[n,p]of u){const v=st[n],S=p.slice(0,at);S.forEach((_,A)=>{const C=v+(A-(S.length-1)/2)*it,k=ot+A/Math.max(1,S.length-1)*ct;f.push({id:_.id,role:n,trust:_.trust,preview:_.preview,x:k,y:C})})}const i=t.recommended!=null?{x:Y[Ee],y:we,confidence:Math.max(0,Math.min(1,t.recommended.trust_score))}:null,d=i?f.map(n=>({fromX:n.x,fromY:n.y,toX:i.x,toY:i.y,trust:n.trust,role:n.role,sign:n.role==="contradicting"?-1:1})):[],a=new Map(f.map(n=>[n.id,n])),x=(t.contradictions??[]).map(n=>{const p=a.get(n.stronger.id),v=a.get(n.weaker.id);return!p||!v?null:{ax:p.x,ay:p.y,bx:v.x,by:v.y,strength:Math.max(.35,n.topic_overlap||.5)}}).filter(n=>n!==null),w=(t.superseded??[]).map(n=>{const p=a.get(n.id);return p?{x:p.x,y:p.y,toX:(i==null?void 0:i.x)??Y[Ee],toY:(i==null?void 0:i.y)??we}:null}).filter(n=>n!==null);return{query:e,gates:s,evidence:f,ribbons:d,nucleus:i,fringes:x,scars:w,receiptX:Y[rt],sourceCount:((l=t.evidence)==null?void 0:l.length)??0}}const dt=` struct Params { frame: f32, loopPhase: f32, nodeCount: f32, edgeCount: f32, pathCount: f32, pulse: f32, viewportW: f32, viewportH: f32, diff --git a/apps/dashboard/build/_app/immutable/nodes/20.Cj35A6gq.js.br b/apps/dashboard/build/_app/immutable/nodes/20.Cj35A6gq.js.br new file mode 100644 index 0000000..a2f8f68 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/20.Cj35A6gq.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/20.Cj35A6gq.js.gz b/apps/dashboard/build/_app/immutable/nodes/20.Cj35A6gq.js.gz new file mode 100644 index 0000000..171ca6c Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/20.Cj35A6gq.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/20.Dqd6_QcY.js.br b/apps/dashboard/build/_app/immutable/nodes/20.Dqd6_QcY.js.br deleted file mode 100644 index ed7ba12..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/20.Dqd6_QcY.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/20.Dqd6_QcY.js.gz b/apps/dashboard/build/_app/immutable/nodes/20.Dqd6_QcY.js.gz deleted file mode 100644 index 08e27c6..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/20.Dqd6_QcY.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/21.CwMgmxy2.js b/apps/dashboard/build/_app/immutable/nodes/21.CwMgmxy2.js deleted file mode 100644 index 4a7b4ce..0000000 --- a/apps/dashboard/build/_app/immutable/nodes/21.CwMgmxy2.js +++ /dev/null @@ -1 +0,0 @@ -var z=Object.defineProperty;var X=(u,c,l)=>c in u?z(u,c,{enumerable:!0,configurable:!0,writable:!0,value:l}):u[c]=l;var x=(u,c,l)=>X(u,typeof c!="symbol"?c+"":c,l);import"../chunks/Bzak7iHL.js";import{o as j}from"../chunks/DAau0uzT.js";import{p as q,d as y,e as G,b as J,g as s,s as o,u as E}from"../chunks/CGq8RnJq.js";import{R as K,e as Q}from"../chunks/Cqe0su6e.js";import{a as A}from"../chunks/D35IQVqe.js";import{r as T}from"../chunks/BMB5u1EX.js";import{T as Z}from"../chunks/D7ozXiSB.js";import{L as ee,F,a as te}from"../chunks/BeGBxCGK.js";function de(u,c){q(c,!0);const l=[...T("#22C7DE"),1],D=[...T("#FFB000"),.9],v=[...T("#FF3B30"),.92],N=2e3,I=40,b=200,M=16;let a=y(G([])),S=y(!0),d=y(null);j(()=>{C()});async function C(){o(S,!0),o(d,null);try{const e=await A.memories.list({limit:String(N)});o(a,await L(e.memories),!0)}catch(e){o(a,[],!0),o(d,e instanceof Error?e.message:"API FETCH FAILED",!0)}finally{o(S,!1)}}async function L(e){const t=e.slice(),r=t.map((n,i)=>({memory:n,index:i})).filter(({memory:n})=>!n.nextReviewAt).slice(0,b);for(let n=0;n{try{const W=await A.memories.get(f.id);t[V]={...f,...W}}catch{}}))}return t}function R(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function h(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}function g(e){const t=e.nextReviewAt?Date.parse(e.nextReviewAt):Number.POSITIVE_INFINITY;return Number.isFinite(t)?t:Number.POSITIVE_INFINITY}function m(e,t){const r=g(e);if(!Number.isFinite(r))return 0;const n=(r-t)/864e5;return h(1-n/30)}function P(e,t){const r=R(e.content).replace(/\s+/g," ").trim().slice(0,48),n=g(e),i=Number.isFinite(n)?Math.ceil((n-t)/864e5):9999,f=i<0?`${Math.abs(i)}D OVER`:i===0?"DUE 0D":`DUE ${i}D`;return R(`${r} | ${e.id.slice(0,8)} | ${f} | ${Math.round(e.retentionStrength*100)}%`)}function _(e){const t=Date.now();return e.filter(r=>!!r.nextReviewAt).slice().sort((r,n)=>{const i=g(r)-g(n);return i!==0?i:(r.retentionStrength??0)-(n.retentionStrength??0)}).sort((r,n)=>m(n,t)-m(r,t))}const p=E(()=>_(s(a))),$=E(()=>s(p).length===0?Q("schedule"):{organ:"schedule",nodes:s(p).slice(0,I).map((e,t)=>({source:{kind:"memory",id:e.id},index:t,label:P(e,Date.now()),retention:h(e.retentionStrength),stability:h(e.retrievalStrength),lastAccessed:e.lastAccessedAt,activation:m(e,Date.now()),tags:e.tags,type:e.nodeType})),edges:[],events:[],receipts:[],scalars:{scheduled:s(p).length,loaded:s(a).length,dueNow:s(p).filter(e=>m(e,Date.now())>=1).length},alive:!0}),O=E(()=>s(a).length===0?"0 MEMORIES LOADED":`${s(a).length} MEMORIES / 0 REVIEW TIMESTAMPS`);function w(e){const r=1.52/Math.max(1,I-1);return e.nodes.slice(0,I).map((n,i)=>({id:`schedule:${n.source.id}`,kind:"schedule-memory",memoryId:n.source.id,text:R(n.label),x:-.9,y:.74-i*r,size:.026,color:k(n.activation??0,n.retention),depth:h(.62+(n.activation??0)*.38),weight:h(n.retention),startFrame:-1e5,revealSpan:1,maxWidthEm:54,hitPadX:.03,hitPadY:.014}))}function k(e,t){return t<.4?v:t<.7?D:l}class H{constructor(t,r){x(this,"text");x(this,"current");this.current=r,this.text=new Z(t),this.text.setText(w(this.current)),this.text.init().then(()=>this.text.setText(w(this.current)))}uploadScene(t){this.current=t,this.text.setText(w(this.current))}render(t){this.text.render(t)}pickAt(t,r){return this.text.pickAt(t,r)}dispose(){this.text.dispose()}}class Y{constructor(t){x(this,"field");this.field=new ee(t)}uploadScene(t){const r=t.nodes.map(n=>({id:n.source.id,score:n.activation??0,hue:n.retention<.4?F.scarlet:n.retention<.7?F.caution:F.oxygen,energy:n.activation,metric2:n.retention,scar:(n.activation??0)>=1,kind:"schedule-memory",payload:n}));this.field.setCells(te(r,n=>n.score>=1?0:n.score>=.75?1:n.score>=.5?2:3,{ringCount:4,maxRadius:.88,minCellR:.045,maxCellR:.11}))}compute(t){this.field.compute(t)}render(t){this.field.render(t)}pickAt(t,r){return this.field.pickAt(t,r)}dispose(){this.field.dispose()}}function B(e,t){const r=new Y(e);return r.uploadScene(t),[r,new H(e,t)]}async function U(e){if(e.kind!=="schedule-memory")return;const t=e.payload;if(t.memoryId)try{const r=await A.memories.promote(t.memoryId);o(a,s(a).map(n=>n.id===r.id?{...n,retentionStrength:r.retentionStrength}:n),!0),o(d,null)}catch(r){o(d,r instanceof Error?r.message:"PROMOTE FAILED",!0)}}{let e=E(()=>`schedule-due-field:${s(p).length}:${s(a).length}`);K(u,{organ:"schedule",get seed(){return s(e)},get scene(){return s($)},passes:B,get loading(){return s(S)},get error(){return s(d)},get emptyLabel(){return s(O)},onpick:U})}J()}export{de as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/21.CwMgmxy2.js.br b/apps/dashboard/build/_app/immutable/nodes/21.CwMgmxy2.js.br deleted file mode 100644 index 3e2b87f..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/21.CwMgmxy2.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/21.CwMgmxy2.js.gz b/apps/dashboard/build/_app/immutable/nodes/21.CwMgmxy2.js.gz deleted file mode 100644 index 6376e13..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/21.CwMgmxy2.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/21.yCKOHF-q.js b/apps/dashboard/build/_app/immutable/nodes/21.yCKOHF-q.js new file mode 100644 index 0000000..6ada92d --- /dev/null +++ b/apps/dashboard/build/_app/immutable/nodes/21.yCKOHF-q.js @@ -0,0 +1 @@ +var z=Object.defineProperty;var X=(l,c,d)=>c in l?z(l,c,{enumerable:!0,configurable:!0,writable:!0,value:d}):l[c]=d;var x=(l,c,d)=>X(l,typeof c!="symbol"?c+"":c,d);import"../chunks/Bzak7iHL.js";import{o as j}from"../chunks/DAau0uzT.js";import{p as q,d as y,e as G,b as J,g as i,s as o,u as E}from"../chunks/CGq8RnJq.js";import{R as K,e as Q}from"../chunks/BpEKQwpr.js";import{a as A}from"../chunks/D35IQVqe.js";import{r as T}from"../chunks/BMB5u1EX.js";import{T as Z}from"../chunks/D7ozXiSB.js";import{L as ee,F,a as te}from"../chunks/DETSv_kY.js";function de(l,c){q(c,!0);const d=[...T("#22C7DE"),1],D=[...T("#FFB000"),.9],v=[...T("#FF3B30"),.92],N=2e3,I=40,b=200,M=16;let a=y(G([])),S=y(!0),h=y(null);j(()=>{C()});async function C(){o(S,!0),o(h,null);try{const e=await A.memories.list({limit:String(N)});o(a,await L(e.memories),!0)}catch(e){o(a,[],!0),o(h,e instanceof Error?e.message:"API FETCH FAILED",!0)}finally{o(S,!1)}}async function L(e){const t=e.slice(),r=t.map((n,s)=>({memory:n,index:s})).filter(({memory:n})=>!n.nextReviewAt).slice(0,b);for(let n=0;n{try{const W=await A.memories.get(u.id);t[V]={...u,...W}}catch{}}))}return t}function R(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function p(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}function m(e){const t=e.nextReviewAt?Date.parse(e.nextReviewAt):Number.POSITIVE_INFINITY;return Number.isFinite(t)?t:Number.POSITIVE_INFINITY}function f(e,t){const r=m(e);if(!Number.isFinite(r))return 0;const n=(r-t)/864e5;return p(1-n/30)}function P(e,t){const r=R(e.content).replace(/\s+/g," ").trim().slice(0,48),n=m(e),s=Number.isFinite(n)?Math.ceil((n-t)/864e5):9999,u=s<0?`${Math.abs(s)}D OVER`:s===0?"DUE 0D":`DUE ${s}D`;return R(`${r} | ${e.id.slice(0,8)} | ${u} | ${Math.round(e.retentionStrength*100)}%`)}function _(e){const t=Date.now();return e.filter(r=>!!r.nextReviewAt).slice().sort((r,n)=>{const s=m(r)-m(n);return s!==0?s:(r.retentionStrength??0)-(n.retentionStrength??0)}).sort((r,n)=>f(n,t)-f(r,t))}const g=E(()=>_(i(a))),$=E(()=>i(g).length===0?Q("schedule"):{organ:"schedule",nodes:i(g).slice(0,I).map((e,t)=>({source:{kind:"memory",id:e.id},index:t,label:P(e,Date.now()),retention:p(e.retentionStrength),stability:p(e.retrievalStrength),lastAccessed:e.lastAccessedAt,activation:f(e,Date.now()),tags:e.tags,type:e.nodeType})),edges:[],events:[],receipts:[],scalars:{scheduled:i(g).length,loaded:i(a).length,dueNow:i(g).filter(e=>f(e,Date.now())>=1).length},alive:!0}),O=E(()=>i(a).length===0?"0 MEMORIES LOADED":`${i(a).length} MEMORIES / 0 REVIEW TIMESTAMPS`);function w(e){const r=1.52/Math.max(1,I-1);return e.nodes.slice(0,I).map((n,s)=>({id:`schedule:${n.source.id}`,kind:"schedule-memory",memoryId:n.source.id,text:R(n.label),x:-.9,y:.74-s*r,size:.026,color:k(n.activation??0,n.retention),depth:p(.62+(n.activation??0)*.38),weight:p(n.retention),startFrame:-1e5,revealSpan:1,maxWidthEm:54,hitPadX:.03,hitPadY:.014}))}function k(e,t){return t<.4?v:t<.7?D:d}class H{constructor(t,r){x(this,"text");x(this,"current");this.current=r,this.text=new Z(t),this.text.setText(w(this.current)),this.text.init().then(()=>this.text.setText(w(this.current)))}uploadScene(t){this.current=t,this.text.setText(w(this.current))}render(t){this.text.render(t)}pickAt(t,r){return this.text.pickAt(t,r)}dispose(){this.text.dispose()}}class Y{constructor(t){x(this,"field");this.field=new ee(t)}uploadScene(t){const r=t.nodes.map(n=>({id:n.source.id,score:n.activation??0,hue:n.retention<.4?F.scarlet:n.retention<.7?F.caution:F.oxygen,energy:n.activation,metric2:n.retention,scar:(n.activation??0)>=1,kind:"schedule-memory",payload:n}));this.field.setCells(te(r,n=>n.score>=1?0:n.score>=.75?1:n.score>=.5?2:3,{ringCount:4,maxRadius:.88,minCellR:.045,maxCellR:.11}))}compute(t){this.field.compute(t)}render(t){this.field.render(t)}pickAt(t,r){return this.field.pickAt(t,r)}dispose(){this.field.dispose()}}function B(e,t){const r=new Y(e);return r.uploadScene(t),[r,new H(e,t)]}async function U(e){var n;if(e.kind!=="schedule-memory")return;const t=e.payload,r=t.memoryId??((n=t.source)==null?void 0:n.id);if(r)try{const s=await A.memories.promote(r);o(a,i(a).map(u=>u.id===s.id?{...u,retentionStrength:s.retentionStrength}:u),!0),o(h,null)}catch(s){o(h,s instanceof Error?s.message:"PROMOTE FAILED",!0)}}{let e=E(()=>`schedule-due-field:${i(g).length}:${i(a).length}`);K(l,{organ:"schedule",get seed(){return i(e)},get scene(){return i($)},passes:B,get loading(){return i(S)},get error(){return i(h)},get emptyLabel(){return i(O)},onpick:U})}J()}export{de as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/21.yCKOHF-q.js.br b/apps/dashboard/build/_app/immutable/nodes/21.yCKOHF-q.js.br new file mode 100644 index 0000000..9f6350b Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/21.yCKOHF-q.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/21.yCKOHF-q.js.gz b/apps/dashboard/build/_app/immutable/nodes/21.yCKOHF-q.js.gz new file mode 100644 index 0000000..aeaf200 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/21.yCKOHF-q.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/22.CdolZyzx.js.br b/apps/dashboard/build/_app/immutable/nodes/22.CdolZyzx.js.br deleted file mode 100644 index 80d7ae2..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/22.CdolZyzx.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/22.CdolZyzx.js.gz b/apps/dashboard/build/_app/immutable/nodes/22.CdolZyzx.js.gz deleted file mode 100644 index 2539968..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/22.CdolZyzx.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/22.CdolZyzx.js b/apps/dashboard/build/_app/immutable/nodes/22.kK1AQf2j.js similarity index 98% rename from apps/dashboard/build/_app/immutable/nodes/22.CdolZyzx.js rename to apps/dashboard/build/_app/immutable/nodes/22.kK1AQf2j.js index 4085f9c..b284a64 100644 --- a/apps/dashboard/build/_app/immutable/nodes/22.CdolZyzx.js +++ b/apps/dashboard/build/_app/immutable/nodes/22.kK1AQf2j.js @@ -1 +1 @@ -var It=Object.defineProperty;var Tt=(R,h,m)=>h in R?It(R,h,{enumerable:!0,configurable:!0,writable:!0,value:m}):R[h]=m;var G=(R,h,m)=>Tt(R,typeof h!="symbol"?h+"":h,m);import"../chunks/Bzak7iHL.js";import{o as Ct}from"../chunks/DAau0uzT.js";import{p as Nt,j as At,g as e,b as vt,d as f,u as tt,s as i,k as Dt}from"../chunks/CGq8RnJq.js";import{a as Lt,s as Mt}from"../chunks/DV6OI5iy.js";import{R as Ot}from"../chunks/Cqe0su6e.js";import{r as N,C as $t,V as yt,R as et,I as st}from"../chunks/BMB5u1EX.js";import{T as bt}from"../chunks/D7ozXiSB.js";import{L as xt,F as V,l as Pt}from"../chunks/BeGBxCGK.js";import{a as w}from"../chunks/D35IQVqe.js";import{w as Gt,a as wt}from"../chunks/Ch9vNiEl.js";function zt(R,h){Nt(h,!0);const m=()=>Lt(wt,"$isConnected",nt),[nt,it]=Mt(),F=[...N($t.forward),1],p=[...N(yt.throughput),.98],I=[...N(et.luciferin),1],A=[...N(et.recall),.98],v=[...N(st.caution),.98],H=[...N(st.veto),.98],_=-1e5,B=1,ot=.95,Y=["fact","concept","pattern","decision","person","place"];let E=f(null),$=f(null),D=f(null),L=f(null),u=f(null),U=f(0),d=f("READY"),y=f(!0),T=null;const at=tt(()=>{var t,s,n;return{organ:"settings",nodes:[],edges:[],events:[],receipts:[],scalars:{memories:((t=e(E))==null?void 0:t.totalMemories)??0,retention:((s=e(E))==null?void 0:s.averageRetention)??0,coverage:((n=e(E))==null?void 0:n.embeddingCoverage)??0},alive:!0}});let C=null;At(()=>{e(E),e($),e(D),e(L),e(u),m(),e(d),e(y),T==null||T.refresh(),C==null||C.setCells(k())});function k(){var n;const t=((n=e($))==null?void 0:n.distribution)??[],s=[];return t.forEach((c,r)=>{const a=(r+.5)/Math.max(1,t.length),M=Math.min(60,Math.ceil(c.count/8));for(let S=0;S.66?V.oxygen:a>.33?V.healthy:V.debt,energy:.3+.6*a,metric2:a,scar:a<.2,kind:"settings-tissue",payload:{band:`${r*10}%`,count:c.count}})}),Pt(s,{maxRadius:.96,minCellR:.01,maxCellR:.04})}Ct(()=>{b()});async function b(){i(y,!0);try{const[t,s]=await Promise.all([w.stats().catch(()=>null),w.retentionDistribution().catch(()=>null)]);i(E,t,!0),i($,s,!0)}finally{i(y,!1)}}async function rt(t){if(!e(u))switch(t.id){case"settings:action:consolidate":await ct();break;case"settings:action:dream":await lt();break;case"settings:action:birth":ut();break;case"settings:action:refresh":await Et();break}}async function ct(){i(u,"consolidate"),i(d,"CONSOLIDATING — FSRS-6 DECAY + MAINTENANCE..."),i(L,null);try{i(D,await w.consolidate(),!0),await b(),i(d,"CONSOLIDATION COMPLETE")}catch(t){i(d,`CONSOLIDATE FAILED - ${t instanceof Error?t.message:String(t)}`.slice(0,64),!0)}finally{i(u,null)}}async function lt(){i(u,"dream"),i(d,"DREAMING — REPLAYING MEMORIES, FINDING CONNECTIONS..."),i(D,null);try{i(L,await w.dream(),!0),await b(),i(d,"DREAM CYCLE COMPLETE")}catch(t){i(d,`DREAM FAILED - ${t instanceof Error?t.message:String(t)}`.slice(0,64),!0)}finally{i(u,null)}}function ut(){const t=Y[e(U)%Y.length];Dt(U),Gt.injectEvent({type:"MemoryCreated",data:{id:`demo-birth-${Date.now()}`,content:`Demo memory #${e(U)} - ${t}`,node_type:t,tags:["demo","v2.3-birth-ritual"],retention:.9}}),i(d,`BIRTH ORB INJECTED - ${t.toUpperCase()} (SEE GRAPH)`)}async function Et(){i(u,"refresh"),i(d,"REFRESHING VITALS...");try{await b(),i(d,"VITALS REFRESHED")}finally{i(u,null)}}function dt(t,s){const n=new xt(t);C=n,n.setCells(k());const c={compute:a=>n.compute(a),render:a=>n.render(a),dispose:()=>{n.dispose(),C===n&&(C=null)}},r=new gt(t);return T=r,r.uploadScene(s),[c,r]}class gt{constructor(s){G(this,"text");G(this,"initPromise",null);G(this,"focused",null);this.text=new bt(s)}uploadScene(s){this.ensureReady().then(()=>this.text.setText(W()))}refresh(){this.ensureReady().then(()=>this.text.setText(W()))}render(s){this.text.render(s)}pickAt(s,n){const c=this.text.pickAt(s,n),r=(c==null?void 0:c.kind)==="settings-action",a=r?c.id:null;return a!==this.focused&&(this.focused=a,this.text.setRunDepth(a,1)),r?c:null}dispose(){this.text.dispose(),T===this&&(T=null)}async ensureReady(){this.initPromise||(this.initPromise=this.text.init()),await this.initPromise}}function W(){var z,X,J,Z,q,Q;const t=[];t.push(o("settings:title","settings-title","SETTINGS & SYSTEM",-.9,.86,.052,I)),t.push(o("settings:subtitle","settings-sub","TUNE THE COGNITIVE ENGINE. WATCH IT BREATHE. RUN THE RITUALS THAT KEEP MEMORY ALIVE.",-.9,.79,.02,p,64));const s=((z=e(E))==null?void 0:z.totalMemories)??0,n=((X=e(E))==null?void 0:X.averageRetention)??0,c=((J=e(E))==null?void 0:J.embeddingCoverage)??0,r=m();t.push(o("settings:v-mem-l","settings-vital","MEMORIES",-.9,.66,.024,p)),t.push(o("settings:v-mem","settings-vital",s.toLocaleString(),-.9,.6,.05,F)),t.push(o("settings:v-ret-l","settings-vital","AVG RETENTION",-.42,.66,.024,p)),t.push(o("settings:v-ret","settings-vital",`${(n*100).toFixed(1)}%`,-.42,.6,.05,ht(n))),t.push(o("settings:v-ws-l","settings-vital","WEBSOCKET",.04,.66,.024,p)),t.push(o("settings:v-ws","settings-vital",r?"ONLINE":"OFFLINE",.04,.6,.05,r?A:H)),t.push(o("settings:v-ver-l","settings-vital","VESTIGE",.5,.66,.024,p)),t.push(o("settings:v-ver","settings-vital",`v${e(E)?"2.2.0":"?"}`,.5,.6,.05,I)),t.push(o("settings:v-cov","settings-vital",`EMBEDDING COVERAGE ${c.toFixed(0)}%`,-.9,.53,.02,p)),t.push(o("settings:hist-h","settings-hist","RETENTION DISTRIBUTION",-.9,.44,.026,I));const a=((Z=e($))==null?void 0:Z.distribution)??[],M=Math.max(1,...a.map(l=>l.count)),S=.38,pt=.05;a.forEach((l,g)=>{const O=S-g*pt,mt=g*10,ft=Math.round(l.count/M*30),Rt="#".repeat(Math.max(l.count>0?1:0,ft)),St=`${String(mt).padStart(3," ")}% ${Rt}`;t.push(o(`settings:hist-${g}`,"settings-hist",St,-.9,O,.02,K(g),60)),t.push(o(`settings:hist-c-${g}`,"settings-hist",l.count.toLocaleString(),.32,O,.02,K(g)))});const P=-.5;if(t.push(x("settings:action:consolidate",e(u)==="consolidate"?"[ CONSOLIDATING... ]":"[ CONSOLIDATE ]",-.9,P,e(u)==="consolidate"?v:F)),t.push(x("settings:action:dream",e(u)==="dream"?"[ DREAMING... ]":"[ DREAM ]",-.36,P,e(u)==="dream"?v:A)),t.push(x("settings:action:birth","[ TRIGGER BIRTH ]",.06,P,I)),t.push(x("settings:action:refresh",e(u)==="refresh"?"[ REFRESHING... ]":"[ REFRESH ]",.56,P,e(u)==="refresh"?v:p)),t.push(o("settings:status","settings-status",`> ${e(d)}`,-.9,-.6,.024,I,72)),e(D)){const l=e(D),g=`PROCESSED ${l.nodesProcessed} DECAYED ${l.decayApplied} EMBEDDED ${l.embeddingsGenerated} MERGED ${l.duplicatesMerged} ${l.durationMs}MS`;t.push(o("settings:res-c","settings-result",g,-.9,-.68,.022,A,72))}if(e(L)){const l=e(L),g=`REPLAYED ${l.memoriesReplayed} CONNECTIONS ${l.connectionsPersisted} INSIGHTS ${((q=l.insights)==null?void 0:q.length)??0}`;t.push(o("settings:res-d","settings-result",g,-.9,-.68,.022,A,72));const O=(Q=l.insights)==null?void 0:Q[0];O&&t.push(o("settings:res-d1","settings-result",`~ ${O.insight}`,-.9,-.74,.02,p,76))}return t.push(o("settings:about","settings-about","RUST + AXUM + SVELTEKIT 2 + SVELTE 5 + WEBGPU | FSRS-6 | NOMIC EMBED v1.5 (256D) | USEARCH HNSW | LOCAL-FIRST, ZERO CLOUD",-.9,-.86,.018,p,88)),t}function o(t,s,n,c,r,a,M,S){return{id:t,kind:s,text:j(n),x:c,y:r,size:a,color:M,depth:ot,weight:.5,startFrame:_,revealSpan:B,maxWidthEm:S}}function x(t,s,n,c,r){return{id:t,kind:"settings-action",text:j(s),x:n,y:c,size:.032,color:r,depth:1,weight:.7,startFrame:_,revealSpan:B,maxWidthEm:40,hitPadX:.03,hitPadY:.05}}function ht(t){return t>.7?A:t>.4?v:H}function K(t){return t<2?H:t<4?v:t<7?F:I}function j(t){return t.replace(/[—–]/g,"-").replace(/[‘’]/g,"'").replace(/[“”]/g,'"').replace(/…/g,"...").replace(/[^\x20-\x7E]/g,"?")}{let t=tt(()=>{var s,n;return`settings-console:${((s=e(E))==null?void 0:s.totalMemories)??0}:${(((n=e(E))==null?void 0:n.averageRetention)??0).toFixed(3)}:${m()}`});Ot(R,{organ:"settings",get seed(){return e(t)},get scene(){return e(at)},passes:dt,get loading(){return e(y)},onpick:rt})}vt(),it()}export{zt as component}; +var It=Object.defineProperty;var Tt=(R,h,m)=>h in R?It(R,h,{enumerable:!0,configurable:!0,writable:!0,value:m}):R[h]=m;var G=(R,h,m)=>Tt(R,typeof h!="symbol"?h+"":h,m);import"../chunks/Bzak7iHL.js";import{o as Ct}from"../chunks/DAau0uzT.js";import{p as Nt,j as At,g as e,b as vt,d as f,u as tt,s as i,k as Dt}from"../chunks/CGq8RnJq.js";import{a as Lt,s as Mt}from"../chunks/DV6OI5iy.js";import{R as Ot}from"../chunks/BpEKQwpr.js";import{r as N,C as $t,V as yt,R as et,I as st}from"../chunks/BMB5u1EX.js";import{T as bt}from"../chunks/D7ozXiSB.js";import{L as xt,F as V,l as Pt}from"../chunks/DETSv_kY.js";import{a as w}from"../chunks/D35IQVqe.js";import{w as Gt,a as wt}from"../chunks/Ch9vNiEl.js";function zt(R,h){Nt(h,!0);const m=()=>Lt(wt,"$isConnected",nt),[nt,it]=Mt(),F=[...N($t.forward),1],p=[...N(yt.throughput),.98],I=[...N(et.luciferin),1],A=[...N(et.recall),.98],v=[...N(st.caution),.98],H=[...N(st.veto),.98],_=-1e5,B=1,ot=.95,Y=["fact","concept","pattern","decision","person","place"];let E=f(null),$=f(null),D=f(null),L=f(null),u=f(null),U=f(0),d=f("READY"),y=f(!0),T=null;const at=tt(()=>{var t,s,n;return{organ:"settings",nodes:[],edges:[],events:[],receipts:[],scalars:{memories:((t=e(E))==null?void 0:t.totalMemories)??0,retention:((s=e(E))==null?void 0:s.averageRetention)??0,coverage:((n=e(E))==null?void 0:n.embeddingCoverage)??0},alive:!0}});let C=null;At(()=>{e(E),e($),e(D),e(L),e(u),m(),e(d),e(y),T==null||T.refresh(),C==null||C.setCells(k())});function k(){var n;const t=((n=e($))==null?void 0:n.distribution)??[],s=[];return t.forEach((c,r)=>{const a=(r+.5)/Math.max(1,t.length),M=Math.min(60,Math.ceil(c.count/8));for(let S=0;S.66?V.oxygen:a>.33?V.healthy:V.debt,energy:.3+.6*a,metric2:a,scar:a<.2,kind:"settings-tissue",payload:{band:`${r*10}%`,count:c.count}})}),Pt(s,{maxRadius:.96,minCellR:.01,maxCellR:.04})}Ct(()=>{b()});async function b(){i(y,!0);try{const[t,s]=await Promise.all([w.stats().catch(()=>null),w.retentionDistribution().catch(()=>null)]);i(E,t,!0),i($,s,!0)}finally{i(y,!1)}}async function rt(t){if(!e(u))switch(t.id){case"settings:action:consolidate":await ct();break;case"settings:action:dream":await lt();break;case"settings:action:birth":ut();break;case"settings:action:refresh":await Et();break}}async function ct(){i(u,"consolidate"),i(d,"CONSOLIDATING — FSRS-6 DECAY + MAINTENANCE..."),i(L,null);try{i(D,await w.consolidate(),!0),await b(),i(d,"CONSOLIDATION COMPLETE")}catch(t){i(d,`CONSOLIDATE FAILED - ${t instanceof Error?t.message:String(t)}`.slice(0,64),!0)}finally{i(u,null)}}async function lt(){i(u,"dream"),i(d,"DREAMING — REPLAYING MEMORIES, FINDING CONNECTIONS..."),i(D,null);try{i(L,await w.dream(),!0),await b(),i(d,"DREAM CYCLE COMPLETE")}catch(t){i(d,`DREAM FAILED - ${t instanceof Error?t.message:String(t)}`.slice(0,64),!0)}finally{i(u,null)}}function ut(){const t=Y[e(U)%Y.length];Dt(U),Gt.injectEvent({type:"MemoryCreated",data:{id:`demo-birth-${Date.now()}`,content:`Demo memory #${e(U)} - ${t}`,node_type:t,tags:["demo","v2.3-birth-ritual"],retention:.9}}),i(d,`BIRTH ORB INJECTED - ${t.toUpperCase()} (SEE GRAPH)`)}async function Et(){i(u,"refresh"),i(d,"REFRESHING VITALS...");try{await b(),i(d,"VITALS REFRESHED")}finally{i(u,null)}}function dt(t,s){const n=new xt(t);C=n,n.setCells(k());const c={compute:a=>n.compute(a),render:a=>n.render(a),dispose:()=>{n.dispose(),C===n&&(C=null)}},r=new gt(t);return T=r,r.uploadScene(s),[c,r]}class gt{constructor(s){G(this,"text");G(this,"initPromise",null);G(this,"focused",null);this.text=new bt(s)}uploadScene(s){this.ensureReady().then(()=>this.text.setText(W()))}refresh(){this.ensureReady().then(()=>this.text.setText(W()))}render(s){this.text.render(s)}pickAt(s,n){const c=this.text.pickAt(s,n),r=(c==null?void 0:c.kind)==="settings-action",a=r?c.id:null;return a!==this.focused&&(this.focused=a,this.text.setRunDepth(a,1)),r?c:null}dispose(){this.text.dispose(),T===this&&(T=null)}async ensureReady(){this.initPromise||(this.initPromise=this.text.init()),await this.initPromise}}function W(){var z,X,J,Z,q,Q;const t=[];t.push(o("settings:title","settings-title","SETTINGS & SYSTEM",-.9,.86,.052,I)),t.push(o("settings:subtitle","settings-sub","TUNE THE COGNITIVE ENGINE. WATCH IT BREATHE. RUN THE RITUALS THAT KEEP MEMORY ALIVE.",-.9,.79,.02,p,64));const s=((z=e(E))==null?void 0:z.totalMemories)??0,n=((X=e(E))==null?void 0:X.averageRetention)??0,c=((J=e(E))==null?void 0:J.embeddingCoverage)??0,r=m();t.push(o("settings:v-mem-l","settings-vital","MEMORIES",-.9,.66,.024,p)),t.push(o("settings:v-mem","settings-vital",s.toLocaleString(),-.9,.6,.05,F)),t.push(o("settings:v-ret-l","settings-vital","AVG RETENTION",-.42,.66,.024,p)),t.push(o("settings:v-ret","settings-vital",`${(n*100).toFixed(1)}%`,-.42,.6,.05,ht(n))),t.push(o("settings:v-ws-l","settings-vital","WEBSOCKET",.04,.66,.024,p)),t.push(o("settings:v-ws","settings-vital",r?"ONLINE":"OFFLINE",.04,.6,.05,r?A:H)),t.push(o("settings:v-ver-l","settings-vital","VESTIGE",.5,.66,.024,p)),t.push(o("settings:v-ver","settings-vital",`v${e(E)?"2.2.0":"?"}`,.5,.6,.05,I)),t.push(o("settings:v-cov","settings-vital",`EMBEDDING COVERAGE ${c.toFixed(0)}%`,-.9,.53,.02,p)),t.push(o("settings:hist-h","settings-hist","RETENTION DISTRIBUTION",-.9,.44,.026,I));const a=((Z=e($))==null?void 0:Z.distribution)??[],M=Math.max(1,...a.map(l=>l.count)),S=.38,pt=.05;a.forEach((l,g)=>{const O=S-g*pt,mt=g*10,ft=Math.round(l.count/M*30),Rt="#".repeat(Math.max(l.count>0?1:0,ft)),St=`${String(mt).padStart(3," ")}% ${Rt}`;t.push(o(`settings:hist-${g}`,"settings-hist",St,-.9,O,.02,K(g),60)),t.push(o(`settings:hist-c-${g}`,"settings-hist",l.count.toLocaleString(),.32,O,.02,K(g)))});const P=-.5;if(t.push(x("settings:action:consolidate",e(u)==="consolidate"?"[ CONSOLIDATING... ]":"[ CONSOLIDATE ]",-.9,P,e(u)==="consolidate"?v:F)),t.push(x("settings:action:dream",e(u)==="dream"?"[ DREAMING... ]":"[ DREAM ]",-.36,P,e(u)==="dream"?v:A)),t.push(x("settings:action:birth","[ TRIGGER BIRTH ]",.06,P,I)),t.push(x("settings:action:refresh",e(u)==="refresh"?"[ REFRESHING... ]":"[ REFRESH ]",.56,P,e(u)==="refresh"?v:p)),t.push(o("settings:status","settings-status",`> ${e(d)}`,-.9,-.6,.024,I,72)),e(D)){const l=e(D),g=`PROCESSED ${l.nodesProcessed} DECAYED ${l.decayApplied} EMBEDDED ${l.embeddingsGenerated} MERGED ${l.duplicatesMerged} ${l.durationMs}MS`;t.push(o("settings:res-c","settings-result",g,-.9,-.68,.022,A,72))}if(e(L)){const l=e(L),g=`REPLAYED ${l.memoriesReplayed} CONNECTIONS ${l.connectionsPersisted} INSIGHTS ${((q=l.insights)==null?void 0:q.length)??0}`;t.push(o("settings:res-d","settings-result",g,-.9,-.68,.022,A,72));const O=(Q=l.insights)==null?void 0:Q[0];O&&t.push(o("settings:res-d1","settings-result",`~ ${O.insight}`,-.9,-.74,.02,p,76))}return t.push(o("settings:about","settings-about","RUST + AXUM + SVELTEKIT 2 + SVELTE 5 + WEBGPU | FSRS-6 | NOMIC EMBED v1.5 (256D) | USEARCH HNSW | LOCAL-FIRST, ZERO CLOUD",-.9,-.86,.018,p,88)),t}function o(t,s,n,c,r,a,M,S){return{id:t,kind:s,text:j(n),x:c,y:r,size:a,color:M,depth:ot,weight:.5,startFrame:_,revealSpan:B,maxWidthEm:S}}function x(t,s,n,c,r){return{id:t,kind:"settings-action",text:j(s),x:n,y:c,size:.032,color:r,depth:1,weight:.7,startFrame:_,revealSpan:B,maxWidthEm:40,hitPadX:.03,hitPadY:.05}}function ht(t){return t>.7?A:t>.4?v:H}function K(t){return t<2?H:t<4?v:t<7?F:I}function j(t){return t.replace(/[—–]/g,"-").replace(/[‘’]/g,"'").replace(/[“”]/g,'"').replace(/…/g,"...").replace(/[^\x20-\x7E]/g,"?")}{let t=tt(()=>{var s,n;return`settings-console:${((s=e(E))==null?void 0:s.totalMemories)??0}:${(((n=e(E))==null?void 0:n.averageRetention)??0).toFixed(3)}:${m()}`});Ot(R,{organ:"settings",get seed(){return e(t)},get scene(){return e(at)},passes:dt,get loading(){return e(y)},onpick:rt})}vt(),it()}export{zt as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/22.kK1AQf2j.js.br b/apps/dashboard/build/_app/immutable/nodes/22.kK1AQf2j.js.br new file mode 100644 index 0000000..81e0e8c Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/22.kK1AQf2j.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/22.kK1AQf2j.js.gz b/apps/dashboard/build/_app/immutable/nodes/22.kK1AQf2j.js.gz new file mode 100644 index 0000000..d33a89e Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/22.kK1AQf2j.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/23.CWsheXid.js b/apps/dashboard/build/_app/immutable/nodes/23.B0dVDPB6.js similarity index 97% rename from apps/dashboard/build/_app/immutable/nodes/23.CWsheXid.js rename to apps/dashboard/build/_app/immutable/nodes/23.B0dVDPB6.js index 8da0126..cf09203 100644 --- a/apps/dashboard/build/_app/immutable/nodes/23.CWsheXid.js +++ b/apps/dashboard/build/_app/immutable/nodes/23.B0dVDPB6.js @@ -1 +1 @@ -var Y=Object.defineProperty;var q=(f,u,m)=>u in f?Y(f,u,{enumerable:!0,configurable:!0,writable:!0,value:m}):f[u]=m;var h=(f,u,m)=>q(f,typeof u!="symbol"?u+"":u,m);import"../chunks/Bzak7iHL.js";import{o as v}from"../chunks/DAau0uzT.js";import{p as B,b as G,g as o,s as a,d as R,u as P}from"../chunks/CGq8RnJq.js";import{R as X}from"../chunks/Cqe0su6e.js";import{r as b,C as J,V as K,R as Q,I as k}from"../chunks/BMB5u1EX.js";import{T as Z}from"../chunks/D7ozXiSB.js";import{L as tt,l as et,F as g}from"../chunks/BeGBxCGK.js";import{a as M}from"../chunks/D35IQVqe.js";function dt(f,u){B(u,!0);const m=[...b(J.forward),1],F=[...b(K.throughput),.96],E=[...b(Q.luciferin),.9],A=[...b(k.caution),.88],I=[...b(k.veto),.9];let l=R(null),x=R(!0),y=R(null),C=R(null);const $=P(()=>{const e=o(l)?U(o(l),o(C)):[],t=Object.fromEntries(e.map(n=>[n.metric,n.magnitude]));return{organ:"stats",nodes:[],edges:[],events:[],receipts:e,scalars:t,alive:e.length>0}});v(()=>{L()});async function L(){a(x,!0),a(y,null);try{a(l,await M.stats(),!0)}catch(e){a(l,null),a(y,e instanceof Error?e.message:String(e),!0)}finally{a(x,!1)}}async function T(e){if(e.kind==="stats-vital"){a(x,!0),a(y,null);try{a(C,await M.consolidate(),!0),a(l,await M.stats(),!0)}catch(t){a(y,t instanceof Error?t.message:String(t),!0)}finally{a(x,!1)}}}function V(e,t){const n=new D(e);n.uploadScene(t);const s=new _(e);return s.uploadScene(t),[n,s]}class D{constructor(t){h(this,"field");this.field=new tt(t)}uploadScene(t){const s=t.receipts.map(i=>({id:`stats:${i.metric}`,score:i.magnitude,hue:O(i.metric,i.magnitude),energy:.4+.6*i.magnitude,scar:(i.metric.includes("due")||i.metric.includes("Retention"))&&i.magnitude<.4,kind:"stats-vital",payload:i}));this.field.setCells(et(s,{maxRadius:.86,minCellR:.03,maxCellR:.11}))}compute(t){this.field.compute(t)}render(t){this.field.render(t)}pickAt(t,n){return this.field.pickAt(t,n)}dispose(){this.field.dispose()}}function O(e,t){return e.includes("due")||e.includes("decay")?t>.4?g.caution:g.forward:e.includes("Coverage")||e.includes("Embeddings")?t>.7?g.oxygen:g.bridge:e.includes("Retention")||e.includes("Strength")?t<.4?g.scarlet:g.oxygen:g.recall}class _{constructor(t){h(this,"text");h(this,"initPromise",null);h(this,"scene",null);h(this,"focused",null);this.text=new Z(t)}uploadScene(t){this.scene=t,this.ensureReady().then(()=>this.text.setText(this.buildItems(t)))}render(t){this.text.render(t)}pickAt(t,n){const s=this.text.pickAt(t,n),i=(s==null?void 0:s.id)??null;return i!==this.focused&&(this.focused=i,this.text.setRunDepth(i,1)),s}dispose(){this.text.dispose(),this.scene=null}async ensureReady(){this.initPromise||(this.initPromise=this.text.init()),await this.initPromise}buildItems(t){const n=t.receipts;if(n.length===0)return[];const s=.68,i=1.36/Math.max(1,n.length-1);return n.map((d,r)=>{const c=p(d.magnitude);return{id:`stats:${d.metric}`,kind:"stats-vital",text:d.label,x:-.82,y:s-r*i,size:r<4?.036:.027,color:z(d.metric,c),depth:c,weight:Math.max(.18,Math.sqrt(c)),startFrame:r*2,revealSpan:22,maxWidthEm:48,hitPadX:.03,hitPadY:.03}})}}function U(e,t){const n=Object.entries(e),s=n.map(([,r])=>typeof r=="number"&&Number.isFinite(r)?Math.abs(r):null).filter(r=>r!==null),i=Math.max(1,...s),d=n.map(([r,c],S)=>{const W=N(r,c,i);return w(r,c,W)});if(t)for(const[r,c]of Object.entries(t)){const S=`consolidate.${r}`;d.push(w(S,c,N(S,c,i),d.length))}return d}function w(e,t,n,s){return{source:{kind:"scalar",id:e,scalar:{name:e,value:n}},label:H(`${e} | ${j(e,t)}`),nodeIndices:[],metric:e,rawValue:t,magnitude:p(n)}}function N(e,t,n){if(typeof t=="number"&&Number.isFinite(t))return e.includes("Coverage")?p(t>1?t/100:t):e.includes("average")||e.includes("Retention")||e.includes("Strength")?p(t):p(Math.log10(Math.abs(t)+1)/Math.log10(n+1));if(typeof t=="string"){const s=Date.parse(t);if(Number.isFinite(s)){const i=Math.max(0,(Date.now()-s)/864e5);return p(1/(1+i/30))}return p(t.length/48)}return .5}function j(e,t){return typeof t=="number"&&Number.isFinite(t)?e.includes("Coverage")?`${t.toFixed(t>1?0:2)}%`:e.includes("average")?`${(t*100).toFixed(1)}%`:Number.isInteger(t)?t.toLocaleString():t.toFixed(3):typeof t=="string"?t:String(t)}function z(e,t){return e.includes("due")||e.includes("decay")?t>.4?A:F:e.includes("Coverage")||e.includes("Embeddings")?t>.7?E:m:e.includes("Retention")||e.includes("Strength")?t<.4?I:E:F}function H(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function p(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}{let e=P(()=>{var t,n,s;return`stats-vitals:${((t=o(l))==null?void 0:t.totalMemories)??0}:${((n=o(l))==null?void 0:n.dueForReview)??0}:${((s=o(l))==null?void 0:s.averageRetention)??0}`});X(f,{organ:"stats",get seed(){return o(e)},get scene(){return o($)},passes:V,get loading(){return o(x)},get error(){return o(y)},onpick:T})}G()}export{dt as component}; +var Y=Object.defineProperty;var q=(f,u,m)=>u in f?Y(f,u,{enumerable:!0,configurable:!0,writable:!0,value:m}):f[u]=m;var h=(f,u,m)=>q(f,typeof u!="symbol"?u+"":u,m);import"../chunks/Bzak7iHL.js";import{o as v}from"../chunks/DAau0uzT.js";import{p as B,b as G,g as o,s as a,d as R,u as P}from"../chunks/CGq8RnJq.js";import{R as X}from"../chunks/BpEKQwpr.js";import{r as b,C as J,V as K,R as Q,I as k}from"../chunks/BMB5u1EX.js";import{T as Z}from"../chunks/D7ozXiSB.js";import{L as tt,l as et,F as g}from"../chunks/DETSv_kY.js";import{a as M}from"../chunks/D35IQVqe.js";function dt(f,u){B(u,!0);const m=[...b(J.forward),1],F=[...b(K.throughput),.96],E=[...b(Q.luciferin),.9],A=[...b(k.caution),.88],I=[...b(k.veto),.9];let l=R(null),x=R(!0),y=R(null),C=R(null);const $=P(()=>{const e=o(l)?U(o(l),o(C)):[],t=Object.fromEntries(e.map(n=>[n.metric,n.magnitude]));return{organ:"stats",nodes:[],edges:[],events:[],receipts:e,scalars:t,alive:e.length>0}});v(()=>{L()});async function L(){a(x,!0),a(y,null);try{a(l,await M.stats(),!0)}catch(e){a(l,null),a(y,e instanceof Error?e.message:String(e),!0)}finally{a(x,!1)}}async function T(e){if(e.kind==="stats-vital"){a(x,!0),a(y,null);try{a(C,await M.consolidate(),!0),a(l,await M.stats(),!0)}catch(t){a(y,t instanceof Error?t.message:String(t),!0)}finally{a(x,!1)}}}function V(e,t){const n=new D(e);n.uploadScene(t);const s=new _(e);return s.uploadScene(t),[n,s]}class D{constructor(t){h(this,"field");this.field=new tt(t)}uploadScene(t){const s=t.receipts.map(i=>({id:`stats:${i.metric}`,score:i.magnitude,hue:O(i.metric,i.magnitude),energy:.4+.6*i.magnitude,scar:(i.metric.includes("due")||i.metric.includes("Retention"))&&i.magnitude<.4,kind:"stats-vital",payload:i}));this.field.setCells(et(s,{maxRadius:.86,minCellR:.03,maxCellR:.11}))}compute(t){this.field.compute(t)}render(t){this.field.render(t)}pickAt(t,n){return this.field.pickAt(t,n)}dispose(){this.field.dispose()}}function O(e,t){return e.includes("due")||e.includes("decay")?t>.4?g.caution:g.forward:e.includes("Coverage")||e.includes("Embeddings")?t>.7?g.oxygen:g.bridge:e.includes("Retention")||e.includes("Strength")?t<.4?g.scarlet:g.oxygen:g.recall}class _{constructor(t){h(this,"text");h(this,"initPromise",null);h(this,"scene",null);h(this,"focused",null);this.text=new Z(t)}uploadScene(t){this.scene=t,this.ensureReady().then(()=>this.text.setText(this.buildItems(t)))}render(t){this.text.render(t)}pickAt(t,n){const s=this.text.pickAt(t,n),i=(s==null?void 0:s.id)??null;return i!==this.focused&&(this.focused=i,this.text.setRunDepth(i,1)),s}dispose(){this.text.dispose(),this.scene=null}async ensureReady(){this.initPromise||(this.initPromise=this.text.init()),await this.initPromise}buildItems(t){const n=t.receipts;if(n.length===0)return[];const s=.68,i=1.36/Math.max(1,n.length-1);return n.map((d,r)=>{const c=p(d.magnitude);return{id:`stats:${d.metric}`,kind:"stats-vital",text:d.label,x:-.82,y:s-r*i,size:r<4?.036:.027,color:z(d.metric,c),depth:c,weight:Math.max(.18,Math.sqrt(c)),startFrame:r*2,revealSpan:22,maxWidthEm:48,hitPadX:.03,hitPadY:.03}})}}function U(e,t){const n=Object.entries(e),s=n.map(([,r])=>typeof r=="number"&&Number.isFinite(r)?Math.abs(r):null).filter(r=>r!==null),i=Math.max(1,...s),d=n.map(([r,c],S)=>{const W=N(r,c,i);return w(r,c,W)});if(t)for(const[r,c]of Object.entries(t)){const S=`consolidate.${r}`;d.push(w(S,c,N(S,c,i),d.length))}return d}function w(e,t,n,s){return{source:{kind:"scalar",id:e,scalar:{name:e,value:n}},label:H(`${e} | ${j(e,t)}`),nodeIndices:[],metric:e,rawValue:t,magnitude:p(n)}}function N(e,t,n){if(typeof t=="number"&&Number.isFinite(t))return e.includes("Coverage")?p(t>1?t/100:t):e.includes("average")||e.includes("Retention")||e.includes("Strength")?p(t):p(Math.log10(Math.abs(t)+1)/Math.log10(n+1));if(typeof t=="string"){const s=Date.parse(t);if(Number.isFinite(s)){const i=Math.max(0,(Date.now()-s)/864e5);return p(1/(1+i/30))}return p(t.length/48)}return .5}function j(e,t){return typeof t=="number"&&Number.isFinite(t)?e.includes("Coverage")?`${t.toFixed(t>1?0:2)}%`:e.includes("average")?`${(t*100).toFixed(1)}%`:Number.isInteger(t)?t.toLocaleString():t.toFixed(3):typeof t=="string"?t:String(t)}function z(e,t){return e.includes("due")||e.includes("decay")?t>.4?A:F:e.includes("Coverage")||e.includes("Embeddings")?t>.7?E:m:e.includes("Retention")||e.includes("Strength")?t<.4?I:E:F}function H(e){return e.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function p(e){return Math.min(1,Math.max(0,Number.isFinite(e)?e:.5))}{let e=P(()=>{var t,n,s;return`stats-vitals:${((t=o(l))==null?void 0:t.totalMemories)??0}:${((n=o(l))==null?void 0:n.dueForReview)??0}:${((s=o(l))==null?void 0:s.averageRetention)??0}`});X(f,{organ:"stats",get seed(){return o(e)},get scene(){return o($)},passes:V,get loading(){return o(x)},get error(){return o(y)},onpick:T})}G()}export{dt as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/23.B0dVDPB6.js.br b/apps/dashboard/build/_app/immutable/nodes/23.B0dVDPB6.js.br new file mode 100644 index 0000000..c70e838 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/23.B0dVDPB6.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/23.B0dVDPB6.js.gz b/apps/dashboard/build/_app/immutable/nodes/23.B0dVDPB6.js.gz new file mode 100644 index 0000000..4e63c55 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/23.B0dVDPB6.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/23.CWsheXid.js.br b/apps/dashboard/build/_app/immutable/nodes/23.CWsheXid.js.br deleted file mode 100644 index 4cf7c35..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/23.CWsheXid.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/23.CWsheXid.js.gz b/apps/dashboard/build/_app/immutable/nodes/23.CWsheXid.js.gz deleted file mode 100644 index a4d38b6..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/23.CWsheXid.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/24.BbbXGX69.js.br b/apps/dashboard/build/_app/immutable/nodes/24.BbbXGX69.js.br deleted file mode 100644 index 8059e19..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/24.BbbXGX69.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/24.BbbXGX69.js.gz b/apps/dashboard/build/_app/immutable/nodes/24.BbbXGX69.js.gz deleted file mode 100644 index b046c9e..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/24.BbbXGX69.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/24.BbbXGX69.js b/apps/dashboard/build/_app/immutable/nodes/24.taYcndi3.js similarity index 99% rename from apps/dashboard/build/_app/immutable/nodes/24.BbbXGX69.js rename to apps/dashboard/build/_app/immutable/nodes/24.taYcndi3.js index 5aaede1..5bae681 100644 --- a/apps/dashboard/build/_app/immutable/nodes/24.BbbXGX69.js +++ b/apps/dashboard/build/_app/immutable/nodes/24.taYcndi3.js @@ -1,4 +1,4 @@ -var de=Object.defineProperty;var pe=(s,e,t)=>e in s?de(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var w=(s,e,t)=>pe(s,typeof e!="symbol"?e+"":e,t);import"../chunks/Bzak7iHL.js";import{o as me}from"../chunks/DAau0uzT.js";import{p as fe,d as N,e as se,j as he,g as n,b as ge,u as D,h as be,s as A,$ as ve}from"../chunks/CGq8RnJq.js";import{h as ye}from"../chunks/De_e6MzK.js";import{a as le}from"../chunks/D35IQVqe.js";import{r as F,M as xe,R as ae}from"../chunks/BMB5u1EX.js";import{T as Se}from"../chunks/D7ozXiSB.js";import{R as we}from"../chunks/Cqe0su6e.js";const j="rgba16float",K=768,J=96,te=16,ie=12,oe=` +var de=Object.defineProperty;var pe=(s,e,t)=>e in s?de(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var w=(s,e,t)=>pe(s,typeof e!="symbol"?e+"":e,t);import"../chunks/Bzak7iHL.js";import{o as me}from"../chunks/DAau0uzT.js";import{p as fe,d as N,e as se,j as he,g as n,b as ge,u as D,h as be,s as A,$ as ve}from"../chunks/CGq8RnJq.js";import{h as ye}from"../chunks/De_e6MzK.js";import{a as le}from"../chunks/D35IQVqe.js";import{r as F,M as xe,R as ae}from"../chunks/BMB5u1EX.js";import{T as Se}from"../chunks/D7ozXiSB.js";import{R as we}from"../chunks/BpEKQwpr.js";const j="rgba16float",K=768,J=96,te=16,ie=12,oe=` struct Params { frame: f32, loop_phase: f32, diff --git a/apps/dashboard/build/_app/immutable/nodes/24.taYcndi3.js.br b/apps/dashboard/build/_app/immutable/nodes/24.taYcndi3.js.br new file mode 100644 index 0000000..1c0e2a9 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/24.taYcndi3.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/24.taYcndi3.js.gz b/apps/dashboard/build/_app/immutable/nodes/24.taYcndi3.js.gz new file mode 100644 index 0000000..63ec594 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/24.taYcndi3.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/25.CpxKI_0Q.js.gz b/apps/dashboard/build/_app/immutable/nodes/25.CpxKI_0Q.js.gz index 8173a46..d578196 100644 Binary files a/apps/dashboard/build/_app/immutable/nodes/25.CpxKI_0Q.js.gz and b/apps/dashboard/build/_app/immutable/nodes/25.CpxKI_0Q.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/3.C6cru0cW.js.gz b/apps/dashboard/build/_app/immutable/nodes/3.C6cru0cW.js.gz index 971e466..85236b5 100644 Binary files a/apps/dashboard/build/_app/immutable/nodes/3.C6cru0cW.js.gz and b/apps/dashboard/build/_app/immutable/nodes/3.C6cru0cW.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/4.CIxbWFkr.js.gz b/apps/dashboard/build/_app/immutable/nodes/4.CIxbWFkr.js.gz index 535ed39..1d295d4 100644 Binary files a/apps/dashboard/build/_app/immutable/nodes/4.CIxbWFkr.js.gz and b/apps/dashboard/build/_app/immutable/nodes/4.CIxbWFkr.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/5.bHY_C0IS.js b/apps/dashboard/build/_app/immutable/nodes/5.XKzsmb3Z.js similarity index 95% rename from apps/dashboard/build/_app/immutable/nodes/5.bHY_C0IS.js rename to apps/dashboard/build/_app/immutable/nodes/5.XKzsmb3Z.js index d8e64ed..88c39e3 100644 --- a/apps/dashboard/build/_app/immutable/nodes/5.bHY_C0IS.js +++ b/apps/dashboard/build/_app/immutable/nodes/5.XKzsmb3Z.js @@ -1 +1 @@ -var _=Object.defineProperty;var H=(u,o,d)=>o in u?_(u,o,{enumerable:!0,configurable:!0,writable:!0,value:d}):u[o]=d;var M=(u,o,d)=>H(u,typeof o!="symbol"?o+"":o,d);import"../chunks/Bzak7iHL.js";import{o as U,g as V}from"../chunks/DAau0uzT.js";import{p as W,d as p,e as q,b as D,s,h as Q,$ as z,g as n,u as $}from"../chunks/CGq8RnJq.js";import{h as K}from"../chunks/De_e6MzK.js";import{p as Y}from"../chunks/CbBCXwzm.js";import{a as I}from"../chunks/D35IQVqe.js";import{R as G}from"../chunks/Cqe0su6e.js";import{r as X,a as j}from"../chunks/BMB5u1EX.js";import{T as B}from"../chunks/D7ozXiSB.js";import{L as J,F as Z,l as tt}from"../chunks/BeGBxCGK.js";function pt(u,o){W(o,!0);const d=[...X("#22C7DE"),1],v=36,N=40;let c=p(q([])),g=p(0),f=p(0),R=p(""),S=p(!0),A=p(null);U(()=>{k()});async function O(){var i,a,l;const t=(i=V(Y).url.searchParams.get("q"))==null?void 0:i.trim();return t||(((l=(a=(await I.memories.list({limit:"1"})).memories[0])==null?void 0:a.content)==null?void 0:l.replace(/\s+/g," ").trim())??"").slice(0,96)}async function k(){s(S,!0),s(A,null);try{const t=await O();if(s(R,t,!0),!t){s(c,[],!0),s(g,0),s(f,0);return}const e=await I.search(t,N);s(c,e.results,!0),s(g,e.total,!0),s(f,e.durationMs,!0)}catch(t){s(c,[],!0),s(g,0),s(f,0),s(A,t instanceof Error?t.message:"UNKNOWN ACTIVATION FETCH ERROR",!0)}finally{s(S,!1)}}function T(t){return t.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function x(t){return Math.min(1,Math.max(0,Number.isFinite(t)?t:.5))}function h(t){return x(t.combinedScore??t.retrievalStrength??t.retentionStrength??.5)}function E(t){return x(t.retentionStrength??h(t))}function P(t){const e=T(t.content).replace(/\s+/g," ").trim().slice(0,54),r=Math.round(h(t)*100);return T(`${e} | ${t.id.slice(0,8)} | ${r}%`)}function C(){const t=n(c).slice(0,v),e=.72,r=1.5/Math.max(1,v-1);return t.map((i,a)=>({id:`activation:${i.id}`,kind:"activation-result",memoryId:i.id,text:P(i),x:-.88,y:e-a*r,size:.026,color:d,depth:h(i),weight:E(i),startFrame:a*2,revealSpan:20,maxWidthEm:46,hitPadX:.03,hitPadY:.015}))}let w=$(()=>({organ:"activation",nodes:n(c).slice(0,v).map((t,e)=>({source:{kind:"memory",id:t.id},index:e,label:T(t.content).replace(/\s+/g," ").trim().slice(0,54),retention:E(t),stability:t.storageStrength,lastAccessed:t.lastAccessedAt,activation:h(t),trust:h(t),tags:t.tags??[],type:t.nodeType})),edges:[],events:[],receipts:[],scalars:{total:n(g),durationMs:n(f),visibleResults:Math.min(n(c).length,v),queryLength:n(R).length},alive:n(c).length>0}));class L{constructor(e){M(this,"field");this.field=new J(e)}uploadScene(e){const i=e.nodes.map(a=>{const l=x(a.activation??.5),m=x(a.retention);return{id:a.source.id,score:l,hue:m>0?j(m):Z.recall,energy:.4+.6*l,metric2:m,kind:"activation-result",payload:a}});this.field.setCells(tt(i,{maxRadius:.92,minCellR:.012,maxCellR:.05}))}compute(e){this.field.compute(e)}render(e){this.field.render(e)}pickAt(e,r){return this.field.pickAt(e,r)}dispose(){this.field.dispose()}}function b(t,e){const r=new L(t);r.uploadScene(e);const i=new B(t);return i.init().then(()=>i.setText(C())),[r,{render:l=>i.render(l),uploadScene:()=>i.setText(C()),pickAt:(l,m)=>i.pickAt(l,m),dispose:()=>i.dispose()}]}function F(t){var r;const e=t.payload;return(e==null?void 0:e.memoryId)??((r=e==null?void 0:e.source)==null?void 0:r.id)??null}async function y(t){if(t.kind!=="activation-result")return;const e=F(t);if(e)try{const r=await I.memories.promote(e);s(c,n(c).map(i=>i.id===r.id?{...i,...r}:i),!0)}catch(r){s(A,r instanceof Error?r.message:"UNKNOWN ACTIVATION PROMOTE ERROR",!0)}}K("13cmvxk",t=>{Q(()=>{z.title="Activation · Vestige"})});{let t=$(()=>`activation-field:${n(R)}:${n(g)}:${n(f)}`);G(u,{organ:"activation",get seed(){return n(t)},get scene(){return n(w)},passes:b,get loading(){return n(S)},get error(){return n(A)},emptyLabel:"NO SEARCH ACTIVATION RESULTS",onpick:y})}D()}export{pt as component}; +var _=Object.defineProperty;var H=(u,o,d)=>o in u?_(u,o,{enumerable:!0,configurable:!0,writable:!0,value:d}):u[o]=d;var M=(u,o,d)=>H(u,typeof o!="symbol"?o+"":o,d);import"../chunks/Bzak7iHL.js";import{o as U,g as V}from"../chunks/DAau0uzT.js";import{p as W,d as p,e as q,b as D,s,h as Q,$ as z,g as n,u as $}from"../chunks/CGq8RnJq.js";import{h as K}from"../chunks/De_e6MzK.js";import{p as Y}from"../chunks/CbBCXwzm.js";import{a as I}from"../chunks/D35IQVqe.js";import{R as G}from"../chunks/BpEKQwpr.js";import{r as X,a as j}from"../chunks/BMB5u1EX.js";import{T as B}from"../chunks/D7ozXiSB.js";import{L as J,F as Z,l as tt}from"../chunks/DETSv_kY.js";function pt(u,o){W(o,!0);const d=[...X("#22C7DE"),1],v=36,N=40;let c=p(q([])),g=p(0),f=p(0),R=p(""),S=p(!0),A=p(null);U(()=>{k()});async function O(){var i,a,l;const t=(i=V(Y).url.searchParams.get("q"))==null?void 0:i.trim();return t||(((l=(a=(await I.memories.list({limit:"1"})).memories[0])==null?void 0:a.content)==null?void 0:l.replace(/\s+/g," ").trim())??"").slice(0,96)}async function k(){s(S,!0),s(A,null);try{const t=await O();if(s(R,t,!0),!t){s(c,[],!0),s(g,0),s(f,0);return}const e=await I.search(t,N);s(c,e.results,!0),s(g,e.total,!0),s(f,e.durationMs,!0)}catch(t){s(c,[],!0),s(g,0),s(f,0),s(A,t instanceof Error?t.message:"UNKNOWN ACTIVATION FETCH ERROR",!0)}finally{s(S,!1)}}function T(t){return t.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function x(t){return Math.min(1,Math.max(0,Number.isFinite(t)?t:.5))}function h(t){return x(t.combinedScore??t.retrievalStrength??t.retentionStrength??.5)}function E(t){return x(t.retentionStrength??h(t))}function P(t){const e=T(t.content).replace(/\s+/g," ").trim().slice(0,54),r=Math.round(h(t)*100);return T(`${e} | ${t.id.slice(0,8)} | ${r}%`)}function C(){const t=n(c).slice(0,v),e=.72,r=1.5/Math.max(1,v-1);return t.map((i,a)=>({id:`activation:${i.id}`,kind:"activation-result",memoryId:i.id,text:P(i),x:-.88,y:e-a*r,size:.026,color:d,depth:h(i),weight:E(i),startFrame:a*2,revealSpan:20,maxWidthEm:46,hitPadX:.03,hitPadY:.015}))}let w=$(()=>({organ:"activation",nodes:n(c).slice(0,v).map((t,e)=>({source:{kind:"memory",id:t.id},index:e,label:T(t.content).replace(/\s+/g," ").trim().slice(0,54),retention:E(t),stability:t.storageStrength,lastAccessed:t.lastAccessedAt,activation:h(t),trust:h(t),tags:t.tags??[],type:t.nodeType})),edges:[],events:[],receipts:[],scalars:{total:n(g),durationMs:n(f),visibleResults:Math.min(n(c).length,v),queryLength:n(R).length},alive:n(c).length>0}));class L{constructor(e){M(this,"field");this.field=new J(e)}uploadScene(e){const i=e.nodes.map(a=>{const l=x(a.activation??.5),m=x(a.retention);return{id:a.source.id,score:l,hue:m>0?j(m):Z.recall,energy:.4+.6*l,metric2:m,kind:"activation-result",payload:a}});this.field.setCells(tt(i,{maxRadius:.92,minCellR:.012,maxCellR:.05}))}compute(e){this.field.compute(e)}render(e){this.field.render(e)}pickAt(e,r){return this.field.pickAt(e,r)}dispose(){this.field.dispose()}}function b(t,e){const r=new L(t);r.uploadScene(e);const i=new B(t);return i.init().then(()=>i.setText(C())),[r,{render:l=>i.render(l),uploadScene:()=>i.setText(C()),pickAt:(l,m)=>i.pickAt(l,m),dispose:()=>i.dispose()}]}function F(t){var r;const e=t.payload;return(e==null?void 0:e.memoryId)??((r=e==null?void 0:e.source)==null?void 0:r.id)??null}async function y(t){if(t.kind!=="activation-result")return;const e=F(t);if(e)try{const r=await I.memories.promote(e);s(c,n(c).map(i=>i.id===r.id?{...i,...r}:i),!0)}catch(r){s(A,r instanceof Error?r.message:"UNKNOWN ACTIVATION PROMOTE ERROR",!0)}}K("13cmvxk",t=>{Q(()=>{z.title="Activation · Vestige"})});{let t=$(()=>`activation-field:${n(R)}:${n(g)}:${n(f)}`);G(u,{organ:"activation",get seed(){return n(t)},get scene(){return n(w)},passes:b,get loading(){return n(S)},get error(){return n(A)},emptyLabel:"NO SEARCH ACTIVATION RESULTS",onpick:y})}D()}export{pt as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/5.XKzsmb3Z.js.br b/apps/dashboard/build/_app/immutable/nodes/5.XKzsmb3Z.js.br new file mode 100644 index 0000000..b7f5eb1 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/5.XKzsmb3Z.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/5.XKzsmb3Z.js.gz b/apps/dashboard/build/_app/immutable/nodes/5.XKzsmb3Z.js.gz new file mode 100644 index 0000000..9613087 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/5.XKzsmb3Z.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/5.bHY_C0IS.js.br b/apps/dashboard/build/_app/immutable/nodes/5.bHY_C0IS.js.br deleted file mode 100644 index ed72a74..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/5.bHY_C0IS.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/5.bHY_C0IS.js.gz b/apps/dashboard/build/_app/immutable/nodes/5.bHY_C0IS.js.gz deleted file mode 100644 index e67ca9c..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/5.bHY_C0IS.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/6.BAqyGpdp.js.br b/apps/dashboard/build/_app/immutable/nodes/6.BAqyGpdp.js.br deleted file mode 100644 index dd8360b..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/6.BAqyGpdp.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/6.BAqyGpdp.js.gz b/apps/dashboard/build/_app/immutable/nodes/6.BAqyGpdp.js.gz deleted file mode 100644 index 64912a2..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/6.BAqyGpdp.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/6.BAqyGpdp.js b/apps/dashboard/build/_app/immutable/nodes/6.CNes4HHG.js similarity index 77% rename from apps/dashboard/build/_app/immutable/nodes/6.BAqyGpdp.js rename to apps/dashboard/build/_app/immutable/nodes/6.CNes4HHG.js index c87ad3f..94563d4 100644 --- a/apps/dashboard/build/_app/immutable/nodes/6.BAqyGpdp.js +++ b/apps/dashboard/build/_app/immutable/nodes/6.CNes4HHG.js @@ -1,4 +1,4 @@ -var kr=Object.defineProperty;var Pr=(t,r,l)=>r in t?kr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[r]=l;var j=(t,r,l)=>Pr(t,typeof r!="symbol"?r+"":r,l);import"../chunks/Bzak7iHL.js";import{d as ir,s as u,b as Xe,o as Sr}from"../chunks/DAau0uzT.js";import{p as lr,c as s,r as a,X as n,af as Ie,Y as B,a as y,b as or,aH as xt,f as _,g as e,d as Se,e as er,j as tr,s as U,u as ge}from"../chunks/CGq8RnJq.js";import{i as O}from"../chunks/Ccqjq5DS.js";import{e as fe,s as qt,r as Br,i as rr}from"../chunks/DqfV0sZu.js";import{P as Cr,A as ar,a as we,r as xe}from"../chunks/B9l3DI-J.js";import{s as pe}from"../chunks/uCQU803Y.js";import{s as Ge}from"../chunks/HFGAk8XQ.js";import{b as Mr}from"../chunks/DGM4cicq.js";import{p as Rr,a as gt,s as Er}from"../chunks/DV6OI5iy.js";import{I as Nt}from"../chunks/CKbQrCJw.js";import{g as Gr}from"../chunks/DJDK-KWF.js";import{a as lt}from"../chunks/D35IQVqe.js";import{l as Ir,t as Ar,a as Lr,b as zr}from"../chunks/Ch9vNiEl.js";import{R as Tr}from"../chunks/Cqe0su6e.js";import{r as zt,R as Ur,I as Or,C as Vr}from"../chunks/BMB5u1EX.js";import{L as $r,F as Tt,l as Fr}from"../chunks/BeGBxCGK.js";var Nr=_('
'),Dr=_('
Activation path
'),Hr=_(' '),Wr=_('
Retrieved
'),jr=_(' '),Qr=_('
Suppressed
'),Xr=_(" ",1),Yr=_('
retrieved
suppressed
trust floor
');function Kr(t,r){lr(r,!0);let l=Rr(r,"compact",3,!1);const v={low:"var(--color-recall, #10b981)",medium:"#f59e0b",high:"#f43f5e"};function b(){const _e=r.receipt.retrieved[0];if(!_e)return;const ce=r.receipt.retrieved.join(",");Gr(`/graph?center=${encodeURIComponent(_e)}&focus=${encodeURIComponent(ce)}`)}var c=Yr();let f,P;var q=s(c),G=s(q),g=s(G,!0);a(G);var I=n(G,2);let M;var E=s(I);a(I),a(q);var re=n(q,2),ae=s(re),Q=s(ae),Be=s(Q,!0);a(Q),Ie(2),a(ae);var w=n(ae,2),le=s(w),me=s(le,!0);a(le),Ie(2),a(w);var oe=n(w,2),i=s(oe),k=s(i);a(i),Ie(2),a(oe),a(re);var V=n(re,2);{var ye=_e=>{var ce=Xr(),Ye=xt(ce);{var vt=ee=>{var W=Dr(),ve=n(s(W),2);fe(ve,16,()=>r.receipt.activation_path,X=>X,(X,be)=>{var Y=Nr(),Ce=s(Y,!0);a(Y),B(()=>u(Ce,be)),y(X,Y)}),a(W),y(ee,W)};O(Ye,ee=>{r.receipt.activation_path.length&&ee(vt)})}var ut=n(Ye,2);{var dt=ee=>{var W=Wr(),ve=n(s(W),2);fe(ve,20,()=>r.receipt.retrieved,X=>X,(X,be)=>{var Y=Hr(),Ce=s(Y,!0);a(Y),B(Ke=>u(Ce,Ke),[()=>be.slice(0,8)]),y(X,Y)}),a(ve),a(W),y(ee,W)};O(ut,ee=>{r.receipt.retrieved.length&&ee(dt)})}var pt=n(ut,2);{var ft=ee=>{var W=Qr(),ve=n(s(W),2);fe(ve,21,()=>r.receipt.suppressed,X=>X.id,(X,be)=>{var Y=jr(),Ce=s(Y);a(Y),B((Ke,Je)=>{qt(Y,"title",e(be).reason),u(Ce,`${Ke??""} · ${Je??""}`)},[()=>e(be).id.slice(0,8),()=>e(be).reason.replace("_"," ")]),y(X,Y)}),a(ve),a(W),y(ee,W)};O(pt,ee=>{r.receipt.suppressed.length&&ee(ft)})}y(_e,ce)};O(V,_e=>{l()||_e(ye)})}var qe=n(V,2),ct=s(qe);Nt(ct,{name:"sparkle",size:14}),Ie(),a(qe),a(c),B(_e=>{f=pe(c,1,"receipt svelte-1wdzvwu",null,f,{compact:l()}),P=Ge(c,"",P,{"--risk":v[r.receipt.decay_risk]}),u(g,r.receipt.receipt_id),M=Ge(I,"",M,{color:v[r.receipt.decay_risk]}),u(E,`decay: ${r.receipt.decay_risk??""}`),u(Be,r.receipt.retrieved.length),u(me,r.receipt.suppressed.length),u(k,`${_e??""}%`),qe.disabled=!r.receipt.retrieved.length},[()=>(r.receipt.trust_floor*100).toFixed(0)]),Xe("click",qe,b),y(t,c),or()}ir(["click"]);function ot(t){switch(t){case"mcp.call":return"var(--color-synapse-glow, #818cf8)";case"memory.retrieve":return"var(--color-recall, #10b981)";case"memory.suppress":return"#a78bfa";case"memory.write":return"#38bdf8";case"contradiction.detected":return"#fb7185";case"sanhedrin.veto":return"#f43f5e";case"dream.patch":return"#c084fc";default:return"var(--color-synapse, #6366f1)"}}function We(t){switch(t){case"mcp.call":return"Tool Call";case"memory.retrieve":return"Retrieved";case"memory.suppress":return"Suppressed";case"memory.write":return"Wrote";case"contradiction.detected":return"Contradiction";case"sanhedrin.veto":return"Veto";case"dream.patch":return"Dream Patch";default:return t}}function Ut(t){switch(t){case"mcp.call":return"⟐";case"memory.retrieve":return"◉";case"memory.suppress":return"⊘";case"memory.write":return"✎";case"contradiction.detected":return"⚡";case"sanhedrin.veto":return"⛔";case"dream.patch":return"☾";default:return"•"}}function Ot(t){switch(t.type){case"mcp.call":return`${t.tool} · args ${t.argsHash.slice(0,8)}`;case"memory.retrieve":return`${t.ids.length} ${t.ids.length===1?"memory":"memories"} surfaced`;case"memory.suppress":return`${t.id.slice(0,8)} — ${t.reason.replace("_"," ")}`;case"memory.write":return`${t.id.slice(0,8)} — ${t.source}`;case"contradiction.detected":return t.detail;case"sanhedrin.veto":return`"${t.claim}" (conf ${(t.confidence*100).toFixed(0)}%)`;case"dream.patch":return`${t.proposalIds.length} consolidation proposal(s)`;default:return""}}function Jr(t){switch(t.type){case"memory.retrieve":return t.ids;case"memory.suppress":case"memory.write":return[t.id];case"contradiction.detected":return t.ids;case"sanhedrin.veto":return t.evidenceIds;case"dream.patch":return t.proposalIds;default:return[]}}function Zr(t){return!Number.isFinite(t)||t<=0?"—":new Date(t).toLocaleTimeString(void 0,{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function sr(t,r){return Math.max(0,t-r)}const wt=512,Vt=12,$t=8,Ft=128,je="rgba16float",cr=` +var kr=Object.defineProperty;var Pr=(t,r,l)=>r in t?kr(t,r,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[r]=l;var j=(t,r,l)=>Pr(t,typeof r!="symbol"?r+"":r,l);import"../chunks/Bzak7iHL.js";import{d as ir,s as u,b as Xe,o as Sr}from"../chunks/DAau0uzT.js";import{p as lr,c as s,r as a,X as n,af as Ie,Y as B,a as y,b as or,aH as xt,f as _,g as e,d as Se,e as er,j as tr,s as U,u as ge}from"../chunks/CGq8RnJq.js";import{i as O}from"../chunks/Ccqjq5DS.js";import{e as fe,s as qt,r as Br,i as rr}from"../chunks/DqfV0sZu.js";import{P as Cr,A as ar,a as we,r as xe}from"../chunks/B9l3DI-J.js";import{s as pe}from"../chunks/uCQU803Y.js";import{s as Ge}from"../chunks/HFGAk8XQ.js";import{b as Mr}from"../chunks/DGM4cicq.js";import{p as Rr,a as gt,s as Er}from"../chunks/DV6OI5iy.js";import{I as Nt}from"../chunks/CKbQrCJw.js";import{g as Gr}from"../chunks/DJDK-KWF.js";import{a as lt}from"../chunks/D35IQVqe.js";import{l as Ir,t as Ar,a as Lr,b as zr}from"../chunks/Ch9vNiEl.js";import{R as Tr}from"../chunks/BpEKQwpr.js";import{r as zt,R as Ur,I as Or,C as Vr}from"../chunks/BMB5u1EX.js";import{L as $r,F as Tt,l as Fr}from"../chunks/DETSv_kY.js";var Nr=_('
'),Dr=_('
Activation path
'),Hr=_(' '),Wr=_('
Retrieved
'),jr=_(' '),Qr=_('
Suppressed
'),Xr=_(" ",1),Yr=_('
retrieved
suppressed
trust floor
');function Kr(t,r){lr(r,!0);let l=Rr(r,"compact",3,!1);const v={low:"var(--color-recall, #10b981)",medium:"#f59e0b",high:"#f43f5e"};function b(){const _e=r.receipt.retrieved[0];if(!_e)return;const ce=r.receipt.retrieved.join(",");Gr(`/graph?center=${encodeURIComponent(_e)}&focus=${encodeURIComponent(ce)}`)}var c=Yr();let f,P;var q=s(c),E=s(q),g=s(E,!0);a(E);var I=n(E,2);let M;var G=s(I);a(I),a(q);var re=n(q,2),ae=s(re),Q=s(ae),Be=s(Q,!0);a(Q),Ie(2),a(ae);var w=n(ae,2),le=s(w),me=s(le,!0);a(le),Ie(2),a(w);var oe=n(w,2),i=s(oe),k=s(i);a(i),Ie(2),a(oe),a(re);var V=n(re,2);{var ye=_e=>{var ce=Xr(),Ye=xt(ce);{var vt=ee=>{var W=Dr(),ve=n(s(W),2);fe(ve,16,()=>r.receipt.activation_path,X=>X,(X,be)=>{var Y=Nr(),Ce=s(Y,!0);a(Y),B(()=>u(Ce,be)),y(X,Y)}),a(W),y(ee,W)};O(Ye,ee=>{r.receipt.activation_path.length&&ee(vt)})}var ut=n(Ye,2);{var dt=ee=>{var W=Wr(),ve=n(s(W),2);fe(ve,20,()=>r.receipt.retrieved,X=>X,(X,be)=>{var Y=Hr(),Ce=s(Y,!0);a(Y),B(Ke=>u(Ce,Ke),[()=>be.slice(0,8)]),y(X,Y)}),a(ve),a(W),y(ee,W)};O(ut,ee=>{r.receipt.retrieved.length&&ee(dt)})}var pt=n(ut,2);{var ft=ee=>{var W=Qr(),ve=n(s(W),2);fe(ve,21,()=>r.receipt.suppressed,X=>X.id,(X,be)=>{var Y=jr(),Ce=s(Y);a(Y),B((Ke,Je)=>{qt(Y,"title",e(be).reason),u(Ce,`${Ke??""} · ${Je??""}`)},[()=>e(be).id.slice(0,8),()=>e(be).reason.replace("_"," ")]),y(X,Y)}),a(ve),a(W),y(ee,W)};O(pt,ee=>{r.receipt.suppressed.length&&ee(ft)})}y(_e,ce)};O(V,_e=>{l()||_e(ye)})}var qe=n(V,2),ct=s(qe);Nt(ct,{name:"sparkle",size:14}),Ie(),a(qe),a(c),B(_e=>{f=pe(c,1,"receipt svelte-1wdzvwu",null,f,{compact:l()}),P=Ge(c,"",P,{"--risk":v[r.receipt.decay_risk]}),u(g,r.receipt.receipt_id),M=Ge(I,"",M,{color:v[r.receipt.decay_risk]}),u(G,`decay: ${r.receipt.decay_risk??""}`),u(Be,r.receipt.retrieved.length),u(me,r.receipt.suppressed.length),u(k,`${_e??""}%`),qe.disabled=!r.receipt.retrieved.length},[()=>(r.receipt.trust_floor*100).toFixed(0)]),Xe("click",qe,b),y(t,c),or()}ir(["click"]);function ot(t){switch(t){case"mcp.call":return"var(--color-synapse-glow, #818cf8)";case"memory.retrieve":return"var(--color-recall, #10b981)";case"memory.suppress":return"#a78bfa";case"memory.write":return"#38bdf8";case"contradiction.detected":return"#fb7185";case"sanhedrin.veto":return"#f43f5e";case"dream.patch":return"#c084fc";default:return"var(--color-synapse, #6366f1)"}}function We(t){switch(t){case"mcp.call":return"Tool Call";case"memory.retrieve":return"Retrieved";case"memory.suppress":return"Suppressed";case"memory.write":return"Wrote";case"contradiction.detected":return"Contradiction";case"sanhedrin.veto":return"Veto";case"dream.patch":return"Dream Patch";default:return t}}function Ut(t){switch(t){case"mcp.call":return"⟐";case"memory.retrieve":return"◉";case"memory.suppress":return"⊘";case"memory.write":return"✎";case"contradiction.detected":return"⚡";case"sanhedrin.veto":return"⛔";case"dream.patch":return"☾";default:return"•"}}function Ot(t){switch(t.type){case"mcp.call":return`${t.tool} · args ${t.argsHash.slice(0,8)}`;case"memory.retrieve":return`${t.ids.length} ${t.ids.length===1?"memory":"memories"} surfaced`;case"memory.suppress":return`${t.id.slice(0,8)} — ${t.reason.replace("_"," ")}`;case"memory.write":return`${t.id.slice(0,8)} — ${t.source}`;case"contradiction.detected":return t.detail;case"sanhedrin.veto":return`"${t.claim}" (conf ${(t.confidence*100).toFixed(0)}%)`;case"dream.patch":return`${t.proposalIds.length} consolidation proposal(s)`;default:return""}}function Jr(t){switch(t.type){case"memory.retrieve":return t.ids;case"memory.suppress":case"memory.write":return[t.id];case"contradiction.detected":return t.ids;case"sanhedrin.veto":return t.evidenceIds;case"dream.patch":return t.proposalIds;default:return[]}}function Zr(t){return!Number.isFinite(t)||t<=0?"—":new Date(t).toLocaleTimeString(void 0,{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function sr(t,r){return Math.max(0,t-r)}const wt=512,Vt=12,$t=8,Ft=128,je="rgba16float",cr=` struct Params { frame: f32, loop_phase: f32, @@ -228,5 +228,5 @@ fn fs_blur(frag: VSOut) -> @location(0) vec4f { acc = acc + textureSampleLevel(blur_src, blur_sampler, frag.uv + step * 2.0, 0.0) * 0.06136; return acc; } -`;function aa(t){switch(t){case"mcp.call":return 0;case"memory.retrieve":return 1;case"memory.suppress":return 2;case"memory.write":return 3;case"sanhedrin.veto":return 4;case"contradiction.detected":return 5;case"dream.patch":return 6}}function nr(t){return["tool","retrieve","suppress","write","veto","contradiction","dream"].indexOf(t)}class sa{constructor(r,l){j(this,"engine");j(this,"scene",null);j(this,"resources",null);j(this,"sampler",null);j(this,"traceBindLayout",null);j(this,"membraneBindLayout",null);j(this,"blurBindLayout",null);j(this,"impulsePipeline",null);j(this,"lanePipeline",null);j(this,"receiptPipeline",null);j(this,"blurPipeline",null);j(this,"membranePipeline",null);j(this,"eventCount",0);j(this,"receiptCount",0);j(this,"hitRects",[]);this.engine=r,this.uploadScene(l)}uploadScene(r){this.scene=r,this.buildHitRects();const l=this.engine.gpuDevice;l&&(this.ensurePipelines(l),this.ensureResources(l),this.uploadBuffers(l))}ensurePipelines(r){if(this.impulsePipeline||!this.engine.paramsBuffer)return;const l=r.createShaderModule({label:"blackbox-trace-wgsl",code:ea}),v=r.createShaderModule({label:"blackbox-membrane-wgsl",code:ta}),b=r.createShaderModule({label:"blackbox-blur-wgsl",code:ra});this.traceBindLayout=r.createBindGroupLayout({label:"blackbox-trace-bind-layout",entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}},{binding:2,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}}]}),this.membraneBindLayout=r.createBindGroupLayout({label:"blackbox-membrane-bind-layout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:3,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}}]}),this.blurBindLayout=r.createBindGroupLayout({label:"blackbox-blur-bind-layout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}}]});const c=r.createPipelineLayout({label:"blackbox-trace-layout",bindGroupLayouts:[this.traceBindLayout]}),f=r.createPipelineLayout({label:"blackbox-membrane-layout",bindGroupLayouts:[this.membraneBindLayout]}),P=r.createPipelineLayout({label:"blackbox-blur-layout",bindGroupLayouts:[this.blurBindLayout]});this.sampler=r.createSampler({magFilter:"linear",minFilter:"linear"});const q={color:{srcFactor:"one",dstFactor:"one",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one",operation:"add"}};this.impulsePipeline=r.createRenderPipeline({label:"blackbox-impulses",layout:c,vertex:{module:l,entryPoint:"vs_impulse"},fragment:{module:l,entryPoint:"fs_impulse",targets:[{format:je,blend:q}]},primitive:{topology:"triangle-list"}}),this.lanePipeline=r.createRenderPipeline({label:"blackbox-lanes",layout:c,vertex:{module:l,entryPoint:"vs_lane"},fragment:{module:l,entryPoint:"fs_lane",targets:[{format:je,blend:q}]},primitive:{topology:"triangle-list"}}),this.receiptPipeline=r.createRenderPipeline({label:"blackbox-receipt-beads",layout:c,vertex:{module:l,entryPoint:"vs_receipt"},fragment:{module:l,entryPoint:"fs_receipt",targets:[{format:je,blend:q}]},primitive:{topology:"triangle-list"}}),this.blurPipeline=r.createRenderPipeline({label:"blackbox-field-blur",layout:P,vertex:{module:b,entryPoint:"vs_fullscreen"},fragment:{module:b,entryPoint:"fs_blur",targets:[{format:je}]},primitive:{topology:"triangle-list"}}),this.membranePipeline=r.createRenderPipeline({label:"blackbox-field-membrane",layout:f,vertex:{module:v,entryPoint:"vs_fullscreen"},fragment:{module:v,entryPoint:"fs_membrane",targets:[{format:this.engine.sceneFormat,blend:q}]},primitive:{topology:"triangle-list"}})}ensureResources(r){var w,le,me,oe,i,k;if(!this.traceBindLayout||!this.blurBindLayout||!this.membraneBindLayout||!this.engine.paramsBuffer||!this.sampler)return;const l=Math.max(16,Math.floor((this.engine.params[6]||1280)/2)),v=Math.max(16,Math.floor((this.engine.params[7]||720)/2)),b=!this.resources||this.resources.fieldSize[0]!==l||this.resources.fieldSize[1]!==v;let c=(w=this.resources)==null?void 0:w.eventBuffer,f=(le=this.resources)==null?void 0:le.receiptBuffer,P=(me=this.resources)==null?void 0:me.blurHBuffer,q=(oe=this.resources)==null?void 0:oe.blurVBuffer;if(c||(c=r.createBuffer({label:"blackbox-event-cells",size:wt*Vt*4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})),f||(f=r.createBuffer({label:"blackbox-receipt-beads",size:Ft*$t*4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})),P||(P=r.createBuffer({label:"blackbox-blur-h-dir",size:16,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),r.queue.writeBuffer(P,0,new Float32Array([1,0,0,0]))),q||(q=r.createBuffer({label:"blackbox-blur-v-dir",size:16,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),r.queue.writeBuffer(q,0,new Float32Array([0,1,0,0]))),!b&&this.resources)return;(i=this.resources)==null||i.fieldA.destroy(),(k=this.resources)==null||k.fieldB.destroy();const G=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING,g=r.createTexture({label:"blackbox-field-a-rgba16float",size:[l,v],format:je,usage:G}),I=r.createTexture({label:"blackbox-field-b-rgba16float",size:[l,v],format:je,usage:G}),M=g.createView(),E=I.createView(),re=r.createBindGroup({label:"blackbox-trace-bind",layout:this.traceBindLayout,entries:[{binding:0,resource:{buffer:this.engine.paramsBuffer}},{binding:1,resource:{buffer:c}},{binding:2,resource:{buffer:f}}]}),ae=r.createBindGroup({label:"blackbox-membrane-bind",layout:this.membraneBindLayout,entries:[{binding:0,resource:{buffer:this.engine.paramsBuffer}},{binding:3,resource:this.sampler},{binding:4,resource:M}]}),Q=r.createBindGroup({label:"blackbox-blur-h-bind",layout:this.blurBindLayout,entries:[{binding:0,resource:this.sampler},{binding:1,resource:M},{binding:2,resource:{buffer:P}}]}),Be=r.createBindGroup({label:"blackbox-blur-v-bind",layout:this.blurBindLayout,entries:[{binding:0,resource:this.sampler},{binding:1,resource:E},{binding:2,resource:{buffer:q}}]});this.resources={eventBuffer:c,receiptBuffer:f,blurHBuffer:P,blurVBuffer:q,traceBindGroup:re,membraneBindGroup:ae,blurHBindGroup:Q,blurVBindGroup:Be,fieldA:g,fieldB:I,fieldAView:M,fieldBView:E,fieldSize:[l,v]}}uploadBuffers(r){if(!this.resources||!this.scene)return;const l=Math.min(wt,this.scene.visibleEventCount||this.scene.traceEvents.length),v=Math.max(1,this.scene.traceEvents.length-1),b=new Float32Array(wt*Vt);this.eventCount=Math.min(wt,this.scene.traceEvents.length);for(let f=0;f({event:b,x:-.84+1.68*(c/l),y:.66-1.28*(nr(b.lane)/6),w:.055,h:.065}))}compute(r){const l=this.engine.gpuDevice;if(!l||!this.resources||!this.impulsePipeline||!this.lanePipeline||!this.receiptPipeline||!this.blurPipeline)return;this.ensureResources(l);const v=this.resources,b=r.beginRenderPass({label:"blackbox-field-splat-pass",colorAttachments:[{view:v.fieldAView,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}]});b.setBindGroup(0,v.traceBindGroup),b.setPipeline(this.lanePipeline),b.draw(6,7),this.eventCount>0&&(b.setPipeline(this.impulsePipeline),b.draw(6,this.eventCount)),this.receiptCount>0&&this.eventCount>0&&(b.setPipeline(this.receiptPipeline),b.draw(6,this.receiptCount)),b.end();const c=r.beginRenderPass({label:"blackbox-field-blur-h-pass",colorAttachments:[{view:v.fieldBView,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}]});c.setPipeline(this.blurPipeline),c.setBindGroup(0,v.blurHBindGroup),c.draw(6,1),c.end();const f=r.beginRenderPass({label:"blackbox-field-blur-v-pass",colorAttachments:[{view:v.fieldAView,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}]});f.setPipeline(this.blurPipeline),f.setBindGroup(0,v.blurVBindGroup),f.draw(6,1),f.end()}render(r){!this.resources||!this.membranePipeline||!this.impulsePipeline||!this.lanePipeline||!this.receiptPipeline||(r.setPipeline(this.membranePipeline),r.setBindGroup(0,this.resources.membraneBindGroup),r.draw(6,1),r.setBindGroup(0,this.resources.traceBindGroup),r.setPipeline(this.lanePipeline),r.draw(6,7),this.eventCount>0&&(r.setPipeline(this.impulsePipeline),r.draw(6,this.eventCount)),this.receiptCount>0&&this.eventCount>0&&(r.setPipeline(this.receiptPipeline),r.draw(6,this.receiptCount)))}pickAt(r,l){for(const v of this.hitRects)if(Math.abs(r-v.x)<=v.w&&Math.abs(l-v.y)<=v.h)return{id:v.event.id,kind:"trace-event",index:v.event.index,payload:v.event};return null}dispose(){var r,l,v,b,c,f;(r=this.resources)==null||r.eventBuffer.destroy(),(l=this.resources)==null||l.receiptBuffer.destroy(),(v=this.resources)==null||v.blurHBuffer.destroy(),(b=this.resources)==null||b.blurVBuffer.destroy(),(c=this.resources)==null||c.fieldA.destroy(),(f=this.resources)==null||f.fieldB.destroy(),this.resources=null}}function na(t,r){return zt(Ur.healthy),zt(Or.veto),zt(Vr.forward),[new sa(t,r)]}function kt(t){return Math.max(0,Math.min(1,Number.isFinite(t)?t:0))}function Qe(t,r=0){return typeof t=="number"&&Number.isFinite(t)?t:r}function ia(t,r,l){return{kind:"trace",id:`${t??"trace:none"}:event:${r}:${l}`}}function la(t,r,l){return{kind:"event",id:`${t??"trace:none"}:event:${r}:${l}`}}function oa(t){return{kind:"memory",id:t}}function ca(t){switch(t){case"mcp.call":return"tool";case"memory.retrieve":return"retrieve";case"memory.suppress":return"suppress";case"memory.write":return"write";case"sanhedrin.veto":return"veto";case"contradiction.detected":return"contradiction";case"dream.patch":return"dream"}}function va(t){switch(t.type){case"memory.retrieve":return t.ids;case"memory.suppress":return[t.id];case"memory.write":return[t.id];case"contradiction.detected":return t.ids;case"sanhedrin.veto":return t.evidenceIds;case"dream.patch":return t.proposalIds;case"mcp.call":return[]}}function ua(t){switch(t.type){case"mcp.call":return t.tool;case"memory.retrieve":return`${t.ids.length} memories retrieved`;case"memory.suppress":return`suppressed ${t.id.slice(0,8)}`;case"memory.write":return`wrote ${t.id.slice(0,8)}`;case"contradiction.detected":return`contradiction ${t.ids.join(" ↔ ")}`;case"sanhedrin.veto":return"Sanhedrin veto";case"dream.patch":return`${t.proposalIds.length} dream proposals`}}function da(t){switch(t.type){case"mcp.call":return`MCP tool ${t.tool} called; args hash ${t.argsHash.slice(0,12)}`;case"memory.retrieve":return`Retrieved ${t.ids.length} memories with activation map`;case"memory.suppress":return`Suppressed ${t.id}: ${t.reason}`;case"memory.write":return`Memory write ${t.id} from ${t.source}`;case"contradiction.detected":return t.detail;case"sanhedrin.veto":return`${Math.round(kt(t.confidence)*100)}% veto confidence: ${t.claim}`;case"dream.patch":return`Dream patch proposals: ${t.proposalIds.join(", ")}`}}function pa(t){return t.type!=="memory.retrieve"?[]:Object.entries(t.activation??{}).map(([r,l])=>({id:r,activation:kt(l)})).sort((r,l)=>l.activation-r.activation)}function fa(t){if(t.type==="sanhedrin.veto")return kt(t.confidence);if(t.type==="memory.retrieve"){const r=Object.values(t.activation??{});return r.length?kt(r.reduce((l,v)=>l+v,0)/r.length):.45}return t.type==="memory.suppress"?.78:t.type==="memory.write"?.72:t.type==="contradiction.detected"?.82:t.type==="dream.patch"?.52:.62}function ma(t,r=[],l){var le,me,oe;const v=(t==null?void 0:t.runId)??null,b=(t==null?void 0:t.events)??[],c=(t==null?void 0:t.summary)??null,f=Qe(c==null?void 0:c.startedAt,((le=b[0])==null?void 0:le.at)??0),P=Qe(c==null?void 0:c.lastAt,((me=b[b.length-1])==null?void 0:me.at)??f),q=b.length?b.length-1:0,G=Math.max(0,Math.min(q,l??q)),g=b.length?G+1:0,I=b.map((i,k)=>({index:k,id:`${v??i.runId}:event:${k}:${i.type}`,type:i.type,lane:ca(i.type),runId:i.runId,at:i.at,label:ua(i),summary:da(i),memoryIds:va(i),activationPairs:pa(i),confidence:fa(i),provenance:ia(v,k,i.type),raw:i})),M=new Map;for(const i of I)for(const k of i.memoryIds){if(!k||M.has(k))continue;const V=((oe=i.activationPairs.find(ye=>ye.id===k))==null?void 0:oe.activation)??0;M.set(k,{source:oa(k),index:M.size,label:k.slice(0,12),retention:Math.max(.25,V),activation:V,trust:i.type==="memory.suppress"?.2:Math.max(.35,i.confidence),suppression:i.type==="memory.suppress"?1:0,tags:[i.lane,i.type],type:"trace-memory"})}const E=[...M.values()],re=I.slice(0,g).map(i=>{var k;return{source:la(v,i.index,i.type),type:i.type,targetIndex:i.memoryIds.length?((k=M.get(i.memoryIds[0]))==null?void 0:k.index)??-1:-1,frame:i.index*34+18,energy:Math.max(.18,i.confidence)}}),ae=I.slice(0,g).flatMap(i=>{const k=i.memoryIds.filter(V=>M.has(V));return k.length<2?[]:k.slice(1).map((V,ye)=>{var qe;return{source:{kind:"pair",id:`${i.id}:pair:${k[0]}:${V}`},sourceIndex:M.get(k[0]).index,targetIndex:M.get(V).index,weight:((qe=i.activationPairs[ye+1])==null?void 0:qe.activation)??i.confidence,kind:i.type}})}),Q=r??[],Be=Q.map(i=>{const k=[...new Set([...i.retrieved??[],...i.activation_path??[],...(i.mutations??[]).map(V=>V.id)])];return{source:{kind:"receipt",id:i.receipt_id},label:`receipt ${i.receipt_id.slice(0,10)}`,nodeIndices:k.map(V=>{var ye;return(ye=M.get(V))==null?void 0:ye.index}).filter(V=>typeof V=="number")}}),w={organ:"blackbox",nodes:E,edges:ae,events:re,receipts:Be,scalars:{eventCount:b.length,visibleEventCount:g,retrievedCount:Qe(c==null?void 0:c.retrievedCount,I.filter(i=>i.type==="memory.retrieve").length),suppressedCount:Qe(c==null?void 0:c.suppressedCount,I.filter(i=>i.type==="memory.suppress").length),writeCount:Qe(c==null?void 0:c.writeCount,I.filter(i=>i.type==="memory.write").length),vetoCount:Qe(c==null?void 0:c.vetoCount,I.filter(i=>i.type==="sanhedrin.veto").length),durationMs:Math.max(0,P-f),receiptCount:Be.length},alive:b.length>0,runId:v,traceEvents:I,visibleEventCount:g,selectedIndex:G,startedAt:f,lastAt:P,durationMs:Math.max(0,P-f),receiptRows:Q};return w.alive||(w.receipts=Q.map(i=>({source:{kind:"receipt",id:i.receipt_id},label:`receipt ${i.receipt_id.slice(0,10)}`,nodeIndices:[]})),w.scalars.eventCount=0,w.scalars.visibleEventCount=0),w}var ya=_(' ',1),_a=_(' '),ba=_('awaiting…'),ha=_('
GPU pick
'),ga=_(`

No agent runs recorded yet. Make an MCP tool call — every call is - recorded here.

`),wa=_(' '),xa=_(' '),qa=_(' '),ka=_(' '),Pa=_('
  • '),Sa=_('
      '),Ba=_('
      Loading trace…
      '),Ca=_('
      '),Ma=_('
      Select a run to replay.
      '),Ra=_(' '),Ea=_(""),Ga=_(' '),Ia=_(' '),Aa=_('
      '),La=_(' '),za=_('
      vs
      '),Ta=_(' '),Ua=_('
      '),Oa=_('

      '),Va=_('

      No memories touched yet.

      '),$a=_(' '),Fa=_('
      '),Na=_('

      Receipts — proof behind retrievals

      '),Da=_('
    • '),Ha=_('
      Step

      Memory pulse — touched this run

      Event producers — this run

      • mcp.call · memory.write · memory.retrieve · memory.suppress live
      • contradiction.detected
      • dream.patch
      • sanhedrin.veto

      Event log

        ',1),Wa=_('
        '),ja=_('
        '),Qa=_('
        trace events

        Watch the agent think. Watch memory change. Watch the receipt prove why.

        '),Xa=_('
        WebSocket
        Live runId
        Last event
        Events seen
        ',1);function fs(t,r){lr(r,!0);const l=()=>gt(Ir,"$lastTraceEvent",f),v=()=>gt(Lr,"$isConnected",f),b=()=>gt(zr,"$liveRunId",f),c=()=>gt(Ar,"$traceEvents",f),[f,P]=Er();let q=Se(er([])),G=Se(null),g=Se(null),I=Se(!1),M=Se(null),E=Se(0),re=Se(!1),ae=Se(er([])),Q=Se(null);const Be=ge(()=>e(g)?e(g).events.slice(0,e(E)+1):[]),w=ge(()=>e(g)&&e(g).events.length?e(g).events[e(E)]:null),le=ge(()=>{var o,d;return((d=(o=e(g))==null?void 0:o.events[0])==null?void 0:d.at)??0}),me=ge(()=>Array.from(new Set(e(Be).flatMap(Jr)))),oe=ge(()=>{var o;return((o=e(g))==null?void 0:o.events.some(d=>d.type==="sanhedrin.veto"))??!1}),i=ge(()=>{var o;return((o=e(g))==null?void 0:o.events.some(d=>d.type==="dream.patch"))??!1}),k=ge(()=>{var o;return((o=e(g))==null?void 0:o.events.some(d=>d.type==="contradiction.detected"))??!1}),V=ge(()=>ma(e(g),e(ae),e(E)));function ye(o){var p;if(o.kind!=="trace-event")return;const d=o.payload;U(Q,d,!0),U(E,Math.max(0,Math.min((p=e(g))!=null&&p.events.length?e(g).events.length-1:0,d.index)),!0)}async function qe(){try{const o=await lt.traces.list(100);U(q,o.runs,!0),!e(G)&&e(q).length&&ct(e(q)[0].runId)}catch(o){U(M,String(o),!0)}}async function ct(o){U(G,o,!0),U(I,!0),U(M,null);try{U(g,await lt.traces.get(o),!0),U(E,Math.max(0,(e(g).events.length||1)-1),!0),U(Q,null),U(ae,(await lt.receipts.listForRun(o,8)).receipts,!0)}catch(d){U(M,String(d),!0),U(g,null)}finally{U(I,!1)}}function _e(){e(G)&&(window.location.href=lt.traces.exportUrl(e(G)))}tr(()=>{var p;const o=l();if(!o)return;const d=(p=o.data)==null?void 0:p.run_id;d&&d===e(G)&<.traces.get(e(G)).then(A=>{U(g,A,!0),U(E,Math.max(0,A.events.length-1),!0)})}),Sr(qe);let ce=null;function Ye(){const o=Math.max(1,...e(q).map(p=>p.eventCount??0)),d=e(q).slice(0,200).map(p=>{const A=vt((p.eventCount??0)/o),S=(p.vetoCount??0)>0?Tt.scarlet:(p.suppressedCount??0)>0?Tt.caution:Tt.forward;return{id:p.runId,score:.35+.65*A,hue:S,energy:.4+.6*A,selected:p.runId===e(G),scar:(p.vetoCount??0)>0,metric2:vt((p.retrievedCount??0)/Math.max(1,p.eventCount??1)),kind:"trace-run",payload:p}});return Fr(d,{maxRadius:.95,minCellR:.016,maxCellR:.06})}function vt(o){return Math.min(1,Math.max(0,Number.isFinite(o)?o:0))}function ut(o,d){const p=new $r(o);return ce=p,p.setCells(Ye()),[{compute:S=>p.compute(S),render:S=>p.render(S),pickAt:(S,N)=>p.pickAt(S,N),dispose:()=>{p.dispose(),ce===p&&(ce=null)}},...na(o,d)]}tr(()=>{e(q).length,ce==null||ce.setCells(Ye())});var dt=Xa(),pt=xt(dt);{let o=ge(()=>`agent-flight-recorder:${e(G)??"empty"}:${e(V).visibleEventCount}`);Tr(pt,{organ:"blackbox",get seed(){return e(o)},get scene(){return e(V)},passes:ut,get loading(){return e(I)},get error(){return e(M)},emptyLabel:"NO AGENT TRACE SELECTED - RECORDER ARMED",onpick:ye})}var ft=n(pt,2),ee=s(ft);Cr(ee,{icon:"blackbox",title:"Agent Black Box",subtitle:"Watch the agent think. Watch memory change. Watch the receipt prove why.",accent:"synapse",children:(o,d)=>{var p=ya(),A=xt(p);let S;var N=s(A);Nt(N,{name:"sparkle",size:14}),Ie(),a(A);var se=n(A,2),Me=s(se);Nt(Me,{name:"feed",size:14}),Ie(),a(se),B(()=>{S=pe(A,1,"mode-toggle svelte-1ayqwv0",null,S,{on:e(re)}),se.disabled=!e(G)}),Xe("click",A,()=>U(re,!e(re))),Xe("click",se,_e),y(o,p)},$$slots:{default:!0}});var W=n(ee,2),ve=s(W),X=n(s(ve),2);let be;var Y=s(X);let Ce;var Ke=n(Y);a(X),a(ve);var Je=n(ve,2),Dt=n(s(Je),2),vr=s(Dt,!0);a(Dt),a(Je);var Pt=n(Je,2),Ht=n(s(Pt),2),ur=s(Ht);{var dr=o=>{var d=_a();let p;var A=s(d,!0);a(d),B((S,N)=>{p=Ge(d,"",p,S),u(A,N)},[()=>{var S,N;return{"--c":ot((N=(S=l().data)==null?void 0:S.event)==null?void 0:N.type)}},()=>{var S,N;return We((N=(S=l().data)==null?void 0:S.event)==null?void 0:N.type)}]),y(o,d)},pr=o=>{var d=ba();y(o,d)};O(ur,o=>{l()?o(dr):o(pr,!1)})}a(Ht),a(Pt);var Wt=n(Pt,2),jt=n(s(Wt),2),fr=s(jt);ar(fr,{get value(){return c().length}}),a(jt),a(Wt),a(W),we(W,o=>{var d;return(d=xe)==null?void 0:d(o)});var Qt=n(W,2);{var mr=o=>{var d=ha(),p=n(s(d),2),A=s(p,!0);a(p);var S=n(p,2),N=s(S,!0);a(S);var se=n(S,2),Me=s(se,!0);a(se),a(d),we(d,Ze=>{var Ae;return(Ae=xe)==null?void 0:Ae(Ze)}),B(()=>{u(A,e(Q).label),u(N,e(Q).summary),u(Me,e(Q).provenance.id)}),y(o,d)};O(Qt,o=>{e(Q)&&o(mr)})}var yr=n(Qt,2);{var _r=o=>{var d=Wa(),p=s(d),A=n(s(p),2);{var S=x=>{var R=ga();y(x,R)},N=x=>{var R=Sa();fe(R,21,()=>e(q),te=>te.runId,(te,L)=>{var ke=Pa(),ue=s(ke);let Re;var ze=s(ue),Ee=s(ze),et=s(Ee,!0);a(Ee);var z=n(Ee,2),$e=s(z,!0);a(z),a(ze);var Te=n(ze,2),Ue=s(Te),Fe=s(Ue);a(Ue);var mt=n(Ue,2);{var Bt=$=>{var T=wa(),he=s(T);a(T),B(()=>u(he,`↑${e(L).retrievedCount??""}`)),y($,T)};O(mt,$=>{e(L).retrievedCount&&$(Bt)})}var yt=n(mt,2);{var Ne=$=>{var T=xa(),he=s(T);a(T),B(()=>u(he,`⊘${e(L).suppressedCount??""}`)),y($,T)};O(yt,$=>{e(L).suppressedCount&&$(Ne)})}var tt=n(yt,2);{var De=$=>{var T=qa(),he=s(T);a(T),B(()=>u(he,`✎${e(L).writeCount??""}`)),y($,T)};O(tt,$=>{e(L).writeCount&&$(De)})}var _t=n(tt,2);{var bt=$=>{var T=ka(),he=s(T);a(T),B(()=>u(he,`⛔${e(L).vetoCount??""}`)),y($,T)};O(_t,$=>{e(L).vetoCount&&$(bt)})}a(Te),a(ue),a(ke),B($=>{Re=pe(ue,1,"run-row svelte-1ayqwv0",null,Re,{active:e(L).runId===e(G)}),u(et,$),u($e,e(L).firstTool??"—"),u(Fe,`${e(L).eventCount??""} ev`)},[()=>e(L).runId.replace("run_","").slice(0,10)]),Xe("click",ue,()=>ct(e(L).runId)),y(te,ke)}),a(R),y(x,R)};O(A,x=>{e(q).length===0?x(S):x(N,!1)})}a(p),we(p,x=>{var R;return(R=xe)==null?void 0:R(x)});var se=n(p,2),Me=s(se);{var Ze=x=>{var R=Ba();y(x,R)},Ae=x=>{var R=Ca(),te=s(R,!0);a(R),B(()=>u(te,e(M))),y(x,R)},St=x=>{var R=Ma();y(x,R)},Le=x=>{var R=Ha(),te=xt(R),L=s(te),ke=s(L),ue=n(s(ke)),Re=s(ue,!0);a(ue);var ze=n(ue);a(ke);var Ee=n(ke,2);{var et=h=>{var m=Ra(),F=s(m);a(m),B(C=>u(F,`+${C??""}ms`),[()=>sr(e(w).at,e(le))]),y(h,m)};O(Ee,h=>{e(w)&&h(et)})}a(L);var z=n(L,2);Br(z);var $e=n(z,2);fe($e,21,()=>e(g).events,rr,(h,m,F)=>{var C=Ea();let D,Pe;B((de,Oe,He)=>{D=pe(C,1,"tick svelte-1ayqwv0",null,D,{past:F<=e(E)}),qt(C,"title",de),qt(C,"aria-label",Oe),Pe=Ge(C,"",Pe,He)},[()=>We(e(m).type),()=>`Step ${F+1}: ${We(e(m).type)}`,()=>({"--c":ot(e(m).type)})]),Xe("click",C,()=>U(E,F,!0)),y(h,C)}),a($e),a(te),we(te,h=>{var m;return(m=xe)==null?void 0:m(h)});var Te=n(te,2);{var Ue=h=>{var m=Oa();let F;var C=s(m),D=s(C),Pe=s(D,!0);a(D);var de=n(D,2),Oe=s(de,!0);a(de);var He=n(de,2),rt=s(He,!0);a(He),a(C);var at=n(C,2),st=s(at,!0);a(at);var Rt=n(at,2);{var ht=K=>{var H=Aa();fe(H,20,()=>e(w).ids,J=>J,(J,ne)=>{var ie=Ia();let Z;var Ve=s(ie),nt=s(Ve,!0);a(Ve);var It=n(Ve,2);{var At=it=>{var Lt=Ga(),xr=s(Lt);a(Lt),B(qr=>u(xr,`${qr??""}%`),[()=>(e(w).activation[ne]*100).toFixed(0)]),y(it,Lt)};O(It,it=>{e(w).activation[ne]!=null&&it(At)})}a(ie),B(it=>{Z=Ge(ie,"",Z,{"--a":e(w).activation[ne]??0}),u(nt,it)},[()=>ne.slice(0,8)]),y(J,ie)}),a(H),y(K,H)},Et=K=>{var H=za(),J=s(H),ne=s(J);a(J);var ie=n(J,4);fe(ie,16,()=>e(w).ids.filter(Z=>Z!==e(w).winnerId),Z=>Z,(Z,Ve)=>{var nt=La(),It=s(nt,!0);a(nt),B(At=>u(It,At),[()=>Ve.slice(0,8)]),y(Z,nt)}),a(H),B(Z=>u(ne,`kept ${Z??""}`),[()=>{var Z;return(Z=e(w).winnerId)==null?void 0:Z.slice(0,8)}]),y(K,H)},Gt=K=>{var H=Ua();fe(H,20,()=>e(w).evidenceIds,J=>J,(J,ne)=>{var ie=Ta(),Z=s(ie,!0);a(ie),B(Ve=>u(Z,Ve),[()=>ne.slice(0,8)]),y(J,ie)}),a(H),y(K,H)};O(Rt,K=>{e(w).type==="memory.retrieve"?K(ht):e(w).type==="contradiction.detected"?K(Et,1):e(w).type==="sanhedrin.veto"&&K(Gt,2)})}a(m),we(m,K=>{var H;return(H=xe)==null?void 0:H(K)}),B((K,H,J,ne,ie)=>{F=Ge(m,"",F,K),u(Pe,H),u(Oe,J),u(rt,ne),u(st,ie)},[()=>({"--c":ot(e(w).type)}),()=>Ut(e(w).type),()=>We(e(w).type),()=>Zr(e(w).at),()=>Ot(e(w))]),y(h,m)};O(Te,h=>{e(w)&&h(Ue)})}var Fe=n(Te,2),mt=n(s(Fe),2);{var Bt=h=>{var m=Va();y(h,m)},yt=h=>{var m=Fa();fe(m,20,()=>e(me),F=>F,(F,C)=>{var D=$a(),Pe=s(D,!0);a(D),B(de=>u(Pe,de),[()=>C.slice(0,8)]),y(F,D)}),a(m),y(h,m)};O(mt,h=>{e(me).length===0?h(Bt):h(yt,!1)})}a(Fe),we(Fe,h=>{var m;return(m=xe)==null?void 0:m(h)});var Ne=n(Fe,2),tt=n(s(Ne),2),De=n(s(tt),2);let _t;var bt=n(s(De),2),$=s(bt,!0);a(bt),a(De);var T=n(De,2);let he;var Xt=n(s(T),2),hr=s(Xt,!0);a(Xt),a(T);var Ct=n(T,2);let Yt;var Kt=n(s(Ct),2),gr=s(Kt,!0);a(Kt),a(Ct),a(tt),a(Ne),we(Ne,h=>{var m;return(m=xe)==null?void 0:m(h)});var Jt=n(Ne,2);{var wr=h=>{var m=Na(),F=n(s(m),2);fe(F,21,()=>e(ae).slice(0,2),C=>C.receipt_id,(C,D)=>{Kr(C,{get receipt(){return e(D)}})}),a(F),a(m),we(m,C=>{var D;return(D=xe)==null?void 0:D(C)}),y(h,m)};O(Jt,h=>{e(ae).length&&h(wr)})}var Mt=n(Jt,2),Zt=n(s(Mt),2);fe(Zt,21,()=>e(g).events,rr,(h,m,F)=>{var C=Da();let D,Pe;var de=s(C),Oe=s(de),He=s(Oe,!0);a(Oe);var rt=n(Oe,2),at=s(rt,!0);a(rt);var st=n(rt,2),Rt=s(st,!0);a(st);var ht=n(st,2),Et=s(ht);a(ht),a(de),a(C),B((Gt,K,H,J,ne)=>{D=pe(C,1,"log-row svelte-1ayqwv0",null,D,{active:F===e(E),dim:F>e(E)}),Pe=Ge(C,"",Pe,Gt),u(He,K),u(at,H),u(Rt,J),u(Et,`+${ne??""}ms`)},[()=>({"--c":ot(e(m).type)}),()=>Ut(e(m).type),()=>We(e(m).type),()=>Ot(e(m)),()=>sr(e(m).at,e(le))]),Xe("click",de,()=>U(E,F,!0)),y(h,C)}),a(Zt),a(Mt),we(Mt,h=>{var m;return(m=xe)==null?void 0:m(h)}),B(h=>{u(Re,e(E)+1),u(ze,` / ${e(g).events.length??""}`),qt(z,"max",h),_t=pe(De,1,"producer svelte-1ayqwv0",null,_t,{ok:e(k)}),u($,e(k)?"fired this run":"no contradiction in this run"),he=pe(T,1,"producer caveat svelte-1ayqwv0",null,he,{ok:e(i)}),u(hr,e(i)?"fired this run":"No dream run in this trace"),Yt=pe(Ct,1,"producer caveat svelte-1ayqwv0",null,Yt,{ok:e(oe)}),u(gr,e(oe)?"fired this run":"No veto producer connected (optional Sanhedrin hook, off by default)")},[()=>Math.max(0,e(g).events.length-1)]),Mr(z,()=>e(E),h=>U(E,h)),y(x,R)};O(Me,x=>{e(I)?x(Ze):e(M)?x(Ae,1):e(g)?x(Le,!1):x(St,2)})}a(se),a(d),y(o,d)},br=o=>{var d=Qa(),p=s(d),A=s(p);let S;var N=n(A,2),se=s(N,!0);a(N),a(p);var Me=n(p,2);{var Ze=Le=>{const x=ge(()=>{var z;return(z=l().data)==null?void 0:z.event});var R=ja();let te;var L=s(R),ke=s(L,!0);a(L);var ue=n(L,2),Re=s(ue),ze=s(Re,!0);a(Re);var Ee=n(Re,2),et=s(Ee,!0);a(Ee),a(ue),a(R),B((z,$e,Te,Ue)=>{te=Ge(R,"",te,z),u(ke,$e),u(ze,Te),u(et,Ue)},[()=>{var z;return{"--c":ot((z=e(x))==null?void 0:z.type)}},()=>{var z;return Ut((z=e(x))==null?void 0:z.type)},()=>{var z;return We((z=e(x))==null?void 0:z.type)},()=>Ot(e(x))]),y(Le,R)};O(Me,Le=>{l()&&Le(Ze)})}var Ae=n(Me,2),St=s(Ae);ar(St,{get value(){return c().length}}),Ie(2),a(Ae),Ie(2),a(d),we(d,Le=>{var x;return(x=xe)==null?void 0:x(Le)}),B(()=>{S=pe(A,1,"dot big svelte-1ayqwv0",null,S,{live:v()}),u(se,b()??"awaiting run…")}),y(o,d)};O(yr,o=>{e(re)?o(br,!1):o(_r)})}a(ft),B(()=>{be=pe(X,1,"spine-value svelte-1ayqwv0",null,be,{live:v()}),Ce=pe(Y,1,"dot svelte-1ayqwv0",null,Ce,{live:v()}),u(Ke,` ${v()?"Connected":"Offline"}`),u(vr,b()??"—")}),y(t,dt),or(),P()}ir(["click"]);export{fs as component}; +`;function aa(t){switch(t){case"mcp.call":return 0;case"memory.retrieve":return 1;case"memory.suppress":return 2;case"memory.write":return 3;case"sanhedrin.veto":return 4;case"contradiction.detected":return 5;case"dream.patch":return 6}}function nr(t){return["tool","retrieve","suppress","write","veto","contradiction","dream"].indexOf(t)}class sa{constructor(r,l){j(this,"engine");j(this,"scene",null);j(this,"resources",null);j(this,"sampler",null);j(this,"traceBindLayout",null);j(this,"membraneBindLayout",null);j(this,"blurBindLayout",null);j(this,"impulsePipeline",null);j(this,"lanePipeline",null);j(this,"receiptPipeline",null);j(this,"blurPipeline",null);j(this,"membranePipeline",null);j(this,"eventCount",0);j(this,"receiptCount",0);j(this,"hitRects",[]);this.engine=r,this.uploadScene(l)}uploadScene(r){this.scene=r,this.buildHitRects();const l=this.engine.gpuDevice;l&&(this.ensurePipelines(l),this.ensureResources(l),this.uploadBuffers(l))}ensurePipelines(r){if(this.impulsePipeline||!this.engine.paramsBuffer)return;const l=r.createShaderModule({label:"blackbox-trace-wgsl",code:ea}),v=r.createShaderModule({label:"blackbox-membrane-wgsl",code:ta}),b=r.createShaderModule({label:"blackbox-blur-wgsl",code:ra});this.traceBindLayout=r.createBindGroupLayout({label:"blackbox-trace-bind-layout",entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}},{binding:2,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}}]}),this.membraneBindLayout=r.createBindGroupLayout({label:"blackbox-membrane-bind-layout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:3,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}},{binding:4,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}}]}),this.blurBindLayout=r.createBindGroupLayout({label:"blackbox-blur-bind-layout",entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}}]});const c=r.createPipelineLayout({label:"blackbox-trace-layout",bindGroupLayouts:[this.traceBindLayout]}),f=r.createPipelineLayout({label:"blackbox-membrane-layout",bindGroupLayouts:[this.membraneBindLayout]}),P=r.createPipelineLayout({label:"blackbox-blur-layout",bindGroupLayouts:[this.blurBindLayout]});this.sampler=r.createSampler({magFilter:"linear",minFilter:"linear"});const q={color:{srcFactor:"one",dstFactor:"one",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one",operation:"add"}};this.impulsePipeline=r.createRenderPipeline({label:"blackbox-impulses",layout:c,vertex:{module:l,entryPoint:"vs_impulse"},fragment:{module:l,entryPoint:"fs_impulse",targets:[{format:je,blend:q}]},primitive:{topology:"triangle-list"}}),this.lanePipeline=r.createRenderPipeline({label:"blackbox-lanes",layout:c,vertex:{module:l,entryPoint:"vs_lane"},fragment:{module:l,entryPoint:"fs_lane",targets:[{format:je,blend:q}]},primitive:{topology:"triangle-list"}}),this.receiptPipeline=r.createRenderPipeline({label:"blackbox-receipt-beads",layout:c,vertex:{module:l,entryPoint:"vs_receipt"},fragment:{module:l,entryPoint:"fs_receipt",targets:[{format:je,blend:q}]},primitive:{topology:"triangle-list"}}),this.blurPipeline=r.createRenderPipeline({label:"blackbox-field-blur",layout:P,vertex:{module:b,entryPoint:"vs_fullscreen"},fragment:{module:b,entryPoint:"fs_blur",targets:[{format:je}]},primitive:{topology:"triangle-list"}}),this.membranePipeline=r.createRenderPipeline({label:"blackbox-field-membrane",layout:f,vertex:{module:v,entryPoint:"vs_fullscreen"},fragment:{module:v,entryPoint:"fs_membrane",targets:[{format:this.engine.sceneFormat,blend:q}]},primitive:{topology:"triangle-list"}})}ensureResources(r){var w,le,me,oe,i,k;if(!this.traceBindLayout||!this.blurBindLayout||!this.membraneBindLayout||!this.engine.paramsBuffer||!this.sampler)return;const l=Math.max(16,Math.floor((this.engine.params[6]||1280)/2)),v=Math.max(16,Math.floor((this.engine.params[7]||720)/2)),b=!this.resources||this.resources.fieldSize[0]!==l||this.resources.fieldSize[1]!==v;let c=(w=this.resources)==null?void 0:w.eventBuffer,f=(le=this.resources)==null?void 0:le.receiptBuffer,P=(me=this.resources)==null?void 0:me.blurHBuffer,q=(oe=this.resources)==null?void 0:oe.blurVBuffer;if(c||(c=r.createBuffer({label:"blackbox-event-cells",size:wt*Vt*4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})),f||(f=r.createBuffer({label:"blackbox-receipt-beads",size:Ft*$t*4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})),P||(P=r.createBuffer({label:"blackbox-blur-h-dir",size:16,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),r.queue.writeBuffer(P,0,new Float32Array([1,0,0,0]))),q||(q=r.createBuffer({label:"blackbox-blur-v-dir",size:16,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),r.queue.writeBuffer(q,0,new Float32Array([0,1,0,0]))),!b&&this.resources)return;(i=this.resources)==null||i.fieldA.destroy(),(k=this.resources)==null||k.fieldB.destroy();const E=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING,g=r.createTexture({label:"blackbox-field-a-rgba16float",size:[l,v],format:je,usage:E}),I=r.createTexture({label:"blackbox-field-b-rgba16float",size:[l,v],format:je,usage:E}),M=g.createView(),G=I.createView(),re=r.createBindGroup({label:"blackbox-trace-bind",layout:this.traceBindLayout,entries:[{binding:0,resource:{buffer:this.engine.paramsBuffer}},{binding:1,resource:{buffer:c}},{binding:2,resource:{buffer:f}}]}),ae=r.createBindGroup({label:"blackbox-membrane-bind",layout:this.membraneBindLayout,entries:[{binding:0,resource:{buffer:this.engine.paramsBuffer}},{binding:3,resource:this.sampler},{binding:4,resource:M}]}),Q=r.createBindGroup({label:"blackbox-blur-h-bind",layout:this.blurBindLayout,entries:[{binding:0,resource:this.sampler},{binding:1,resource:M},{binding:2,resource:{buffer:P}}]}),Be=r.createBindGroup({label:"blackbox-blur-v-bind",layout:this.blurBindLayout,entries:[{binding:0,resource:this.sampler},{binding:1,resource:G},{binding:2,resource:{buffer:q}}]});this.resources={eventBuffer:c,receiptBuffer:f,blurHBuffer:P,blurVBuffer:q,traceBindGroup:re,membraneBindGroup:ae,blurHBindGroup:Q,blurVBindGroup:Be,fieldA:g,fieldB:I,fieldAView:M,fieldBView:G,fieldSize:[l,v]}}uploadBuffers(r){if(!this.resources||!this.scene)return;const l=Math.min(wt,this.scene.visibleEventCount||this.scene.traceEvents.length),v=Math.max(1,this.scene.traceEvents.length-1),b=new Float32Array(wt*Vt);this.eventCount=Math.min(wt,this.scene.traceEvents.length);for(let f=0;f({event:b,x:-.84+1.68*(c/l),y:.66-1.28*(nr(b.lane)/6),w:.055,h:.065}))}compute(r){const l=this.engine.gpuDevice;if(!l||!this.resources||!this.impulsePipeline||!this.lanePipeline||!this.receiptPipeline||!this.blurPipeline)return;this.ensureResources(l);const v=this.resources,b=r.beginRenderPass({label:"blackbox-field-splat-pass",colorAttachments:[{view:v.fieldAView,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}]});b.setBindGroup(0,v.traceBindGroup),b.setPipeline(this.lanePipeline),b.draw(6,7),this.eventCount>0&&(b.setPipeline(this.impulsePipeline),b.draw(6,this.eventCount)),this.receiptCount>0&&this.eventCount>0&&(b.setPipeline(this.receiptPipeline),b.draw(6,this.receiptCount)),b.end();const c=r.beginRenderPass({label:"blackbox-field-blur-h-pass",colorAttachments:[{view:v.fieldBView,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}]});c.setPipeline(this.blurPipeline),c.setBindGroup(0,v.blurHBindGroup),c.draw(6,1),c.end();const f=r.beginRenderPass({label:"blackbox-field-blur-v-pass",colorAttachments:[{view:v.fieldAView,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"}]});f.setPipeline(this.blurPipeline),f.setBindGroup(0,v.blurVBindGroup),f.draw(6,1),f.end()}render(r){!this.resources||!this.membranePipeline||!this.impulsePipeline||!this.lanePipeline||!this.receiptPipeline||(r.setPipeline(this.membranePipeline),r.setBindGroup(0,this.resources.membraneBindGroup),r.draw(6,1),r.setBindGroup(0,this.resources.traceBindGroup),r.setPipeline(this.lanePipeline),r.draw(6,7),this.eventCount>0&&(r.setPipeline(this.impulsePipeline),r.draw(6,this.eventCount)),this.receiptCount>0&&this.eventCount>0&&(r.setPipeline(this.receiptPipeline),r.draw(6,this.receiptCount)))}pickAt(r,l){for(const v of this.hitRects)if(Math.abs(r-v.x)<=v.w&&Math.abs(l-v.y)<=v.h)return{id:v.event.id,kind:"trace-event",index:v.event.index,payload:v.event};return null}dispose(){var r,l,v,b,c,f;(r=this.resources)==null||r.eventBuffer.destroy(),(l=this.resources)==null||l.receiptBuffer.destroy(),(v=this.resources)==null||v.blurHBuffer.destroy(),(b=this.resources)==null||b.blurVBuffer.destroy(),(c=this.resources)==null||c.fieldA.destroy(),(f=this.resources)==null||f.fieldB.destroy(),this.resources=null}}function na(t,r){return zt(Ur.healthy),zt(Or.veto),zt(Vr.forward),[new sa(t,r)]}function kt(t){return Math.max(0,Math.min(1,Number.isFinite(t)?t:0))}function Qe(t,r=0){return typeof t=="number"&&Number.isFinite(t)?t:r}function ia(t,r,l){return{kind:"trace",id:`${t??"trace:none"}:event:${r}:${l}`}}function la(t,r,l){return{kind:"event",id:`${t??"trace:none"}:event:${r}:${l}`}}function oa(t){return{kind:"memory",id:t}}function ca(t){switch(t){case"mcp.call":return"tool";case"memory.retrieve":return"retrieve";case"memory.suppress":return"suppress";case"memory.write":return"write";case"sanhedrin.veto":return"veto";case"contradiction.detected":return"contradiction";case"dream.patch":return"dream"}}function va(t){switch(t.type){case"memory.retrieve":return t.ids;case"memory.suppress":return[t.id];case"memory.write":return[t.id];case"contradiction.detected":return t.ids;case"sanhedrin.veto":return t.evidenceIds;case"dream.patch":return t.proposalIds;case"mcp.call":return[]}}function ua(t){switch(t.type){case"mcp.call":return t.tool;case"memory.retrieve":return`${t.ids.length} memories retrieved`;case"memory.suppress":return`suppressed ${t.id.slice(0,8)}`;case"memory.write":return`wrote ${t.id.slice(0,8)}`;case"contradiction.detected":return`contradiction ${t.ids.join(" ↔ ")}`;case"sanhedrin.veto":return"Sanhedrin veto";case"dream.patch":return`${t.proposalIds.length} dream proposals`}}function da(t){switch(t.type){case"mcp.call":return`MCP tool ${t.tool} called; args hash ${t.argsHash.slice(0,12)}`;case"memory.retrieve":return`Retrieved ${t.ids.length} memories with activation map`;case"memory.suppress":return`Suppressed ${t.id}: ${t.reason}`;case"memory.write":return`Memory write ${t.id} from ${t.source}`;case"contradiction.detected":return t.detail;case"sanhedrin.veto":return`${Math.round(kt(t.confidence)*100)}% veto confidence: ${t.claim}`;case"dream.patch":return`Dream patch proposals: ${t.proposalIds.join(", ")}`}}function pa(t){return t.type!=="memory.retrieve"?[]:Object.entries(t.activation??{}).map(([r,l])=>({id:r,activation:kt(l)})).sort((r,l)=>l.activation-r.activation)}function fa(t){if(t.type==="sanhedrin.veto")return kt(t.confidence);if(t.type==="memory.retrieve"){const r=Object.values(t.activation??{});return r.length?kt(r.reduce((l,v)=>l+v,0)/r.length):.45}return t.type==="memory.suppress"?.78:t.type==="memory.write"?.72:t.type==="contradiction.detected"?.82:t.type==="dream.patch"?.52:.62}function ma(t,r=[],l){var le,me,oe;const v=(t==null?void 0:t.runId)??null,b=(t==null?void 0:t.events)??[],c=(t==null?void 0:t.summary)??null,f=Qe(c==null?void 0:c.startedAt,((le=b[0])==null?void 0:le.at)??0),P=Qe(c==null?void 0:c.lastAt,((me=b[b.length-1])==null?void 0:me.at)??f),q=b.length?b.length-1:0,E=Math.max(0,Math.min(q,l??q)),g=b.length?E+1:0,I=b.map((i,k)=>({index:k,id:`${v??i.runId}:event:${k}:${i.type}`,type:i.type,lane:ca(i.type),runId:i.runId,at:i.at,label:ua(i),summary:da(i),memoryIds:va(i),activationPairs:pa(i),confidence:fa(i),provenance:ia(v,k,i.type),raw:i})),M=new Map;for(const i of I)for(const k of i.memoryIds){if(!k||M.has(k))continue;const V=((oe=i.activationPairs.find(ye=>ye.id===k))==null?void 0:oe.activation)??0;M.set(k,{source:oa(k),index:M.size,label:k.slice(0,12),retention:Math.max(.25,V),activation:V,trust:i.type==="memory.suppress"?.2:Math.max(.35,i.confidence),suppression:i.type==="memory.suppress"?1:0,tags:[i.lane,i.type],type:"trace-memory"})}const G=[...M.values()],re=I.slice(0,g).map(i=>{var k;return{source:la(v,i.index,i.type),type:i.type,targetIndex:i.memoryIds.length?((k=M.get(i.memoryIds[0]))==null?void 0:k.index)??-1:-1,frame:i.index*34+18,energy:Math.max(.18,i.confidence)}}),ae=I.slice(0,g).flatMap(i=>{const k=i.memoryIds.filter(V=>M.has(V));return k.length<2?[]:k.slice(1).map((V,ye)=>{var qe;return{source:{kind:"pair",id:`${i.id}:pair:${k[0]}:${V}`},sourceIndex:M.get(k[0]).index,targetIndex:M.get(V).index,weight:((qe=i.activationPairs[ye+1])==null?void 0:qe.activation)??i.confidence,kind:i.type}})}),Q=r??[],Be=Q.map(i=>{const k=[...new Set([...i.retrieved??[],...i.activation_path??[],...(i.mutations??[]).map(V=>V.id)])];return{source:{kind:"receipt",id:i.receipt_id},label:`receipt ${i.receipt_id.slice(0,10)}`,nodeIndices:k.map(V=>{var ye;return(ye=M.get(V))==null?void 0:ye.index}).filter(V=>typeof V=="number")}}),w={organ:"blackbox",nodes:G,edges:ae,events:re,receipts:Be,scalars:{eventCount:b.length,visibleEventCount:g,retrievedCount:Qe(c==null?void 0:c.retrievedCount,I.filter(i=>i.type==="memory.retrieve").length),suppressedCount:Qe(c==null?void 0:c.suppressedCount,I.filter(i=>i.type==="memory.suppress").length),writeCount:Qe(c==null?void 0:c.writeCount,I.filter(i=>i.type==="memory.write").length),vetoCount:Qe(c==null?void 0:c.vetoCount,I.filter(i=>i.type==="sanhedrin.veto").length),durationMs:Math.max(0,P-f),receiptCount:Be.length},alive:b.length>0,runId:v,traceEvents:I,visibleEventCount:g,selectedIndex:E,startedAt:f,lastAt:P,durationMs:Math.max(0,P-f),receiptRows:Q};return w.alive||(w.receipts=Q.map(i=>({source:{kind:"receipt",id:i.receipt_id},label:`receipt ${i.receipt_id.slice(0,10)}`,nodeIndices:[]})),w.scalars.eventCount=0,w.scalars.visibleEventCount=0),w}var ya=_(' ',1),_a=_(' '),ba=_('awaiting…'),ha=_('
        GPU pick
        '),ga=_(`

        No agent runs recorded yet. Make an MCP tool call — every call is + recorded here.

        `),wa=_(' '),xa=_(' '),qa=_(' '),ka=_(' '),Pa=_('
      1. '),Sa=_('
          '),Ba=_('
          Loading trace…
          '),Ca=_('
          '),Ma=_('
          Select a run to replay.
          '),Ra=_(' '),Ea=_(""),Ga=_(' '),Ia=_(' '),Aa=_('
          '),La=_(' '),za=_('
          vs
          '),Ta=_(' '),Ua=_('
          '),Oa=_('

          '),Va=_('

          No memories touched yet.

          '),$a=_(' '),Fa=_('
          '),Na=_('

          Receipts — proof behind retrievals

          '),Da=_('
        • '),Ha=_('
          Step

          Memory pulse — touched this run

          Event producers — this run

          • mcp.call · memory.write · memory.retrieve · memory.suppress live
          • contradiction.detected
          • dream.patch
          • sanhedrin.veto

          Event log

            ',1),Wa=_('
            '),ja=_('
            '),Qa=_('
            trace events

            Watch the agent think. Watch memory change. Watch the receipt prove why.

            '),Xa=_('
            WebSocket
            Live runId
            Last event
            Events seen
            ',1);function fs(t,r){lr(r,!0);const l=()=>gt(Ir,"$lastTraceEvent",f),v=()=>gt(Lr,"$isConnected",f),b=()=>gt(zr,"$liveRunId",f),c=()=>gt(Ar,"$traceEvents",f),[f,P]=Er();let q=Se(er([])),E=Se(null),g=Se(null),I=Se(!1),M=Se(null),G=Se(0),re=Se(!1),ae=Se(er([])),Q=Se(null);const Be=ge(()=>e(g)?e(g).events.slice(0,e(G)+1):[]),w=ge(()=>e(g)&&e(g).events.length?e(g).events[e(G)]:null),le=ge(()=>{var o,d;return((d=(o=e(g))==null?void 0:o.events[0])==null?void 0:d.at)??0}),me=ge(()=>Array.from(new Set(e(Be).flatMap(Jr)))),oe=ge(()=>{var o;return((o=e(g))==null?void 0:o.events.some(d=>d.type==="sanhedrin.veto"))??!1}),i=ge(()=>{var o;return((o=e(g))==null?void 0:o.events.some(d=>d.type==="dream.patch"))??!1}),k=ge(()=>{var o;return((o=e(g))==null?void 0:o.events.some(d=>d.type==="contradiction.detected"))??!1}),V=ge(()=>ma(e(g),e(ae),e(G)));function ye(o){var p;if(o.kind!=="trace-event")return;const d=o.payload;U(Q,d,!0),U(G,Math.max(0,Math.min((p=e(g))!=null&&p.events.length?e(g).events.length-1:0,d.index)),!0)}async function qe(){try{const o=await lt.traces.list(100);U(q,o.runs,!0),!e(E)&&e(q).length&&ct(e(q)[0].runId)}catch(o){U(M,String(o),!0)}}async function ct(o){U(E,o,!0),U(I,!0),U(M,null);try{U(g,await lt.traces.get(o),!0),U(G,Math.max(0,(e(g).events.length||1)-1),!0),U(Q,null),U(ae,(await lt.receipts.listForRun(o,8)).receipts,!0)}catch(d){U(M,String(d),!0),U(g,null)}finally{U(I,!1)}}function _e(){e(E)&&(window.location.href=lt.traces.exportUrl(e(E)))}tr(()=>{var p;const o=l();if(!o)return;const d=(p=o.data)==null?void 0:p.run_id;d&&d===e(E)&<.traces.get(e(E)).then(A=>{U(g,A,!0),U(G,Math.max(0,A.events.length-1),!0)})}),Sr(qe);let ce=null;function Ye(){const o=Math.max(1,...e(q).map(p=>p.eventCount??0)),d=e(q).slice(0,200).map(p=>{const A=vt((p.eventCount??0)/o),S=(p.vetoCount??0)>0?Tt.scarlet:(p.suppressedCount??0)>0?Tt.caution:Tt.forward;return{id:p.runId,score:.35+.65*A,hue:S,energy:.4+.6*A,selected:p.runId===e(E),scar:(p.vetoCount??0)>0,metric2:vt((p.retrievedCount??0)/Math.max(1,p.eventCount??1)),kind:"trace-run",payload:p}});return Fr(d,{maxRadius:.95,minCellR:.016,maxCellR:.06})}function vt(o){return Math.min(1,Math.max(0,Number.isFinite(o)?o:0))}function ut(o,d){const p=new $r(o);return ce=p,p.setCells(Ye()),[{compute:S=>p.compute(S),render:S=>p.render(S),pickAt:(S,N)=>p.pickAt(S,N),dispose:()=>{p.dispose(),ce===p&&(ce=null)}},...na(o,d)]}tr(()=>{e(q).length,e(E),ce==null||ce.setCells(Ye())});var dt=Xa(),pt=xt(dt);{let o=ge(()=>`agent-flight-recorder:${e(E)??"empty"}:${e(V).visibleEventCount}`);Tr(pt,{organ:"blackbox",get seed(){return e(o)},get scene(){return e(V)},passes:ut,get loading(){return e(I)},get error(){return e(M)},emptyLabel:"NO AGENT TRACE SELECTED - RECORDER ARMED",onpick:ye})}var ft=n(pt,2),ee=s(ft);Cr(ee,{icon:"blackbox",title:"Agent Black Box",subtitle:"Watch the agent think. Watch memory change. Watch the receipt prove why.",accent:"synapse",children:(o,d)=>{var p=ya(),A=xt(p);let S;var N=s(A);Nt(N,{name:"sparkle",size:14}),Ie(),a(A);var se=n(A,2),Me=s(se);Nt(Me,{name:"feed",size:14}),Ie(),a(se),B(()=>{S=pe(A,1,"mode-toggle svelte-1ayqwv0",null,S,{on:e(re)}),se.disabled=!e(E)}),Xe("click",A,()=>U(re,!e(re))),Xe("click",se,_e),y(o,p)},$$slots:{default:!0}});var W=n(ee,2),ve=s(W),X=n(s(ve),2);let be;var Y=s(X);let Ce;var Ke=n(Y);a(X),a(ve);var Je=n(ve,2),Dt=n(s(Je),2),vr=s(Dt,!0);a(Dt),a(Je);var Pt=n(Je,2),Ht=n(s(Pt),2),ur=s(Ht);{var dr=o=>{var d=_a();let p;var A=s(d,!0);a(d),B((S,N)=>{p=Ge(d,"",p,S),u(A,N)},[()=>{var S,N;return{"--c":ot((N=(S=l().data)==null?void 0:S.event)==null?void 0:N.type)}},()=>{var S,N;return We((N=(S=l().data)==null?void 0:S.event)==null?void 0:N.type)}]),y(o,d)},pr=o=>{var d=ba();y(o,d)};O(ur,o=>{l()?o(dr):o(pr,!1)})}a(Ht),a(Pt);var Wt=n(Pt,2),jt=n(s(Wt),2),fr=s(jt);ar(fr,{get value(){return c().length}}),a(jt),a(Wt),a(W),we(W,o=>{var d;return(d=xe)==null?void 0:d(o)});var Qt=n(W,2);{var mr=o=>{var d=ha(),p=n(s(d),2),A=s(p,!0);a(p);var S=n(p,2),N=s(S,!0);a(S);var se=n(S,2),Me=s(se,!0);a(se),a(d),we(d,Ze=>{var Ae;return(Ae=xe)==null?void 0:Ae(Ze)}),B(()=>{u(A,e(Q).label),u(N,e(Q).summary),u(Me,e(Q).provenance.id)}),y(o,d)};O(Qt,o=>{e(Q)&&o(mr)})}var yr=n(Qt,2);{var _r=o=>{var d=Wa(),p=s(d),A=n(s(p),2);{var S=x=>{var R=ga();y(x,R)},N=x=>{var R=Sa();fe(R,21,()=>e(q),te=>te.runId,(te,L)=>{var ke=Pa(),ue=s(ke);let Re;var ze=s(ue),Ee=s(ze),et=s(Ee,!0);a(Ee);var z=n(Ee,2),$e=s(z,!0);a(z),a(ze);var Te=n(ze,2),Ue=s(Te),Fe=s(Ue);a(Ue);var mt=n(Ue,2);{var Bt=$=>{var T=wa(),he=s(T);a(T),B(()=>u(he,`↑${e(L).retrievedCount??""}`)),y($,T)};O(mt,$=>{e(L).retrievedCount&&$(Bt)})}var yt=n(mt,2);{var Ne=$=>{var T=xa(),he=s(T);a(T),B(()=>u(he,`⊘${e(L).suppressedCount??""}`)),y($,T)};O(yt,$=>{e(L).suppressedCount&&$(Ne)})}var tt=n(yt,2);{var De=$=>{var T=qa(),he=s(T);a(T),B(()=>u(he,`✎${e(L).writeCount??""}`)),y($,T)};O(tt,$=>{e(L).writeCount&&$(De)})}var _t=n(tt,2);{var bt=$=>{var T=ka(),he=s(T);a(T),B(()=>u(he,`⛔${e(L).vetoCount??""}`)),y($,T)};O(_t,$=>{e(L).vetoCount&&$(bt)})}a(Te),a(ue),a(ke),B($=>{Re=pe(ue,1,"run-row svelte-1ayqwv0",null,Re,{active:e(L).runId===e(E)}),u(et,$),u($e,e(L).firstTool??"—"),u(Fe,`${e(L).eventCount??""} ev`)},[()=>e(L).runId.replace("run_","").slice(0,10)]),Xe("click",ue,()=>ct(e(L).runId)),y(te,ke)}),a(R),y(x,R)};O(A,x=>{e(q).length===0?x(S):x(N,!1)})}a(p),we(p,x=>{var R;return(R=xe)==null?void 0:R(x)});var se=n(p,2),Me=s(se);{var Ze=x=>{var R=Ba();y(x,R)},Ae=x=>{var R=Ca(),te=s(R,!0);a(R),B(()=>u(te,e(M))),y(x,R)},St=x=>{var R=Ma();y(x,R)},Le=x=>{var R=Ha(),te=xt(R),L=s(te),ke=s(L),ue=n(s(ke)),Re=s(ue,!0);a(ue);var ze=n(ue);a(ke);var Ee=n(ke,2);{var et=h=>{var m=Ra(),F=s(m);a(m),B(C=>u(F,`+${C??""}ms`),[()=>sr(e(w).at,e(le))]),y(h,m)};O(Ee,h=>{e(w)&&h(et)})}a(L);var z=n(L,2);Br(z);var $e=n(z,2);fe($e,21,()=>e(g).events,rr,(h,m,F)=>{var C=Ea();let D,Pe;B((de,Oe,He)=>{D=pe(C,1,"tick svelte-1ayqwv0",null,D,{past:F<=e(G)}),qt(C,"title",de),qt(C,"aria-label",Oe),Pe=Ge(C,"",Pe,He)},[()=>We(e(m).type),()=>`Step ${F+1}: ${We(e(m).type)}`,()=>({"--c":ot(e(m).type)})]),Xe("click",C,()=>U(G,F,!0)),y(h,C)}),a($e),a(te),we(te,h=>{var m;return(m=xe)==null?void 0:m(h)});var Te=n(te,2);{var Ue=h=>{var m=Oa();let F;var C=s(m),D=s(C),Pe=s(D,!0);a(D);var de=n(D,2),Oe=s(de,!0);a(de);var He=n(de,2),rt=s(He,!0);a(He),a(C);var at=n(C,2),st=s(at,!0);a(at);var Rt=n(at,2);{var ht=K=>{var H=Aa();fe(H,20,()=>e(w).ids,J=>J,(J,ne)=>{var ie=Ia();let Z;var Ve=s(ie),nt=s(Ve,!0);a(Ve);var It=n(Ve,2);{var At=it=>{var Lt=Ga(),xr=s(Lt);a(Lt),B(qr=>u(xr,`${qr??""}%`),[()=>(e(w).activation[ne]*100).toFixed(0)]),y(it,Lt)};O(It,it=>{e(w).activation[ne]!=null&&it(At)})}a(ie),B(it=>{Z=Ge(ie,"",Z,{"--a":e(w).activation[ne]??0}),u(nt,it)},[()=>ne.slice(0,8)]),y(J,ie)}),a(H),y(K,H)},Et=K=>{var H=za(),J=s(H),ne=s(J);a(J);var ie=n(J,4);fe(ie,16,()=>e(w).ids.filter(Z=>Z!==e(w).winnerId),Z=>Z,(Z,Ve)=>{var nt=La(),It=s(nt,!0);a(nt),B(At=>u(It,At),[()=>Ve.slice(0,8)]),y(Z,nt)}),a(H),B(Z=>u(ne,`kept ${Z??""}`),[()=>{var Z;return(Z=e(w).winnerId)==null?void 0:Z.slice(0,8)}]),y(K,H)},Gt=K=>{var H=Ua();fe(H,20,()=>e(w).evidenceIds,J=>J,(J,ne)=>{var ie=Ta(),Z=s(ie,!0);a(ie),B(Ve=>u(Z,Ve),[()=>ne.slice(0,8)]),y(J,ie)}),a(H),y(K,H)};O(Rt,K=>{e(w).type==="memory.retrieve"?K(ht):e(w).type==="contradiction.detected"?K(Et,1):e(w).type==="sanhedrin.veto"&&K(Gt,2)})}a(m),we(m,K=>{var H;return(H=xe)==null?void 0:H(K)}),B((K,H,J,ne,ie)=>{F=Ge(m,"",F,K),u(Pe,H),u(Oe,J),u(rt,ne),u(st,ie)},[()=>({"--c":ot(e(w).type)}),()=>Ut(e(w).type),()=>We(e(w).type),()=>Zr(e(w).at),()=>Ot(e(w))]),y(h,m)};O(Te,h=>{e(w)&&h(Ue)})}var Fe=n(Te,2),mt=n(s(Fe),2);{var Bt=h=>{var m=Va();y(h,m)},yt=h=>{var m=Fa();fe(m,20,()=>e(me),F=>F,(F,C)=>{var D=$a(),Pe=s(D,!0);a(D),B(de=>u(Pe,de),[()=>C.slice(0,8)]),y(F,D)}),a(m),y(h,m)};O(mt,h=>{e(me).length===0?h(Bt):h(yt,!1)})}a(Fe),we(Fe,h=>{var m;return(m=xe)==null?void 0:m(h)});var Ne=n(Fe,2),tt=n(s(Ne),2),De=n(s(tt),2);let _t;var bt=n(s(De),2),$=s(bt,!0);a(bt),a(De);var T=n(De,2);let he;var Xt=n(s(T),2),hr=s(Xt,!0);a(Xt),a(T);var Ct=n(T,2);let Yt;var Kt=n(s(Ct),2),gr=s(Kt,!0);a(Kt),a(Ct),a(tt),a(Ne),we(Ne,h=>{var m;return(m=xe)==null?void 0:m(h)});var Jt=n(Ne,2);{var wr=h=>{var m=Na(),F=n(s(m),2);fe(F,21,()=>e(ae).slice(0,2),C=>C.receipt_id,(C,D)=>{Kr(C,{get receipt(){return e(D)}})}),a(F),a(m),we(m,C=>{var D;return(D=xe)==null?void 0:D(C)}),y(h,m)};O(Jt,h=>{e(ae).length&&h(wr)})}var Mt=n(Jt,2),Zt=n(s(Mt),2);fe(Zt,21,()=>e(g).events,rr,(h,m,F)=>{var C=Da();let D,Pe;var de=s(C),Oe=s(de),He=s(Oe,!0);a(Oe);var rt=n(Oe,2),at=s(rt,!0);a(rt);var st=n(rt,2),Rt=s(st,!0);a(st);var ht=n(st,2),Et=s(ht);a(ht),a(de),a(C),B((Gt,K,H,J,ne)=>{D=pe(C,1,"log-row svelte-1ayqwv0",null,D,{active:F===e(G),dim:F>e(G)}),Pe=Ge(C,"",Pe,Gt),u(He,K),u(at,H),u(Rt,J),u(Et,`+${ne??""}ms`)},[()=>({"--c":ot(e(m).type)}),()=>Ut(e(m).type),()=>We(e(m).type),()=>Ot(e(m)),()=>sr(e(m).at,e(le))]),Xe("click",de,()=>U(G,F,!0)),y(h,C)}),a(Zt),a(Mt),we(Mt,h=>{var m;return(m=xe)==null?void 0:m(h)}),B(h=>{u(Re,e(G)+1),u(ze,` / ${e(g).events.length??""}`),qt(z,"max",h),_t=pe(De,1,"producer svelte-1ayqwv0",null,_t,{ok:e(k)}),u($,e(k)?"fired this run":"no contradiction in this run"),he=pe(T,1,"producer caveat svelte-1ayqwv0",null,he,{ok:e(i)}),u(hr,e(i)?"fired this run":"No dream run in this trace"),Yt=pe(Ct,1,"producer caveat svelte-1ayqwv0",null,Yt,{ok:e(oe)}),u(gr,e(oe)?"fired this run":"No veto producer connected (optional Sanhedrin hook, off by default)")},[()=>Math.max(0,e(g).events.length-1)]),Mr(z,()=>e(G),h=>U(G,h)),y(x,R)};O(Me,x=>{e(I)?x(Ze):e(M)?x(Ae,1):e(g)?x(Le,!1):x(St,2)})}a(se),a(d),y(o,d)},br=o=>{var d=Qa(),p=s(d),A=s(p);let S;var N=n(A,2),se=s(N,!0);a(N),a(p);var Me=n(p,2);{var Ze=Le=>{const x=ge(()=>{var z;return(z=l().data)==null?void 0:z.event});var R=ja();let te;var L=s(R),ke=s(L,!0);a(L);var ue=n(L,2),Re=s(ue),ze=s(Re,!0);a(Re);var Ee=n(Re,2),et=s(Ee,!0);a(Ee),a(ue),a(R),B((z,$e,Te,Ue)=>{te=Ge(R,"",te,z),u(ke,$e),u(ze,Te),u(et,Ue)},[()=>{var z;return{"--c":ot((z=e(x))==null?void 0:z.type)}},()=>{var z;return Ut((z=e(x))==null?void 0:z.type)},()=>{var z;return We((z=e(x))==null?void 0:z.type)},()=>Ot(e(x))]),y(Le,R)};O(Me,Le=>{l()&&Le(Ze)})}var Ae=n(Me,2),St=s(Ae);ar(St,{get value(){return c().length}}),Ie(2),a(Ae),Ie(2),a(d),we(d,Le=>{var x;return(x=xe)==null?void 0:x(Le)}),B(()=>{S=pe(A,1,"dot big svelte-1ayqwv0",null,S,{live:v()}),u(se,b()??"awaiting run…")}),y(o,d)};O(yr,o=>{e(re)?o(br,!1):o(_r)})}a(ft),B(()=>{be=pe(X,1,"spine-value svelte-1ayqwv0",null,be,{live:v()}),Ce=pe(Y,1,"dot svelte-1ayqwv0",null,Ce,{live:v()}),u(Ke,` ${v()?"Connected":"Offline"}`),u(vr,b()??"—")}),y(t,dt),or(),P()}ir(["click"]);export{fs as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/6.CNes4HHG.js.br b/apps/dashboard/build/_app/immutable/nodes/6.CNes4HHG.js.br new file mode 100644 index 0000000..4626e7a Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/6.CNes4HHG.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/6.CNes4HHG.js.gz b/apps/dashboard/build/_app/immutable/nodes/6.CNes4HHG.js.gz new file mode 100644 index 0000000..997a7cc Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/6.CNes4HHG.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/7.AFPOwdob.js.br b/apps/dashboard/build/_app/immutable/nodes/7.AFPOwdob.js.br deleted file mode 100644 index 64a1b41..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/7.AFPOwdob.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/7.AFPOwdob.js.gz b/apps/dashboard/build/_app/immutable/nodes/7.AFPOwdob.js.gz deleted file mode 100644 index 1441c9f..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/7.AFPOwdob.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/7.AFPOwdob.js b/apps/dashboard/build/_app/immutable/nodes/7.Cs_QL9bJ.js similarity index 99% rename from apps/dashboard/build/_app/immutable/nodes/7.AFPOwdob.js rename to apps/dashboard/build/_app/immutable/nodes/7.Cs_QL9bJ.js index 8b09000..7e3e728 100644 --- a/apps/dashboard/build/_app/immutable/nodes/7.AFPOwdob.js +++ b/apps/dashboard/build/_app/immutable/nodes/7.Cs_QL9bJ.js @@ -1,4 +1,4 @@ -var wr=Object.defineProperty;var Pr=(r,t,s)=>t in r?wr(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var Q=(r,t,s)=>Pr(r,typeof t!="symbol"?t+"":t,s);import"../chunks/Bzak7iHL.js";import{d as Zt,b as ue,e as tt,s as w,o as $t}from"../chunks/DAau0uzT.js";import{p as er,c as a,X as l,aH as rt,Y as W,g as e,s as P,a as R,u as $,r as i,af as me,b as tr,d as Z,f as O,aP as jt,e as Ut}from"../chunks/CGq8RnJq.js";import{i as X}from"../chunks/Ccqjq5DS.js";import{e as De,s as h,i as Pt}from"../chunks/DqfV0sZu.js";import{P as Mr,A as je,a as Le,r as Oe}from"../chunks/B9l3DI-J.js";import{s as Vt}from"../chunks/uCQU803Y.js";import{s as be}from"../chunks/HFGAk8XQ.js";import{p as Mt,s as Br,a as Sr}from"../chunks/DV6OI5iy.js";import{D as Yt}from"../chunks/DnDQzBs4.js";import{I as Bt}from"../chunks/CKbQrCJw.js";import{R as Gr}from"../chunks/Cqe0su6e.js";import{r as ot,M as Fr,I as Ht,R as Ar,m as Wt,a as Rr}from"../chunks/BMB5u1EX.js";import{L as jr,l as Lr}from"../chunks/BeGBxCGK.js";import{a as qt}from"../chunks/D35IQVqe.js";import{e as Or}from"../chunks/Ch9vNiEl.js";const rr=.7,sr=.5,Dr="#ef4444",Tr="#f59e0b",Er="#fde047";function At(r){return r>rr?Dr:r>sr?Tr:Er}function ir(r){return r>rr?"strong":r>sr?"moderate":"mild"}const Qt="#8b5cf6",Ir={fact:"#3b82f6",concept:"#8b5cf6",event:"#f59e0b",person:"#10b981",place:"#06b6d4",note:"#6b7280",pattern:"#ec4899",decision:"#ef4444"};function Xt(r){return r?Ir[r]??Qt:Qt}const Kt=5,Cr=9;function Nr(r){if(!Number.isFinite(r))return Kt;const t=r<0?0:r>1?1:r;return Kt+t*Cr}const zr=.12;function Jt(r,t){return t==null||t===r?1:zr}function ct(r,t=60){return r==null||typeof r!="string"||t<=0?"":r.length<=t?r:r.slice(0,t-1)+"…"}function $r(r){if(!r||r.length===0)return 0;const t=new Set;for(const s of r)s.memory_a_id&&t.add(s.memory_a_id),s.memory_b_id&&t.add(s.memory_b_id);return t.size}function Ur(r){if(!r||r.length===0)return 0;let t=0;for(const s of r)t+=Math.abs((s.trust_a??0)-(s.trust_b??0));return t/r.length}var Vr=jt('',1),Yr=jt(' '),Hr=jt('',1),Wr=O('
            '),qr=O('
            '),Qr=O('
            '),Xr=O('
            topic:
            '),Kr=O('
            SEVERITYstrong (>0.7)moderate (0.5-0.7)mild (0.3-0.5)
            ');function Jr(r,t){er(t,!0);let s=Mt(t,"focusedPairIndex",3,null),c=Mt(t,"width",3,800),n=Mt(t,"height",3,600);const o=$(()=>{const _=c()/2,u=n()/2,C=Math.min(c(),n())*.38;return{cx:_,cy:u,R:C}}),m=$(()=>{const _=[],u=[],C=t.contradictions.length||1;return t.contradictions.forEach((k,T)=>{const Y=T/C*Math.PI*2-Math.PI/2,M=.18+k.similarity*.22,E=Y-M,B=Y+M,se=e(o).R+Math.sin(T*2.3)*18,ie=e(o).R+Math.cos(T*1.7)*18,D={x:e(o).cx+Math.cos(E)*se,y:e(o).cy+Math.sin(E)*se,trust:k.trust_a,preview:k.memory_a_preview,type:k.memory_a_type,created:k.memory_a_created,tags:k.memory_a_tags,memoryId:k.memory_a_id,pairIndex:T,side:"a"},z={x:e(o).cx+Math.cos(B)*ie,y:e(o).cy+Math.sin(B)*ie,trust:k.trust_b,preview:k.memory_b_preview,type:k.memory_b_type,created:k.memory_b_created,tags:k.memory_b_tags,memoryId:k.memory_b_id,pairIndex:T,side:"b"};_.push(D,z);const ne=(D.x+z.x)/2,q=(D.y+z.y)/2,K=.55-k.similarity*.25,le=ne+(e(o).cx-ne)*K,xe=q+(e(o).cy-q)*K,pt=1+Math.min(k.trust_a,k.trust_b)*4;u.push({pairIndex:T,path:`M ${D.x.toFixed(1)} ${D.y.toFixed(1)} Q ${le.toFixed(1)} ${xe.toFixed(1)} ${z.x.toFixed(1)} ${z.y.toFixed(1)}`,color:At(k.similarity),thickness:pt,severity:ir(k.similarity),topic:k.topic,similarity:k.similarity,dateDiff:k.date_diff_days,aPoint:D,bPoint:z,midX:le,midY:xe})}),{nodes:_,arcs:u}});let p=Z(null),g=Z(null),F=Z(0),v=Z(0);function j(_){const u=_.currentTarget.getBoundingClientRect();P(F,_.clientX-u.left),P(v,_.clientY-u.top)}function I(_){t.onSelectPair&&t.onSelectPair(s()===_?null:_)}function U(){var _;(_=t.onSelectPair)==null||_.call(t,null)}var b=Kr(),G=a(b),V=l(a(G)),re=l(V),oe=l(re),he=l(oe);De(he,17,()=>e(m).arcs,_=>_.pairIndex,(_,u)=>{const C=$(()=>Jt(e(u).pairIndex,s())),k=$(()=>s()===e(u).pairIndex);var T=Vr(),Y=rt(T),M=l(Y),E=l(M);W(B=>{h(Y,"d",e(u).path),h(Y,"stroke",e(u).color),h(Y,"stroke-width",e(u).thickness*3),h(Y,"stroke-opacity",.08*e(C)),h(M,"d",e(u).path),h(M,"stroke",e(u).color),h(M,"stroke-width",e(u).thickness*(e(k)?1.6:1)),h(M,"stroke-opacity",(e(k)?1:.72)*e(C)),h(M,"aria-label",`contradiction ${e(u).pairIndex+1}: ${e(u).topic??""}`),h(E,"d",e(u).path),h(E,"stroke",e(u).color),h(E,"stroke-width",B),h(E,"stroke-opacity",.85*e(C)),be(E,`animation-duration: ${4+e(u).pairIndex%5}s`)},[()=>Math.max(1,e(u).thickness*.6)]),ue("click",M,B=>{B.stopPropagation(),I(e(u).pairIndex)}),tt("mouseenter",M,()=>P(g,e(u),!0)),tt("mouseleave",M,()=>P(g,null)),ue("keydown",M,B=>{B.key==="Enter"&&I(e(u).pairIndex)}),R(_,T)});var Se=l(he);De(Se,19,()=>e(m).nodes,(_,u)=>_.memoryId+"-"+_.side+"-"+u,(_,u)=>{const C=$(()=>Jt(e(u).pairIndex,s())),k=$(()=>s()===e(u).pairIndex),T=$(()=>Nr(e(u).trust)),Y=$(()=>Xt(e(u).type));var M=Hr(),E=rt(M),B=l(E),se=l(B);{var ie=D=>{var z=Yr(),ne=a(z,!0);i(z),W(q=>{h(z,"x",e(u).x),h(z,"y",e(u).y-e(T)-8),w(ne,q)},[()=>ct(e(u).preview,40)]),R(D,z)};X(se,D=>{e(k)&&D(ie)})}W(D=>{h(E,"cx",e(u).x),h(E,"cy",e(u).y),h(E,"r",e(T)*2.2),h(E,"fill",e(Y)),h(E,"opacity",.12*e(C)),h(B,"cx",e(u).x),h(B,"cy",e(u).y),h(B,"r",e(T)),h(B,"fill",e(Y)),h(B,"opacity",e(C)),h(B,"stroke-opacity",e(k)?.85:.25),h(B,"stroke-width",e(k)?2:1),h(B,"aria-label",`memory ${D??""}`)},[()=>ct(e(u).preview,40)]),tt("mouseenter",B,()=>P(p,e(u),!0)),tt("mouseleave",B,()=>P(p,null)),ue("click",B,D=>{D.stopPropagation(),I(e(u).pairIndex)}),ue("keydown",B,D=>{D.key==="Enter"&&I(e(u).pairIndex)}),R(_,M)}),me(),i(G);var Ge=l(G,2);{var ut=_=>{var u=Qr(),C=a(u),k=a(C),T=l(k,2),Y=a(T,!0);i(T);var M=l(T,2),E=a(M);i(M),i(C);var B=l(C,2),se=a(B,!0);i(B);var ie=l(B,2);{var D=q=>{var K=Wr(),le=a(K);i(K),W(()=>w(le,`created ${e(p).created??""}`)),R(q,K)};X(ie,q=>{e(p).created&&q(D)})}var z=l(ie,2);{var ne=q=>{var K=qr(),le=a(K,!0);i(K),W(xe=>w(le,xe),[()=>e(p).tags.slice(0,4).join(" · ")]),R(q,K)};X(z,q=>{e(p).tags&&e(p).tags.length>0&&q(ne)})}i(u),W((q,K,le,xe)=>{be(u,`left: ${q??""}px; top: ${K??""}px;`),be(k,`background: ${le??""}`),w(Y,e(p).type??"memory"),w(E,`trust ${xe??""}%`),w(se,e(p).preview)},[()=>Math.max(0,Math.min(e(F)+12,c()-240)),()=>Math.max(0,Math.min(e(v)-8,n()-120)),()=>Xt(e(p).type),()=>(e(p).trust*100).toFixed(0)]),R(_,u)},fe=_=>{var u=Xr(),C=a(u),k=a(C),T=l(k,2),Y=a(T);i(T),i(C);var M=l(C,2),E=l(a(M)),B=a(E,!0);i(E),i(M);var se=l(M,2),ie=a(se);i(se),i(u),W((D,z,ne)=>{be(u,`left: ${D??""}px; top: ${z??""}px;`),be(k,`background: ${e(g).color??""}`),w(Y,`${e(g).severity??""} conflict`),w(B,e(g).topic),w(ie,`similarity ${ne??""}% · ${e(g).dateDiff??""}d apart`)},[()=>Math.max(0,Math.min(e(F)+12,c()-240)),()=>Math.max(0,Math.min(e(v)-8,n()-120)),()=>(e(g).similarity*100).toFixed(0)]),R(_,u)};X(Ge,_=>{e(p)?_(ut):e(g)&&_(fe,1)})}i(b),W(()=>{be(b,`aspect-ratio: ${c()??""} / ${n()??""};`),h(G,"width",c()),h(G,"height",n()),h(G,"viewBox",`0 0 ${c()??""} ${n()??""}`),h(V,"width",c()),h(V,"height",n()),h(re,"cx",e(o).cx),h(re,"cy",e(o).cy),h(re,"r",e(o).R),h(oe,"cx",e(o).cx),h(oe,"cy",e(o).cy)}),ue("mousemove",G,j),tt("mouseleave",G,()=>{P(p,null),P(g,null)}),ue("click",G,U),R(r,b),tr()}Zt(["mousemove","click","keydown"]);const nt="rgba16float",lt=160,St=16,ar=` +var wr=Object.defineProperty;var Pr=(r,t,s)=>t in r?wr(r,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[t]=s;var Q=(r,t,s)=>Pr(r,typeof t!="symbol"?t+"":t,s);import"../chunks/Bzak7iHL.js";import{d as Zt,b as ue,e as tt,s as w,o as $t}from"../chunks/DAau0uzT.js";import{p as er,c as a,X as l,aH as rt,Y as W,g as e,s as P,a as R,u as $,r as i,af as me,b as tr,d as Z,f as O,aP as jt,e as Ut}from"../chunks/CGq8RnJq.js";import{i as X}from"../chunks/Ccqjq5DS.js";import{e as De,s as h,i as Pt}from"../chunks/DqfV0sZu.js";import{P as Mr,A as je,a as Le,r as Oe}from"../chunks/B9l3DI-J.js";import{s as Vt}from"../chunks/uCQU803Y.js";import{s as be}from"../chunks/HFGAk8XQ.js";import{p as Mt,s as Br,a as Sr}from"../chunks/DV6OI5iy.js";import{D as Yt}from"../chunks/DnDQzBs4.js";import{I as Bt}from"../chunks/CKbQrCJw.js";import{R as Gr}from"../chunks/BpEKQwpr.js";import{r as ot,M as Fr,I as Ht,R as Ar,m as Wt,a as Rr}from"../chunks/BMB5u1EX.js";import{L as jr,l as Lr}from"../chunks/DETSv_kY.js";import{a as qt}from"../chunks/D35IQVqe.js";import{e as Or}from"../chunks/Ch9vNiEl.js";const rr=.7,sr=.5,Dr="#ef4444",Tr="#f59e0b",Er="#fde047";function At(r){return r>rr?Dr:r>sr?Tr:Er}function ir(r){return r>rr?"strong":r>sr?"moderate":"mild"}const Qt="#8b5cf6",Ir={fact:"#3b82f6",concept:"#8b5cf6",event:"#f59e0b",person:"#10b981",place:"#06b6d4",note:"#6b7280",pattern:"#ec4899",decision:"#ef4444"};function Xt(r){return r?Ir[r]??Qt:Qt}const Kt=5,Cr=9;function Nr(r){if(!Number.isFinite(r))return Kt;const t=r<0?0:r>1?1:r;return Kt+t*Cr}const zr=.12;function Jt(r,t){return t==null||t===r?1:zr}function ct(r,t=60){return r==null||typeof r!="string"||t<=0?"":r.length<=t?r:r.slice(0,t-1)+"…"}function $r(r){if(!r||r.length===0)return 0;const t=new Set;for(const s of r)s.memory_a_id&&t.add(s.memory_a_id),s.memory_b_id&&t.add(s.memory_b_id);return t.size}function Ur(r){if(!r||r.length===0)return 0;let t=0;for(const s of r)t+=Math.abs((s.trust_a??0)-(s.trust_b??0));return t/r.length}var Vr=jt('',1),Yr=jt(' '),Hr=jt('',1),Wr=O('
            '),qr=O('
            '),Qr=O('
            '),Xr=O('
            topic:
            '),Kr=O('
            SEVERITYstrong (>0.7)moderate (0.5-0.7)mild (0.3-0.5)
            ');function Jr(r,t){er(t,!0);let s=Mt(t,"focusedPairIndex",3,null),c=Mt(t,"width",3,800),n=Mt(t,"height",3,600);const o=$(()=>{const _=c()/2,u=n()/2,C=Math.min(c(),n())*.38;return{cx:_,cy:u,R:C}}),m=$(()=>{const _=[],u=[],C=t.contradictions.length||1;return t.contradictions.forEach((k,T)=>{const Y=T/C*Math.PI*2-Math.PI/2,M=.18+k.similarity*.22,E=Y-M,B=Y+M,se=e(o).R+Math.sin(T*2.3)*18,ie=e(o).R+Math.cos(T*1.7)*18,D={x:e(o).cx+Math.cos(E)*se,y:e(o).cy+Math.sin(E)*se,trust:k.trust_a,preview:k.memory_a_preview,type:k.memory_a_type,created:k.memory_a_created,tags:k.memory_a_tags,memoryId:k.memory_a_id,pairIndex:T,side:"a"},z={x:e(o).cx+Math.cos(B)*ie,y:e(o).cy+Math.sin(B)*ie,trust:k.trust_b,preview:k.memory_b_preview,type:k.memory_b_type,created:k.memory_b_created,tags:k.memory_b_tags,memoryId:k.memory_b_id,pairIndex:T,side:"b"};_.push(D,z);const ne=(D.x+z.x)/2,q=(D.y+z.y)/2,K=.55-k.similarity*.25,le=ne+(e(o).cx-ne)*K,xe=q+(e(o).cy-q)*K,pt=1+Math.min(k.trust_a,k.trust_b)*4;u.push({pairIndex:T,path:`M ${D.x.toFixed(1)} ${D.y.toFixed(1)} Q ${le.toFixed(1)} ${xe.toFixed(1)} ${z.x.toFixed(1)} ${z.y.toFixed(1)}`,color:At(k.similarity),thickness:pt,severity:ir(k.similarity),topic:k.topic,similarity:k.similarity,dateDiff:k.date_diff_days,aPoint:D,bPoint:z,midX:le,midY:xe})}),{nodes:_,arcs:u}});let p=Z(null),g=Z(null),F=Z(0),v=Z(0);function j(_){const u=_.currentTarget.getBoundingClientRect();P(F,_.clientX-u.left),P(v,_.clientY-u.top)}function I(_){t.onSelectPair&&t.onSelectPair(s()===_?null:_)}function U(){var _;(_=t.onSelectPair)==null||_.call(t,null)}var b=Kr(),G=a(b),V=l(a(G)),re=l(V),oe=l(re),he=l(oe);De(he,17,()=>e(m).arcs,_=>_.pairIndex,(_,u)=>{const C=$(()=>Jt(e(u).pairIndex,s())),k=$(()=>s()===e(u).pairIndex);var T=Vr(),Y=rt(T),M=l(Y),E=l(M);W(B=>{h(Y,"d",e(u).path),h(Y,"stroke",e(u).color),h(Y,"stroke-width",e(u).thickness*3),h(Y,"stroke-opacity",.08*e(C)),h(M,"d",e(u).path),h(M,"stroke",e(u).color),h(M,"stroke-width",e(u).thickness*(e(k)?1.6:1)),h(M,"stroke-opacity",(e(k)?1:.72)*e(C)),h(M,"aria-label",`contradiction ${e(u).pairIndex+1}: ${e(u).topic??""}`),h(E,"d",e(u).path),h(E,"stroke",e(u).color),h(E,"stroke-width",B),h(E,"stroke-opacity",.85*e(C)),be(E,`animation-duration: ${4+e(u).pairIndex%5}s`)},[()=>Math.max(1,e(u).thickness*.6)]),ue("click",M,B=>{B.stopPropagation(),I(e(u).pairIndex)}),tt("mouseenter",M,()=>P(g,e(u),!0)),tt("mouseleave",M,()=>P(g,null)),ue("keydown",M,B=>{B.key==="Enter"&&I(e(u).pairIndex)}),R(_,T)});var Se=l(he);De(Se,19,()=>e(m).nodes,(_,u)=>_.memoryId+"-"+_.side+"-"+u,(_,u)=>{const C=$(()=>Jt(e(u).pairIndex,s())),k=$(()=>s()===e(u).pairIndex),T=$(()=>Nr(e(u).trust)),Y=$(()=>Xt(e(u).type));var M=Hr(),E=rt(M),B=l(E),se=l(B);{var ie=D=>{var z=Yr(),ne=a(z,!0);i(z),W(q=>{h(z,"x",e(u).x),h(z,"y",e(u).y-e(T)-8),w(ne,q)},[()=>ct(e(u).preview,40)]),R(D,z)};X(se,D=>{e(k)&&D(ie)})}W(D=>{h(E,"cx",e(u).x),h(E,"cy",e(u).y),h(E,"r",e(T)*2.2),h(E,"fill",e(Y)),h(E,"opacity",.12*e(C)),h(B,"cx",e(u).x),h(B,"cy",e(u).y),h(B,"r",e(T)),h(B,"fill",e(Y)),h(B,"opacity",e(C)),h(B,"stroke-opacity",e(k)?.85:.25),h(B,"stroke-width",e(k)?2:1),h(B,"aria-label",`memory ${D??""}`)},[()=>ct(e(u).preview,40)]),tt("mouseenter",B,()=>P(p,e(u),!0)),tt("mouseleave",B,()=>P(p,null)),ue("click",B,D=>{D.stopPropagation(),I(e(u).pairIndex)}),ue("keydown",B,D=>{D.key==="Enter"&&I(e(u).pairIndex)}),R(_,M)}),me(),i(G);var Ge=l(G,2);{var ut=_=>{var u=Qr(),C=a(u),k=a(C),T=l(k,2),Y=a(T,!0);i(T);var M=l(T,2),E=a(M);i(M),i(C);var B=l(C,2),se=a(B,!0);i(B);var ie=l(B,2);{var D=q=>{var K=Wr(),le=a(K);i(K),W(()=>w(le,`created ${e(p).created??""}`)),R(q,K)};X(ie,q=>{e(p).created&&q(D)})}var z=l(ie,2);{var ne=q=>{var K=qr(),le=a(K,!0);i(K),W(xe=>w(le,xe),[()=>e(p).tags.slice(0,4).join(" · ")]),R(q,K)};X(z,q=>{e(p).tags&&e(p).tags.length>0&&q(ne)})}i(u),W((q,K,le,xe)=>{be(u,`left: ${q??""}px; top: ${K??""}px;`),be(k,`background: ${le??""}`),w(Y,e(p).type??"memory"),w(E,`trust ${xe??""}%`),w(se,e(p).preview)},[()=>Math.max(0,Math.min(e(F)+12,c()-240)),()=>Math.max(0,Math.min(e(v)-8,n()-120)),()=>Xt(e(p).type),()=>(e(p).trust*100).toFixed(0)]),R(_,u)},fe=_=>{var u=Xr(),C=a(u),k=a(C),T=l(k,2),Y=a(T);i(T),i(C);var M=l(C,2),E=l(a(M)),B=a(E,!0);i(E),i(M);var se=l(M,2),ie=a(se);i(se),i(u),W((D,z,ne)=>{be(u,`left: ${D??""}px; top: ${z??""}px;`),be(k,`background: ${e(g).color??""}`),w(Y,`${e(g).severity??""} conflict`),w(B,e(g).topic),w(ie,`similarity ${ne??""}% · ${e(g).dateDiff??""}d apart`)},[()=>Math.max(0,Math.min(e(F)+12,c()-240)),()=>Math.max(0,Math.min(e(v)-8,n()-120)),()=>(e(g).similarity*100).toFixed(0)]),R(_,u)};X(Ge,_=>{e(p)?_(ut):e(g)&&_(fe,1)})}i(b),W(()=>{be(b,`aspect-ratio: ${c()??""} / ${n()??""};`),h(G,"width",c()),h(G,"height",n()),h(G,"viewBox",`0 0 ${c()??""} ${n()??""}`),h(V,"width",c()),h(V,"height",n()),h(re,"cx",e(o).cx),h(re,"cy",e(o).cy),h(re,"r",e(o).R),h(oe,"cx",e(o).cx),h(oe,"cy",e(o).cy)}),ue("mousemove",G,j),tt("mouseleave",G,()=>{P(p,null),P(g,null)}),ue("click",G,U),R(r,b),tr()}Zt(["mousemove","click","keydown"]);const nt="rgba16float",lt=160,St=16,ar=` struct Params { frame: f32, loop_phase: f32, diff --git a/apps/dashboard/build/_app/immutable/nodes/7.Cs_QL9bJ.js.br b/apps/dashboard/build/_app/immutable/nodes/7.Cs_QL9bJ.js.br new file mode 100644 index 0000000..194325d Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/7.Cs_QL9bJ.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/7.Cs_QL9bJ.js.gz b/apps/dashboard/build/_app/immutable/nodes/7.Cs_QL9bJ.js.gz new file mode 100644 index 0000000..47f4d62 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/7.Cs_QL9bJ.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/8.BTNjDzh8.js.br b/apps/dashboard/build/_app/immutable/nodes/8.BTNjDzh8.js.br deleted file mode 100644 index 1d64b1e..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/8.BTNjDzh8.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/8.BTNjDzh8.js.gz b/apps/dashboard/build/_app/immutable/nodes/8.BTNjDzh8.js.gz deleted file mode 100644 index 8b00c9e..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/8.BTNjDzh8.js.gz and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/8.BTNjDzh8.js b/apps/dashboard/build/_app/immutable/nodes/8.DYPUVn-a.js similarity index 98% rename from apps/dashboard/build/_app/immutable/nodes/8.BTNjDzh8.js rename to apps/dashboard/build/_app/immutable/nodes/8.DYPUVn-a.js index e81e3d4..c88dfa1 100644 --- a/apps/dashboard/build/_app/immutable/nodes/8.BTNjDzh8.js +++ b/apps/dashboard/build/_app/immutable/nodes/8.DYPUVn-a.js @@ -1 +1 @@ -var de=Object.defineProperty;var ce=(g,u,f)=>u in g?de(g,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):g[u]=f;var S=(g,u,f)=>ce(g,typeof u!="symbol"?u+"":u,f);import"../chunks/Bzak7iHL.js";import{o as me}from"../chunks/DAau0uzT.js";import{p as le,d as $,e as ue,b as he,h as pe,g as c,s as y,u as q,$ as ge}from"../chunks/CGq8RnJq.js";import{h as fe}from"../chunks/De_e6MzK.js";import{R as xe}from"../chunks/Cqe0su6e.js";import{r as k,C as ye,R as J,I as Ee,a as Ne}from"../chunks/BMB5u1EX.js";import{T as Re}from"../chunks/D7ozXiSB.js";import{L as Ce,F as K,l as Me}from"../chunks/BeGBxCGK.js";import{a as Q}from"../chunks/D35IQVqe.js";function Fe(g,u){le(u,!0);const f=[...k(ye.forward),1],A=[...k(J.luciferin),.88],E=[...k(J.recall),.62];[...k(Ee.veto)];const Z=36,T=-1e5,ee=64;let b=$(null),N=$(!1),v=$(null),L=$(null),F=$(ue([]));const w=q(()=>re(c(b),c(L),c(N)));me(()=>{Q.memories.list({limit:"80"}).then(t=>{y(F,t.memories,!0),h==null||h.setCells(D())}).catch(()=>{})});async function te(){if(!c(N)){y(N,!0),y(v,null);try{y(b,await Q.dream(),!0),h==null||h.setCells(D(),{ambient:.5})}catch(t){y(v,t instanceof Error?t.message:String(t),!0)}finally{y(N,!1)}}}let h=null;function D(){var n;const t=((n=c(b))==null?void 0:n.insights)??[];let s;return t.length>0?s=t.slice(0,120).map((r,e)=>{var p;const a=m(Number(r.confidence??0)),d=m(Number(r.noveltyScore??a));return{id:((p=r.sourceMemories)==null?void 0:p[0])??`dream-insight:${e}`,score:.5+.5*d,hue:d>.6?K.retrograde:K.bridge,energy:.6+.4*a,metric2:a,kind:"dream-insight",payload:r}}):s=c(F).map(r=>{const e=m(r.retentionStrength);return{id:r.id,score:.3+.3*e,hue:Ne(e),energy:.12+.28*e,metric2:e,kind:"dream-dormant",payload:r}}),Me(s,{maxRadius:.92,minCellR:.014,maxCellR:.052})}function R(t){return t.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function m(t){return Math.min(1,Math.max(0,Number.isFinite(t)?t:.5))}function O(t,s){return{kind:"scalar",id:`dreams.${t}`,scalar:{name:t,value:s}}}function se(t,s){var r;const n=((r=t.sourceMemories)==null?void 0:r[0])??`${t.type}:${s}`;return R(`${n}:${s}`).slice(0,96)}function re(t,s,n){var G,W,X,_,V;if(!t)return{organ:"dreams",nodes:[],edges:[],events:[],receipts:[],scalars:{},alive:!0,records:[],raw:null,selectedRecordId:s,busy:n};const r=Array.isArray(t.insights)?t.insights:[],e=Number(t.memoriesReplayed??0),a=Number(t.connectionsPersisted??0),d=Number(((G=t.stats)==null?void 0:G.insightsGenerated)??r.length),p=Number(((W=t.stats)==null?void 0:W.durationMs)??0),C=Number(((X=t.stats)==null?void 0:X.newConnectionsFound)??a),i=Number(((_=t.stats)==null?void 0:_.memoriesStrengthened)??0),M=Number(((V=t.stats)==null?void 0:V.memoriesCompressed)??0),I=[{id:"dreams:cycle",kind:"dream-cycle",text:[t.status,String(e),String(a),String(d),String(p)].map(o=>R(o??"")).join(" | "),depth:m(e/50),weight:m(C/Math.max(1,e)),source:O("memoriesReplayed",e)}];return t.message&&r.length===0&&I.push({id:"dreams:message",kind:"dream-cycle",text:R(t.message),depth:m(e/50),weight:m(d/Math.max(1,e)),source:O("message",e)}),r.forEach((o,x)=>{var B;const P=m(Number(o.confidence??0)),H=m(Number(o.noveltyScore??P)),j=se(o,x),oe=((B=o.sourceMemories)==null?void 0:B[0])??j;I.push({id:`dreams:insight:${j}`,kind:"dream-insight",text:`C ${Math.round(P*100)} · N ${Math.round(H*100)} | ${R(o.insight??"")}`,depth:P,weight:H,source:{kind:"memory",id:oe},insightIndex:x})}),{organ:"dreams",nodes:I.map((o,x)=>({source:o.source,index:x,label:o.text,retention:o.weight,trust:o.depth,tags:[o.kind],type:o.kind})),edges:[],events:I.map((o,x)=>({source:o.source,type:o.kind,targetIndex:x,frame:18+x*10,energy:o.weight})),receipts:[],scalars:{memoriesReplayed:e,connectionsPersisted:a,newConnectionsFound:C,insightsGenerated:d,memoriesStrengthened:i,memoriesCompressed:M,durationMs:p},alive:!0,records:I,raw:t,selectedRecordId:s,busy:n}}function U(t,s=ee){const n=R(t).split(/\s+/).filter(Boolean),r=[];let e="";for(const a of n){if(!e){e=a.slice(0,s);continue}`${e} ${a}`.length<=s?e+=` ${a}`:(r.push(e),e=a.slice(0,s))}return e&&r.push(e),r.length>0?r:[""]}function l(t,s,n,r,e={}){return{id:t,kind:s,text:n,x:-.88,y:r,size:.024,color:E,depth:.5,weight:.5,startFrame:T,revealSpan:20,maxWidthEm:64,...e}}function Y(t){var p,C;const s=t,n=s.records.slice(0,Z),r=[];let e=.76;if(r.push(l("dreams:run","dream-action",s.busy?"[ DREAMING... ]":"[ RUN DREAM CYCLE ]",e,{size:.032,color:s.busy?E:A,hitPadX:.03,hitPadY:.05})),e-=.065,r.push(l("dreams:run-note","dream-detail","strengthens memories and persists connections",e,{color:E,size:.02})),e-=.09,!s.raw)return r.push(l("dreams:dormant","dream-status","DREAM ENGINE DORMANT - RUN EXPLICIT CYCLE",e,{color:E,size:.028})),r;for(const i of n)r.push({id:i.id,kind:i.kind,text:i.text,x:-.88,y:e,size:i.kind==="dream-cycle"?.03:.024,color:i.id===s.selectedRecordId?A:i.kind==="dream-cycle"?E:f,depth:i.depth,weight:i.weight,startFrame:T,revealSpan:20,maxWidthEm:52,hitPadX:.03,hitPadY:.014,insightIndex:i.insightIndex}),e-=.052;const a=n.find(i=>i.id===s.selectedRecordId);if(!a)return r;e=.45;const d=.08;if(r.push(l("dreams:detail-heading","dream-detail","SELECTED DREAM RECEIPT",e,{x:d,color:A,maxWidthEm:34})),e-=.052,a.kind==="dream-insight"&&a.insightIndex!==void 0){const i=(p=s.raw.insights)==null?void 0:p[a.insightIndex];i&&(U(i.insight,34).forEach((M,z)=>{r.push(l(`dreams:detail:text:${z}`,"dream-detail",M,e,{x:d,color:f,maxWidthEm:34})),e-=.043}),r.push(l("dreams:detail:type","dream-detail",`TYPE: ${R(i.type)}`,e,{x:d})),e-=.043,r.push(l("dreams:detail:confidence","dream-detail",`CONFIDENCE: ${Math.round(m(i.confidence)*100)}`,e,{x:d})),e-=.043,r.push(l("dreams:detail:novelty","dream-detail",`NOVELTY: ${Math.round(m(i.noveltyScore)*100)}`,e,{x:d})),e-=.043,r.push(l("dreams:detail:sources","dream-detail",`SOURCE COUNT: ${((C=i.sourceMemories)==null?void 0:C.length)??0}`,e,{x:d})),e-=.06)}else U(a.text,34).forEach((i,M)=>{r.push(l(`dreams:detail:cycle:${M}`,"dream-detail",i,e,{x:d})),e-=.043}),e-=.017;return r.push(l("dreams:again","dream-action",s.busy?"[ DREAMING... ]":"[ DREAM AGAIN ]",e,{x:d,color:s.busy?E:A,size:.03,hitPadX:.03,hitPadY:.05})),r}class ne{constructor(s,n){S(this,"text");S(this,"scene");S(this,"engine");this.engine=s,this.scene=n,this.text=new Re(s),this.text.init().then(()=>this.text.setText(Y(this.scene)))}uploadScene(s){this.scene=s,this.text.setText(Y(s))}render(s){this.text.render(s)}pickAt(s,n){return this.text.pickAt(s,n)}dispose(){this.text.dispose(),this.engine}}function ie(t,s){const n=new Ce(t);return h=n,n.setCells(D()),[{compute:e=>n.compute(e),render:e=>n.render(e),pickAt:(e,a)=>n.pickAt(e,a),dispose:()=>{n.dispose(),h===n&&(h=null)}},new ne(t,s)]}function ae(t){if(t.kind==="dream-action"){c(N)||te();return}t.kind!=="dream-cycle"&&t.kind!=="dream-insight"||y(L,t.id,!0)}fe("1fv2vo0",t=>{pe(()=>{ge.title="Dreams · Vestige"})});{let t=q(()=>{var s;return`dreams:${((s=c(b))==null?void 0:s.status)??"pending"}:${c(w).records.length}:${c(w).scalars.durationMs??0}`});xe(g,{organ:"dreams",get seed(){return c(t)},get scene(){return c(w)},passes:ie,get loading(){return c(N)},get error(){return c(v)},onpick:ae})}he()}export{Fe as component}; +var de=Object.defineProperty;var ce=(g,u,f)=>u in g?de(g,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):g[u]=f;var S=(g,u,f)=>ce(g,typeof u!="symbol"?u+"":u,f);import"../chunks/Bzak7iHL.js";import{o as me}from"../chunks/DAau0uzT.js";import{p as le,d as $,e as ue,b as he,h as pe,g as c,s as y,u as q,$ as ge}from"../chunks/CGq8RnJq.js";import{h as fe}from"../chunks/De_e6MzK.js";import{R as xe}from"../chunks/BpEKQwpr.js";import{r as k,C as ye,R as J,I as Ee,a as Ne}from"../chunks/BMB5u1EX.js";import{T as Re}from"../chunks/D7ozXiSB.js";import{L as Ce,F as K,l as Me}from"../chunks/DETSv_kY.js";import{a as Q}from"../chunks/D35IQVqe.js";function Fe(g,u){le(u,!0);const f=[...k(ye.forward),1],A=[...k(J.luciferin),.88],E=[...k(J.recall),.62];[...k(Ee.veto)];const Z=36,T=-1e5,ee=64;let b=$(null),N=$(!1),v=$(null),L=$(null),F=$(ue([]));const w=q(()=>re(c(b),c(L),c(N)));me(()=>{Q.memories.list({limit:"80"}).then(t=>{y(F,t.memories,!0),h==null||h.setCells(D())}).catch(()=>{})});async function te(){if(!c(N)){y(N,!0),y(v,null);try{y(b,await Q.dream(),!0),h==null||h.setCells(D(),{ambient:.5})}catch(t){y(v,t instanceof Error?t.message:String(t),!0)}finally{y(N,!1)}}}let h=null;function D(){var n;const t=((n=c(b))==null?void 0:n.insights)??[];let s;return t.length>0?s=t.slice(0,120).map((r,e)=>{var p;const a=m(Number(r.confidence??0)),d=m(Number(r.noveltyScore??a));return{id:((p=r.sourceMemories)==null?void 0:p[0])??`dream-insight:${e}`,score:.5+.5*d,hue:d>.6?K.retrograde:K.bridge,energy:.6+.4*a,metric2:a,kind:"dream-insight",payload:r}}):s=c(F).map(r=>{const e=m(r.retentionStrength);return{id:r.id,score:.3+.3*e,hue:Ne(e),energy:.12+.28*e,metric2:e,kind:"dream-dormant",payload:r}}),Me(s,{maxRadius:.92,minCellR:.014,maxCellR:.052})}function R(t){return t.replace(/[\u2014\u2013]/g,"-").replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2026/g,"...").replace(/[^\x20-\x7E]/g,"?")}function m(t){return Math.min(1,Math.max(0,Number.isFinite(t)?t:.5))}function O(t,s){return{kind:"scalar",id:`dreams.${t}`,scalar:{name:t,value:s}}}function se(t,s){var r;const n=((r=t.sourceMemories)==null?void 0:r[0])??`${t.type}:${s}`;return R(`${n}:${s}`).slice(0,96)}function re(t,s,n){var G,W,X,_,V;if(!t)return{organ:"dreams",nodes:[],edges:[],events:[],receipts:[],scalars:{},alive:!0,records:[],raw:null,selectedRecordId:s,busy:n};const r=Array.isArray(t.insights)?t.insights:[],e=Number(t.memoriesReplayed??0),a=Number(t.connectionsPersisted??0),d=Number(((G=t.stats)==null?void 0:G.insightsGenerated)??r.length),p=Number(((W=t.stats)==null?void 0:W.durationMs)??0),C=Number(((X=t.stats)==null?void 0:X.newConnectionsFound)??a),i=Number(((_=t.stats)==null?void 0:_.memoriesStrengthened)??0),M=Number(((V=t.stats)==null?void 0:V.memoriesCompressed)??0),I=[{id:"dreams:cycle",kind:"dream-cycle",text:[t.status,String(e),String(a),String(d),String(p)].map(o=>R(o??"")).join(" | "),depth:m(e/50),weight:m(C/Math.max(1,e)),source:O("memoriesReplayed",e)}];return t.message&&r.length===0&&I.push({id:"dreams:message",kind:"dream-cycle",text:R(t.message),depth:m(e/50),weight:m(d/Math.max(1,e)),source:O("message",e)}),r.forEach((o,x)=>{var B;const P=m(Number(o.confidence??0)),H=m(Number(o.noveltyScore??P)),j=se(o,x),oe=((B=o.sourceMemories)==null?void 0:B[0])??j;I.push({id:`dreams:insight:${j}`,kind:"dream-insight",text:`C ${Math.round(P*100)} · N ${Math.round(H*100)} | ${R(o.insight??"")}`,depth:P,weight:H,source:{kind:"memory",id:oe},insightIndex:x})}),{organ:"dreams",nodes:I.map((o,x)=>({source:o.source,index:x,label:o.text,retention:o.weight,trust:o.depth,tags:[o.kind],type:o.kind})),edges:[],events:I.map((o,x)=>({source:o.source,type:o.kind,targetIndex:x,frame:18+x*10,energy:o.weight})),receipts:[],scalars:{memoriesReplayed:e,connectionsPersisted:a,newConnectionsFound:C,insightsGenerated:d,memoriesStrengthened:i,memoriesCompressed:M,durationMs:p},alive:!0,records:I,raw:t,selectedRecordId:s,busy:n}}function U(t,s=ee){const n=R(t).split(/\s+/).filter(Boolean),r=[];let e="";for(const a of n){if(!e){e=a.slice(0,s);continue}`${e} ${a}`.length<=s?e+=` ${a}`:(r.push(e),e=a.slice(0,s))}return e&&r.push(e),r.length>0?r:[""]}function l(t,s,n,r,e={}){return{id:t,kind:s,text:n,x:-.88,y:r,size:.024,color:E,depth:.5,weight:.5,startFrame:T,revealSpan:20,maxWidthEm:64,...e}}function Y(t){var p,C;const s=t,n=s.records.slice(0,Z),r=[];let e=.76;if(r.push(l("dreams:run","dream-action",s.busy?"[ DREAMING... ]":"[ RUN DREAM CYCLE ]",e,{size:.032,color:s.busy?E:A,hitPadX:.03,hitPadY:.05})),e-=.065,r.push(l("dreams:run-note","dream-detail","strengthens memories and persists connections",e,{color:E,size:.02})),e-=.09,!s.raw)return r.push(l("dreams:dormant","dream-status","DREAM ENGINE DORMANT - RUN EXPLICIT CYCLE",e,{color:E,size:.028})),r;for(const i of n)r.push({id:i.id,kind:i.kind,text:i.text,x:-.88,y:e,size:i.kind==="dream-cycle"?.03:.024,color:i.id===s.selectedRecordId?A:i.kind==="dream-cycle"?E:f,depth:i.depth,weight:i.weight,startFrame:T,revealSpan:20,maxWidthEm:52,hitPadX:.03,hitPadY:.014,insightIndex:i.insightIndex}),e-=.052;const a=n.find(i=>i.id===s.selectedRecordId);if(!a)return r;e=.45;const d=.08;if(r.push(l("dreams:detail-heading","dream-detail","SELECTED DREAM RECEIPT",e,{x:d,color:A,maxWidthEm:34})),e-=.052,a.kind==="dream-insight"&&a.insightIndex!==void 0){const i=(p=s.raw.insights)==null?void 0:p[a.insightIndex];i&&(U(i.insight,34).forEach((M,z)=>{r.push(l(`dreams:detail:text:${z}`,"dream-detail",M,e,{x:d,color:f,maxWidthEm:34})),e-=.043}),r.push(l("dreams:detail:type","dream-detail",`TYPE: ${R(i.type)}`,e,{x:d})),e-=.043,r.push(l("dreams:detail:confidence","dream-detail",`CONFIDENCE: ${Math.round(m(i.confidence)*100)}`,e,{x:d})),e-=.043,r.push(l("dreams:detail:novelty","dream-detail",`NOVELTY: ${Math.round(m(i.noveltyScore)*100)}`,e,{x:d})),e-=.043,r.push(l("dreams:detail:sources","dream-detail",`SOURCE COUNT: ${((C=i.sourceMemories)==null?void 0:C.length)??0}`,e,{x:d})),e-=.06)}else U(a.text,34).forEach((i,M)=>{r.push(l(`dreams:detail:cycle:${M}`,"dream-detail",i,e,{x:d})),e-=.043}),e-=.017;return r.push(l("dreams:again","dream-action",s.busy?"[ DREAMING... ]":"[ DREAM AGAIN ]",e,{x:d,color:s.busy?E:A,size:.03,hitPadX:.03,hitPadY:.05})),r}class ne{constructor(s,n){S(this,"text");S(this,"scene");S(this,"engine");this.engine=s,this.scene=n,this.text=new Re(s),this.text.init().then(()=>this.text.setText(Y(this.scene)))}uploadScene(s){this.scene=s,this.text.setText(Y(s))}render(s){this.text.render(s)}pickAt(s,n){return this.text.pickAt(s,n)}dispose(){this.text.dispose(),this.engine}}function ie(t,s){const n=new Ce(t);return h=n,n.setCells(D()),[{compute:e=>n.compute(e),render:e=>n.render(e),pickAt:(e,a)=>n.pickAt(e,a),dispose:()=>{n.dispose(),h===n&&(h=null)}},new ne(t,s)]}function ae(t){if(t.kind==="dream-action"){c(N)||te();return}t.kind!=="dream-cycle"&&t.kind!=="dream-insight"||y(L,t.id,!0)}fe("1fv2vo0",t=>{pe(()=>{ge.title="Dreams · Vestige"})});{let t=q(()=>{var s;return`dreams:${((s=c(b))==null?void 0:s.status)??"pending"}:${c(w).records.length}:${c(w).scalars.durationMs??0}`});xe(g,{organ:"dreams",get seed(){return c(t)},get scene(){return c(w)},passes:ie,get loading(){return c(N)},get error(){return c(v)},onpick:ae})}he()}export{Fe as component}; diff --git a/apps/dashboard/build/_app/immutable/nodes/8.DYPUVn-a.js.br b/apps/dashboard/build/_app/immutable/nodes/8.DYPUVn-a.js.br new file mode 100644 index 0000000..22e668b Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/8.DYPUVn-a.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/8.DYPUVn-a.js.gz b/apps/dashboard/build/_app/immutable/nodes/8.DYPUVn-a.js.gz new file mode 100644 index 0000000..ddca9d1 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/8.DYPUVn-a.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/9.h0jHlQck.js b/apps/dashboard/build/_app/immutable/nodes/9.Bc6B0Hcn.js similarity index 99% rename from apps/dashboard/build/_app/immutable/nodes/9.h0jHlQck.js rename to apps/dashboard/build/_app/immutable/nodes/9.Bc6B0Hcn.js index 7d01398..90b4341 100644 --- a/apps/dashboard/build/_app/immutable/nodes/9.h0jHlQck.js +++ b/apps/dashboard/build/_app/immutable/nodes/9.Bc6B0Hcn.js @@ -1,4 +1,4 @@ -var Ze=Object.defineProperty;var Je=(i,e,s)=>e in i?Ze(i,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[e]=s;var D=(i,e,s)=>Je(i,typeof e!="symbol"?e+"":e,s);import"../chunks/Bzak7iHL.js";import{d as We,s as C,b as fe,o as et,a as tt}from"../chunks/DAau0uzT.js";import{p as $e,aS as it,aH as ge,g as r,a as w,b as Ye,u as q,c as d,r as u,X as p,Y as $,s as F,f as S,d as re,e as Ne,af as we}from"../chunks/CGq8RnJq.js";import{i as J}from"../chunks/Ccqjq5DS.js";import{e as Ce,i as je,s as Se,r as rt}from"../chunks/DqfV0sZu.js";import{P as st,A as Te,a as Ie,r as nt}from"../chunks/B9l3DI-J.js";import{b as at}from"../chunks/DGM4cicq.js";import{s as Ee}from"../chunks/uCQU803Y.js";import{s as Pe}from"../chunks/HFGAk8XQ.js";import{p as lt}from"../chunks/DV6OI5iy.js";import{N as ot}from"../chunks/CcUbQ_Wl.js";import{I as ct}from"../chunks/CKbQrCJw.js";import{R as ut}from"../chunks/Cqe0su6e.js";import{r as ke,M as dt,R as Ve,I as mt,m as ft}from"../chunks/BMB5u1EX.js";import{a as pt}from"../chunks/D35IQVqe.js";function Qe(i){return i>=.92?"near-identical":i>=.8?"strong":"weak"}function De(i){const e=Qe(i);return e==="near-identical"?"var(--color-decay)":e==="strong"?"var(--color-warning)":"#fde047"}function vt(i){const e=Qe(i);return e==="near-identical"?"Near-identical":e==="strong"?"Strong match":"Weak match"}function gt(i){return i>.7?"#10b981":i>.4?"#f59e0b":"#ef4444"}function Xe(i){if(!i||i.length===0)return null;let e=i[0],s=Number.isFinite(e.retention)?e.retention:-1/0;for(let t=1;ts&&(e=a,s=n)}return e}function Ae(i){return i.map(e=>e.id).slice().sort().join("|")}function ht(i,e=80){if(!i)return"";const s=i.trim().replace(/\s+/g," ");return s.length<=e?s:s.slice(0,e)+"…"}function He(i){if(!i||typeof i!="string")return"";const e=new Date(i);return Number.isNaN(e.getTime())?"":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function bt(i,e=4){return Array.isArray(i)?i.slice(0,e):[]}var yt=S('REVIEW REQUIRED · NOT SAFE TO MERGE'),xt=S(" "),_t=S('WINNER'),wt=S(' '),St=S('
            '),Pt=S('

            '),kt=S('
            '),Bt=S('
            ');function Mt(i,e){$e(e,!0);let s=lt(e,"oversized",3,!1),t=re(!1);const a=12,n=q(()=>Xe(e.memories)),o=q(()=>{if(e.memories.length<=a)return e.memories;const c=e.memories.filter(y=>{var T;return y.id!==((T=r(n))==null?void 0:T.id)});return r(n)?[r(n),...c.slice(0,a-1)]:c.slice(0,a)}),m=q(()=>e.memories.length-r(o).length);var v=it(),x=ge(v);{var L=c=>{var y=Bt(),T=d(y),P=d(T),H=d(P),g=d(H),h=d(g);u(g);var M=p(g,2),z=d(M,!0);u(M);var Y=p(M,2),K=d(Y);u(Y),u(H);var O=p(H,2),k=d(O);u(O),u(P);var R=p(P,2);{var te=B=>{var b=yt();w(B,b)},ee=B=>{var b=xt(),j=d(b);u(b),$(()=>{Ee(b,1,`flex-shrink-0 rounded-full border px-3 py-1 text-xs font-medium ${e.suggestedAction==="merge"?"border-recall/40 bg-recall/10 text-recall":"border-dream-glow/40 bg-dream/10 text-dream-glow"}`),C(j,`Classification: ${e.suggestedAction==="merge"?"merge candidate":"review"}`)}),w(B,b)};J(R,B=>{s()?B(te):B(ee,!1)})}u(T);var Z=p(T,2),se=d(Z);Ce(se,17,()=>r(o),B=>B.id,(B,b)=>{var j=Pt(),ae=d(j),le=p(ae,2),oe=d(le),ce=d(oe),l=d(ce,!0);u(ce);var f=p(ce,2);{var _=W=>{var X=_t();w(W,X)};J(f,W=>{r(b).id===r(n).id&&W(_)})}var A=p(f,2);Ce(A,17,()=>bt(r(b).tags,4),je,(W,X)=>{var de=wt(),Le=d(de,!0);u(de),$(()=>C(Le,r(X))),w(W,de)}),u(oe);var G=p(oe,2),N=d(G,!0);u(G);var E=p(G,2);{var I=W=>{var X=St(),de=d(X,!0);u(X),$(Le=>C(de,Le),[()=>He(r(b).createdAt)]),w(W,X)},V=q(()=>He(r(b).createdAt));J(E,W=>{r(V)&&W(I)})}u(le);var Q=p(le,2),U=d(Q),me=d(U);u(U);var _e=p(U,2),ue=d(_e);u(_e),u(Q),u(j),$((W,X,de)=>{Ee(j,1,`group flex items-start gap-3 rounded-xl border border-synapse/5 bg-white/[0.02] p-3 transition-all duration-200 hover:border-synapse/20 hover:bg-white/[0.04] ${r(b).id===r(n).id?"ring-1 ring-recall/30":""}`),Pe(ae,`background: ${(ot[r(b).nodeType]||"#8B95A5")??""}`),Se(ae,"title",r(b).nodeType),C(l,r(b).nodeType),Ee(G,1,`text-sm text-text leading-relaxed ${r(t)?"whitespace-pre-wrap":""}`),C(N,W),Pe(me,`width: ${r(b).retention*100}%; background: ${X??""}`),C(ue,`${de??""}%`)},[()=>r(t)?r(b).content:ht(r(b).content),()=>gt(r(b).retention),()=>(r(b).retention*100).toFixed(0)]),w(B,j)});var pe=p(se,2);{var ie=B=>{var b=kt(),j=d(b);u(b),$(()=>C(j,`+${r(m)??""} linked candidates — oversized similarity component. Members +var Ze=Object.defineProperty;var Je=(i,e,s)=>e in i?Ze(i,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[e]=s;var D=(i,e,s)=>Je(i,typeof e!="symbol"?e+"":e,s);import"../chunks/Bzak7iHL.js";import{d as We,s as C,b as fe,o as et,a as tt}from"../chunks/DAau0uzT.js";import{p as $e,aS as it,aH as ge,g as r,a as w,b as Ye,u as q,c as d,r as u,X as p,Y as $,s as F,f as S,d as re,e as Ne,af as we}from"../chunks/CGq8RnJq.js";import{i as J}from"../chunks/Ccqjq5DS.js";import{e as Ce,i as je,s as Se,r as rt}from"../chunks/DqfV0sZu.js";import{P as st,A as Te,a as Ie,r as nt}from"../chunks/B9l3DI-J.js";import{b as at}from"../chunks/DGM4cicq.js";import{s as Ee}from"../chunks/uCQU803Y.js";import{s as Pe}from"../chunks/HFGAk8XQ.js";import{p as lt}from"../chunks/DV6OI5iy.js";import{N as ot}from"../chunks/CcUbQ_Wl.js";import{I as ct}from"../chunks/CKbQrCJw.js";import{R as ut}from"../chunks/BpEKQwpr.js";import{r as ke,M as dt,R as Ve,I as mt,m as ft}from"../chunks/BMB5u1EX.js";import{a as pt}from"../chunks/D35IQVqe.js";function Qe(i){return i>=.92?"near-identical":i>=.8?"strong":"weak"}function De(i){const e=Qe(i);return e==="near-identical"?"var(--color-decay)":e==="strong"?"var(--color-warning)":"#fde047"}function vt(i){const e=Qe(i);return e==="near-identical"?"Near-identical":e==="strong"?"Strong match":"Weak match"}function gt(i){return i>.7?"#10b981":i>.4?"#f59e0b":"#ef4444"}function Xe(i){if(!i||i.length===0)return null;let e=i[0],s=Number.isFinite(e.retention)?e.retention:-1/0;for(let t=1;ts&&(e=a,s=n)}return e}function Ae(i){return i.map(e=>e.id).slice().sort().join("|")}function ht(i,e=80){if(!i)return"";const s=i.trim().replace(/\s+/g," ");return s.length<=e?s:s.slice(0,e)+"…"}function He(i){if(!i||typeof i!="string")return"";const e=new Date(i);return Number.isNaN(e.getTime())?"":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function bt(i,e=4){return Array.isArray(i)?i.slice(0,e):[]}var yt=S('REVIEW REQUIRED · NOT SAFE TO MERGE'),xt=S(" "),_t=S('WINNER'),wt=S(' '),St=S('
            '),Pt=S('

            '),kt=S('
            '),Bt=S('
            ');function Mt(i,e){$e(e,!0);let s=lt(e,"oversized",3,!1),t=re(!1);const a=12,n=q(()=>Xe(e.memories)),o=q(()=>{if(e.memories.length<=a)return e.memories;const c=e.memories.filter(y=>{var T;return y.id!==((T=r(n))==null?void 0:T.id)});return r(n)?[r(n),...c.slice(0,a-1)]:c.slice(0,a)}),m=q(()=>e.memories.length-r(o).length);var v=it(),x=ge(v);{var L=c=>{var y=Bt(),T=d(y),P=d(T),H=d(P),g=d(H),h=d(g);u(g);var M=p(g,2),z=d(M,!0);u(M);var Y=p(M,2),K=d(Y);u(Y),u(H);var O=p(H,2),k=d(O);u(O),u(P);var R=p(P,2);{var te=B=>{var b=yt();w(B,b)},ee=B=>{var b=xt(),j=d(b);u(b),$(()=>{Ee(b,1,`flex-shrink-0 rounded-full border px-3 py-1 text-xs font-medium ${e.suggestedAction==="merge"?"border-recall/40 bg-recall/10 text-recall":"border-dream-glow/40 bg-dream/10 text-dream-glow"}`),C(j,`Classification: ${e.suggestedAction==="merge"?"merge candidate":"review"}`)}),w(B,b)};J(R,B=>{s()?B(te):B(ee,!1)})}u(T);var Z=p(T,2),se=d(Z);Ce(se,17,()=>r(o),B=>B.id,(B,b)=>{var j=Pt(),ae=d(j),le=p(ae,2),oe=d(le),ce=d(oe),l=d(ce,!0);u(ce);var f=p(ce,2);{var _=W=>{var X=_t();w(W,X)};J(f,W=>{r(b).id===r(n).id&&W(_)})}var A=p(f,2);Ce(A,17,()=>bt(r(b).tags,4),je,(W,X)=>{var de=wt(),Le=d(de,!0);u(de),$(()=>C(Le,r(X))),w(W,de)}),u(oe);var G=p(oe,2),N=d(G,!0);u(G);var E=p(G,2);{var I=W=>{var X=St(),de=d(X,!0);u(X),$(Le=>C(de,Le),[()=>He(r(b).createdAt)]),w(W,X)},V=q(()=>He(r(b).createdAt));J(E,W=>{r(V)&&W(I)})}u(le);var Q=p(le,2),U=d(Q),me=d(U);u(U);var _e=p(U,2),ue=d(_e);u(_e),u(Q),u(j),$((W,X,de)=>{Ee(j,1,`group flex items-start gap-3 rounded-xl border border-synapse/5 bg-white/[0.02] p-3 transition-all duration-200 hover:border-synapse/20 hover:bg-white/[0.04] ${r(b).id===r(n).id?"ring-1 ring-recall/30":""}`),Pe(ae,`background: ${(ot[r(b).nodeType]||"#8B95A5")??""}`),Se(ae,"title",r(b).nodeType),C(l,r(b).nodeType),Ee(G,1,`text-sm text-text leading-relaxed ${r(t)?"whitespace-pre-wrap":""}`),C(N,W),Pe(me,`width: ${r(b).retention*100}%; background: ${X??""}`),C(ue,`${de??""}%`)},[()=>r(t)?r(b).content:ht(r(b).content),()=>gt(r(b).retention),()=>(r(b).retention*100).toFixed(0)]),w(B,j)});var pe=p(se,2);{var ie=B=>{var b=kt(),j=d(b);u(b),$(()=>C(j,`+${r(m)??""} linked candidates — oversized similarity component. Members chain through pairwise similarity; distant members may be unrelated. Raise the threshold to split it.`)),w(B,b)};J(pe,B=>{r(m)>0&&B(ie)})}u(Z);var be=p(Z,2),ye=d(be),ne=p(ye,2),Re=d(ne,!0);u(ne);var xe=p(ne,2);u(be),u(y),$((B,b,j,ae,le,oe,ce)=>{Pe(g,`color: ${B??""}`),C(h,`${b??""}%`),C(z,j),C(K,`· ${e.memories.length??""} memories`),Se(O,"aria-valuenow",ae),Pe(k,`width: ${le??""}%; background: ${oe??""}; box-shadow: 0 0 12px ${ce??""}66`),Se(ye,"title",s()?"Oversized similarity component — not safe to merge":"Merge backend not shipped yet — no destructive action is taken from this screen"),Se(ne,"aria-expanded",r(t)),C(Re,r(t)?"Collapse":"Review")},[()=>De(e.similarity),()=>(e.similarity*100).toFixed(1),()=>vt(e.similarity),()=>Math.round(e.similarity*100),()=>(e.similarity*100).toFixed(1),()=>De(e.similarity),()=>De(e.similarity)]),fe("click",ne,()=>F(t,!r(t))),fe("click",xe,function(...B){var b;(b=e.onDismiss)==null||b.apply(this,B)}),w(c,y)};J(x,c=>{e.memories.length>0&&r(n)&&c(L)})}w(i,v),Ye()}We(["click"]);const Be="rgba16float",ve=512,Me=512,Oe=16,Ue=16,qe=` struct Params { diff --git a/apps/dashboard/build/_app/immutable/nodes/9.Bc6B0Hcn.js.br b/apps/dashboard/build/_app/immutable/nodes/9.Bc6B0Hcn.js.br new file mode 100644 index 0000000..e38011c Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/9.Bc6B0Hcn.js.br differ diff --git a/apps/dashboard/build/_app/immutable/nodes/9.Bc6B0Hcn.js.gz b/apps/dashboard/build/_app/immutable/nodes/9.Bc6B0Hcn.js.gz new file mode 100644 index 0000000..83b2263 Binary files /dev/null and b/apps/dashboard/build/_app/immutable/nodes/9.Bc6B0Hcn.js.gz differ diff --git a/apps/dashboard/build/_app/immutable/nodes/9.h0jHlQck.js.br b/apps/dashboard/build/_app/immutable/nodes/9.h0jHlQck.js.br deleted file mode 100644 index cca7fb6..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/9.h0jHlQck.js.br and /dev/null differ diff --git a/apps/dashboard/build/_app/immutable/nodes/9.h0jHlQck.js.gz b/apps/dashboard/build/_app/immutable/nodes/9.h0jHlQck.js.gz deleted file mode 100644 index 6257bb0..0000000 Binary files a/apps/dashboard/build/_app/immutable/nodes/9.h0jHlQck.js.gz and /dev/null differ diff --git a/apps/dashboard/build/favicon.svg.gz b/apps/dashboard/build/favicon.svg.gz index 06ecd9b..61b0904 100644 Binary files a/apps/dashboard/build/favicon.svg.gz and b/apps/dashboard/build/favicon.svg.gz differ diff --git a/apps/dashboard/build/index.html b/apps/dashboard/build/index.html index 74f0b25..485ca34 100644 --- a/apps/dashboard/build/index.html +++ b/apps/dashboard/build/index.html @@ -16,7 +16,7 @@ - + @@ -38,7 +38,7 @@ Promise.all([ import("/dashboard/_app/immutable/entry/start.DeXDFAvJ.js"), - import("/dashboard/_app/immutable/entry/app.DIsclQy8.js") + import("/dashboard/_app/immutable/entry/app.Bj0mlYI5.js") ]).then(([kit, app]) => { kit.start(app, element); }); diff --git a/apps/dashboard/build/index.html.br b/apps/dashboard/build/index.html.br index 00f8bd0..57a12c0 100644 Binary files a/apps/dashboard/build/index.html.br and b/apps/dashboard/build/index.html.br differ diff --git a/apps/dashboard/build/index.html.gz b/apps/dashboard/build/index.html.gz index 63745a4..b56a7dd 100644 Binary files a/apps/dashboard/build/index.html.gz and b/apps/dashboard/build/index.html.gz differ diff --git a/apps/dashboard/build/manifest.json.gz b/apps/dashboard/build/manifest.json.gz index 6e19e25..d01868a 100644 Binary files a/apps/dashboard/build/manifest.json.gz and b/apps/dashboard/build/manifest.json.gz differ diff --git a/apps/dashboard/build/msdf/jetbrains-mono.json.gz b/apps/dashboard/build/msdf/jetbrains-mono.json.gz index cefe8bf..51d409e 100644 Binary files a/apps/dashboard/build/msdf/jetbrains-mono.json.gz and b/apps/dashboard/build/msdf/jetbrains-mono.json.gz differ diff --git a/apps/dashboard/playwright.config.ts b/apps/dashboard/playwright.config.ts index 95f8fd4..82685b5 100644 --- a/apps/dashboard/playwright.config.ts +++ b/apps/dashboard/playwright.config.ts @@ -14,6 +14,10 @@ export default defineConfig({ screenshot: 'on', video: 'retain-on-failure', trace: 'retain-on-failure', + // Pin motion ON so the living-field motion assertions (isAnimating) are + // stable: a CI/host that reports prefers-reduced-motion would otherwise + // freeze every field and false-fail the "field is moving" gate. + reducedMotion: 'no-preference', launchOptions: { args: ['--use-gl=angle', '--ignore-gpu-blocklist'], }, diff --git a/apps/dashboard/src/lib/observatory/RouteStage.svelte b/apps/dashboard/src/lib/observatory/RouteStage.svelte index 0e8ab36..494e218 100644 --- a/apps/dashboard/src/lib/observatory/RouteStage.svelte +++ b/apps/dashboard/src/lib/observatory/RouteStage.svelte @@ -315,8 +315,13 @@ togglePause(); return; } - for (const pass of routePasses) { - const hit = await pass.pickAt?.(ndc.x, ndc.y); + // Pick TOP-DOWN: routePasses render back-to-front (organs return + // [field, ...text/chrome], so text draws ON TOP of the field). Picking must + // mirror what the user sees on top — so iterate in REVERSE (front first). + // Otherwise a background field cell that happens to sit under a foreground + // text control would steal the click from the control the user actually sees. + for (let i = routePasses.length - 1; i >= 0; i--) { + const hit = await routePasses[i].pickAt?.(ndc.x, ndc.y); if (hit) { onpick?.(hit); return; diff --git a/apps/dashboard/src/lib/observatory/field/cell-layout.ts b/apps/dashboard/src/lib/observatory/field/cell-layout.ts index 59c794a..28ac708 100644 --- a/apps/dashboard/src/lib/observatory/field/cell-layout.ts +++ b/apps/dashboard/src/lib/observatory/field/cell-layout.ts @@ -54,12 +54,11 @@ export function layoutGalaxy( const y = Math.sin(ang) * rr; const score = clamp01(d.score); const radius = minCellR + (maxCellR - minCellR) * Math.sqrt(score); - const hue = d.hue ?? retentionColor(score); return { x, y, radius, - hue: [hue[0], hue[1], hue[2]] as [number, number, number], + hue: safeHue(d.hue, score), energy: clamp01(d.energy ?? 0.35 + 0.65 * score), phase: rank / n, pickId: d.id, @@ -92,18 +91,21 @@ export function layoutRings( // group indices per ring to spread points evenly around each ring const perRing = new Map(); return data.map((d, i) => { - const ring = ((ringOf(d, i) % rings) + rings) % rings; + // Guard the bucket: a NaN/Infinity ringOf return would make the modulo NaN + // and collapse every cell to ring 0 (or NaN positions). Floor to a safe int. + const rawRing = ringOf(d, i); + const bucket = Number.isFinite(rawRing) ? Math.floor(rawRing) : 0; + const ring = ((bucket % rings) + rings) % rings; const seen = perRing.get(ring) ?? 0; perRing.set(ring, seen + 1); const ringR = maxR * (0.18 + 0.82 * (ring / Math.max(1, rings - 1))); const ang = seen * GOLDEN_ANGLE + ring * 0.7; const score = clamp01(d.score); - const hue = d.hue ?? retentionColor(score); return { x: Math.cos(ang) * ringR, y: Math.sin(ang) * ringR, radius: minCellR + (maxCellR - minCellR) * Math.sqrt(score), - hue: [hue[0], hue[1], hue[2]] as [number, number, number], + hue: safeHue(d.hue, score), energy: clamp01(d.energy ?? 0.35 + 0.65 * score), phase: ring / rings, pickId: d.id, @@ -133,3 +135,17 @@ export const FIELD_HUE = { function clamp01(v: number): number { return Math.min(1, Math.max(0, Number.isFinite(v) ? v : 0)); } + +/** + * Return a hue whose channels are finite (falls back to the retention ramp on a + * missing or NaN/Infinity component), so no bad color reaches the GPU splat and + * blur — one NaN channel would poison the additive field. + */ +function safeHue(hue: [number, number, number] | undefined, score: number): [number, number, number] { + const base = hue ?? retentionColor(score); + return [ + Number.isFinite(base[0]) ? base[0] : 0, + Number.isFinite(base[1]) ? base[1] : 0, + Number.isFinite(base[2]) ? base[2] : 0 + ]; +} diff --git a/apps/dashboard/src/lib/observatory/field/living-field-pass.ts b/apps/dashboard/src/lib/observatory/field/living-field-pass.ts index 7ae7e1c..5a3eaeb 100644 --- a/apps/dashboard/src/lib/observatory/field/living-field-pass.ts +++ b/apps/dashboard/src/lib/observatory/field/living-field-pass.ts @@ -248,31 +248,42 @@ export class LivingFieldPass implements FramePass { this.cellCount = Math.min(MAX_CELLS, this.cells.length); for (let i = 0; i < this.cellCount; i++) { const c = this.cells[i]; - const ringR = Math.hypot(c.x, c.y); + // Finite-guard every value that reaches the GPU: one NaN/Infinity in a + // position or hue poisons the additive splat (NaN spreads through the + // blur to the whole membrane). A bad organ mapper (score/0, a degenerate + // layout) must not be able to black out the field. + const x = finite(c.x); + const y = finite(c.y); + const ringR = Math.hypot(x, y); + const phase = finite(c.phase); // flags: bit0 selected, bit1 scar, bit2 pulse-strong (energy>0.8) let flags = 0; if (c.selected) flags |= 1; if (c.scar) flags |= 2; - if (c.energy > 0.8) flags |= 4; + if (finite(c.energy) > 0.8) flags |= 4; const o = i * CELL_FLOATS; - data[o + 0] = c.x; - data[o + 1] = c.y; - data[o + 2] = Math.max(0.006, c.radius); + data[o + 0] = x; + data[o + 1] = y; + data[o + 2] = Math.max(0.006, finite(c.radius, 0.02)); data[o + 3] = ringR; - data[o + 4] = c.hue[0]; - data[o + 5] = c.hue[1]; - data[o + 6] = c.hue[2]; + data[o + 4] = finite(c.hue[0]); + data[o + 5] = finite(c.hue[1]); + data[o + 6] = finite(c.hue[2]); data[o + 7] = clamp01(c.energy); - data[o + 8] = c.phase; + data[o + 8] = phase; data[o + 9] = flags; data[o + 10] = clamp01(c.metric2 ?? c.energy); - data[o + 11] = c.spin ?? 1; + data[o + 11] = finite(c.spin ?? 1, 1); data[o + 12] = i; - data[o + 13] = c.seed ?? c.phase * 97.13; + data[o + 13] = finite(c.seed ?? phase * 97.13); data[o + 14] = 0; data[o + 15] = 0; } - this.engine.params[2] = this.cellCount; + // NOTE: do NOT write engine.params[2] (node_count) here. That lane is SHARED + // with any co-resident scene pass (the recall-path NodeRenderer on graph/ + // observatory/memories reads params.node_count to cull its instances). The + // field draws this.cellCount instances directly in render() and never reads + // node_count, so writing it would silently corrupt a sibling pass's cull. device.queue.writeBuffer(this.resources.cellBuffer, 0, data); } @@ -353,6 +364,11 @@ function clamp01(v: number): number { return Math.min(1, Math.max(0, Number.isFinite(v) ? v : 0)); } +/** Coerce a value to a finite number so no NaN/Infinity reaches the GPU buffer. */ +function finite(v: number, fallback = 0): number { + return Number.isFinite(v) ? v : fallback; +} + function diagShader(device: GPUDevice, label: string, code: string): GPUShaderModule { device.pushErrorScope('validation'); const module = device.createShaderModule({ label, code }); diff --git a/apps/dashboard/src/lib/stores/api.ts b/apps/dashboard/src/lib/stores/api.ts index f6d27bf..d3f9c59 100644 --- a/apps/dashboard/src/lib/stores/api.ts +++ b/apps/dashboard/src/lib/stores/api.ts @@ -274,6 +274,7 @@ export type ChangelogEvent = { }; export type ChangelogResponse = { events: ChangelogEvent[]; + totalEvents: number; filter?: { start: string | null; end: string | null; limit: number }; }; diff --git a/apps/dashboard/src/routes/(app)/blackbox/+page.svelte b/apps/dashboard/src/routes/(app)/blackbox/+page.svelte index 59ebeb0..df4ba89 100644 --- a/apps/dashboard/src/routes/(app)/blackbox/+page.svelte +++ b/apps/dashboard/src/routes/(app)/blackbox/+page.svelte @@ -191,7 +191,10 @@ } // Refresh the run constellation whenever the run list changes. $effect(() => { + // Rebuild on run-list change AND on selection change (so the selected cell's + // bright highlight follows the picked run, not just new runs appearing). void runs.length; + void selectedRunId; runsField?.setCells(buildRunCells()); }); diff --git a/apps/dashboard/src/routes/(app)/feed/+page.svelte b/apps/dashboard/src/routes/(app)/feed/+page.svelte index 5a1161e..028f52d 100644 --- a/apps/dashboard/src/routes/(app)/feed/+page.svelte +++ b/apps/dashboard/src/routes/(app)/feed/+page.svelte @@ -78,9 +78,18 @@ kind: 'feed-event', payload: event })); - // A quiet live stream may contain only the real Connected event. Give - // sparse event impulses a broad shockwave rather than inventing motes. - this.field.setCells(layoutGalaxy(data, { maxRadius: 0.78, minCellR: 0.24, maxCellR: 0.32 })); + // A quiet live stream may contain only a couple real events — give those a + // broad shockwave so the field still fills. But a busy stream (up to + // ROW_LIMIT events) needs SMALL cells or they overlap into one blob; scale + // the cell size to the real event count instead of hardcoding the sparse case. + const sparse = data.length < 4; + this.field.setCells( + layoutGalaxy(data, { + maxRadius: sparse ? 0.78 : 0.92, + minCellR: sparse ? 0.24 : 0.018, + maxCellR: sparse ? 0.32 : 0.06 + }) + ); } compute(encoder: GPUCommandEncoder): void { this.field.compute(encoder); } render(pass: GPURenderPassEncoder): void { this.field.render(pass); } diff --git a/apps/dashboard/src/routes/(app)/graph/+page.svelte b/apps/dashboard/src/routes/(app)/graph/+page.svelte index 0fc2854..1fab20f 100644 --- a/apps/dashboard/src/routes/(app)/graph/+page.svelte +++ b/apps/dashboard/src/routes/(app)/graph/+page.svelte @@ -63,9 +63,16 @@ field.setCells(buildGraphFieldCells()); engine.addPass(field); } + // Drop the field handle when we leave field mode: ObservatoryStage unmounts and + // disposes its engine (destroying the field's GPU resources), so the handle is + // stale — calling setCells on it would touch a destroyed device. Nulling it + // keeps the data-refresh $effect from firing against a dead pass. + $effect(() => { + if (renderMode !== 'field') graphFieldPass = null; + }); $effect(() => { void graphData?.nodes.length; - graphFieldPass?.setCells(buildGraphFieldCells()); + if (renderMode === 'field') graphFieldPass?.setCells(buildGraphFieldCells()); }); let selectedMemory: Memory | null = $state(null); let loading = $state(true); diff --git a/apps/dashboard/src/routes/(app)/importance/+page.svelte b/apps/dashboard/src/routes/(app)/importance/+page.svelte index c65fa6d..3ad2dba 100644 --- a/apps/dashboard/src/routes/(app)/importance/+page.svelte +++ b/apps/dashboard/src/routes/(app)/importance/+page.svelte @@ -40,7 +40,10 @@ void loadImportanceField(); }); + let stopReducedMotion: (() => void) | null = null; + onDestroy(() => { + stopReducedMotion?.(); textPass?.dispose(); fieldPass?.dispose(); textPass = null; @@ -48,8 +51,20 @@ engineRef = null; }); + // Mounts ObservatoryCanvas directly (not RouteStage), so wire prefers-reduced- + // motion here: a reduce-motion user gets a frozen field, not a moving one. + function initReducedMotion(engine: ObservatoryEngine): () => void { + if (typeof window === 'undefined') return () => {}; + const mq = window.matchMedia('(prefers-reduced-motion: reduce)'); + engine.setPaused(mq.matches); + const onChange = (e: MediaQueryListEvent) => engine.setPaused(e.matches); + mq.addEventListener('change', onChange); + return () => mq.removeEventListener('change', onChange); + } + async function handleReady(engine: ObservatoryEngine) { engineRef = engine; + stopReducedMotion = initReducedMotion(engine); const field = new LivingFieldPass(engine); fieldPass = field; field.setCells(buildFieldCells()); @@ -230,12 +245,23 @@ async function handlePointerDown(e: PointerEvent) { const ndc = pointerToNdc(e); if (!ndc || !textPass) return; - const hit = textPass.pickAt(ndc.x, ndc.y); - if (hit?.kind !== 'importance') return; - const item = hit.payload as ImportanceTextItem; - if (!item.memoryId) return; + // Pick the TEXT row first; if it misses, pick the FIELD cell (its payload is + // the ImportanceRecord, id at record.memory.id). Without this, clicking a + // glowing importance orb did nothing — only the text rows were clickable. + let memoryId: string | undefined; + const textHit = textPass.pickAt(ndc.x, ndc.y); + if (textHit?.kind === 'importance') { + memoryId = (textHit.payload as ImportanceTextItem).memoryId; + } else { + const fieldHit = fieldPass?.pickAt(ndc.x, ndc.y); + if (fieldHit?.kind === 'importance') { + const rec = fieldHit.payload as { memory?: { id?: string } }; + memoryId = rec.memory?.id; + } + } + if (!memoryId) return; try { - const promoted = await api.memories.promote(item.memoryId); + const promoted = await api.memories.promote(memoryId); // The promote endpoint returns a PARTIAL payload ({ id, promoted, // retentionStrength }) — NOT a full Memory. Merge it onto the existing // record so content/createdAt/etc. survive; replacing outright would drop diff --git a/apps/dashboard/src/routes/(app)/intentions/+page.svelte b/apps/dashboard/src/routes/(app)/intentions/+page.svelte index 8c04844..6b3c29c 100644 --- a/apps/dashboard/src/routes/(app)/intentions/+page.svelte +++ b/apps/dashboard/src/routes/(app)/intentions/+page.svelte @@ -25,6 +25,7 @@ const LUCIFERIN = [...rgb01(RETENTION.luciferin), 0.88] satisfies [number, number, number, number]; const SCARLET = [...rgb01(IMMUNE.veto), 0.92] satisfies [number, number, number, number]; const MUTED = [...rgb01(RETENTION.recall), 0.62] satisfies [number, number, number, number]; + const AMBER = [...rgb01(IMMUNE.caution), 0.9] satisfies [number, number, number, number]; const INTENTION_LIMIT = 36; const ACTIVE_FILTER = 'active'; const ALL_FILTER = 'all'; @@ -83,8 +84,10 @@ constructor(engine: ObservatoryEngine) { this.field = new LivingFieldPass(engine); } uploadScene(scene: RouteSceneModel): void { const data: FieldDatum[] = scene.nodes.map((node) => ({ id: node.source.id, score: node.activation ?? node.retention, hue: FIELD_HUE.forward, energy: node.activation, metric2: node.retention, selected: node.source.id === selectedIntentionId, kind: 'intention', payload: node })); + // RouteStage now picks text chrome (front) before field cells (behind), + // so the galaxy can fill without stealing the filter toggle's click. const sparse = data.length < 4; - this.field.setCells(layoutGalaxy(data, { maxRadius: 0.82, minCellR: sparse ? 0.24 : 0.025, maxCellR: sparse ? 0.32 : 0.075 })); + this.field.setCells(layoutGalaxy(data, { maxRadius: 0.82, minCellR: sparse ? 0.22 : 0.025, maxCellR: sparse ? 0.3 : 0.075 })); } compute(encoder: GPUCommandEncoder): void { this.field.compute(encoder); } render(pass: GPURenderPassEncoder): void { this.field.render(pass); } @@ -160,18 +163,43 @@ }; } + // A dedicated, explicit filter toggle (active <-> all). Selecting an intention + // must NOT silently flip the global filter — that lives here as its own target. + function filterToggleItem(): IntentionTextItem { + return { + id: 'intentions:filter', + kind: 'intention-filter', + text: filter === ACTIVE_FILTER ? '[ SHOWING: ACTIVE - CLICK FOR ALL ]' : '[ SHOWING: ALL - CLICK FOR ACTIVE ]', + // Far top-left corner (radius ~1.3 from origin) — beyond the galaxy's + // bounded reach (maxRadius 0.7 + maxCellR 0.2 ≈ 0.9), so no field cell can + // overlap and steal this click (field is picked before text chrome). + x: -0.94, + y: 0.9, + size: 0.024, + color: AMBER, + depth: 1, + weight: 0.7, + revealSpan: 12, + maxWidthEm: 40, + hitPadX: 0.03, + hitPadY: 0.03 + }; + } + function buildTextItems(): IntentionTextItem[] { if (loading) return [statusItem('LOADING INTENTION FIELD...', CYAN)]; if (error) return [statusItem(`ERROR - ${error}`.slice(0, 72), SCARLET)]; - if (intentions.length === 0) return [statusItem(`EMPTY ${filter.toUpperCase()} INTENTION FIELD`, MUTED)]; + if (intentions.length === 0) return [filterToggleItem(), statusItem(`EMPTY ${filter.toUpperCase()} INTENTION FIELD`, MUTED)]; + const items: IntentionTextItem[] = [filterToggleItem()]; const rows = intentions.slice(0, INTENTION_LIMIT); const top = 0.72; const rowStep = 1.5 / Math.max(1, INTENTION_LIMIT - 1); - return rows.map((intention, i) => { + for (let i = 0; i < rows.length; i++) { + const intention = rows[i]; const id = `intent:${intention.id}`; const active = selectedIntentionId === intention.id; - return { + items.push({ id, kind: 'intention', intentionId: intention.id, @@ -187,8 +215,9 @@ maxWidthEm: 52, hitPadX: 0.03, hitPadY: 0.015 - }; - }); + }); + } + return items; } const scene = $derived({ @@ -232,11 +261,19 @@ }); function handlePick(pick: RoutePick) { + // The explicit filter toggle switches active <-> all (its own target). + if (pick.kind === 'intention-filter') { + void loadIntentions(filter === ACTIVE_FILTER ? ALL_FILTER : ACTIVE_FILTER); + return; + } if (pick.kind !== 'intention') return; - const item = pick.payload as IntentionTextItem; - selectedIntentionId = item.intentionId ?? null; + // The pick can come from the TEXT pass (payload = IntentionTextItem with + // .intentionId) OR the FIELD pass (payload = RouteNode with .source.id). + // Read the intention id from whichever shape it is, so field cells are + // clickable, not just text rows. + const payload = pick.payload as Partial & { source?: { id?: string } }; + selectedIntentionId = payload.intentionId ?? payload.source?.id ?? null; updateTextPass(); - void loadIntentions(filter === ACTIVE_FILTER ? ALL_FILTER : ACTIVE_FILTER); } diff --git a/apps/dashboard/src/routes/(app)/memories/+page.svelte b/apps/dashboard/src/routes/(app)/memories/+page.svelte index d009cb7..16a9b75 100644 --- a/apps/dashboard/src/routes/(app)/memories/+page.svelte +++ b/apps/dashboard/src/routes/(app)/memories/+page.svelte @@ -37,12 +37,14 @@ let loading = $state(true); let error: string | null = $state(null); let activeRun: string | null = null; + let stopReducedMotion: (() => void) | null = null; onMount(() => { void loadMemories(); }); onDestroy(() => { + stopReducedMotion?.(); textPass?.dispose(); fieldPass?.dispose(); textPass = null; @@ -50,8 +52,21 @@ engineRef = null; }); + // This organ mounts ObservatoryCanvas directly (not RouteStage), so it must + // wire prefers-reduced-motion itself: a reduce-motion user gets a frozen field + // (the engine still renders one static frame) instead of continuous orbit. + function initReducedMotion(engine: ObservatoryEngine): () => void { + if (typeof window === 'undefined') return () => {}; + const mq = window.matchMedia('(prefers-reduced-motion: reduce)'); + engine.setPaused(mq.matches); + const onChange = (e: MediaQueryListEvent) => engine.setPaused(e.matches); + mq.addEventListener('change', onChange); + return () => mq.removeEventListener('change', onChange); + } + async function handleReady(engine: ObservatoryEngine) { engineRef = engine; + stopReducedMotion = initReducedMotion(engine); // Engram galaxy FIRST (behind the parallax MSDF text): every real memory a // glowing cell, retention = oxygen. The cursor-parallax text field rides on top. const field = new LivingFieldPass(engine); @@ -228,10 +243,16 @@ await api.memories.suppress(item.memoryId, 'suppressed from memories field'); suppressedIds = new Set(suppressedIds).add(item.memoryId); } else if (e.altKey) { - await api.memories.unsuppress(item.memoryId); - const next = new Set(suppressedIds); - next.delete(item.memoryId); - suppressedIds = next; + // unsuppress COMPOUNDS down by one — a memory suppressed twice is still + // suppressed after one unsuppress. Only clear the scar when the backend + // says it's fully released (stillSuppressed=false), else the cell would + // lie (render healthy while retrieval is still penalized). + const res = await api.memories.unsuppress(item.memoryId); + if (!res.stillSuppressed) { + const next = new Set(suppressedIds); + next.delete(item.memoryId); + suppressedIds = next; + } } else { const promoted = await api.memories.promote(item.memoryId); memories = memories.map((memory) => diff --git a/apps/dashboard/src/routes/(app)/memory-prs/+page.svelte b/apps/dashboard/src/routes/(app)/memory-prs/+page.svelte index db6292a..fb0c941 100644 --- a/apps/dashboard/src/routes/(app)/memory-prs/+page.svelte +++ b/apps/dashboard/src/routes/(app)/memory-prs/+page.svelte @@ -189,10 +189,14 @@ async function handleRoutePick(pick: RoutePick) { if (pick.kind !== 'memory-pr') return; - const item = pick.payload as MemoryPrTextItem; - if (!item.prId) return; + // Pick can be a TEXT row (payload = MemoryPrTextItem with .prId) or a FIELD + // cell (payload = RouteNode with .source.id == pr id). Read whichever, so + // field cells act on the real PR, not silently no-op. + const payload = pick.payload as Partial & { source?: { id?: string } }; + const prId = payload.prId ?? payload.source?.id; + if (!prId) return; try { - const res = (await api.memoryPrs.act(item.prId, 'ask_agent_why')) as { why?: WhySignal[] }; + const res = (await api.memoryPrs.act(prId, 'ask_agent_why')) as { why?: WhySignal[] }; whySignals = res.why ?? []; } catch (err) { error = err instanceof Error ? err.message : 'UNKNOWN MEMORY PR ACTION ERROR'; diff --git a/apps/dashboard/src/routes/(app)/patterns/+page.svelte b/apps/dashboard/src/routes/(app)/patterns/+page.svelte index f2935a2..497b2f2 100644 --- a/apps/dashboard/src/routes/(app)/patterns/+page.svelte +++ b/apps/dashboard/src/routes/(app)/patterns/+page.svelte @@ -35,9 +35,33 @@ let loading = $state(true); let error: string | null = $state(null); let selectedCategory: CrossProjectCategory | null = $state(null); + // The corpus cross-project patterns are mined FROM — a dim living substrate so + // the organ breathes even when there are zero standing transfers today (the + // pattern set is recomputed and legitimately empty at times). Real memories, + // so the field still passes the discipline test. + let poolCells: FieldDatum[] = []; + let patternField: PatternFieldPass | null = null; onMount(() => { void loadPatterns(); + void api.memories + .list({ limit: '90' }) + .then((res) => { + poolCells = res.memories.map((m) => { + const retention = clamp01(m.retentionStrength); + return { + id: m.id, + score: 0.28 + 0.4 * retention, + hue: FIELD_HUE.bridge, + energy: 0.14 + 0.28 * retention, + metric2: retention, + kind: 'pattern-pool', + payload: m + } satisfies FieldDatum; + }); + patternField?.refresh(); + }) + .catch(() => {}); }); async function loadPatterns() { @@ -122,6 +146,7 @@ function createPatternPasses(engine: ObservatoryEngine): RouteFramePass[] { // Field FIRST (renders behind), then MSDF text labels on top. const field = new PatternFieldPass(engine); + patternField = field; const textPass = new TextLayerPass(engine); void textPass.init(); return [ @@ -144,11 +169,33 @@ */ class PatternFieldPass implements RouteFramePass { private field: LivingFieldPass; + private lastNodes: RouteNode[] = []; constructor(engine: ObservatoryEngine) { this.field = new LivingFieldPass(engine); } uploadScene(scene: RouteSceneModel): void { - const nodes = (scene as PatternScene).nodes; + this.lastNodes = (scene as PatternScene).nodes; + this.apply(); + } + /** Re-apply when the fallback memory pool arrives after mount. */ + refresh(): void { + this.apply(); + } + private apply(): void { + const nodes = this.lastNodes; + // No standing cross-project patterns today → breathe the real memory pool + // they're mined from (dim tissue), so the organ is alive, not black. + if (nodes.length === 0) { + this.field.setCells( + layoutRings(poolCells, (_d, i) => i % 6, { + ringCount: 6, + maxRadius: 0.92, + minCellR: 0.02, + maxCellR: 0.05 + }) + ); + return; + } const data: FieldDatum[] = nodes.map((node) => { const strength = clamp01(finite(node.activation ?? 0)); return { diff --git a/apps/dashboard/src/routes/(app)/schedule/+page.svelte b/apps/dashboard/src/routes/(app)/schedule/+page.svelte index 13f29ce..d4ca3bb 100644 --- a/apps/dashboard/src/routes/(app)/schedule/+page.svelte +++ b/apps/dashboard/src/routes/(app)/schedule/+page.svelte @@ -262,10 +262,13 @@ async function handleRoutePick(pick: RoutePick) { if (pick.kind !== 'schedule-memory') return; - const item = pick.payload as ScheduleTextItem; - if (!item.memoryId) return; + // TEXT row payload has .memoryId; FIELD cell payload is a RouteNode whose + // source.id is the memory id. Read either so field cells promote, not no-op. + const item = pick.payload as Partial & { source?: { id?: string } }; + const memoryId = item.memoryId ?? item.source?.id; + if (!memoryId) return; try { - const promoted = await api.memories.promote(item.memoryId); + const promoted = await api.memories.promote(memoryId); // promote returns a PARTIAL {id, promoted, retentionStrength} — merge the // changed field into the full Memory, never replace it (a full swap drops // content/nodeType/... and crashes the next render — the /memories bug).