signetai 0.1.68 → 0.1.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/_app/immutable/chunks/D_6Ax5uP.js +1 -0
- package/dashboard/_app/immutable/entry/{app.Cu_eXv80.js → app.B__dB5zY.js} +2 -2
- package/dashboard/_app/immutable/entry/start.BokfFlbu.js +1 -0
- package/dashboard/_app/immutable/nodes/{1.RXxywdn_.js → 1.DGWYhGpd.js} +1 -1
- package/dashboard/_app/version.json +1 -1
- package/dashboard/index.html +6 -6
- package/dist/cli.js +28 -6
- package/dist/daemon.js +484 -38
- package/package.json +1 -1
- package/dashboard/_app/immutable/chunks/AGb2L2ZT.js +0 -1
- package/dashboard/_app/immutable/entry/start.CpyzCF5b.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b8 as he,b9 as mt,aK as A,L as U,ay as T,aJ as te,ba as _t}from"./BgyhSYBR.js";import{o as qe}from"./CSXJCotK.js";const V=[];function Se(e,t=he){let n=null;const r=new Set;function a(o){if(mt(e,o)&&(e=o,n)){const l=!V.length;for(const c of r)c[1](),V.push(c,e);if(l){for(let c=0;c<V.length;c+=2)V[c][0](V[c+1]);V.length=0}}}function i(o){a(o(e))}function s(o,l=he){const c=[o,l];return r.add(c),r.size===1&&(n=t(a,i)||he),o(e),()=>{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:a,update:i,subscribe:s}}class Ee{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class Re{constructor(t,n){this.status=t,this.location=n}}class xe extends Error{constructor(t,n,r){super(r),this.status=t,this.text=n}}new URL("sveltekit-internal://");function wt(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function vt(e){return e.split("%25").map(decodeURI).join("%25")}function yt(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function pe({href:e}){return e.split("#")[0]}function bt(e,t,n,r=!1){const a=new URL(e);Object.defineProperty(a,"searchParams",{value:new Proxy(a.searchParams,{get(s,o){if(o==="get"||o==="getAll"||o==="has")return(c,...d)=>(n(c),s[o](c,...d));t();const l=Reflect.get(s,o);return typeof l=="function"?l.bind(s):l}}),enumerable:!0,configurable:!0});const i=["href","pathname","search","toString","toJSON"];r&&i.push("hash");for(const s of i)Object.defineProperty(a,s,{get(){return t(),e[s]},enumerable:!0,configurable:!0});return a}function kt(...e){let t=5381;for(const n of e)if(typeof n=="string"){let r=n.length;for(;r;)t=t*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)t=t*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;new TextDecoder;function St(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const Et=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||"GET")!=="GET"&&M.delete(Le(e)),Et(e,t));const M=new Map;function Rt(e,t){const n=Le(e,t),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:a,...i}=JSON.parse(r.textContent);const s=r.getAttribute("data-ttl");return s&&M.set(n,{body:a,init:i,ttl:1e3*Number(s)}),r.getAttribute("data-b64")!==null&&(a=St(a)),Promise.resolve(new Response(a,i))}return window.fetch(e,t)}function xt(e,t,n){if(M.size>0){const r=Le(e,n),a=M.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(n?.cache))return new Response(a.body,a.init);M.delete(r)}}return window.fetch(t,n)}function Le(e,t){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){const a=[];t.headers&&a.push([...new Headers(t.headers)].join(",")),t.body&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&a.push(t.body),r+=`[data-hash="${kt(...a)}"]`}return r}const Lt=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function At(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${Tt(e).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return t.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const i=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(i)return t.push({name:i[1],matcher:i[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const s=r.split(/\[(.+?)\](?!\])/);return"/"+s.map((l,c)=>{if(c%2){if(l.startsWith("x+"))return ge(String.fromCharCode(parseInt(l.slice(2),16)));if(l.startsWith("u+"))return ge(String.fromCharCode(...l.slice(2).split("-").map(w=>parseInt(w,16))));const d=Lt.exec(l),[,p,f,u,h]=d;return t.push({name:u,matcher:h,optional:!!p,rest:!!f,chained:f?c===1&&s[0]==="":!1}),f?"([^]*?)":p?"([^/]*)?":"([^/]+?)"}return ge(l)}).join("")}).join("")}/?$`),params:t}}function Ut(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function Tt(e){return e.slice(1).split("/").filter(Ut)}function Pt(e,t,n){const r={},a=e.slice(1),i=a.filter(o=>o!==void 0);let s=0;for(let o=0;o<t.length;o+=1){const l=t[o];let c=a[o-s];if(l.chained&&l.rest&&s&&(c=a.slice(o-s,o+1).filter(d=>d).join("/"),s=0),c===void 0)if(l.rest)c="";else continue;if(!l.matcher||n[l.matcher](c)){r[l.name]=c;const d=t[o+1],p=a[o+1];d&&!d.rest&&d.optional&&p&&l.chained&&(s=0),!d&&!p&&Object.keys(r).length===i.length&&(s=0);continue}if(l.optional&&l.chained){s++;continue}return}if(!s)return r}function ge(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function It({nodes:e,server_loads:t,dictionary:n,matchers:r}){const a=new Set(t);return Object.entries(n).map(([o,[l,c,d]])=>{const{pattern:p,params:f}=At(o),u={id:o,exec:h=>{const w=p.exec(h);if(w)return Pt(w,f,r)},errors:[1,...d||[]].map(h=>e[h]),layouts:[0,...c||[]].map(s),leaf:i(l)};return u.errors.length=u.layouts.length=Math.max(u.errors.length,u.layouts.length),u});function i(o){const l=o<0;return l&&(o=~o),[l,e[o]]}function s(o){return o===void 0?o:[a.has(o),e[o]]}}function He(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function De(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}const x=globalThis.__sveltekit_1h7pxt?.base??"",Ot=globalThis.__sveltekit_1h7pxt?.assets??x??"",$t="1771693305934",Je="sveltekit:snapshot",We="sveltekit:scroll",Ye="sveltekit:states",Ct="sveltekit:pageurl",B="sveltekit:history",H="sveltekit:navigation",N={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},Ae=location.origin;function Xe(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function q(){return{x:pageXOffset,y:pageYOffset}}function K(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const Ve={...N,"":N.hover};function Qe(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function Ze(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=Qe(e)}}function we(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const o=location.hash.split("#")[1]||"/";r.hash=`#${o}${r.hash}`}}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,i=!r||!!a||ue(r,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),s=r?.origin===Ae&&e.hasAttribute("download");return{url:r,external:i,target:a,download:s}}function ne(e){let t=null,n=null,r=null,a=null,i=null,s=null,o=e;for(;o&&o!==document.documentElement;)r===null&&(r=K(o,"preload-code")),a===null&&(a=K(o,"preload-data")),t===null&&(t=K(o,"keepfocus")),n===null&&(n=K(o,"noscroll")),i===null&&(i=K(o,"reload")),s===null&&(s=K(o,"replacestate")),o=Qe(o);function l(c){switch(c){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Ve[r??"off"],preload_data:Ve[a??"off"],keepfocus:l(t),noscroll:l(n),reload:l(i),replace_state:l(s)}}function Ke(e){const t=Se(e);let n=!0;function r(){n=!0,t.update(s=>s)}function a(s){n=!1,t.set(s)}function i(s){let o;return t.subscribe(l=>{(o===void 0||n&&l!==o)&&s(o=l)})}return{notify:r,set:a,subscribe:i}}const et={v:()=>{}};function Nt(){const{set:e,subscribe:t}=Se(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${Ot}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const s=(await a.json()).version!==$t;return s&&(e(!0),et.v(),clearTimeout(n)),s}catch{return!1}}return{subscribe:t,check:r}}function ue(e,t,n){return e.origin!==Ae||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function fn(e){}const tt=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...tt];const jt=new Set([...tt]);[...jt];function qt(e){return e.filter(t=>t!=null)}function Ue(e){return e instanceof Ee||e instanceof xe?e.status:500}function Dt(e){return e instanceof xe?e.text:"Internal Error"}let k,J,me;const Vt=qe.toString().includes("$$")||/function \w+\(\) \{\}/.test(qe.toString());Vt?(k={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL("https://example.com")},J={current:null},me={current:!1}):(k=new class{#e=A({});get data(){return U(this.#e)}set data(t){T(this.#e,t)}#t=A(null);get form(){return U(this.#t)}set form(t){T(this.#t,t)}#n=A(null);get error(){return U(this.#n)}set error(t){T(this.#n,t)}#r=A({});get params(){return U(this.#r)}set params(t){T(this.#r,t)}#a=A({id:null});get route(){return U(this.#a)}set route(t){T(this.#a,t)}#o=A({});get state(){return U(this.#o)}set state(t){T(this.#o,t)}#s=A(-1);get status(){return U(this.#s)}set status(t){T(this.#s,t)}#i=A(new URL("https://example.com"));get url(){return U(this.#i)}set url(t){T(this.#i,t)}},J=new class{#e=A(null);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},me=new class{#e=A(!1);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},et.v=()=>me.current=!0);function Kt(e){Object.assign(k,e)}const Be={spanContext(){return Bt},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this},addLink(){return this},addLinks(){return this}},Bt={traceId:"",spanId:"",traceFlags:0},Ft=new Set(["icon","shortcut icon","apple-touch-icon"]),C=He(We)??{},W=He(Je)??{},$={url:Ke({}),page:Ke({}),navigating:Se(null),updated:Nt()};function Te(e){C[e]=q()}function Gt(e,t){let n=e+1;for(;C[n];)delete C[n],n+=1;for(n=t+1;W[n];)delete W[n],n+=1}function Y(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function nt(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(x||"/");e&&await e.update()}}function Fe(){}let Pe,ve,re,P,ye,v;const ae=[],oe=[];let L=null;function be(){L?.fork?.then(e=>e?.discard()),L=null}const ee=new Map,rt=new Set,Mt=new Set,z=new Set;let _={branch:[],error:null,url:null},at=!1,se=!1,Ge=!0,X=!1,G=!1,ot=!1,Ie=!1,st,y,R,j;const ie=new Set,Me=new Map;async function gn(e,t,n){globalThis.__sveltekit_1h7pxt?.data&&globalThis.__sveltekit_1h7pxt.data,document.URL!==location.href&&(location.href=location.href),v=e,await e.hooks.init?.(),Pe=It(e),P=document.documentElement,ye=t,ve=e.nodes[0],re=e.nodes[1],ve(),re(),y=history.state?.[B],R=history.state?.[H],y||(y=R=Date.now(),history.replaceState({...history.state,[B]:y,[H]:R},""));const r=C[y];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await an(ye,n)):(await F({type:"enter",url:Xe(v.hash?ln(new URL(location.href)):location.href),replace_state:!0}),a()),rn()}function zt(){ae.length=0,Ie=!1}function it(e){oe.some(t=>t?.snapshot)&&(W[e]=oe.map(t=>t?.snapshot?.capture()))}function lt(e){W[e]?.forEach((t,n)=>{oe[n]?.snapshot?.restore(t)})}function ze(){Te(y),De(We,C),it(R),De(Je,W)}async function Ht(e,t,n,r){let a;t.invalidateAll&&be(),await F({type:"goto",url:Xe(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{t.invalidateAll&&(Ie=!0,a=[...Me.keys()]),t.invalidate&&t.invalidate.forEach(nn)}}),t.invalidateAll&&te().then(te).then(()=>{Me.forEach(({resource:i},s)=>{a?.includes(s)&&i.refresh?.()})})}async function Jt(e){if(e.id!==L?.id){be();const t={};ie.add(t),L={id:e.id,token:t,promise:ft({...e,preload:t}).then(n=>(ie.delete(t),n.type==="loaded"&&n.state.error&&be(),n)),fork:null}}return L.promise}async function _e(e){const t=(await fe(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].map(n=>n?.[1]()))}async function ct(e,t,n){_=e.state;const r=document.querySelector("style[data-sveltekit]");if(r&&r.remove(),Object.assign(k,e.props.page),st=new v.root({target:t,props:{...e.props,stores:$,components:oe},hydrate:n,sync:!1}),await Promise.resolve(),lt(R),n){const a={from:null,to:{params:_.params,route:{id:_.route?.id??null},url:new URL(location.href),scroll:C[y]??q()},willUnload:!1,type:"enter",complete:Promise.resolve()};z.forEach(i=>i(a))}se=!0}function le({url:e,params:t,branch:n,status:r,error:a,route:i,form:s}){let o="never";if(x&&(e.pathname===x||e.pathname===x+"/"))o="always";else for(const u of n)u?.slash!==void 0&&(o=u.slash);e.pathname=wt(e.pathname,o),e.search=e.search;const l={type:"loaded",state:{url:e,params:t,branch:n,error:a,route:i},props:{constructors:qt(n).map(u=>u.node.component),page:je(k)}};s!==void 0&&(l.props.form=s);let c={},d=!k,p=0;for(let u=0;u<Math.max(n.length,_.branch.length);u+=1){const h=n[u],w=_.branch[u];h?.data!==w?.data&&(d=!0),h&&(c={...c,...h.data},d&&(l.props[`data_${p}`]=c),p+=1)}return(!_.url||e.href!==_.url.href||_.error!==a||s!==void 0&&s!==k.form||d)&&(l.props.page={error:a,params:t,route:{id:i?.id??null},state:{},status:r,url:new URL(e),form:s??null,data:d?c:k.data}),l}async function Oe({loader:e,parent:t,url:n,params:r,route:a,server_data_node:i}){let s=null,o=!0;const l={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},c=await e();if(c.universal?.load){let d=function(...f){for(const u of f){const{href:h}=new URL(u,n);l.dependencies.add(h)}};const p={tracing:{enabled:!1,root:Be,current:Be},route:new Proxy(a,{get:(f,u)=>(o&&(l.route=!0),f[u])}),params:new Proxy(r,{get:(f,u)=>(o&&l.params.add(u),f[u])}),data:i?.data??null,url:bt(n,()=>{o&&(l.url=!0)},f=>{o&&l.search_params.add(f)},v.hash),async fetch(f,u){f instanceof Request&&(u={body:f.method==="GET"||f.method==="HEAD"?void 0:await f.blob(),cache:f.cache,credentials:f.credentials,headers:[...f.headers].length>0?f?.headers:void 0,integrity:f.integrity,keepalive:f.keepalive,method:f.method,mode:f.mode,redirect:f.redirect,referrer:f.referrer,referrerPolicy:f.referrerPolicy,signal:f.signal,...u});const{resolved:h,promise:w}=ut(f,u,n);return o&&d(h.href),w},setHeaders:()=>{},depends:d,parent(){return o&&(l.parent=!0),t()},untrack(f){o=!1;try{return f()}finally{o=!0}}};s=await c.universal.load.call(null,p)??null}return{node:c,loader:e,server:i,universal:c.universal?.load?{type:"data",data:s,uses:l}:null,data:s??i?.data??null,slash:c.universal?.trailingSlash??i?.slash}}function ut(e,t,n){let r=e instanceof Request?e.url:e;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const i=se?xt(r,a.href,t):Rt(r,t);return{resolved:a,promise:i}}function Wt(e,t,n,r,a,i){if(Ie)return!0;if(!a)return!1;if(a.parent&&e||a.route&&t||a.url&&n)return!0;for(const s of a.search_params)if(r.has(s))return!0;for(const s of a.params)if(i[s]!==_.params[s])return!0;for(const s of a.dependencies)if(ae.some(o=>o(new URL(s))))return!0;return!1}function $e(e,t){return e?.type==="data"?e:e?.type==="skip"?t??null:null}function Yt(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const r of n){const a=e.searchParams.getAll(r),i=t.searchParams.getAll(r);a.every(s=>i.includes(s))&&i.every(s=>a.includes(s))&&n.delete(r)}return n}function Xt({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:je(k),constructors:[]}}}async function ft({id:e,invalidating:t,url:n,params:r,route:a,preload:i}){if(L?.id===e)return ie.delete(L.token),L.promise;const{errors:s,layouts:o,leaf:l}=a,c=[...o,l];s.forEach(m=>m?.().catch(()=>{})),c.forEach(m=>m?.[1]().catch(()=>{}));const d=_.url?e!==ce(_.url):!1,p=_.route?a.id!==_.route.id:!1,f=Yt(_.url,n);let u=!1;const h=c.map(async(m,g)=>{if(!m)return;const S=_.branch[g];return m[1]===S?.loader&&!Wt(u,p,d,f,S.universal?.uses,r)?S:(u=!0,Oe({loader:m[1],url:n,params:r,route:a,parent:async()=>{const I={};for(let O=0;O<g;O+=1)Object.assign(I,(await h[O])?.data);return I},server_data_node:$e(m[0]?{type:"skip"}:null,m[0]?S?.server:void 0)}))});for(const m of h)m.catch(()=>{});const w=[];for(let m=0;m<c.length;m+=1)if(c[m])try{w.push(await h[m])}catch(g){if(g instanceof Re)return{type:"redirect",location:g.location};if(ie.has(i))return Xt({error:await Q(g,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let S=Ue(g),E;if(g instanceof Ee)E=g.body;else{if(await $.updated.check())return await nt(),await Y(n);E=await Q(g,{params:r,url:n,route:{id:a.id}})}const I=await Qt(m,w,s);return I?le({url:n,params:r,branch:w.slice(0,I.idx).concat(I.node),status:S,error:E,route:a}):await ht(n,{id:a.id},E,S)}else w.push(void 0);return le({url:n,params:r,branch:w,status:200,error:null,route:a,form:t?void 0:null})}async function Qt(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)r-=1;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function Ce({status:e,error:t,url:n,route:r}){const a={};let i=null;try{const s=await Oe({loader:ve,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:$e(i)}),o={node:await re(),loader:re,universal:null,server:null,data:null};return le({url:n,params:a,branch:[s,o],status:e,error:t,route:null})}catch(s){if(s instanceof Re)return Ht(new URL(s.location,location.href),{},0);throw s}}async function Zt(e){const t=e.href;if(ee.has(t))return ee.get(t);let n;try{const r=(async()=>{let a=await v.hooks.reroute({url:new URL(e),fetch:async(i,s)=>ut(i,s,e).promise})??e;if(typeof a=="string"){const i=new URL(e);v.hash?i.hash=a:i.pathname=a,a=i}return a})();ee.set(t,r),n=await r}catch{ee.delete(t);return}return n}async function fe(e,t){if(e&&!ue(e,x,v.hash)){const n=await Zt(e);if(!n)return;const r=en(n);for(const a of Pe){const i=a.exec(r);if(i)return{id:ce(e),invalidating:t,route:a,params:yt(i),url:e}}}}function en(e){return vt(v.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(x.length))||"/"}function ce(e){return(v.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function dt({url:e,type:t,intent:n,delta:r,event:a,scroll:i}){let s=!1;const o=Ne(_,n,e,t,i??null);r!==void 0&&(o.navigation.delta=r),a!==void 0&&(o.navigation.event=a);const l={...o.navigation,cancel:()=>{s=!0,o.reject(new Error("navigation cancelled"))}};return X||rt.forEach(c=>c(l)),s?null:o}async function F({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:i,state:s={},redirect_count:o=0,nav_token:l={},accept:c=Fe,block:d=Fe,event:p}){const f=j;j=l;const u=await fe(t,!1),h=e==="enter"?Ne(_,u,t,e):dt({url:t,type:e,delta:n?.delta,intent:u,scroll:n?.scroll,event:p});if(!h){d(),j===l&&(j=f);return}const w=y,m=R;c(),X=!0,se&&h.navigation.type!=="enter"&&$.navigating.set(J.current=h.navigation);let g=u&&await ft(u);if(!g){if(ue(t,x,v.hash))return await Y(t,i);g=await ht(t,{id:null},await Q(new xe(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,i)}if(t=u?.url||t,j!==l)return h.reject(new Error("navigation aborted")),!1;if(g.type==="redirect"){if(o<20){await F({type:e,url:new URL(g.location,t),popped:n,keepfocus:r,noscroll:a,replace_state:i,state:s,redirect_count:o+1,nav_token:l}),h.fulfil(void 0);return}g=await Ce({status:500,error:await Q(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else g.props.page.status>=400&&await $.updated.check()&&(await nt(),await Y(t,i));if(zt(),Te(w),it(m),g.props.page.url.pathname!==t.pathname&&(t.pathname=g.props.page.url.pathname),s=n?n.state:s,!n){const b=i?0:1,Z={[B]:y+=b,[H]:R+=b,[Ye]:s};(i?history.replaceState:history.pushState).call(history,Z,"",t),i||Gt(y,R)}const S=u&&L?.id===u.id?L.fork:null;L=null,g.props.page.state=s;let E;if(se){const b=(await Promise.all(Array.from(Mt,D=>D(h.navigation)))).filter(D=>typeof D=="function");if(b.length>0){let D=function(){b.forEach(de=>{z.delete(de)})};b.push(D),b.forEach(de=>{z.add(de)})}_=g.state,g.props.page&&(g.props.page.url=t);const Z=S&&await S;Z?E=Z.commit():(st.$set(g.props),Kt(g.props.page),E=_t?.()),ot=!0}else await ct(g,ye,!1);const{activeElement:I}=document;await E,await te(),await te();let O=null;if(Ge){const b=n?n.scroll:a?q():null;b?scrollTo(b.x,b.y):(O=t.hash&&document.getElementById(pt(t)))?O.scrollIntoView():scrollTo(0,0)}const gt=document.activeElement!==I&&document.activeElement!==document.body;!r&&!gt&&sn(t,!O),Ge=!0,g.props.page&&Object.assign(k,g.props.page),X=!1,e==="popstate"&<(R),h.fulfil(void 0),h.navigation.to&&(h.navigation.to.scroll=q()),z.forEach(b=>b(h.navigation)),$.navigating.set(J.current=null)}async function ht(e,t,n,r,a){return e.origin===Ae&&e.pathname===location.pathname&&!at?await Ce({status:r,error:n,url:e,route:t}):await Y(e,a)}function tn(){let e,t={element:void 0,href:void 0},n;P.addEventListener("mousemove",o=>{const l=o.target;clearTimeout(e),e=setTimeout(()=>{i(l,N.hover)},20)});function r(o){o.defaultPrevented||i(o.composedPath()[0],N.tap)}P.addEventListener("mousedown",r),P.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(o=>{for(const l of o)l.isIntersecting&&(_e(new URL(l.target.href)),a.unobserve(l.target))},{threshold:0});async function i(o,l){const c=Ze(o,P),d=c===t.element&&c?.href===t.href&&l>=n;if(!c||d)return;const{url:p,external:f,download:u}=we(c,x,v.hash);if(f||u)return;const h=ne(c),w=p&&ce(_.url)===ce(p);if(!(h.reload||w))if(l<=h.preload_data){t={element:c,href:c.href},n=N.tap;const m=await fe(p,!1);if(!m)return;Jt(m)}else l<=h.preload_code&&(t={element:c,href:c.href},n=l,_e(p))}function s(){a.disconnect();for(const o of P.querySelectorAll("a")){const{url:l,external:c,download:d}=we(o,x,v.hash);if(c||d)continue;const p=ne(o);p.reload||(p.preload_code===N.viewport&&a.observe(o),p.preload_code===N.eager&&_e(l))}}z.add(s),s()}function Q(e,t){if(e instanceof Ee)return e.body;const n=Ue(e),r=Dt(e);return v.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function nn(e){if(typeof e=="function")ae.push(e);else{const{href:t}=new URL(e,location.href);ae.push(n=>n.href===t)}}function rn(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let n=!1;if(ze(),!X){const r=Ne(_,void 0,null,"leave"),a={...r.navigation,cancel:()=>{n=!0,r.reject(new Error("navigation cancelled"))}};rt.forEach(i=>i(a))}n?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&ze()}),navigator.connection?.saveData||tn(),P.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const n=Ze(t.composedPath()[0],P);if(!n)return;const{url:r,external:a,target:i,download:s}=we(n,x,v.hash);if(!r)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const o=ne(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||s)return;const[c,d]=(v.hash?r.hash.replace(/^#/,""):r.href).split("#"),p=c===pe(location);if(a||o.reload&&(!p||!d)){dt({url:r,type:"link",event:t})?X=!0:t.preventDefault();return}if(d!==void 0&&p){const[,f]=_.url.href.split("#");if(f===d){if(t.preventDefault(),d===""||d==="top"&&n.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const u=n.ownerDocument.getElementById(decodeURIComponent(d));u&&(u.scrollIntoView(),u.focus())}return}if(G=!0,Te(y),e(r),!o.replace_state)return;G=!1}t.preventDefault(),await new Promise(f=>{requestAnimationFrame(()=>{setTimeout(f,0)}),setTimeout(f,100)}),await F({type:"link",url:r,keepfocus:o.keepfocus,noscroll:o.noscroll,replace_state:o.replace_state??r.href===location.href,event:t})}),P.addEventListener("submit",t=>{if(t.defaultPrevented)return;const n=HTMLFormElement.prototype.cloneNode.call(t.target),r=t.submitter;if((r?.formTarget||n.target)==="_blank"||(r?.formMethod||n.method)!=="get")return;const s=new URL(r?.hasAttribute("formaction")&&r?.formAction||n.action);if(ue(s,x,!1))return;const o=t.target,l=ne(o);if(l.reload)return;t.preventDefault(),t.stopPropagation();const c=new FormData(o,r);s.search=new URLSearchParams(c).toString(),F({type:"form",url:s,keepfocus:l.keepfocus,noscroll:l.noscroll,replace_state:l.replace_state??s.href===location.href,event:t})}),addEventListener("popstate",async t=>{if(!ke){if(t.state?.[B]){const n=t.state[B];if(j={},n===y)return;const r=C[n],a=t.state[Ye]??{},i=new URL(t.state[Ct]??location.href),s=t.state[H],o=_.url?pe(location)===pe(_.url):!1;if(s===R&&(ot||o)){a!==k.state&&(k.state=a),e(i),C[y]=q(),r&&scrollTo(r.x,r.y),y=n;return}const c=n-y;await F({type:"popstate",url:i,popped:{state:a,scroll:r,delta:c},accept:()=>{y=n,R=s},block:()=>{history.go(-c)},nav_token:j,event:t})}else if(!G){const n=new URL(location.href);e(n),v.hash&&location.reload()}}}),addEventListener("hashchange",()=>{G&&(G=!1,history.replaceState({...history.state,[B]:++y,[H]:R},"",location.href))});for(const t of document.querySelectorAll("link"))Ft.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&$.navigating.set(J.current=null)});function e(t){_.url=k.url=t,$.page.set(je(k)),$.page.notify()}}async function an(e,{status:t=200,error:n,node_ids:r,params:a,route:i,server_route:s,data:o,form:l}){at=!0;const c=new URL(location.href);let d;({params:a={},route:i={id:null}}=await fe(c,!1)||{}),d=Pe.find(({id:u})=>u===i.id);let p,f=!0;try{const u=r.map(async(w,m)=>{const g=o[m];return g?.uses&&(g.uses=on(g.uses)),Oe({loader:v.nodes[w],url:c,params:a,route:i,parent:async()=>{const S={};for(let E=0;E<m;E+=1)Object.assign(S,(await u[E]).data);return S},server_data_node:$e(g)})}),h=await Promise.all(u);if(d){const w=d.layouts;for(let m=0;m<w.length;m++)w[m]||h.splice(m,0,void 0)}p=le({url:c,params:a,branch:h,status:t,error:n,form:l,route:d??null})}catch(u){if(u instanceof Re){await Y(new URL(u.location,location.href));return}p=await Ce({status:Ue(u),error:await Q(u,{url:c,params:a,route:i}),url:c,route:i}),e.textContent="",f=!1}p.props.page&&(p.props.page.state={}),await ct(p,e,f)}function on(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}let ke=!1;function sn(e,t=!0){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const r=pt(e);if(r&&document.getElementById(r)){const{x:i,y:s}=q();setTimeout(()=>{const o=history.state;ke=!0,location.replace(new URL(`#${r}`,location.href)),history.replaceState(o,"",e),t&&scrollTo(i,s),ke=!1})}else{const i=document.body,s=i.getAttribute("tabindex");i.tabIndex=-1,i.focus({preventScroll:!0,focusVisible:!1}),s!==null?i.setAttribute("tabindex",s):i.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const i=[];for(let s=0;s<a.rangeCount;s+=1)i.push(a.getRangeAt(s));setTimeout(()=>{if(a.rangeCount===i.length){for(let s=0;s<a.rangeCount;s+=1){const o=i[s],l=a.getRangeAt(s);if(o.commonAncestorContainer!==l.commonAncestorContainer||o.startContainer!==l.startContainer||o.endContainer!==l.endContainer||o.startOffset!==l.startOffset||o.endOffset!==l.endOffset)return}a.removeAllRanges()}})}}}function Ne(e,t,n,r,a=null){let i,s;const o=new Promise((c,d)=>{i=c,s=d});return o.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:q()},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n,scroll:a},willUnload:!t,type:r,complete:o},fulfil:i,reject:s}}function je(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function ln(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function pt(e){let t;if(v.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{gn as a,fn as l,k as p,$ as s};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.BZSViVUm.js","../chunks/BDTjsgX_.js","../chunks/BgyhSYBR.js","../chunks/LB_B8bnq.js","../assets/0.CHlQvdd5.css","../nodes/1.
|
|
2
|
-
import{h as G,g as W,f as H,E as J,au as K,av as Q,aw as X,L as v,ax as Z,ay as O,az as p,A as $,aA as ee,aB as te,u as re,x as ae,aC as ne,aD as se,N as ie,aE as oe,aF as ce,S as ue,aG as M,aH as le,ai as fe,aI as de,P as _e,I as me,v as ve,aJ as he,y as w,X as ge,U as ye,aK as I,V as Ee,W as be,Q as Pe,aL as L}from"../chunks/BgyhSYBR.js";import{h as Se,m as Re,u as Oe,s as we}from"../chunks/BLwfUV_X.js";import{a as R,c as x,f as U,t as Ae}from"../chunks/BDTjsgX_.js";import{o as Ie}from"../chunks/CSXJCotK.js";import{i as T,b as C}from"../chunks/CeI9go5C.js";import{B as Le}from"../chunks/LB_B8bnq.js";function D(r,e,n){G&&W();var c=new Le(r);H(()=>{var i=e()??null;c.ensure(i,i&&(t=>n(t,i)))},J)}let A=!1;function xe(r){var e=A;try{return A=!1,[r(),A]}finally{A=e}}function N(r,e,n,c){var i=!ae||(n&ne)!==0,t=(n&te)!==0,a=(n&ce)!==0,s=c,E=!0,P=()=>(E&&(E=!1,s=a?re(c):c),s),u;if(t){var h=ue in r||M in r;u=K(r,e)?.set??(h&&e in r?o=>r[e]=o:void 0)}var d,_=!1;t?[d,_]=xe(()=>r[e]):d=r[e],d===void 0&&c!==void 0&&(d=P(),u&&(i&&Q(),u(d)));var f;if(i?f=()=>{var o=r[e];return o===void 0?P():(E=!0,o)}:f=()=>{var o=r[e];return o!==void 0&&(s=void 0),o===void 0?s:o},i&&(n&X)===0)return f;if(u){var l=r.$$legacy;return(function(o,y){return arguments.length>0?((!i||!y||l||_)&&u(y?f():o),o):f()})}var g=!1,m=((n&se)!==0?ie:oe)(()=>(g=!1,f()));t&&v(m);var S=$;return(function(o,y){if(arguments.length>0){const b=y?v(m):i&&t?Z(o):o;return O(m,b),g=!0,s!==void 0&&(s=b),o}return p&&g||(S.f&ee)!==0?m.v:v(m)})}function Te(r){return class extends Ce{constructor(e){super({component:r,...e})}}}class Ce{#t;#e;constructor(e){var n=new Map,c=(t,a)=>{var s=de(a,!1,!1);return n.set(t,s),s};const i=new Proxy({...e.props||{},$$events:{}},{get(t,a){return v(n.get(a)??c(a,Reflect.get(t,a)))},has(t,a){return a===M?!0:(v(n.get(a)??c(a,Reflect.get(t,a))),Reflect.has(t,a))},set(t,a,s){return O(n.get(a)??c(a,s),s),Reflect.set(t,a,s)}});this.#e=(e.hydrate?Se:Re)(e.component,{target:e.target,anchor:e.anchor,props:i,context:e.context,intro:e.intro??!1,recover:e.recover}),(!e?.props?.$$host||e.sync===!1)&&le(),this.#t=i.$$events;for(const t of Object.keys(this.#e))t==="$set"||t==="$destroy"||t==="$on"||fe(this,t,{get(){return this.#e[t]},set(a){this.#e[t]=a},enumerable:!0});this.#e.$set=t=>{Object.assign(i,t)},this.#e.$destroy=()=>{Oe(this.#e)}}$set(e){this.#e.$set(e)}$on(e,n){this.#t[e]=this.#t[e]||[];const c=(...i)=>n.call(this,...i);return this.#t[e].push(c),()=>{this.#t[e]=this.#t[e].filter(i=>i!==c)}}$destroy(){this.#e.$destroy()}}const De="modulepreload",Ne=function(r,e){return new URL(r,e).href},k={},j=function(e,n,c){let i=Promise.resolve();if(n&&n.length>0){let P=function(u){return Promise.all(u.map(h=>Promise.resolve(h).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};const a=document.getElementsByTagName("link"),s=document.querySelector("meta[property=csp-nonce]"),E=s?.nonce||s?.getAttribute("nonce");i=P(n.map(u=>{if(u=Ne(u,c),u in k)return;k[u]=!0;const h=u.endsWith(".css"),d=h?'[rel="stylesheet"]':"";if(c)for(let f=a.length-1;f>=0;f--){const l=a[f];if(l.href===u&&(!h||l.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${d}`))return;const _=document.createElement("link");if(_.rel=h?"stylesheet":De,h||(_.as="script"),_.crossOrigin="",_.href=u,E&&_.setAttribute("nonce",E),document.head.appendChild(_),h)return new Promise((f,l)=>{_.addEventListener("load",f),_.addEventListener("error",()=>l(new Error(`Unable to preload CSS for ${u}`)))})}))}function t(a){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=a,window.dispatchEvent(s),!s.defaultPrevented)throw a}return i.then(a=>{for(const s of a||[])s.status==="rejected"&&t(s.reason);return e().catch(t)})},We={};var je=U('<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>'),Be=U("<!> <!>",1);function ke(r,e){_e(e,!0);let n=N(e,"components",23,()=>[]),c=N(e,"data_0",3,null),i=N(e,"data_1",3,null);me(()=>e.stores.page.set(e.page)),ve(()=>{e.stores,e.page,e.constructors,n(),e.form,c(),i(),e.stores.page.notify()});let t=I(!1),a=I(!1),s=I(null);Ie(()=>{const l=e.stores.page.subscribe(()=>{v(t)&&(O(a,!0),he().then(()=>{O(s,document.title||"untitled page",!0)}))});return O(t,!0),l});const E=L(()=>e.constructors[1]);var P=Be(),u=w(P);{var h=l=>{const g=L(()=>e.constructors[0]);var m=x(),S=w(m);D(S,()=>v(g),(o,y)=>{C(y(o,{get data(){return c()},get form(){return e.form},get params(){return e.page.params},children:(b,Ue)=>{var B=x(),Y=w(B);D(Y,()=>v(E),(q,F)=>{C(F(q,{get data(){return i()},get form(){return e.form},get params(){return e.page.params}}),z=>n()[1]=z,()=>n()?.[1])}),R(b,B)},$$slots:{default:!0}}),b=>n()[0]=b,()=>n()?.[0])}),R(l,m)},d=l=>{const g=L(()=>e.constructors[0]);var m=x(),S=w(m);D(S,()=>v(g),(o,y)=>{C(y(o,{get data(){return c()},get form(){return e.form},get params(){return e.page.params}}),b=>n()[0]=b,()=>n()?.[0])}),R(l,m)};T(u,l=>{e.constructors[1]?l(h):l(d,!1)})}var _=ge(u,2);{var f=l=>{var g=je(),m=Ee(g);{var S=o=>{var y=Ae();Pe(()=>we(y,v(s))),R(o,y)};T(m,o=>{v(a)&&o(S)})}be(g),R(l,g)};T(_,l=>{v(t)&&l(f)})}R(r,P),ye()}const He=Te(ke),Je=[()=>j(()=>import("../nodes/0.BZSViVUm.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url),()=>j(()=>import("../nodes/1.
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.BZSViVUm.js","../chunks/BDTjsgX_.js","../chunks/BgyhSYBR.js","../chunks/LB_B8bnq.js","../assets/0.CHlQvdd5.css","../nodes/1.DGWYhGpd.js","../chunks/BLwfUV_X.js","../chunks/D_6Ax5uP.js","../chunks/CSXJCotK.js","../nodes/2.4kZUm8L6.js","../chunks/CeI9go5C.js","../assets/2.Nit4L07m.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{h as G,g as W,f as H,E as J,au as K,av as Q,aw as X,L as v,ax as Z,ay as O,az as p,A as $,aA as ee,aB as te,u as re,x as ae,aC as ne,aD as se,N as ie,aE as oe,aF as ce,S as ue,aG as M,aH as le,ai as fe,aI as de,P as _e,I as me,v as ve,aJ as he,y as w,X as ge,U as ye,aK as I,V as Ee,W as be,Q as Pe,aL as L}from"../chunks/BgyhSYBR.js";import{h as Se,m as Re,u as Oe,s as we}from"../chunks/BLwfUV_X.js";import{a as R,c as x,f as U,t as Ae}from"../chunks/BDTjsgX_.js";import{o as Ie}from"../chunks/CSXJCotK.js";import{i as T,b as C}from"../chunks/CeI9go5C.js";import{B as Le}from"../chunks/LB_B8bnq.js";function D(r,e,n){G&&W();var c=new Le(r);H(()=>{var i=e()??null;c.ensure(i,i&&(t=>n(t,i)))},J)}let A=!1;function xe(r){var e=A;try{return A=!1,[r(),A]}finally{A=e}}function N(r,e,n,c){var i=!ae||(n&ne)!==0,t=(n&te)!==0,a=(n&ce)!==0,s=c,E=!0,P=()=>(E&&(E=!1,s=a?re(c):c),s),u;if(t){var h=ue in r||M in r;u=K(r,e)?.set??(h&&e in r?o=>r[e]=o:void 0)}var d,_=!1;t?[d,_]=xe(()=>r[e]):d=r[e],d===void 0&&c!==void 0&&(d=P(),u&&(i&&Q(),u(d)));var f;if(i?f=()=>{var o=r[e];return o===void 0?P():(E=!0,o)}:f=()=>{var o=r[e];return o!==void 0&&(s=void 0),o===void 0?s:o},i&&(n&X)===0)return f;if(u){var l=r.$$legacy;return(function(o,y){return arguments.length>0?((!i||!y||l||_)&&u(y?f():o),o):f()})}var g=!1,m=((n&se)!==0?ie:oe)(()=>(g=!1,f()));t&&v(m);var S=$;return(function(o,y){if(arguments.length>0){const b=y?v(m):i&&t?Z(o):o;return O(m,b),g=!0,s!==void 0&&(s=b),o}return p&&g||(S.f&ee)!==0?m.v:v(m)})}function Te(r){return class extends Ce{constructor(e){super({component:r,...e})}}}class Ce{#t;#e;constructor(e){var n=new Map,c=(t,a)=>{var s=de(a,!1,!1);return n.set(t,s),s};const i=new Proxy({...e.props||{},$$events:{}},{get(t,a){return v(n.get(a)??c(a,Reflect.get(t,a)))},has(t,a){return a===M?!0:(v(n.get(a)??c(a,Reflect.get(t,a))),Reflect.has(t,a))},set(t,a,s){return O(n.get(a)??c(a,s),s),Reflect.set(t,a,s)}});this.#e=(e.hydrate?Se:Re)(e.component,{target:e.target,anchor:e.anchor,props:i,context:e.context,intro:e.intro??!1,recover:e.recover}),(!e?.props?.$$host||e.sync===!1)&&le(),this.#t=i.$$events;for(const t of Object.keys(this.#e))t==="$set"||t==="$destroy"||t==="$on"||fe(this,t,{get(){return this.#e[t]},set(a){this.#e[t]=a},enumerable:!0});this.#e.$set=t=>{Object.assign(i,t)},this.#e.$destroy=()=>{Oe(this.#e)}}$set(e){this.#e.$set(e)}$on(e,n){this.#t[e]=this.#t[e]||[];const c=(...i)=>n.call(this,...i);return this.#t[e].push(c),()=>{this.#t[e]=this.#t[e].filter(i=>i!==c)}}$destroy(){this.#e.$destroy()}}const De="modulepreload",Ne=function(r,e){return new URL(r,e).href},k={},j=function(e,n,c){let i=Promise.resolve();if(n&&n.length>0){let P=function(u){return Promise.all(u.map(h=>Promise.resolve(h).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};const a=document.getElementsByTagName("link"),s=document.querySelector("meta[property=csp-nonce]"),E=s?.nonce||s?.getAttribute("nonce");i=P(n.map(u=>{if(u=Ne(u,c),u in k)return;k[u]=!0;const h=u.endsWith(".css"),d=h?'[rel="stylesheet"]':"";if(c)for(let f=a.length-1;f>=0;f--){const l=a[f];if(l.href===u&&(!h||l.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${d}`))return;const _=document.createElement("link");if(_.rel=h?"stylesheet":De,h||(_.as="script"),_.crossOrigin="",_.href=u,E&&_.setAttribute("nonce",E),document.head.appendChild(_),h)return new Promise((f,l)=>{_.addEventListener("load",f),_.addEventListener("error",()=>l(new Error(`Unable to preload CSS for ${u}`)))})}))}function t(a){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=a,window.dispatchEvent(s),!s.defaultPrevented)throw a}return i.then(a=>{for(const s of a||[])s.status==="rejected"&&t(s.reason);return e().catch(t)})},We={};var je=U('<div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"><!></div>'),Be=U("<!> <!>",1);function ke(r,e){_e(e,!0);let n=N(e,"components",23,()=>[]),c=N(e,"data_0",3,null),i=N(e,"data_1",3,null);me(()=>e.stores.page.set(e.page)),ve(()=>{e.stores,e.page,e.constructors,n(),e.form,c(),i(),e.stores.page.notify()});let t=I(!1),a=I(!1),s=I(null);Ie(()=>{const l=e.stores.page.subscribe(()=>{v(t)&&(O(a,!0),he().then(()=>{O(s,document.title||"untitled page",!0)}))});return O(t,!0),l});const E=L(()=>e.constructors[1]);var P=Be(),u=w(P);{var h=l=>{const g=L(()=>e.constructors[0]);var m=x(),S=w(m);D(S,()=>v(g),(o,y)=>{C(y(o,{get data(){return c()},get form(){return e.form},get params(){return e.page.params},children:(b,Ue)=>{var B=x(),Y=w(B);D(Y,()=>v(E),(q,F)=>{C(F(q,{get data(){return i()},get form(){return e.form},get params(){return e.page.params}}),z=>n()[1]=z,()=>n()?.[1])}),R(b,B)},$$slots:{default:!0}}),b=>n()[0]=b,()=>n()?.[0])}),R(l,m)},d=l=>{const g=L(()=>e.constructors[0]);var m=x(),S=w(m);D(S,()=>v(g),(o,y)=>{C(y(o,{get data(){return c()},get form(){return e.form},get params(){return e.page.params}}),b=>n()[0]=b,()=>n()?.[0])}),R(l,m)};T(u,l=>{e.constructors[1]?l(h):l(d,!1)})}var _=ge(u,2);{var f=l=>{var g=je(),m=Ee(g);{var S=o=>{var y=Ae();Pe(()=>we(y,v(s))),R(o,y)};T(m,o=>{v(a)&&o(S)})}be(g),R(l,g)};T(_,l=>{v(t)&&l(f)})}R(r,P),ye()}const He=Te(ke),Je=[()=>j(()=>import("../nodes/0.BZSViVUm.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url),()=>j(()=>import("../nodes/1.DGWYhGpd.js"),__vite__mapDeps([5,1,2,6,7,8]),import.meta.url),()=>j(()=>import("../nodes/2.4kZUm8L6.js"),__vite__mapDeps([9,1,2,8,6,10,3,11]),import.meta.url)],Ke=[],Qe={"/":[2]},V={handleError:(({error:r})=>{console.error(r)}),reroute:(()=>{}),transport:{}},Me=Object.fromEntries(Object.entries(V.transport).map(([r,e])=>[r,e.decode])),Xe=Object.fromEntries(Object.entries(V.transport).map(([r,e])=>[r,e.encode])),Ze=!1,pe=(r,e)=>Me[r](e);export{pe as decode,Me as decoders,Qe as dictionary,Xe as encoders,Ze as hash,V as hooks,We as matchers,Je as nodes,He as root,Ke as server_loads};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as o,a as r}from"../chunks/D_6Ax5uP.js";export{o as load_css,r as start};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as b,f as k}from"../chunks/BDTjsgX_.js";import{w as x,I as y,v as i,u as $,J as l,K as w,L as v,M as E,N as I,O as J,P as K,y as L,Q as M,U as N,V as u,W as m,X as O}from"../chunks/BgyhSYBR.js";import{s as _}from"../chunks/BLwfUV_X.js";import{s as P,p as g}from"../chunks/
|
|
1
|
+
import{a as b,f as k}from"../chunks/BDTjsgX_.js";import{w as x,I as y,v as i,u as $,J as l,K as w,L as v,M as E,N as I,O as J,P as K,y as L,Q as M,U as N,V as u,W as m,X as O}from"../chunks/BgyhSYBR.js";import{s as _}from"../chunks/BLwfUV_X.js";import{s as P,p as g}from"../chunks/D_6Ax5uP.js";function Q(a=!1){const t=x,e=t.l.u;if(!e)return;let r=()=>E(t.s);if(a){let o=0,s={};const f=I(()=>{let p=!1;const c=t.s;for(const n in c)c[n]!==s[n]&&(s[n]=c[n],p=!0);return p&&o++,o});r=()=>v(f)}e.b.length&&y(()=>{d(t,r),l(e.b)}),i(()=>{const o=$(()=>e.m.map(w));return()=>{for(const s of o)typeof s=="function"&&s()}}),e.a.length&&i(()=>{d(t,r),l(e.a)})}function d(a,t){if(a.l.s)for(const e of a.l.s)v(e);t()}J();const U={get error(){return g.error},get status(){return g.status}};P.updated.check;const h=U;var V=k("<h1> </h1> <p> </p>",1);function z(a,t){K(t,!1),Q();var e=V(),r=L(e),o=u(r,!0);m(r);var s=O(r,2),f=u(s,!0);m(s),M(()=>{_(o,h.status),_(f,h.error?.message)}),b(a,e),N()}export{z as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"
|
|
1
|
+
{"version":"1771693305934"}
|
package/dashboard/index.html
CHANGED
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
document.documentElement.dataset.theme = t;
|
|
18
18
|
})();
|
|
19
19
|
</script>
|
|
20
|
-
<link href="/_app/immutable/entry/start.
|
|
21
|
-
<link href="/_app/immutable/chunks/
|
|
20
|
+
<link href="/_app/immutable/entry/start.BokfFlbu.js" rel="modulepreload">
|
|
21
|
+
<link href="/_app/immutable/chunks/D_6Ax5uP.js" rel="modulepreload">
|
|
22
22
|
<link href="/_app/immutable/chunks/BgyhSYBR.js" rel="modulepreload">
|
|
23
23
|
<link href="/_app/immutable/chunks/CSXJCotK.js" rel="modulepreload">
|
|
24
|
-
<link href="/_app/immutable/entry/app.
|
|
24
|
+
<link href="/_app/immutable/entry/app.B__dB5zY.js" rel="modulepreload">
|
|
25
25
|
<link href="/_app/immutable/chunks/BLwfUV_X.js" rel="modulepreload">
|
|
26
26
|
<link href="/_app/immutable/chunks/BDTjsgX_.js" rel="modulepreload">
|
|
27
27
|
<link href="/_app/immutable/chunks/CeI9go5C.js" rel="modulepreload">
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
<div style="display: contents">
|
|
33
33
|
<script>
|
|
34
34
|
{
|
|
35
|
-
|
|
35
|
+
__sveltekit_1h7pxt = {
|
|
36
36
|
base: ""
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
const element = document.currentScript.parentElement;
|
|
40
40
|
|
|
41
41
|
Promise.all([
|
|
42
|
-
import("/_app/immutable/entry/start.
|
|
43
|
-
import("/_app/immutable/entry/app.
|
|
42
|
+
import("/_app/immutable/entry/start.BokfFlbu.js"),
|
|
43
|
+
import("/_app/immutable/entry/app.B__dB5zY.js")
|
|
44
44
|
]).then(([kit, app]) => {
|
|
45
45
|
kit.start(app, element);
|
|
46
46
|
});
|
package/dist/cli.js
CHANGED
|
@@ -8347,7 +8347,7 @@ var require_file_uri_to_path = __commonJS2((exports, module) => {
|
|
|
8347
8347
|
}
|
|
8348
8348
|
});
|
|
8349
8349
|
var require_bindings = __commonJS2((exports, module) => {
|
|
8350
|
-
var __filename2 = "/home/
|
|
8350
|
+
var __filename2 = "/home/nicholai/signet/signetai/node_modules/.bun/bindings@1.5.0/node_modules/bindings/bindings.js";
|
|
8351
8351
|
var fs6 = __require2("fs");
|
|
8352
8352
|
var path2 = __require2("path");
|
|
8353
8353
|
var fileURLToPath2 = require_file_uri_to_path();
|
|
@@ -16190,6 +16190,23 @@ function up7(db) {
|
|
|
16190
16190
|
db.exec("ALTER TABLE memory_jobs ADD COLUMN document_id TEXT");
|
|
16191
16191
|
}
|
|
16192
16192
|
}
|
|
16193
|
+
function up8(db) {
|
|
16194
|
+
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
|
|
16195
|
+
if (tables.length === 0)
|
|
16196
|
+
return;
|
|
16197
|
+
db.exec(`
|
|
16198
|
+
DELETE FROM embeddings
|
|
16199
|
+
WHERE rowid NOT IN (
|
|
16200
|
+
SELECT MIN(rowid) FROM embeddings
|
|
16201
|
+
GROUP BY content_hash
|
|
16202
|
+
)
|
|
16203
|
+
`);
|
|
16204
|
+
db.exec(`DROP INDEX IF EXISTS idx_embeddings_hash`);
|
|
16205
|
+
db.exec(`
|
|
16206
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_embeddings_content_hash_unique
|
|
16207
|
+
ON embeddings(content_hash)
|
|
16208
|
+
`);
|
|
16209
|
+
}
|
|
16193
16210
|
var MIGRATIONS = [
|
|
16194
16211
|
{ version: 1, name: "baseline", up },
|
|
16195
16212
|
{ version: 2, name: "pipeline-v2", up: up2 },
|
|
@@ -16205,6 +16222,11 @@ var MIGRATIONS = [
|
|
|
16205
16222
|
version: 7,
|
|
16206
16223
|
name: "documents-and-connectors",
|
|
16207
16224
|
up: up7
|
|
16225
|
+
},
|
|
16226
|
+
{
|
|
16227
|
+
version: 8,
|
|
16228
|
+
name: "embeddings-unique-hash",
|
|
16229
|
+
up: up8
|
|
16208
16230
|
}
|
|
16209
16231
|
];
|
|
16210
16232
|
function checksum(m) {
|
|
@@ -17458,7 +17480,7 @@ var require_file_uri_to_path2 = __commonJS3((exports, module) => {
|
|
|
17458
17480
|
}
|
|
17459
17481
|
});
|
|
17460
17482
|
var require_bindings2 = __commonJS3((exports, module) => {
|
|
17461
|
-
var __filename2 = "/home/
|
|
17483
|
+
var __filename2 = "/home/nicholai/signet/signetai/node_modules/.bun/bindings@1.5.0/node_modules/bindings/bindings.js";
|
|
17462
17484
|
var fs6 = __require3("fs");
|
|
17463
17485
|
var path2 = __require3("path");
|
|
17464
17486
|
var fileURLToPath2 = require_file_uri_to_path2();
|
|
@@ -25679,7 +25701,7 @@ var require_file_uri_to_path3 = __commonJS4((exports, module) => {
|
|
|
25679
25701
|
}
|
|
25680
25702
|
});
|
|
25681
25703
|
var require_bindings3 = __commonJS4((exports, module) => {
|
|
25682
|
-
var __filename2 = "/home/
|
|
25704
|
+
var __filename2 = "/home/nicholai/signet/signetai/node_modules/.bun/bindings@1.5.0/node_modules/bindings/bindings.js";
|
|
25683
25705
|
var fs6 = __require4("fs");
|
|
25684
25706
|
var path2 = __require4("path");
|
|
25685
25707
|
var fileURLToPath2 = require_file_uri_to_path3();
|
|
@@ -33412,7 +33434,7 @@ var require_file_uri_to_path22 = __commonJS22((exports, module) => {
|
|
|
33412
33434
|
}
|
|
33413
33435
|
});
|
|
33414
33436
|
var require_bindings22 = __commonJS22((exports, module) => {
|
|
33415
|
-
var __filename2 = "/home/
|
|
33437
|
+
var __filename2 = "/home/nicholai/signet/signetai/node_modules/.bun/bindings@1.5.0/node_modules/bindings/bindings.js";
|
|
33416
33438
|
var fs6 = __require22("fs");
|
|
33417
33439
|
var path2 = __require22("path");
|
|
33418
33440
|
var fileURLToPath2 = require_file_uri_to_path22();
|
|
@@ -41281,7 +41303,7 @@ var require_file_uri_to_path4 = __commonJS5((exports, module) => {
|
|
|
41281
41303
|
}
|
|
41282
41304
|
});
|
|
41283
41305
|
var require_bindings4 = __commonJS5((exports, module) => {
|
|
41284
|
-
var __filename2 = "/home/
|
|
41306
|
+
var __filename2 = "/home/nicholai/signet/signetai/node_modules/.bun/bindings@1.5.0/node_modules/bindings/bindings.js";
|
|
41285
41307
|
var fs6 = __require5("fs");
|
|
41286
41308
|
var path2 = __require5("path");
|
|
41287
41309
|
var fileURLToPath2 = require_file_uri_to_path4();
|
|
@@ -49014,7 +49036,7 @@ var require_file_uri_to_path23 = __commonJS23((exports, module) => {
|
|
|
49014
49036
|
}
|
|
49015
49037
|
});
|
|
49016
49038
|
var require_bindings23 = __commonJS23((exports, module) => {
|
|
49017
|
-
var __filename2 = "/home/
|
|
49039
|
+
var __filename2 = "/home/nicholai/signet/signetai/node_modules/.bun/bindings@1.5.0/node_modules/bindings/bindings.js";
|
|
49018
49040
|
var fs6 = __require23("fs");
|
|
49019
49041
|
var path2 = __require23("path");
|
|
49020
49042
|
var fileURLToPath2 = require_file_uri_to_path23();
|
package/dist/daemon.js
CHANGED
|
@@ -4269,7 +4269,7 @@ var require_file_uri_to_path = __commonJS((exports, module) => {
|
|
|
4269
4269
|
}
|
|
4270
4270
|
});
|
|
4271
4271
|
var require_bindings = __commonJS((exports, module) => {
|
|
4272
|
-
var __filename2 = "/home/
|
|
4272
|
+
var __filename2 = "/home/nicholai/signet/signetai/node_modules/.bun/bindings@1.5.0/node_modules/bindings/bindings.js";
|
|
4273
4273
|
var fs = __require2("fs");
|
|
4274
4274
|
var path = __require2("path");
|
|
4275
4275
|
var fileURLToPath = require_file_uri_to_path();
|
|
@@ -12112,6 +12112,23 @@ function up7(db) {
|
|
|
12112
12112
|
db.exec("ALTER TABLE memory_jobs ADD COLUMN document_id TEXT");
|
|
12113
12113
|
}
|
|
12114
12114
|
}
|
|
12115
|
+
function up8(db) {
|
|
12116
|
+
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='embeddings'").all();
|
|
12117
|
+
if (tables.length === 0)
|
|
12118
|
+
return;
|
|
12119
|
+
db.exec(`
|
|
12120
|
+
DELETE FROM embeddings
|
|
12121
|
+
WHERE rowid NOT IN (
|
|
12122
|
+
SELECT MIN(rowid) FROM embeddings
|
|
12123
|
+
GROUP BY content_hash
|
|
12124
|
+
)
|
|
12125
|
+
`);
|
|
12126
|
+
db.exec(`DROP INDEX IF EXISTS idx_embeddings_hash`);
|
|
12127
|
+
db.exec(`
|
|
12128
|
+
CREATE UNIQUE INDEX IF NOT EXISTS idx_embeddings_content_hash_unique
|
|
12129
|
+
ON embeddings(content_hash)
|
|
12130
|
+
`);
|
|
12131
|
+
}
|
|
12115
12132
|
var MIGRATIONS = [
|
|
12116
12133
|
{ version: 1, name: "baseline", up },
|
|
12117
12134
|
{ version: 2, name: "pipeline-v2", up: up2 },
|
|
@@ -12127,6 +12144,11 @@ var MIGRATIONS = [
|
|
|
12127
12144
|
version: 7,
|
|
12128
12145
|
name: "documents-and-connectors",
|
|
12129
12146
|
up: up7
|
|
12147
|
+
},
|
|
12148
|
+
{
|
|
12149
|
+
version: 8,
|
|
12150
|
+
name: "embeddings-unique-hash",
|
|
12151
|
+
up: up8
|
|
12130
12152
|
}
|
|
12131
12153
|
];
|
|
12132
12154
|
function checksum(m) {
|
|
@@ -12195,7 +12217,7 @@ function runMigrations(db) {
|
|
|
12195
12217
|
}
|
|
12196
12218
|
}
|
|
12197
12219
|
}
|
|
12198
|
-
var __dirname2 = "/home/
|
|
12220
|
+
var __dirname2 = "/home/nicholai/signet/signetai/packages/core/src";
|
|
12199
12221
|
function getExtensionSuffix() {
|
|
12200
12222
|
if (platform === "win32")
|
|
12201
12223
|
return "dll";
|
|
@@ -20287,6 +20309,7 @@ function txRecoverMemory(db, input) {
|
|
|
20287
20309
|
// ../daemon/src/pipeline/provider.ts
|
|
20288
20310
|
var DEFAULT_OLLAMA_CONFIG = {
|
|
20289
20311
|
model: "qwen3:4b",
|
|
20312
|
+
baseUrl: "http://localhost:11434",
|
|
20290
20313
|
defaultTimeoutMs: 45000
|
|
20291
20314
|
};
|
|
20292
20315
|
function createOllamaProvider(config) {
|
|
@@ -20295,42 +20318,44 @@ function createOllamaProvider(config) {
|
|
|
20295
20318
|
name: `ollama:${cfg.model}`,
|
|
20296
20319
|
async generate(prompt, opts) {
|
|
20297
20320
|
const timeoutMs = opts?.timeoutMs ?? cfg.defaultTimeoutMs;
|
|
20298
|
-
const
|
|
20299
|
-
|
|
20300
|
-
stderr: "pipe"
|
|
20301
|
-
});
|
|
20302
|
-
let timedOut = false;
|
|
20321
|
+
const controller = new AbortController;
|
|
20322
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
20303
20323
|
try {
|
|
20304
|
-
const
|
|
20305
|
-
|
|
20306
|
-
|
|
20307
|
-
|
|
20308
|
-
|
|
20309
|
-
|
|
20310
|
-
|
|
20311
|
-
|
|
20312
|
-
|
|
20313
|
-
|
|
20314
|
-
|
|
20324
|
+
const res = await fetch(`${cfg.baseUrl}/api/generate`, {
|
|
20325
|
+
method: "POST",
|
|
20326
|
+
headers: { "Content-Type": "application/json" },
|
|
20327
|
+
body: JSON.stringify({
|
|
20328
|
+
model: cfg.model,
|
|
20329
|
+
prompt,
|
|
20330
|
+
stream: false,
|
|
20331
|
+
...opts?.maxTokens ? { options: { num_predict: opts.maxTokens } } : {}
|
|
20332
|
+
}),
|
|
20333
|
+
signal: controller.signal
|
|
20334
|
+
});
|
|
20335
|
+
if (!res.ok) {
|
|
20336
|
+
const body = await res.text().catch(() => "");
|
|
20337
|
+
throw new Error(`Ollama HTTP ${res.status}: ${body.slice(0, 200)}`);
|
|
20338
|
+
}
|
|
20339
|
+
const data = await res.json();
|
|
20340
|
+
if (typeof data.response !== "string") {
|
|
20341
|
+
throw new Error("Ollama returned no response field");
|
|
20315
20342
|
}
|
|
20316
|
-
return
|
|
20343
|
+
return data.response.trim();
|
|
20317
20344
|
} catch (e) {
|
|
20318
|
-
if (
|
|
20319
|
-
|
|
20320
|
-
proc.kill();
|
|
20321
|
-
} catch {}
|
|
20345
|
+
if (e instanceof DOMException && e.name === "AbortError") {
|
|
20346
|
+
throw new Error(`Ollama timeout after ${timeoutMs}ms`);
|
|
20322
20347
|
}
|
|
20323
20348
|
throw e;
|
|
20349
|
+
} finally {
|
|
20350
|
+
clearTimeout(timer);
|
|
20324
20351
|
}
|
|
20325
20352
|
},
|
|
20326
20353
|
async available() {
|
|
20327
20354
|
try {
|
|
20328
|
-
const
|
|
20329
|
-
|
|
20330
|
-
stderr: "pipe"
|
|
20355
|
+
const res = await fetch(`${cfg.baseUrl}/api/tags`, {
|
|
20356
|
+
signal: AbortSignal.timeout(3000)
|
|
20331
20357
|
});
|
|
20332
|
-
|
|
20333
|
-
return proc.exitCode === 0;
|
|
20358
|
+
return res.ok;
|
|
20334
20359
|
} catch {
|
|
20335
20360
|
logger.debug("pipeline", "Ollama not available");
|
|
20336
20361
|
return false;
|
|
@@ -20384,9 +20409,11 @@ Text:
|
|
|
20384
20409
|
${content}`;
|
|
20385
20410
|
}
|
|
20386
20411
|
var FENCE_RE = /```(?:json)?\s*([\s\S]*?)```/;
|
|
20412
|
+
var THINK_RE = /<think>[\s\S]*?<\/think>\s*/g;
|
|
20387
20413
|
function stripFences(raw2) {
|
|
20388
|
-
const
|
|
20389
|
-
|
|
20414
|
+
const stripped = raw2.replace(THINK_RE, "");
|
|
20415
|
+
const match2 = stripped.match(FENCE_RE);
|
|
20416
|
+
return match2 ? match2[1].trim() : stripped.trim();
|
|
20390
20417
|
}
|
|
20391
20418
|
function validateFact(raw2, warnings) {
|
|
20392
20419
|
if (typeof raw2 !== "object" || raw2 === null) {
|
|
@@ -20610,7 +20637,8 @@ Return ONLY the JSON, no other text.`;
|
|
|
20610
20637
|
}
|
|
20611
20638
|
var VALID_ACTIONS = new Set(DECISION_ACTIONS);
|
|
20612
20639
|
function parseDecision(raw2, candidateIds, warnings) {
|
|
20613
|
-
const
|
|
20640
|
+
const stripped = raw2.replace(/<think>[\s\S]*?<\/think>\s*/g, "");
|
|
20641
|
+
const jsonStr = stripped.trim().replace(/```(?:json)?\s*([\s\S]*?)```/, "$1").trim();
|
|
20614
20642
|
let parsed;
|
|
20615
20643
|
try {
|
|
20616
20644
|
parsed = JSON.parse(jsonStr);
|
|
@@ -21162,7 +21190,7 @@ function reapStaleLeases(accessor2, timeoutMs) {
|
|
|
21162
21190
|
return countChanges(result);
|
|
21163
21191
|
});
|
|
21164
21192
|
}
|
|
21165
|
-
function startWorker(accessor2, provider, pipelineCfg, decisionCfg) {
|
|
21193
|
+
function startWorker(accessor2, provider, pipelineCfg, decisionCfg, analytics) {
|
|
21166
21194
|
let running = true;
|
|
21167
21195
|
let inflight = null;
|
|
21168
21196
|
let pollTimer = null;
|
|
@@ -21203,7 +21231,15 @@ function startWorker(accessor2, provider, pipelineCfg, decisionCfg) {
|
|
|
21203
21231
|
embeddingByHash.set(contentHash, vector);
|
|
21204
21232
|
}
|
|
21205
21233
|
} catch (e) {
|
|
21206
|
-
|
|
21234
|
+
const emsg = e instanceof Error ? e.message : String(e);
|
|
21235
|
+
prefetchWarnings.push(`Embedding prefetch failed: ${emsg}`);
|
|
21236
|
+
analytics?.recordError({
|
|
21237
|
+
timestamp: new Date().toISOString(),
|
|
21238
|
+
stage: "embedding",
|
|
21239
|
+
code: emsg.includes("timeout") ? "EMBEDDING_TIMEOUT" : "EMBEDDING_PROVIDER_DOWN",
|
|
21240
|
+
message: emsg,
|
|
21241
|
+
memoryId: job.memory_id
|
|
21242
|
+
});
|
|
21207
21243
|
}
|
|
21208
21244
|
}
|
|
21209
21245
|
}
|
|
@@ -21283,9 +21319,11 @@ function startWorker(accessor2, provider, pipelineCfg, decisionCfg) {
|
|
|
21283
21319
|
const job = accessor2.withWriteTx((db) => leaseJob(db, "extract", pipelineCfg.workerMaxRetries));
|
|
21284
21320
|
if (!job)
|
|
21285
21321
|
return;
|
|
21322
|
+
const jobStart = Date.now();
|
|
21286
21323
|
try {
|
|
21287
21324
|
await processExtractJob(job);
|
|
21288
21325
|
consecutiveFailures = 0;
|
|
21326
|
+
analytics?.recordLatency("jobs", Date.now() - jobStart);
|
|
21289
21327
|
} catch (e) {
|
|
21290
21328
|
const msg = e instanceof Error ? e.message : String(e);
|
|
21291
21329
|
logger.warn("pipeline", "Job failed", {
|
|
@@ -21293,6 +21331,14 @@ function startWorker(accessor2, provider, pipelineCfg, decisionCfg) {
|
|
|
21293
21331
|
error: msg,
|
|
21294
21332
|
attempt: job.attempts
|
|
21295
21333
|
});
|
|
21334
|
+
analytics?.recordLatency("jobs", Date.now() - jobStart);
|
|
21335
|
+
analytics?.recordError({
|
|
21336
|
+
timestamp: new Date().toISOString(),
|
|
21337
|
+
stage: "extraction",
|
|
21338
|
+
code: msg.includes("timeout") ? "EXTRACTION_TIMEOUT" : "EXTRACTION_PARSE_FAIL",
|
|
21339
|
+
message: msg,
|
|
21340
|
+
memoryId: job.memory_id
|
|
21341
|
+
});
|
|
21296
21342
|
accessor2.withWriteTx((db) => {
|
|
21297
21343
|
failJob(db, job.id, msg, job.attempts, job.max_attempts);
|
|
21298
21344
|
if (job.attempts >= job.max_attempts) {
|
|
@@ -22451,7 +22497,7 @@ var workerHandle = null;
|
|
|
22451
22497
|
var retentionHandle = null;
|
|
22452
22498
|
var maintenanceHandle = null;
|
|
22453
22499
|
var documentWorkerHandle = null;
|
|
22454
|
-
function startPipeline(accessor2, pipelineCfg, embeddingCfg, fetchEmbedding, searchCfg, providerTracker) {
|
|
22500
|
+
function startPipeline(accessor2, pipelineCfg, embeddingCfg, fetchEmbedding, searchCfg, providerTracker, analytics) {
|
|
22455
22501
|
if (workerHandle) {
|
|
22456
22502
|
logger.warn("pipeline", "Pipeline already running, skipping start");
|
|
22457
22503
|
return;
|
|
@@ -22465,7 +22511,7 @@ function startPipeline(accessor2, pipelineCfg, embeddingCfg, fetchEmbedding, sea
|
|
|
22465
22511
|
search: searchCfg,
|
|
22466
22512
|
fetchEmbedding
|
|
22467
22513
|
};
|
|
22468
|
-
workerHandle = startWorker(accessor2, provider, pipelineCfg, decisionCfg);
|
|
22514
|
+
workerHandle = startWorker(accessor2, provider, pipelineCfg, decisionCfg, analytics);
|
|
22469
22515
|
if (!retentionHandle) {
|
|
22470
22516
|
retentionHandle = startRetentionWorker(accessor2, DEFAULT_RETENTION);
|
|
22471
22517
|
}
|
|
@@ -22907,6 +22953,321 @@ async function rerank(query, candidates, provider, cfg) {
|
|
|
22907
22953
|
clearTimeout(timerId);
|
|
22908
22954
|
}
|
|
22909
22955
|
}
|
|
22956
|
+
|
|
22957
|
+
// ../daemon/src/analytics.ts
|
|
22958
|
+
function createLatencyHistogram(capacity = 1000) {
|
|
22959
|
+
const samples = [];
|
|
22960
|
+
let sorted = true;
|
|
22961
|
+
function ensureSorted() {
|
|
22962
|
+
if (!sorted) {
|
|
22963
|
+
samples.sort((a2, b2) => a2 - b2);
|
|
22964
|
+
sorted = true;
|
|
22965
|
+
}
|
|
22966
|
+
}
|
|
22967
|
+
function percentile(p2) {
|
|
22968
|
+
ensureSorted();
|
|
22969
|
+
if (samples.length === 0)
|
|
22970
|
+
return 0;
|
|
22971
|
+
const idx = Math.ceil(p2 / 100 * samples.length) - 1;
|
|
22972
|
+
return samples[Math.max(0, idx)];
|
|
22973
|
+
}
|
|
22974
|
+
return {
|
|
22975
|
+
record(ms) {
|
|
22976
|
+
if (samples.length >= capacity) {
|
|
22977
|
+
samples.shift();
|
|
22978
|
+
}
|
|
22979
|
+
samples.push(ms);
|
|
22980
|
+
sorted = false;
|
|
22981
|
+
},
|
|
22982
|
+
snapshot() {
|
|
22983
|
+
if (samples.length === 0) {
|
|
22984
|
+
return { p50: 0, p95: 0, p99: 0, count: 0, mean: 0 };
|
|
22985
|
+
}
|
|
22986
|
+
let sum = 0;
|
|
22987
|
+
for (const s2 of samples)
|
|
22988
|
+
sum += s2;
|
|
22989
|
+
return {
|
|
22990
|
+
p50: percentile(50),
|
|
22991
|
+
p95: percentile(95),
|
|
22992
|
+
p99: percentile(99),
|
|
22993
|
+
count: samples.length,
|
|
22994
|
+
mean: Math.round(sum / samples.length)
|
|
22995
|
+
};
|
|
22996
|
+
},
|
|
22997
|
+
get count() {
|
|
22998
|
+
return samples.length;
|
|
22999
|
+
}
|
|
23000
|
+
};
|
|
23001
|
+
}
|
|
23002
|
+
function createAnalyticsCollector(errorCapacity = 500) {
|
|
23003
|
+
const endpoints = new Map;
|
|
23004
|
+
const actors = new Map;
|
|
23005
|
+
const providers = new Map;
|
|
23006
|
+
const connectors = new Map;
|
|
23007
|
+
const errorBuffer = [];
|
|
23008
|
+
const histograms = {
|
|
23009
|
+
remember: createLatencyHistogram(),
|
|
23010
|
+
recall: createLatencyHistogram(),
|
|
23011
|
+
mutate: createLatencyHistogram(),
|
|
23012
|
+
jobs: createLatencyHistogram()
|
|
23013
|
+
};
|
|
23014
|
+
function classifyActor(path) {
|
|
23015
|
+
if (path.includes("/remember") || path.includes("/save")) {
|
|
23016
|
+
return "remembers";
|
|
23017
|
+
}
|
|
23018
|
+
if (path.includes("/recall") || path.includes("/search") || path.includes("/similar")) {
|
|
23019
|
+
return "recalls";
|
|
23020
|
+
}
|
|
23021
|
+
if (path.includes("/modify") || path.includes("/forget") || path.includes("/recover")) {
|
|
23022
|
+
return "mutations";
|
|
23023
|
+
}
|
|
23024
|
+
return "requests";
|
|
23025
|
+
}
|
|
23026
|
+
return {
|
|
23027
|
+
recordRequest(method, path, status, durationMs, actor) {
|
|
23028
|
+
const key = `${method} ${path}`;
|
|
23029
|
+
let ep = endpoints.get(key);
|
|
23030
|
+
if (!ep) {
|
|
23031
|
+
ep = { count: 0, errors: 0, totalLatencyMs: 0 };
|
|
23032
|
+
endpoints.set(key, ep);
|
|
23033
|
+
}
|
|
23034
|
+
ep.count++;
|
|
23035
|
+
ep.totalLatencyMs += durationMs;
|
|
23036
|
+
if (status >= 400)
|
|
23037
|
+
ep.errors++;
|
|
23038
|
+
if (actor) {
|
|
23039
|
+
let a2 = actors.get(actor);
|
|
23040
|
+
if (!a2) {
|
|
23041
|
+
a2 = { requests: 0, remembers: 0, recalls: 0, mutations: 0 };
|
|
23042
|
+
actors.set(actor, a2);
|
|
23043
|
+
}
|
|
23044
|
+
const field = classifyActor(path);
|
|
23045
|
+
if (field === "requests")
|
|
23046
|
+
a2.requests++;
|
|
23047
|
+
else
|
|
23048
|
+
a2[field]++;
|
|
23049
|
+
}
|
|
23050
|
+
},
|
|
23051
|
+
recordProvider(provider, durationMs, success) {
|
|
23052
|
+
let p2 = providers.get(provider);
|
|
23053
|
+
if (!p2) {
|
|
23054
|
+
p2 = { calls: 0, failures: 0, totalLatencyMs: 0 };
|
|
23055
|
+
providers.set(provider, p2);
|
|
23056
|
+
}
|
|
23057
|
+
p2.calls++;
|
|
23058
|
+
p2.totalLatencyMs += durationMs;
|
|
23059
|
+
if (!success)
|
|
23060
|
+
p2.failures++;
|
|
23061
|
+
},
|
|
23062
|
+
recordConnector(connectorId, event, count = 1) {
|
|
23063
|
+
let cs = connectors.get(connectorId);
|
|
23064
|
+
if (!cs) {
|
|
23065
|
+
cs = { syncs: 0, errors: 0, documentsProcessed: 0 };
|
|
23066
|
+
connectors.set(connectorId, cs);
|
|
23067
|
+
}
|
|
23068
|
+
if (event === "sync")
|
|
23069
|
+
cs.syncs += count;
|
|
23070
|
+
else if (event === "error")
|
|
23071
|
+
cs.errors += count;
|
|
23072
|
+
else
|
|
23073
|
+
cs.documentsProcessed += count;
|
|
23074
|
+
},
|
|
23075
|
+
recordError(entry) {
|
|
23076
|
+
if (errorBuffer.length >= errorCapacity) {
|
|
23077
|
+
errorBuffer.shift();
|
|
23078
|
+
}
|
|
23079
|
+
errorBuffer.push(entry);
|
|
23080
|
+
},
|
|
23081
|
+
recordLatency(operation, ms) {
|
|
23082
|
+
histograms[operation].record(ms);
|
|
23083
|
+
},
|
|
23084
|
+
getUsage() {
|
|
23085
|
+
return {
|
|
23086
|
+
endpoints: Object.fromEntries(endpoints),
|
|
23087
|
+
actors: Object.fromEntries(actors),
|
|
23088
|
+
providers: Object.fromEntries(providers),
|
|
23089
|
+
connectors: Object.fromEntries(connectors)
|
|
23090
|
+
};
|
|
23091
|
+
},
|
|
23092
|
+
getErrors(opts) {
|
|
23093
|
+
const limit = opts?.limit ?? 50;
|
|
23094
|
+
const stage = opts?.stage;
|
|
23095
|
+
const since = opts?.since;
|
|
23096
|
+
let filtered = errorBuffer;
|
|
23097
|
+
if (stage) {
|
|
23098
|
+
filtered = filtered.filter((e) => e.stage === stage);
|
|
23099
|
+
}
|
|
23100
|
+
if (since) {
|
|
23101
|
+
filtered = filtered.filter((e) => e.timestamp >= since);
|
|
23102
|
+
}
|
|
23103
|
+
return filtered.slice(-limit);
|
|
23104
|
+
},
|
|
23105
|
+
getErrorSummary() {
|
|
23106
|
+
const counts = {};
|
|
23107
|
+
for (const e of errorBuffer) {
|
|
23108
|
+
counts[e.code] = (counts[e.code] ?? 0) + 1;
|
|
23109
|
+
}
|
|
23110
|
+
return counts;
|
|
23111
|
+
},
|
|
23112
|
+
getLatency() {
|
|
23113
|
+
return {
|
|
23114
|
+
remember: histograms.remember.snapshot(),
|
|
23115
|
+
recall: histograms.recall.snapshot(),
|
|
23116
|
+
mutate: histograms.mutate.snapshot(),
|
|
23117
|
+
jobs: histograms.jobs.snapshot()
|
|
23118
|
+
};
|
|
23119
|
+
},
|
|
23120
|
+
reset() {
|
|
23121
|
+
endpoints.clear();
|
|
23122
|
+
actors.clear();
|
|
23123
|
+
providers.clear();
|
|
23124
|
+
connectors.clear();
|
|
23125
|
+
errorBuffer.length = 0;
|
|
23126
|
+
for (const key of Object.keys(histograms)) {
|
|
23127
|
+
histograms[key] = createLatencyHistogram();
|
|
23128
|
+
}
|
|
23129
|
+
}
|
|
23130
|
+
};
|
|
23131
|
+
}
|
|
23132
|
+
|
|
23133
|
+
// ../daemon/src/timeline.ts
|
|
23134
|
+
function historyToEvents(rows) {
|
|
23135
|
+
return rows.map((r2) => ({
|
|
23136
|
+
timestamp: r2.created_at,
|
|
23137
|
+
source: "history",
|
|
23138
|
+
event: r2.event,
|
|
23139
|
+
details: {
|
|
23140
|
+
changedBy: r2.changed_by,
|
|
23141
|
+
reason: r2.reason,
|
|
23142
|
+
hasOldContent: r2.old_content !== null,
|
|
23143
|
+
hasNewContent: r2.new_content !== null,
|
|
23144
|
+
...r2.metadata ? tryParseJson(r2.metadata) : {}
|
|
23145
|
+
}
|
|
23146
|
+
}));
|
|
23147
|
+
}
|
|
23148
|
+
function jobToEvents(rows) {
|
|
23149
|
+
const events = [];
|
|
23150
|
+
for (const j2 of rows) {
|
|
23151
|
+
events.push({
|
|
23152
|
+
timestamp: j2.created_at,
|
|
23153
|
+
source: "job",
|
|
23154
|
+
event: `job:${j2.job_type}:created`,
|
|
23155
|
+
details: { jobId: j2.id, status: j2.status }
|
|
23156
|
+
});
|
|
23157
|
+
if (j2.leased_at) {
|
|
23158
|
+
events.push({
|
|
23159
|
+
timestamp: j2.leased_at,
|
|
23160
|
+
source: "job",
|
|
23161
|
+
event: `job:${j2.job_type}:leased`,
|
|
23162
|
+
details: { jobId: j2.id, attempt: j2.attempts }
|
|
23163
|
+
});
|
|
23164
|
+
}
|
|
23165
|
+
if (j2.completed_at) {
|
|
23166
|
+
events.push({
|
|
23167
|
+
timestamp: j2.completed_at,
|
|
23168
|
+
source: "job",
|
|
23169
|
+
event: `job:${j2.job_type}:completed`,
|
|
23170
|
+
details: { jobId: j2.id }
|
|
23171
|
+
});
|
|
23172
|
+
}
|
|
23173
|
+
if (j2.failed_at) {
|
|
23174
|
+
events.push({
|
|
23175
|
+
timestamp: j2.failed_at,
|
|
23176
|
+
source: "job",
|
|
23177
|
+
event: `job:${j2.job_type}:failed`,
|
|
23178
|
+
details: { jobId: j2.id, error: j2.error, attempt: j2.attempts }
|
|
23179
|
+
});
|
|
23180
|
+
}
|
|
23181
|
+
}
|
|
23182
|
+
return events;
|
|
23183
|
+
}
|
|
23184
|
+
function logToEvents(entries) {
|
|
23185
|
+
return entries.map((e) => ({
|
|
23186
|
+
timestamp: e.timestamp,
|
|
23187
|
+
source: "log",
|
|
23188
|
+
event: `log:${e.level}:${e.category}`,
|
|
23189
|
+
details: {
|
|
23190
|
+
message: e.message,
|
|
23191
|
+
...e.data ?? {},
|
|
23192
|
+
...e.duration !== undefined ? { durationMs: e.duration } : {}
|
|
23193
|
+
}
|
|
23194
|
+
}));
|
|
23195
|
+
}
|
|
23196
|
+
function errorToEvents(entries) {
|
|
23197
|
+
return entries.map((e) => ({
|
|
23198
|
+
timestamp: e.timestamp,
|
|
23199
|
+
source: "error",
|
|
23200
|
+
event: `error:${e.stage}:${e.code}`,
|
|
23201
|
+
details: {
|
|
23202
|
+
message: e.message,
|
|
23203
|
+
...e.requestId ? { requestId: e.requestId } : {},
|
|
23204
|
+
...e.memoryId ? { memoryId: e.memoryId } : {},
|
|
23205
|
+
...e.actor ? { actor: e.actor } : {}
|
|
23206
|
+
}
|
|
23207
|
+
}));
|
|
23208
|
+
}
|
|
23209
|
+
function tryParseJson(s2) {
|
|
23210
|
+
try {
|
|
23211
|
+
const parsed = JSON.parse(s2);
|
|
23212
|
+
if (typeof parsed === "object" && parsed !== null)
|
|
23213
|
+
return parsed;
|
|
23214
|
+
} catch {}
|
|
23215
|
+
return {};
|
|
23216
|
+
}
|
|
23217
|
+
function detectEntityType(db, id) {
|
|
23218
|
+
const historyHit = db.prepare("SELECT 1 FROM memory_history WHERE memory_id = ? LIMIT 1").get(id);
|
|
23219
|
+
if (historyHit)
|
|
23220
|
+
return { type: "memory", memoryId: id };
|
|
23221
|
+
const memoryHit = db.prepare("SELECT 1 FROM memories WHERE id = ? LIMIT 1").get(id);
|
|
23222
|
+
if (memoryHit)
|
|
23223
|
+
return { type: "memory", memoryId: id };
|
|
23224
|
+
const jobHit = db.prepare("SELECT memory_id FROM memory_jobs WHERE id = ? LIMIT 1").get(id);
|
|
23225
|
+
if (jobHit)
|
|
23226
|
+
return { type: "memory", memoryId: jobHit.memory_id };
|
|
23227
|
+
return { type: "unknown" };
|
|
23228
|
+
}
|
|
23229
|
+
function buildTimeline(sources, entityId) {
|
|
23230
|
+
const { db, getRecentLogs, getRecentErrors } = sources;
|
|
23231
|
+
const detection = detectEntityType(db, entityId);
|
|
23232
|
+
const allEvents = [];
|
|
23233
|
+
if (detection.memoryId) {
|
|
23234
|
+
const historyRows = db.prepare(`SELECT memory_id, event, old_content, new_content,
|
|
23235
|
+
changed_by, reason, metadata, created_at
|
|
23236
|
+
FROM memory_history
|
|
23237
|
+
WHERE memory_id = ?
|
|
23238
|
+
ORDER BY created_at ASC`).all(detection.memoryId);
|
|
23239
|
+
allEvents.push(...historyToEvents(historyRows));
|
|
23240
|
+
const jobRows = db.prepare(`SELECT id, memory_id, job_type, status, attempts,
|
|
23241
|
+
error, created_at, updated_at, leased_at,
|
|
23242
|
+
completed_at, failed_at
|
|
23243
|
+
FROM memory_jobs
|
|
23244
|
+
WHERE memory_id = ?
|
|
23245
|
+
ORDER BY created_at ASC`).all(detection.memoryId);
|
|
23246
|
+
allEvents.push(...jobToEvents(jobRows));
|
|
23247
|
+
}
|
|
23248
|
+
const logs = getRecentLogs({ limit: 500 });
|
|
23249
|
+
const matchingLogs = logs.filter((l2) => {
|
|
23250
|
+
if (l2.data) {
|
|
23251
|
+
const vals = Object.values(l2.data);
|
|
23252
|
+
for (const v2 of vals) {
|
|
23253
|
+
if (typeof v2 === "string" && v2.includes(entityId))
|
|
23254
|
+
return true;
|
|
23255
|
+
}
|
|
23256
|
+
}
|
|
23257
|
+
return l2.message.includes(entityId);
|
|
23258
|
+
});
|
|
23259
|
+
allEvents.push(...logToEvents(matchingLogs));
|
|
23260
|
+
const errors2 = getRecentErrors({ limit: 500 });
|
|
23261
|
+
const matchingErrors = errors2.filter((e) => e.memoryId === entityId || e.requestId === entityId || e.message.includes(entityId));
|
|
23262
|
+
allEvents.push(...errorToEvents(matchingErrors));
|
|
23263
|
+
allEvents.sort((a2, b2) => a2.timestamp.localeCompare(b2.timestamp));
|
|
23264
|
+
return {
|
|
23265
|
+
entityType: detection.type,
|
|
23266
|
+
entityId,
|
|
23267
|
+
events: allEvents,
|
|
23268
|
+
generatedAt: new Date().toISOString()
|
|
23269
|
+
};
|
|
23270
|
+
}
|
|
22910
23271
|
// ../daemon/src/auth/tokens.ts
|
|
22911
23272
|
import { readFileSync as readFileSync6, writeFileSync as writeFileSync2, existsSync as existsSync8, mkdirSync as mkdirSync4 } from "fs";
|
|
22912
23273
|
import { dirname as dirname5 } from "path";
|
|
@@ -22989,7 +23350,8 @@ var PERMISSION_MATRIX = {
|
|
|
22989
23350
|
"admin",
|
|
22990
23351
|
"documents",
|
|
22991
23352
|
"connectors",
|
|
22992
|
-
"diagnostics"
|
|
23353
|
+
"diagnostics",
|
|
23354
|
+
"analytics"
|
|
22993
23355
|
],
|
|
22994
23356
|
operator: [
|
|
22995
23357
|
"remember",
|
|
@@ -22999,7 +23361,8 @@ var PERMISSION_MATRIX = {
|
|
|
22999
23361
|
"recover",
|
|
23000
23362
|
"documents",
|
|
23001
23363
|
"connectors",
|
|
23002
|
-
"diagnostics"
|
|
23364
|
+
"diagnostics",
|
|
23365
|
+
"analytics"
|
|
23003
23366
|
],
|
|
23004
23367
|
agent: ["remember", "recall", "modify", "forget", "recover", "documents"],
|
|
23005
23368
|
readonly: ["recall"]
|
|
@@ -23871,6 +24234,7 @@ var SCRIPTS_DIR = join13(AGENTS_DIR3, "scripts");
|
|
|
23871
24234
|
var PORT = parseInt(process.env.SIGNET_PORT || "3850", 10);
|
|
23872
24235
|
var HOST = process.env.SIGNET_HOST || "localhost";
|
|
23873
24236
|
var providerTracker = createProviderTracker();
|
|
24237
|
+
var analyticsCollector = createAnalyticsCollector();
|
|
23874
24238
|
var repairLimiter = createRateLimiter();
|
|
23875
24239
|
var authConfig = parseAuthConfig(undefined, AGENTS_DIR3);
|
|
23876
24240
|
var authSecret = null;
|
|
@@ -24240,6 +24604,16 @@ app.use("*", async (c2, next) => {
|
|
|
24240
24604
|
await next();
|
|
24241
24605
|
const duration = Date.now() - start;
|
|
24242
24606
|
logger.api.request(c2.req.method, c2.req.path, c2.res.status, duration);
|
|
24607
|
+
const actor = c2.req.header("x-signet-actor");
|
|
24608
|
+
analyticsCollector.recordRequest(c2.req.method, c2.req.path, c2.res.status, duration, actor ?? undefined);
|
|
24609
|
+
const p2 = c2.req.path;
|
|
24610
|
+
if (p2.includes("/remember") || p2.includes("/save")) {
|
|
24611
|
+
analyticsCollector.recordLatency("remember", duration);
|
|
24612
|
+
} else if (p2.includes("/recall") || p2.includes("/search") || p2.includes("/similar")) {
|
|
24613
|
+
analyticsCollector.recordLatency("recall", duration);
|
|
24614
|
+
} else if (p2.includes("/modify") || p2.includes("/forget") || p2.includes("/recover")) {
|
|
24615
|
+
analyticsCollector.recordLatency("mutate", duration);
|
|
24616
|
+
}
|
|
24243
24617
|
});
|
|
24244
24618
|
app.get("/health", (c2) => {
|
|
24245
24619
|
return c2.json({
|
|
@@ -24345,6 +24719,15 @@ app.use("/api/diagnostics", async (c2, next) => {
|
|
|
24345
24719
|
app.use("/api/diagnostics/*", async (c2, next) => {
|
|
24346
24720
|
return requirePermission("diagnostics", authConfig)(c2, next);
|
|
24347
24721
|
});
|
|
24722
|
+
app.use("/api/analytics", async (c2, next) => {
|
|
24723
|
+
return requirePermission("analytics", authConfig)(c2, next);
|
|
24724
|
+
});
|
|
24725
|
+
app.use("/api/analytics/*", async (c2, next) => {
|
|
24726
|
+
return requirePermission("analytics", authConfig)(c2, next);
|
|
24727
|
+
});
|
|
24728
|
+
app.use("/api/timeline/*", async (c2, next) => {
|
|
24729
|
+
return requirePermission("analytics", authConfig)(c2, next);
|
|
24730
|
+
});
|
|
24348
24731
|
app.use("/api/repair/*", async (c2, next) => {
|
|
24349
24732
|
return requirePermission("admin", authConfig)(c2, next);
|
|
24350
24733
|
});
|
|
@@ -27393,6 +27776,69 @@ app.post("/api/repair/retention-sweep", (c2) => {
|
|
|
27393
27776
|
message: "Use the maintenance worker for automated sweeps; manual sweep via this endpoint is not yet wired"
|
|
27394
27777
|
}, 501);
|
|
27395
27778
|
});
|
|
27779
|
+
app.get("/api/analytics/usage", (c2) => {
|
|
27780
|
+
return c2.json(analyticsCollector.getUsage());
|
|
27781
|
+
});
|
|
27782
|
+
app.get("/api/analytics/errors", (c2) => {
|
|
27783
|
+
const stage = c2.req.query("stage");
|
|
27784
|
+
const since = c2.req.query("since") ?? undefined;
|
|
27785
|
+
const limit = c2.req.query("limit") ? parseInt(c2.req.query("limit"), 10) : undefined;
|
|
27786
|
+
return c2.json({
|
|
27787
|
+
errors: analyticsCollector.getErrors({ stage, since, limit }),
|
|
27788
|
+
summary: analyticsCollector.getErrorSummary()
|
|
27789
|
+
});
|
|
27790
|
+
});
|
|
27791
|
+
app.get("/api/analytics/latency", (c2) => {
|
|
27792
|
+
return c2.json(analyticsCollector.getLatency());
|
|
27793
|
+
});
|
|
27794
|
+
app.get("/api/analytics/logs", (c2) => {
|
|
27795
|
+
const limit = parseInt(c2.req.query("limit") || "100", 10);
|
|
27796
|
+
const level = c2.req.query("level");
|
|
27797
|
+
const category = c2.req.query("category");
|
|
27798
|
+
const since = c2.req.query("since") ? new Date(c2.req.query("since")) : undefined;
|
|
27799
|
+
const logs = logger.getRecent({ limit, level, category, since });
|
|
27800
|
+
return c2.json({ logs, count: logs.length });
|
|
27801
|
+
});
|
|
27802
|
+
app.get("/api/analytics/memory-safety", (c2) => {
|
|
27803
|
+
const mutationHealth = getDbAccessor().withReadDb((db) => getDiagnostics(db, providerTracker));
|
|
27804
|
+
const recentMutationErrors = analyticsCollector.getErrors({
|
|
27805
|
+
stage: "mutation",
|
|
27806
|
+
limit: 50
|
|
27807
|
+
});
|
|
27808
|
+
return c2.json({
|
|
27809
|
+
mutation: mutationHealth.mutation,
|
|
27810
|
+
recentErrors: recentMutationErrors,
|
|
27811
|
+
errorSummary: analyticsCollector.getErrorSummary()
|
|
27812
|
+
});
|
|
27813
|
+
});
|
|
27814
|
+
app.get("/api/timeline/:id", (c2) => {
|
|
27815
|
+
const entityId = c2.req.param("id");
|
|
27816
|
+
const timeline = getDbAccessor().withReadDb((db) => buildTimeline({
|
|
27817
|
+
db,
|
|
27818
|
+
getRecentLogs: (opts) => logger.getRecent({ limit: opts.limit }),
|
|
27819
|
+
getRecentErrors: (opts) => analyticsCollector.getErrors({ limit: opts?.limit })
|
|
27820
|
+
}, entityId));
|
|
27821
|
+
return c2.json(timeline);
|
|
27822
|
+
});
|
|
27823
|
+
app.get("/api/timeline/:id/export", (c2) => {
|
|
27824
|
+
const entityId = c2.req.param("id");
|
|
27825
|
+
const timeline = getDbAccessor().withReadDb((db) => {
|
|
27826
|
+
const sources = {
|
|
27827
|
+
db,
|
|
27828
|
+
getRecentLogs: (opts) => logger.getRecent({ limit: opts.limit }),
|
|
27829
|
+
getRecentErrors: (opts) => analyticsCollector.getErrors({ limit: opts?.limit })
|
|
27830
|
+
};
|
|
27831
|
+
return buildTimeline(sources, entityId);
|
|
27832
|
+
});
|
|
27833
|
+
return c2.json({
|
|
27834
|
+
meta: {
|
|
27835
|
+
version: CURRENT_VERSION,
|
|
27836
|
+
exportedAt: new Date().toISOString(),
|
|
27837
|
+
entityId
|
|
27838
|
+
},
|
|
27839
|
+
timeline
|
|
27840
|
+
});
|
|
27841
|
+
});
|
|
27396
27842
|
var dashboardPath = getDashboardPath();
|
|
27397
27843
|
function setupStaticServing() {
|
|
27398
27844
|
if (dashboardPath) {
|
|
@@ -28376,7 +28822,7 @@ async function main() {
|
|
|
28376
28822
|
if (rl.admin)
|
|
28377
28823
|
authAdminLimiter = new AuthRateLimiter(rl.admin.windowMs, rl.admin.max);
|
|
28378
28824
|
if (memoryCfg.pipelineV2.enabled || memoryCfg.pipelineV2.shadowMode) {
|
|
28379
|
-
startPipeline(getDbAccessor(), memoryCfg.pipelineV2, memoryCfg.embedding, fetchEmbedding, memoryCfg.search, providerTracker);
|
|
28825
|
+
startPipeline(getDbAccessor(), memoryCfg.pipelineV2, memoryCfg.embedding, fetchEmbedding, memoryCfg.search, providerTracker, analyticsCollector);
|
|
28380
28826
|
} else {
|
|
28381
28827
|
startRetentionWorker(getDbAccessor(), DEFAULT_RETENTION);
|
|
28382
28828
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b8 as he,b9 as mt,aK as A,L as U,ay as T,aJ as te,ba as _t}from"./BgyhSYBR.js";import{o as qe}from"./CSXJCotK.js";const V=[];function Se(e,t=he){let n=null;const r=new Set;function a(o){if(mt(e,o)&&(e=o,n)){const l=!V.length;for(const c of r)c[1](),V.push(c,e);if(l){for(let c=0;c<V.length;c+=2)V[c][0](V[c+1]);V.length=0}}}function i(o){a(o(e))}function s(o,l=he){const c=[o,l];return r.add(c),r.size===1&&(n=t(a,i)||he),o(e),()=>{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:a,update:i,subscribe:s}}class Ee{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class Re{constructor(t,n){this.status=t,this.location=n}}class xe extends Error{constructor(t,n,r){super(r),this.status=t,this.text=n}}new URL("sveltekit-internal://");function wt(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function vt(e){return e.split("%25").map(decodeURI).join("%25")}function yt(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function pe({href:e}){return e.split("#")[0]}function bt(e,t,n,r=!1){const a=new URL(e);Object.defineProperty(a,"searchParams",{value:new Proxy(a.searchParams,{get(s,o){if(o==="get"||o==="getAll"||o==="has")return(c,...d)=>(n(c),s[o](c,...d));t();const l=Reflect.get(s,o);return typeof l=="function"?l.bind(s):l}}),enumerable:!0,configurable:!0});const i=["href","pathname","search","toString","toJSON"];r&&i.push("hash");for(const s of i)Object.defineProperty(a,s,{get(){return t(),e[s]},enumerable:!0,configurable:!0});return a}function kt(...e){let t=5381;for(const n of e)if(typeof n=="string"){let r=n.length;for(;r;)t=t*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)t=t*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;new TextDecoder;function St(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const Et=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:t?.method||"GET")!=="GET"&&M.delete(Le(e)),Et(e,t));const M=new Map;function Rt(e,t){const n=Le(e,t),r=document.querySelector(n);if(r?.textContent){r.remove();let{body:a,...i}=JSON.parse(r.textContent);const s=r.getAttribute("data-ttl");return s&&M.set(n,{body:a,init:i,ttl:1e3*Number(s)}),r.getAttribute("data-b64")!==null&&(a=St(a)),Promise.resolve(new Response(a,i))}return window.fetch(e,t)}function xt(e,t,n){if(M.size>0){const r=Le(e,n),a=M.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(n?.cache))return new Response(a.body,a.init);M.delete(r)}}return window.fetch(t,n)}function Le(e,t){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t?.headers||t?.body){const a=[];t.headers&&a.push([...new Headers(t.headers)].join(",")),t.body&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&a.push(t.body),r+=`[data-hash="${kt(...a)}"]`}return r}const Lt=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function At(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${Tt(e).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return t.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const i=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(i)return t.push({name:i[1],matcher:i[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const s=r.split(/\[(.+?)\](?!\])/);return"/"+s.map((l,c)=>{if(c%2){if(l.startsWith("x+"))return ge(String.fromCharCode(parseInt(l.slice(2),16)));if(l.startsWith("u+"))return ge(String.fromCharCode(...l.slice(2).split("-").map(w=>parseInt(w,16))));const d=Lt.exec(l),[,p,f,u,h]=d;return t.push({name:u,matcher:h,optional:!!p,rest:!!f,chained:f?c===1&&s[0]==="":!1}),f?"([^]*?)":p?"([^/]*)?":"([^/]+?)"}return ge(l)}).join("")}).join("")}/?$`),params:t}}function Ut(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function Tt(e){return e.slice(1).split("/").filter(Ut)}function Pt(e,t,n){const r={},a=e.slice(1),i=a.filter(o=>o!==void 0);let s=0;for(let o=0;o<t.length;o+=1){const l=t[o];let c=a[o-s];if(l.chained&&l.rest&&s&&(c=a.slice(o-s,o+1).filter(d=>d).join("/"),s=0),c===void 0)if(l.rest)c="";else continue;if(!l.matcher||n[l.matcher](c)){r[l.name]=c;const d=t[o+1],p=a[o+1];d&&!d.rest&&d.optional&&p&&l.chained&&(s=0),!d&&!p&&Object.keys(r).length===i.length&&(s=0);continue}if(l.optional&&l.chained){s++;continue}return}if(!s)return r}function ge(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function It({nodes:e,server_loads:t,dictionary:n,matchers:r}){const a=new Set(t);return Object.entries(n).map(([o,[l,c,d]])=>{const{pattern:p,params:f}=At(o),u={id:o,exec:h=>{const w=p.exec(h);if(w)return Pt(w,f,r)},errors:[1,...d||[]].map(h=>e[h]),layouts:[0,...c||[]].map(s),leaf:i(l)};return u.errors.length=u.layouts.length=Math.max(u.errors.length,u.layouts.length),u});function i(o){const l=o<0;return l&&(o=~o),[l,e[o]]}function s(o){return o===void 0?o:[a.has(o),e[o]]}}function He(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function De(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}const x=globalThis.__sveltekit_1wgbgdw?.base??"",Ot=globalThis.__sveltekit_1wgbgdw?.assets??x??"",$t="1771689448718",Je="sveltekit:snapshot",We="sveltekit:scroll",Ye="sveltekit:states",Ct="sveltekit:pageurl",B="sveltekit:history",H="sveltekit:navigation",N={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},Ae=location.origin;function Xe(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function q(){return{x:pageXOffset,y:pageYOffset}}function K(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const Ve={...N,"":N.hover};function Qe(e){let t=e.assignedSlot??e.parentNode;return t?.nodeType===11&&(t=t.host),t}function Ze(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=Qe(e)}}function we(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const o=location.hash.split("#")[1]||"/";r.hash=`#${o}${r.hash}`}}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,i=!r||!!a||ue(r,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),s=r?.origin===Ae&&e.hasAttribute("download");return{url:r,external:i,target:a,download:s}}function ne(e){let t=null,n=null,r=null,a=null,i=null,s=null,o=e;for(;o&&o!==document.documentElement;)r===null&&(r=K(o,"preload-code")),a===null&&(a=K(o,"preload-data")),t===null&&(t=K(o,"keepfocus")),n===null&&(n=K(o,"noscroll")),i===null&&(i=K(o,"reload")),s===null&&(s=K(o,"replacestate")),o=Qe(o);function l(c){switch(c){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Ve[r??"off"],preload_data:Ve[a??"off"],keepfocus:l(t),noscroll:l(n),reload:l(i),replace_state:l(s)}}function Ke(e){const t=Se(e);let n=!0;function r(){n=!0,t.update(s=>s)}function a(s){n=!1,t.set(s)}function i(s){let o;return t.subscribe(l=>{(o===void 0||n&&l!==o)&&s(o=l)})}return{notify:r,set:a,subscribe:i}}const et={v:()=>{}};function Nt(){const{set:e,subscribe:t}=Se(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${Ot}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const s=(await a.json()).version!==$t;return s&&(e(!0),et.v(),clearTimeout(n)),s}catch{return!1}}return{subscribe:t,check:r}}function ue(e,t,n){return e.origin!==Ae||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function fn(e){}const tt=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...tt];const jt=new Set([...tt]);[...jt];function qt(e){return e.filter(t=>t!=null)}function Ue(e){return e instanceof Ee||e instanceof xe?e.status:500}function Dt(e){return e instanceof xe?e.text:"Internal Error"}let k,J,me;const Vt=qe.toString().includes("$$")||/function \w+\(\) \{\}/.test(qe.toString());Vt?(k={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL("https://example.com")},J={current:null},me={current:!1}):(k=new class{#e=A({});get data(){return U(this.#e)}set data(t){T(this.#e,t)}#t=A(null);get form(){return U(this.#t)}set form(t){T(this.#t,t)}#n=A(null);get error(){return U(this.#n)}set error(t){T(this.#n,t)}#r=A({});get params(){return U(this.#r)}set params(t){T(this.#r,t)}#a=A({id:null});get route(){return U(this.#a)}set route(t){T(this.#a,t)}#o=A({});get state(){return U(this.#o)}set state(t){T(this.#o,t)}#s=A(-1);get status(){return U(this.#s)}set status(t){T(this.#s,t)}#i=A(new URL("https://example.com"));get url(){return U(this.#i)}set url(t){T(this.#i,t)}},J=new class{#e=A(null);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},me=new class{#e=A(!1);get current(){return U(this.#e)}set current(t){T(this.#e,t)}},et.v=()=>me.current=!0);function Kt(e){Object.assign(k,e)}const Be={spanContext(){return Bt},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this},addLink(){return this},addLinks(){return this}},Bt={traceId:"",spanId:"",traceFlags:0},Ft=new Set(["icon","shortcut icon","apple-touch-icon"]),C=He(We)??{},W=He(Je)??{},$={url:Ke({}),page:Ke({}),navigating:Se(null),updated:Nt()};function Te(e){C[e]=q()}function Gt(e,t){let n=e+1;for(;C[n];)delete C[n],n+=1;for(n=t+1;W[n];)delete W[n],n+=1}function Y(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function nt(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(x||"/");e&&await e.update()}}function Fe(){}let Pe,ve,re,P,ye,v;const ae=[],oe=[];let L=null;function be(){L?.fork?.then(e=>e?.discard()),L=null}const ee=new Map,rt=new Set,Mt=new Set,z=new Set;let _={branch:[],error:null,url:null},at=!1,se=!1,Ge=!0,X=!1,G=!1,ot=!1,Ie=!1,st,y,R,j;const ie=new Set,Me=new Map;async function gn(e,t,n){globalThis.__sveltekit_1wgbgdw?.data&&globalThis.__sveltekit_1wgbgdw.data,document.URL!==location.href&&(location.href=location.href),v=e,await e.hooks.init?.(),Pe=It(e),P=document.documentElement,ye=t,ve=e.nodes[0],re=e.nodes[1],ve(),re(),y=history.state?.[B],R=history.state?.[H],y||(y=R=Date.now(),history.replaceState({...history.state,[B]:y,[H]:R},""));const r=C[y];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await an(ye,n)):(await F({type:"enter",url:Xe(v.hash?ln(new URL(location.href)):location.href),replace_state:!0}),a()),rn()}function zt(){ae.length=0,Ie=!1}function it(e){oe.some(t=>t?.snapshot)&&(W[e]=oe.map(t=>t?.snapshot?.capture()))}function lt(e){W[e]?.forEach((t,n)=>{oe[n]?.snapshot?.restore(t)})}function ze(){Te(y),De(We,C),it(R),De(Je,W)}async function Ht(e,t,n,r){let a;t.invalidateAll&&be(),await F({type:"goto",url:Xe(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{t.invalidateAll&&(Ie=!0,a=[...Me.keys()]),t.invalidate&&t.invalidate.forEach(nn)}}),t.invalidateAll&&te().then(te).then(()=>{Me.forEach(({resource:i},s)=>{a?.includes(s)&&i.refresh?.()})})}async function Jt(e){if(e.id!==L?.id){be();const t={};ie.add(t),L={id:e.id,token:t,promise:ft({...e,preload:t}).then(n=>(ie.delete(t),n.type==="loaded"&&n.state.error&&be(),n)),fork:null}}return L.promise}async function _e(e){const t=(await fe(e,!1))?.route;t&&await Promise.all([...t.layouts,t.leaf].map(n=>n?.[1]()))}async function ct(e,t,n){_=e.state;const r=document.querySelector("style[data-sveltekit]");if(r&&r.remove(),Object.assign(k,e.props.page),st=new v.root({target:t,props:{...e.props,stores:$,components:oe},hydrate:n,sync:!1}),await Promise.resolve(),lt(R),n){const a={from:null,to:{params:_.params,route:{id:_.route?.id??null},url:new URL(location.href),scroll:C[y]??q()},willUnload:!1,type:"enter",complete:Promise.resolve()};z.forEach(i=>i(a))}se=!0}function le({url:e,params:t,branch:n,status:r,error:a,route:i,form:s}){let o="never";if(x&&(e.pathname===x||e.pathname===x+"/"))o="always";else for(const u of n)u?.slash!==void 0&&(o=u.slash);e.pathname=wt(e.pathname,o),e.search=e.search;const l={type:"loaded",state:{url:e,params:t,branch:n,error:a,route:i},props:{constructors:qt(n).map(u=>u.node.component),page:je(k)}};s!==void 0&&(l.props.form=s);let c={},d=!k,p=0;for(let u=0;u<Math.max(n.length,_.branch.length);u+=1){const h=n[u],w=_.branch[u];h?.data!==w?.data&&(d=!0),h&&(c={...c,...h.data},d&&(l.props[`data_${p}`]=c),p+=1)}return(!_.url||e.href!==_.url.href||_.error!==a||s!==void 0&&s!==k.form||d)&&(l.props.page={error:a,params:t,route:{id:i?.id??null},state:{},status:r,url:new URL(e),form:s??null,data:d?c:k.data}),l}async function Oe({loader:e,parent:t,url:n,params:r,route:a,server_data_node:i}){let s=null,o=!0;const l={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},c=await e();if(c.universal?.load){let d=function(...f){for(const u of f){const{href:h}=new URL(u,n);l.dependencies.add(h)}};const p={tracing:{enabled:!1,root:Be,current:Be},route:new Proxy(a,{get:(f,u)=>(o&&(l.route=!0),f[u])}),params:new Proxy(r,{get:(f,u)=>(o&&l.params.add(u),f[u])}),data:i?.data??null,url:bt(n,()=>{o&&(l.url=!0)},f=>{o&&l.search_params.add(f)},v.hash),async fetch(f,u){f instanceof Request&&(u={body:f.method==="GET"||f.method==="HEAD"?void 0:await f.blob(),cache:f.cache,credentials:f.credentials,headers:[...f.headers].length>0?f?.headers:void 0,integrity:f.integrity,keepalive:f.keepalive,method:f.method,mode:f.mode,redirect:f.redirect,referrer:f.referrer,referrerPolicy:f.referrerPolicy,signal:f.signal,...u});const{resolved:h,promise:w}=ut(f,u,n);return o&&d(h.href),w},setHeaders:()=>{},depends:d,parent(){return o&&(l.parent=!0),t()},untrack(f){o=!1;try{return f()}finally{o=!0}}};s=await c.universal.load.call(null,p)??null}return{node:c,loader:e,server:i,universal:c.universal?.load?{type:"data",data:s,uses:l}:null,data:s??i?.data??null,slash:c.universal?.trailingSlash??i?.slash}}function ut(e,t,n){let r=e instanceof Request?e.url:e;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const i=se?xt(r,a.href,t):Rt(r,t);return{resolved:a,promise:i}}function Wt(e,t,n,r,a,i){if(Ie)return!0;if(!a)return!1;if(a.parent&&e||a.route&&t||a.url&&n)return!0;for(const s of a.search_params)if(r.has(s))return!0;for(const s of a.params)if(i[s]!==_.params[s])return!0;for(const s of a.dependencies)if(ae.some(o=>o(new URL(s))))return!0;return!1}function $e(e,t){return e?.type==="data"?e:e?.type==="skip"?t??null:null}function Yt(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const r of n){const a=e.searchParams.getAll(r),i=t.searchParams.getAll(r);a.every(s=>i.includes(s))&&i.every(s=>a.includes(s))&&n.delete(r)}return n}function Xt({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:je(k),constructors:[]}}}async function ft({id:e,invalidating:t,url:n,params:r,route:a,preload:i}){if(L?.id===e)return ie.delete(L.token),L.promise;const{errors:s,layouts:o,leaf:l}=a,c=[...o,l];s.forEach(m=>m?.().catch(()=>{})),c.forEach(m=>m?.[1]().catch(()=>{}));const d=_.url?e!==ce(_.url):!1,p=_.route?a.id!==_.route.id:!1,f=Yt(_.url,n);let u=!1;const h=c.map(async(m,g)=>{if(!m)return;const S=_.branch[g];return m[1]===S?.loader&&!Wt(u,p,d,f,S.universal?.uses,r)?S:(u=!0,Oe({loader:m[1],url:n,params:r,route:a,parent:async()=>{const I={};for(let O=0;O<g;O+=1)Object.assign(I,(await h[O])?.data);return I},server_data_node:$e(m[0]?{type:"skip"}:null,m[0]?S?.server:void 0)}))});for(const m of h)m.catch(()=>{});const w=[];for(let m=0;m<c.length;m+=1)if(c[m])try{w.push(await h[m])}catch(g){if(g instanceof Re)return{type:"redirect",location:g.location};if(ie.has(i))return Xt({error:await Q(g,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let S=Ue(g),E;if(g instanceof Ee)E=g.body;else{if(await $.updated.check())return await nt(),await Y(n);E=await Q(g,{params:r,url:n,route:{id:a.id}})}const I=await Qt(m,w,s);return I?le({url:n,params:r,branch:w.slice(0,I.idx).concat(I.node),status:S,error:E,route:a}):await ht(n,{id:a.id},E,S)}else w.push(void 0);return le({url:n,params:r,branch:w,status:200,error:null,route:a,form:t?void 0:null})}async function Qt(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)r-=1;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function Ce({status:e,error:t,url:n,route:r}){const a={};let i=null;try{const s=await Oe({loader:ve,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:$e(i)}),o={node:await re(),loader:re,universal:null,server:null,data:null};return le({url:n,params:a,branch:[s,o],status:e,error:t,route:null})}catch(s){if(s instanceof Re)return Ht(new URL(s.location,location.href),{},0);throw s}}async function Zt(e){const t=e.href;if(ee.has(t))return ee.get(t);let n;try{const r=(async()=>{let a=await v.hooks.reroute({url:new URL(e),fetch:async(i,s)=>ut(i,s,e).promise})??e;if(typeof a=="string"){const i=new URL(e);v.hash?i.hash=a:i.pathname=a,a=i}return a})();ee.set(t,r),n=await r}catch{ee.delete(t);return}return n}async function fe(e,t){if(e&&!ue(e,x,v.hash)){const n=await Zt(e);if(!n)return;const r=en(n);for(const a of Pe){const i=a.exec(r);if(i)return{id:ce(e),invalidating:t,route:a,params:yt(i),url:e}}}}function en(e){return vt(v.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(x.length))||"/"}function ce(e){return(v.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function dt({url:e,type:t,intent:n,delta:r,event:a,scroll:i}){let s=!1;const o=Ne(_,n,e,t,i??null);r!==void 0&&(o.navigation.delta=r),a!==void 0&&(o.navigation.event=a);const l={...o.navigation,cancel:()=>{s=!0,o.reject(new Error("navigation cancelled"))}};return X||rt.forEach(c=>c(l)),s?null:o}async function F({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:i,state:s={},redirect_count:o=0,nav_token:l={},accept:c=Fe,block:d=Fe,event:p}){const f=j;j=l;const u=await fe(t,!1),h=e==="enter"?Ne(_,u,t,e):dt({url:t,type:e,delta:n?.delta,intent:u,scroll:n?.scroll,event:p});if(!h){d(),j===l&&(j=f);return}const w=y,m=R;c(),X=!0,se&&h.navigation.type!=="enter"&&$.navigating.set(J.current=h.navigation);let g=u&&await ft(u);if(!g){if(ue(t,x,v.hash))return await Y(t,i);g=await ht(t,{id:null},await Q(new xe(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,i)}if(t=u?.url||t,j!==l)return h.reject(new Error("navigation aborted")),!1;if(g.type==="redirect"){if(o<20){await F({type:e,url:new URL(g.location,t),popped:n,keepfocus:r,noscroll:a,replace_state:i,state:s,redirect_count:o+1,nav_token:l}),h.fulfil(void 0);return}g=await Ce({status:500,error:await Q(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else g.props.page.status>=400&&await $.updated.check()&&(await nt(),await Y(t,i));if(zt(),Te(w),it(m),g.props.page.url.pathname!==t.pathname&&(t.pathname=g.props.page.url.pathname),s=n?n.state:s,!n){const b=i?0:1,Z={[B]:y+=b,[H]:R+=b,[Ye]:s};(i?history.replaceState:history.pushState).call(history,Z,"",t),i||Gt(y,R)}const S=u&&L?.id===u.id?L.fork:null;L=null,g.props.page.state=s;let E;if(se){const b=(await Promise.all(Array.from(Mt,D=>D(h.navigation)))).filter(D=>typeof D=="function");if(b.length>0){let D=function(){b.forEach(de=>{z.delete(de)})};b.push(D),b.forEach(de=>{z.add(de)})}_=g.state,g.props.page&&(g.props.page.url=t);const Z=S&&await S;Z?E=Z.commit():(st.$set(g.props),Kt(g.props.page),E=_t?.()),ot=!0}else await ct(g,ye,!1);const{activeElement:I}=document;await E,await te(),await te();let O=null;if(Ge){const b=n?n.scroll:a?q():null;b?scrollTo(b.x,b.y):(O=t.hash&&document.getElementById(pt(t)))?O.scrollIntoView():scrollTo(0,0)}const gt=document.activeElement!==I&&document.activeElement!==document.body;!r&&!gt&&sn(t,!O),Ge=!0,g.props.page&&Object.assign(k,g.props.page),X=!1,e==="popstate"&<(R),h.fulfil(void 0),h.navigation.to&&(h.navigation.to.scroll=q()),z.forEach(b=>b(h.navigation)),$.navigating.set(J.current=null)}async function ht(e,t,n,r,a){return e.origin===Ae&&e.pathname===location.pathname&&!at?await Ce({status:r,error:n,url:e,route:t}):await Y(e,a)}function tn(){let e,t={element:void 0,href:void 0},n;P.addEventListener("mousemove",o=>{const l=o.target;clearTimeout(e),e=setTimeout(()=>{i(l,N.hover)},20)});function r(o){o.defaultPrevented||i(o.composedPath()[0],N.tap)}P.addEventListener("mousedown",r),P.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(o=>{for(const l of o)l.isIntersecting&&(_e(new URL(l.target.href)),a.unobserve(l.target))},{threshold:0});async function i(o,l){const c=Ze(o,P),d=c===t.element&&c?.href===t.href&&l>=n;if(!c||d)return;const{url:p,external:f,download:u}=we(c,x,v.hash);if(f||u)return;const h=ne(c),w=p&&ce(_.url)===ce(p);if(!(h.reload||w))if(l<=h.preload_data){t={element:c,href:c.href},n=N.tap;const m=await fe(p,!1);if(!m)return;Jt(m)}else l<=h.preload_code&&(t={element:c,href:c.href},n=l,_e(p))}function s(){a.disconnect();for(const o of P.querySelectorAll("a")){const{url:l,external:c,download:d}=we(o,x,v.hash);if(c||d)continue;const p=ne(o);p.reload||(p.preload_code===N.viewport&&a.observe(o),p.preload_code===N.eager&&_e(l))}}z.add(s),s()}function Q(e,t){if(e instanceof Ee)return e.body;const n=Ue(e),r=Dt(e);return v.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function nn(e){if(typeof e=="function")ae.push(e);else{const{href:t}=new URL(e,location.href);ae.push(n=>n.href===t)}}function rn(){history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let n=!1;if(ze(),!X){const r=Ne(_,void 0,null,"leave"),a={...r.navigation,cancel:()=>{n=!0,r.reject(new Error("navigation cancelled"))}};rt.forEach(i=>i(a))}n?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&ze()}),navigator.connection?.saveData||tn(),P.addEventListener("click",async t=>{if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const n=Ze(t.composedPath()[0],P);if(!n)return;const{url:r,external:a,target:i,download:s}=we(n,x,v.hash);if(!r)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const o=ne(n);if(!(n instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||s)return;const[c,d]=(v.hash?r.hash.replace(/^#/,""):r.href).split("#"),p=c===pe(location);if(a||o.reload&&(!p||!d)){dt({url:r,type:"link",event:t})?X=!0:t.preventDefault();return}if(d!==void 0&&p){const[,f]=_.url.href.split("#");if(f===d){if(t.preventDefault(),d===""||d==="top"&&n.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const u=n.ownerDocument.getElementById(decodeURIComponent(d));u&&(u.scrollIntoView(),u.focus())}return}if(G=!0,Te(y),e(r),!o.replace_state)return;G=!1}t.preventDefault(),await new Promise(f=>{requestAnimationFrame(()=>{setTimeout(f,0)}),setTimeout(f,100)}),await F({type:"link",url:r,keepfocus:o.keepfocus,noscroll:o.noscroll,replace_state:o.replace_state??r.href===location.href,event:t})}),P.addEventListener("submit",t=>{if(t.defaultPrevented)return;const n=HTMLFormElement.prototype.cloneNode.call(t.target),r=t.submitter;if((r?.formTarget||n.target)==="_blank"||(r?.formMethod||n.method)!=="get")return;const s=new URL(r?.hasAttribute("formaction")&&r?.formAction||n.action);if(ue(s,x,!1))return;const o=t.target,l=ne(o);if(l.reload)return;t.preventDefault(),t.stopPropagation();const c=new FormData(o,r);s.search=new URLSearchParams(c).toString(),F({type:"form",url:s,keepfocus:l.keepfocus,noscroll:l.noscroll,replace_state:l.replace_state??s.href===location.href,event:t})}),addEventListener("popstate",async t=>{if(!ke){if(t.state?.[B]){const n=t.state[B];if(j={},n===y)return;const r=C[n],a=t.state[Ye]??{},i=new URL(t.state[Ct]??location.href),s=t.state[H],o=_.url?pe(location)===pe(_.url):!1;if(s===R&&(ot||o)){a!==k.state&&(k.state=a),e(i),C[y]=q(),r&&scrollTo(r.x,r.y),y=n;return}const c=n-y;await F({type:"popstate",url:i,popped:{state:a,scroll:r,delta:c},accept:()=>{y=n,R=s},block:()=>{history.go(-c)},nav_token:j,event:t})}else if(!G){const n=new URL(location.href);e(n),v.hash&&location.reload()}}}),addEventListener("hashchange",()=>{G&&(G=!1,history.replaceState({...history.state,[B]:++y,[H]:R},"",location.href))});for(const t of document.querySelectorAll("link"))Ft.has(t.rel)&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&$.navigating.set(J.current=null)});function e(t){_.url=k.url=t,$.page.set(je(k)),$.page.notify()}}async function an(e,{status:t=200,error:n,node_ids:r,params:a,route:i,server_route:s,data:o,form:l}){at=!0;const c=new URL(location.href);let d;({params:a={},route:i={id:null}}=await fe(c,!1)||{}),d=Pe.find(({id:u})=>u===i.id);let p,f=!0;try{const u=r.map(async(w,m)=>{const g=o[m];return g?.uses&&(g.uses=on(g.uses)),Oe({loader:v.nodes[w],url:c,params:a,route:i,parent:async()=>{const S={};for(let E=0;E<m;E+=1)Object.assign(S,(await u[E]).data);return S},server_data_node:$e(g)})}),h=await Promise.all(u);if(d){const w=d.layouts;for(let m=0;m<w.length;m++)w[m]||h.splice(m,0,void 0)}p=le({url:c,params:a,branch:h,status:t,error:n,form:l,route:d??null})}catch(u){if(u instanceof Re){await Y(new URL(u.location,location.href));return}p=await Ce({status:Ue(u),error:await Q(u,{url:c,params:a,route:i}),url:c,route:i}),e.textContent="",f=!1}p.props.page&&(p.props.page.state={}),await ct(p,e,f)}function on(e){return{dependencies:new Set(e?.dependencies??[]),params:new Set(e?.params??[]),parent:!!e?.parent,route:!!e?.route,url:!!e?.url,search_params:new Set(e?.search_params??[])}}let ke=!1;function sn(e,t=!0){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const r=pt(e);if(r&&document.getElementById(r)){const{x:i,y:s}=q();setTimeout(()=>{const o=history.state;ke=!0,location.replace(new URL(`#${r}`,location.href)),history.replaceState(o,"",e),t&&scrollTo(i,s),ke=!1})}else{const i=document.body,s=i.getAttribute("tabindex");i.tabIndex=-1,i.focus({preventScroll:!0,focusVisible:!1}),s!==null?i.setAttribute("tabindex",s):i.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const i=[];for(let s=0;s<a.rangeCount;s+=1)i.push(a.getRangeAt(s));setTimeout(()=>{if(a.rangeCount===i.length){for(let s=0;s<a.rangeCount;s+=1){const o=i[s],l=a.getRangeAt(s);if(o.commonAncestorContainer!==l.commonAncestorContainer||o.startContainer!==l.startContainer||o.endContainer!==l.endContainer||o.startOffset!==l.startOffset||o.endOffset!==l.endOffset)return}a.removeAllRanges()}})}}}function Ne(e,t,n,r,a=null){let i,s;const o=new Promise((c,d)=>{i=c,s=d});return o.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:e.route?.id??null},url:e.url,scroll:q()},to:n&&{params:t?.params??null,route:{id:t?.route?.id??null},url:n,scroll:a},willUnload:!t,type:r,complete:o},fulfil:i,reject:s}}function je(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function ln(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function pt(e){let t;if(v.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{gn as a,fn as l,k as p,$ as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{l as o,a as r}from"../chunks/AGb2L2ZT.js";export{o as load_css,r as start};
|