@krate/runtime 0.3.0-beta.1 → 0.3.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- var __krate_exports=(()=>{var _=Object.defineProperty,De=Object.defineProperties,Ie=Object.getOwnPropertyDescriptor,Be=Object.getOwnPropertyDescriptors,Ke=Object.getOwnPropertyNames,ae=Object.getOwnPropertySymbols;var de=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable;var ue=(e,t,n)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pe=(e,t)=>{for(var n in t||(t={}))de.call(t,n)&&ue(e,n,t[n]);if(ae)for(var n of ae(t))We.call(t,n)&&ue(e,n,t[n]);return e},he=(e,t)=>De(e,Be(t));var Ve=(e,t)=>{for(var n in t)_(e,n,{get:t[n],enumerable:!0})},Ue=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of Ke(t))!de.call(e,l)&&l!==n&&_(e,l,{get:()=>t[l],enumerable:!(r=Ie(t,l))||r.enumerable});return e};var Fe=e=>Ue(_({},"__esModule",{value:!0}),e);var ft={};Ve(ft,{clearNodes:()=>Te,conditional:()=>it,createEffect:()=>w,createMemo:()=>Ge,createSignal:()=>Ee,disposeAll:()=>je,disposeNode:()=>v,forwardRef:()=>Je,h:()=>tt,hydrate:()=>ot,initRouter:()=>ke,insert:()=>et,mount:()=>nt,onCleanup:()=>Xe,onMount:()=>Ye,reconcile:()=>rt,reconcileTrees:()=>z,reinitRouter:()=>ct});var A=[],me=[],K=!1,M=new Set,W=[],O=!1;function ge(e){return{fn:e,cleanups:[],disposed:!1,sources:new Set,running:!1,rerun:!1,queued:!1}}function V(e){if(!e.disposed){e.disposed=!0;for(let t of e.sources)t.delete(e);e.sources.clear();for(let t of e.cleanups)t();e.cleanups.length=0}}function je(){for(let e of M)V(e);M.clear(),W.length=0,O=!1}function Ee(e){let t=e,n=new Set;return[()=>{let f=A[A.length-1];return f&&!f.disposed&&(n.add(f),f.sources.add(n)),t},f=>{let u=typeof f=="function"?f(t):f;if(u!==t){t=u;let E=Array.from(n);for(let h of E){if(h.disposed){n.delete(h);continue}if(h.running){h.rerun=!0;continue}h.queued||(h.queued=!0,W.push(h))}$e()}}]}function $e(){O||(O=!0,queueMicrotask(ze))}function ze(){O=!1;let e=W.splice(0);for(let t of e)t.disposed||(t.queued=!1,t.rerun=!1,q(t),t.rerun&&!t.disposed&&(t.rerun=!1,q(t)))}function q(e){e.running=!0;for(let t of e.cleanups)t();e.cleanups.length=0,A.push(e);try{let t=e.fn();typeof t=="function"&&e.cleanups.push(t)}finally{A.pop(),e.running=!1}}function w(e){let t=ge(e);return M.add(t),q(t),()=>{V(t),M.delete(t)}}function Xe(e){let t=A[A.length-1];t&&t.cleanups.push(e)}function Ye(e){me.push(e),K||(K=!0,queueMicrotask(Qe))}function Qe(){K=!1;let e=me.splice(0);for(let t of e)t()}function Ge(e){let[t,n]=Ee(void 0),r=ge(()=>{let f=e();n(f)});M.add(r),q(r);let l=A[A.length-1];return l&&l.cleanups.push(()=>{r.disposed||(V(r),M.delete(r))}),t}function Je(e){return t=>e(t,t.ref||(()=>{}))}var U=new WeakMap;function Ne(e,t){let n=U.get(e);n||(n=[],U.set(e,n)),n.push(t)}function v(e){let t=U.get(e);if(t){for(let n of t)n();t.length=0}for(let n=0;n<e.childNodes.length;n++)v(e.childNodes[n])}function Ze(e){let t=e.nextSibling;for(;t;){if(t.nodeType===8&&t.nodeValue==="k")return t;t=t.nextSibling}return null}function Te(e,t){let n=e.parentNode;if(!n)return;let r=e.nextSibling;for(;r&&r!==t;){let l=r.nextSibling;v(r),n.removeChild(r),r=l}}function et(e,t,n){let r=Ze(n);r?(Te(n,r),F(e,t,r)):F(e,t,null)}function F(e,t,n){if(!(t==null||t===!1||t===!0)){if(typeof t=="string"||typeof t=="number")e.insertBefore(document.createTextNode(String(t)),n);else if(t instanceof Node)e.insertBefore(t,n);else if(Array.isArray(t))for(let r of t)F(e,r,n)}}function ye(e,t,n){if(t==="class"||t==="className")n===!1||n===null||n===void 0?e.className="":e.className=String(n);else if(t==="style")typeof n=="string"?e.setAttribute("style",n):n&&typeof n=="object"&&Object.assign(e.style,n);else if(t.startsWith("on")&&typeof n=="function"){let r=t.slice(2).toLowerCase(),l=`__krate_${r}`,f=e[l];f&&e.removeEventListener(r,f),e.addEventListener(r,n),e[l]=n}else t==="ref"?typeof n=="function"&&n(e):t==="key"||n!=null&&n!==!1&&e.setAttribute(t,String(n))}function ve(e,t){if(!(t==null||t===!1||t===!0)){if(Array.isArray(t)){for(let n of t)ve(e,n);return}if(typeof t=="function"){let n=document.createTextNode("");e.appendChild(n),Ne(n,w(()=>{n.nodeValue=String(t())}));return}e.appendChild(t instanceof Node?t:document.createTextNode(String(t)))}}function tt(e,t,...n){if(typeof e=="function")return e(he(pe({},t||{}),{children:n}));let r=document.createElement(e);if(t)for(let[l,f]of Object.entries(t))typeof f=="function"&&!l.startsWith("on")?Ne(r,w(()=>ye(r,l,f()))):ye(r,l,f);for(let l of n)ve(r,l);return r}function be(e){if(typeof e=="string"){let t=document.querySelector(e);if(!t)throw new Error(`Container "${e}" not found`);return t}return e}function nt(e,t){let n=be(t),r=!1;w(()=>{r||(r=!0,n.appendChild(e()))})}function ot(e,t){let n=be(t);if(n.childNodes.length===0){n.appendChild(e());return}let r=e();r&&v(r)}function rt(e,t,n,r,l,f){let u=[],E=t.nextSibling;for(;E&&E!==n;)u.push(E),E=E.nextSibling;if(f){let h=new Map;for(let d of u){let a=d.__k;a!=null&&h.set(a,d)}let m=[],S=new Set;for(let d=0;d<r.length;d++){let a=r[d],g=f(a);S.add(g);let T=l(a,d);T.__k=g,m.push(T)}for(let[d,a]of h)!S.has(d)&&a.parentNode===e&&(v(a),e.removeChild(a));for(let d=0;d<m.length;d++){let a=m[d],g=d===0?t:m[d-1];a!==g.nextSibling&&e.insertBefore(a,g.nextSibling)}}else{let h=Math.max(u.length,r.length);for(let m=0;m<h;m++)if(m<r.length){let S=l(r[m],m);m<u.length?u[m]!==S&&(v(u[m]),e.replaceChild(S,u[m])):e.insertBefore(S,n)}else m<u.length&&u[m].parentNode===e&&(v(u[m]),e.removeChild(u[m]))}}function it(e,t,n,r,l,f){let u=null;w(()=>{let h=r()?l():f?f():null;u?h?(v(u),e.replaceChild(h,u)):(v(u),e.removeChild(u)):h&&e.insertBefore(h,n),u=h})}function C(e){if(e.nodeType===Node.COMMENT_NODE){let t=e.nodeValue||"";return t.indexOf("k:")===0?t:null}if(e.nodeType===Node.ELEMENT_NODE){let t=e,n=t.getAttribute("data-k");if(n)return n;let r=t.getAttribute("id");if(r)return"#"+r}return null}function Se(e,t){let n=new Set;for(let r=0;r<t.attributes.length;r++){let l=t.attributes[r].name,f=t.attributes[r].value;n.add(l),e.getAttribute(l)!==f&&e.setAttribute(l,f)}for(let r=0;r<e.attributes.length;r++){let l=e.attributes[r].name;n.has(l)||e.removeAttribute(l)}}function j(e,t){let n=document.importNode(t,!0);return e.parentNode&&(v(e),e.parentNode.replaceChild(n,e)),n}function xe(e,t){return e.nodeType!==t.nodeType?!1:e.nodeType===Node.ELEMENT_NODE?e.tagName===t.tagName:!0}function $(e,t){if(!xe(e,t))return j(e,t);if(e.nodeType===Node.TEXT_NODE)return e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e;if(e.nodeType===Node.COMMENT_NODE)return e.nodeValue!==t.nodeValue?j(e,t):e;if(e.nodeType!==Node.ELEMENT_NODE)return e;let n=e,r=t;return C(n)!==C(r)?j(n,r):(Se(n,r),Ae(n,r),n)}function Ae(e,t){let n=Array.from(e.childNodes),r=Array.from(t.childNodes);if(n.length===r.length){let d=!0;for(let a=0;a<r.length;a++)if(C(n[a])!==C(r[a])){d=!1;break}if(d){for(let a=0;a<r.length;a++)$(n[a],r[a]);return}}let l=new Map,f=[];n.forEach((d,a)=>{let g=C(d);g!=null?l.has(g)||l.set(g,a):f.push(a)});let u=new Set,E=0,h=null,m=0,S=()=>{for(;m<f.length&&u.has(f[m]);)m++;return m<f.length?f[m]:-1};for(let d of r){let a=C(d),g;if(a!=null&&l.has(a)){let T=l.get(a);l.delete(a),u.add(T);let N=n[T];T<E?e.insertBefore(N,h):E=T,g=$(N,d)}else if(a==null){let T=S();if(T>=0&&xe(n[T],d)){u.add(T);let N=n[T];N.parentNode===e&&N.nextSibling!==h&&e.insertBefore(N,h),g=$(N,d)}else g=document.importNode(d,!0),e.insertBefore(g,h)}else g=document.importNode(d,!0),e.insertBefore(g,h);h=g.nextSibling}n.forEach((d,a)=>{!u.has(a)&&d.parentNode===e&&(v(d),e.removeChild(d))})}function z(e,t){if(e.nodeType!==Node.ELEMENT_NODE||t.nodeType!==Node.ELEMENT_NODE)return;let n=e,r=t;if(n.tagName!==r.tagName){let l=document.importNode(t,!0);n.parentNode&&n.parentNode.replaceChild(l,n);return}Se(n,r),Ae(n,r)}var X=!1,H,R=null,k=new Map,st=30,P=new Map,lt=50,we=/\/chunks\/runtime\.[^/]+\.js$/;function ke(){if(typeof document=="undefined"||X)return;X=!0;let e=".docs-content, main, #root",t=150,n=200,r=null,l=null,f=new Map,u=null;function E(o){for(let i of e.split(", ")){let s=o.querySelector(i.trim());if(s)return s}return o.body}function h(o){if(o.hasAttribute("data-krate-external"))return!1;let i=o.getAttribute("href");return!(!i||i.startsWith("#")||i.startsWith("javascript:")||o.origin!==location.origin||o.target==="_blank")}function m(o){k.has(o)||fetch(o,{headers:{Accept:"text/html"}}).then(i=>i.ok?i.text():null).then(i=>{if(i){if(k.size>=st){let s=k.keys().next().value;s!==void 0&&k.delete(s)}k.set(o,i)}}).catch(()=>{})}function S(){document.addEventListener("mouseover",g),document.addEventListener("focusin",g),typeof IntersectionObserver!="undefined"&&(u=new IntersectionObserver(o=>{for(let i of o)if(i.isIntersecting){let s=i.target,c=s.getAttribute("href");if(c&&h(s)){let p=new URL(c,location.origin).href;m(p)}u.unobserve(i.target)}},{rootMargin:"200px"}),d())}function d(){u&&document.querySelectorAll("a[data-prefetch]").forEach(o=>{u.observe(o)})}function a(){document.removeEventListener("mouseover",g),document.removeEventListener("focusin",g);for(let o of f.values())clearTimeout(o);f.clear(),u&&(u.disconnect(),u=null)}function g(o){let i=o.target.closest("a[data-prefetch]");if(!i||!h(i))return;let s=i.getAttribute("href");if(!s)return;let c=new URL(s,location.origin).href;if(k.has(c))return;let p=f.get(i);p&&clearTimeout(p);let y=setTimeout(()=>{f.delete(i),m(c)},n);f.set(i,y)}function T(o){let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT),s=i.nextNode();for(;s;){let c=s;for(let p of Object.keys(c))p.indexOf("__krate_")===0&&delete c[p];s=i.nextNode()}}let N=null;function Le(){let o=E(document),i=document.querySelector("template[data-krate-loading]");i&&i.content&&o&&(N=i.content.cloneNode(!0),document.body.appendChild(N)),o&&(o.style.transition=`opacity ${t}ms ease`,o.style.opacity="0")}function Y(){N&&N.parentNode&&N.parentNode.removeChild(N),N=null;let o=E(document);o&&(o.style.opacity="1")}function Q(o,i,s,c={}){let{replace:p=!1,scroll:y=!0,restoreScroll:L=!1}=c,D=new DOMParser().parseFromString(o,"text/html"),ie=E(D),I=E(document);if(!ie||!I){location.href=i;return}let se=D.querySelector("title");se&&(document.title=se.textContent||""),typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),T(I),z(I,ie);let le=D.querySelectorAll('link[rel="stylesheet"]'),ce=new Set;le.forEach(b=>{let x=b.getAttribute("href");x&&ce.add(x)}),document.querySelectorAll('link[rel="stylesheet"]').forEach(b=>{let x=b.getAttribute("href");x&&!ce.has(x)&&b.remove()});let fe=new Set;document.querySelectorAll('link[rel="stylesheet"]').forEach(b=>{fe.add(b.href)}),le.forEach(b=>{let x=b.getAttribute("href");if(x&&!fe.has(x)){let B=document.createElement("link");B.rel="stylesheet",B.href=x,document.head.appendChild(B)}}),Ce(s,i).then(()=>{Pe(),d()}),Y();let Re=location.pathname+location.search;if(p)history.replaceState({},"",i);else{if(!L){if(P.size>=lt){let b=P.keys().next().value;b!==void 0&&P.delete(b)}P.set(Re,window.scrollY)}history.pushState({},"",i)}G(i,{restoreScroll:L,scroll:y}),J(),window.dispatchEvent(new CustomEvent("krate:navigate",{detail:{url:i}}))}function Me(o){let i=o.indexOf("#");if(i<0||i===o.length-1)return!1;let s=o.slice(i);try{let c=document.querySelector(s);if(c)return c.scrollIntoView({behavior:"smooth",block:"start"}),!0}catch(c){return!1}return!1}function G(o,i){if(i.restoreScroll){let s=P.get(o);if(s!==void 0){window.scrollTo(0,s);return}}Me(o)||i.scroll&&window.scrollTo(0,0)}function J(){let o=location.pathname;document.querySelectorAll("a[data-krate-link]").forEach(i=>{let s=i.getAttribute("href");if(!s){i.removeAttribute("aria-current");return}let c=s;try{c=new URL(s,location.origin).pathname}catch(y){return}c===o||o==="/"&&(c===""||c==="/")||c!=="/"&&c.length>1&&o.startsWith(c)?i.setAttribute("aria-current","page"):i.removeAttribute("aria-current")})}function Ce(o,i){return o.length===0?Promise.resolve():Promise.all(o.map(s=>{let c=s.getAttribute("src");return c?He(c,i):Promise.resolve()})).then(()=>{})}function He(o,i){return new Promise(s=>{let c=document.createElement("script"),p=Z(o,i);c.src=p,we.test(p)||c.setAttribute("data-krate-spa",""),c.onload=()=>s(),c.onerror=()=>s(),document.body.appendChild(c)})}function Z(o,i){if(/^(https?:)?\/\//.test(o)||o.startsWith("/"))return new URL(o,i).href;let s=i;if(!s.endsWith("/")){let c=s.lastIndexOf("/");s=c>0?s.slice(0,c+1):"/"}return new URL(o,s).href}function Pe(){typeof globalThis.__krate_hydrate=="function"&&globalThis.__krate_hydrate()}function _e(o,i){typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),history.pushState({},"",i),document.open(),document.write(o),document.close()}function Oe(){return r!==null?Promise.resolve(r):fetch("/404.html",{headers:{Accept:"text/html"}}).then(o=>o.ok?o.text():null).then(o=>(r=o,o)).catch(()=>null)}function qe(){return l!==null?Promise.resolve(l):fetch("/500.html",{headers:{Accept:"text/html"}}).then(o=>o.ok?o.text():null).then(o=>(l=o,o)).catch(()=>null)}function ee(o,i){document.querySelectorAll("script[data-krate-spa]").forEach(p=>p.remove());let s=[],c=new Set;return document.querySelectorAll("script[src]").forEach(p=>{c.add(p.src)}),o.querySelectorAll("script[src]").forEach(p=>{let y=p.getAttribute("src");y&&!c.has(Z(y,i))&&s.push(p)}),s}function te(o,i={}){let s=k.get(o);if(s){let y=new DOMParser().parseFromString(s,"text/html");Q(s,o,ee(y,o),i);return}Le(),H&&H.abort(),H=new AbortController;let c=H.signal;fetch(o,{headers:{Accept:"text/html"},signal:c}).then(p=>p.ok?p.text().then(y=>{let re=new DOMParser().parseFromString(y,"text/html");Q(y,o,ee(re,o),i)}):(p.status>=500?qe():Oe()).then(L=>{L?_e(L,o):location.href=o})).catch(p=>{(p==null?void 0:p.name)!=="AbortError"&&(Y(),location.href=o)}).finally(()=>{H&&!c.aborted&&(H=void 0)})}let ne=o=>{if(o.defaultPrevented||o.button!==0||o.metaKey||o.ctrlKey||o.shiftKey||o.altKey)return;let i=o.target.closest("a[data-krate-link]");if(!i||!h(i))return;o.preventDefault();let s=i.getAttribute("href");if(!s)return;let c=new URL(s,location.origin).href,p=i.hasAttribute("data-krate-replace"),y=i.getAttribute("data-krate-scroll")!=="false";if(s===location.pathname+location.search+location.hash){p&&history.replaceState({},"",s),G(c,{scroll:y});return}te(c,{replace:p,scroll:y})},oe=()=>{te(location.href,{restoreScroll:!0})};document.addEventListener("click",ne),window.addEventListener("popstate",oe),S(),J(),document.querySelectorAll("script[src]").forEach(o=>{we.test(o.src)||o.setAttribute("data-krate-spa","")}),R=()=>{document.removeEventListener("click",ne),window.removeEventListener("popstate",oe),a()}}function ct(){R&&(R(),R=null),X=!1,ke()}return Fe(ft);})();
1
+ var __krate_exports=(()=>{var D=Object.defineProperty,Ie=Object.defineProperties,Ve=Object.getOwnPropertyDescriptor,Be=Object.getOwnPropertyDescriptors,Ke=Object.getOwnPropertyNames,he=Object.getOwnPropertySymbols;var ge=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable;var me=(e,t,n)=>t in e?D(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ee=(e,t)=>{for(var n in t||(t={}))ge.call(t,n)&&me(e,n,t[n]);if(he)for(var n of he(t))We.call(t,n)&&me(e,n,t[n]);return e},ye=(e,t)=>Ie(e,Be(t));var Ue=(e,t)=>{for(var n in t)D(e,n,{get:t[n],enumerable:!0})},je=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of Ke(t))!ge.call(e,c)&&c!==n&&D(e,c,{get:()=>t[c],enumerable:!(r=Ve(t,c))||r.enumerable});return e};var Fe=e=>je(D({},"__esModule",{value:!0}),e);var at={};Ue(at,{clearNodes:()=>Se,conditional:()=>st,createEffect:()=>w,createMemo:()=>Ge,createResource:()=>rt,createSignal:()=>M,disposeAll:()=>$e,disposeNode:()=>N,forwardRef:()=>Je,h:()=>tt,hydrate:()=>ot,initRouter:()=>Ce,insert:()=>et,mount:()=>nt,onCleanup:()=>z,onMount:()=>Ye,reconcile:()=>it,reconcileTrees:()=>J,reinitRouter:()=>ft});var L=[],Te=[],j=!1,P=new Set,F=[],I=!1;function be(e){return{fn:e,cleanups:[],disposed:!1,sources:new Set,running:!1,rerun:!1,queued:!1}}function $(e){if(!e.disposed){e.disposed=!0;for(let t of e.sources)t.delete(e);e.sources.clear();for(let t of e.cleanups)t();e.cleanups.length=0}}function $e(){for(let e of P)$(e);P.clear(),F.length=0,I=!1}function M(e){let t=e,n=new Set;return[()=>{let a=L[L.length-1];return a&&!a.disposed&&(n.add(a),a.sources.add(n)),t},a=>{let u=typeof a=="function"?a(t):a;if(u!==t){t=u;let E=Array.from(n);for(let h of E){if(h.disposed){n.delete(h);continue}if(h.running){h.rerun=!0;continue}h.queued||(h.queued=!0,F.push(h))}ze()}}]}function ze(){I||(I=!0,queueMicrotask(Xe))}function Xe(){I=!1;let e=F.splice(0);for(let t of e)t.disposed||(t.queued=!1,t.rerun=!1,V(t),t.rerun&&!t.disposed&&(t.rerun=!1,V(t)))}function V(e){e.running=!0;for(let t of e.cleanups)t();e.cleanups.length=0,L.push(e);try{let t=e.fn();typeof t=="function"&&e.cleanups.push(t)}finally{L.pop(),e.running=!1}}function w(e){let t=be(e);return P.add(t),V(t),()=>{$(t),P.delete(t)}}function z(e){let t=L[L.length-1];t&&t.cleanups.push(e)}function Ye(e){Te.push(e),j||(j=!0,queueMicrotask(Qe))}function Qe(){j=!1;let e=Te.splice(0);for(let t of e)t()}function Ge(e){let[t,n]=M(void 0),r=be(()=>{let a=e();n(a)});P.add(r),V(r);let c=L[L.length-1];return c&&c.cleanups.push(()=>{r.disposed||($(r),P.delete(r))}),t}function Je(e){return t=>e(t,t.ref||(()=>{}))}var X=new WeakMap;function Ne(e,t){let n=X.get(e);n||(n=[],X.set(e,n)),n.push(t)}function N(e){let t=X.get(e);if(t){for(let n of t)n();t.length=0}for(let n=0;n<e.childNodes.length;n++)N(e.childNodes[n])}function Ze(e){let t=e.nextSibling;for(;t;){if(t.nodeType===8&&t.nodeValue==="k")return t;t=t.nextSibling}return null}function Se(e,t){let n=e.parentNode;if(!n)return;let r=e.nextSibling;for(;r&&r!==t;){let c=r.nextSibling;N(r),n.removeChild(r),r=c}}function et(e,t,n){let r=Ze(n);r?(Se(n,r),Y(e,t,r)):Y(e,t,null)}function Y(e,t,n){if(!(t==null||t===!1||t===!0)){if(typeof t=="string"||typeof t=="number")e.insertBefore(document.createTextNode(String(t)),n);else if(t instanceof Node)e.insertBefore(t,n);else if(Array.isArray(t))for(let r of t)Y(e,r,n)}}function ve(e,t,n){if(t==="class"||t==="className")n===!1||n===null||n===void 0?e.className="":e.className=String(n);else if(t==="style")typeof n=="string"?e.setAttribute("style",n):n&&typeof n=="object"&&Object.assign(e.style,n);else if(t.startsWith("on")&&typeof n=="function"){let r=t.slice(2).toLowerCase(),c=`__krate_${r}`,a=e[c];a&&e.removeEventListener(r,a),e.addEventListener(r,n),e[c]=n}else t==="ref"?typeof n=="function"&&n(e):t==="key"||n!=null&&n!==!1&&e.setAttribute(t,String(n))}function xe(e,t){if(!(t==null||t===!1||t===!0)){if(Array.isArray(t)){for(let n of t)xe(e,n);return}if(typeof t=="function"){let n=document.createTextNode("");e.appendChild(n),Ne(n,w(()=>{n.nodeValue=String(t())}));return}e.appendChild(t instanceof Node?t:document.createTextNode(String(t)))}}function tt(e,t,...n){if(typeof e=="function")return e(ye(Ee({},t||{}),{children:n}));let r=document.createElement(e);if(t)for(let[c,a]of Object.entries(t))typeof a=="function"&&!c.startsWith("on")?Ne(r,w(()=>ve(r,c,a()))):ve(r,c,a);for(let c of n)xe(r,c);return r}function Ae(e){if(typeof e=="string"){let t=document.querySelector(e);if(!t)throw new Error(`Container "${e}" not found`);return t}return e}function nt(e,t){let n=Ae(t),r=!1;w(()=>{r||(r=!0,n.appendChild(e()))})}function ot(e,t){let n=Ae(t);if(n.childNodes.length===0){n.appendChild(e());return}let r=e();r&&N(r)}function rt(e,t){let[n,r]=M(void 0),[c,a]=M(!0),[u,E]=M(void 0),[h,m]=M("unresolved"),[v,d]=M(0),l,g=()=>typeof e=="function"?e():e,T=async()=>{l&&l.abort(),l=new AbortController;let S=l,q=g();m(v()>0?"refreshing":"loading"),a(!0),E(void 0);try{let k=await t(q,{signal:S.signal});S.signal.aborted||(r(()=>k),m("ready"))}catch(k){(k==null?void 0:k.name)!=="AbortError"&&!S.signal.aborted&&(E(k),m("error"))}finally{S.signal.aborted||a(!1)}};w(()=>{typeof e=="function"&&e.length===0&&e(),v(),T(),z(()=>{l&&(l.abort(),l=void 0)})});let y=function(){return n()};return Object.defineProperties(y,{loading:{get:()=>c()},error:{get:()=>u()},state:{get:()=>h()}}),[y,{mutate:S=>{r(S)},refetch:()=>{d(S=>S+1)}}]}function it(e,t,n,r,c,a){let u=[],E=t.nextSibling;for(;E&&E!==n;)u.push(E),E=E.nextSibling;if(a){let h=new Map;for(let d of u){let l=d.__k;l!=null&&h.set(l,d)}let m=[],v=new Set;for(let d=0;d<r.length;d++){let l=r[d],g=a(l);v.add(g);let T=c(l,d);T.__k=g,m.push(T)}for(let[d,l]of h)!v.has(d)&&l.parentNode===e&&(N(l),e.removeChild(l));for(let d=0;d<m.length;d++){let l=m[d],g=d===0?t:m[d-1];l!==g.nextSibling&&e.insertBefore(l,g.nextSibling)}}else{let h=Math.max(u.length,r.length);for(let m=0;m<h;m++)if(m<r.length){let v=c(r[m],m);m<u.length?u[m]!==v&&(N(u[m]),e.replaceChild(v,u[m])):e.insertBefore(v,n)}else m<u.length&&u[m].parentNode===e&&(N(u[m]),e.removeChild(u[m]))}}function st(e,t,n,r,c,a){let u=null;w(()=>{let h=r()?c():a?a():null;u?h?(N(u),e.replaceChild(h,u)):(N(u),e.removeChild(u)):h&&e.insertBefore(h,n),u=h})}function _(e){if(e.nodeType===Node.COMMENT_NODE){let t=e.nodeValue||"";return t.indexOf("k:")===0?t:null}if(e.nodeType===Node.ELEMENT_NODE){let t=e,n=t.getAttribute("data-k");if(n)return n;let r=t.getAttribute("id");if(r)return"#"+r}return null}function we(e,t){let n=new Set;for(let r=0;r<t.attributes.length;r++){let c=t.attributes[r].name,a=t.attributes[r].value;n.add(c),e.getAttribute(c)!==a&&e.setAttribute(c,a)}for(let r=0;r<e.attributes.length;r++){let c=e.attributes[r].name;n.has(c)||e.removeAttribute(c)}}function Q(e,t){let n=document.importNode(t,!0);return e.parentNode&&(N(e),e.parentNode.replaceChild(n,e)),n}function ke(e,t){return e.nodeType!==t.nodeType?!1:e.nodeType===Node.ELEMENT_NODE?e.tagName===t.tagName:!0}function G(e,t){if(!ke(e,t))return Q(e,t);if(e.nodeType===Node.TEXT_NODE)return e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e;if(e.nodeType===Node.COMMENT_NODE)return e.nodeValue!==t.nodeValue?Q(e,t):e;if(e.nodeType!==Node.ELEMENT_NODE)return e;let n=e,r=t;return _(n)!==_(r)?Q(n,r):(we(n,r),Le(n,r),n)}function Le(e,t){let n=Array.from(e.childNodes),r=Array.from(t.childNodes);if(n.length===r.length){let d=!0;for(let l=0;l<r.length;l++)if(_(n[l])!==_(r[l])){d=!1;break}if(d){for(let l=0;l<r.length;l++)G(n[l],r[l]);return}}let c=new Map,a=[];n.forEach((d,l)=>{let g=_(d);g!=null?c.has(g)||c.set(g,l):a.push(l)});let u=new Set,E=0,h=null,m=0,v=()=>{for(;m<a.length&&u.has(a[m]);)m++;return m<a.length?a[m]:-1};for(let d of r){let l=_(d),g;if(l!=null&&c.has(l)){let T=c.get(l);c.delete(l),u.add(T);let y=n[T];T<E?e.insertBefore(y,h):E=T,g=G(y,d)}else if(l==null){let T=v();if(T>=0&&ke(n[T],d)){u.add(T);let y=n[T];y.parentNode===e&&y.nextSibling!==h&&e.insertBefore(y,h),g=G(y,d)}else g=document.importNode(d,!0),e.insertBefore(g,h)}else g=document.importNode(d,!0),e.insertBefore(g,h);h=g.nextSibling}n.forEach((d,l)=>{!u.has(l)&&d.parentNode===e&&(N(d),e.removeChild(d))})}function J(e,t){if(e.nodeType!==Node.ELEMENT_NODE||t.nodeType!==Node.ELEMENT_NODE)return;let n=e,r=t;if(n.tagName!==r.tagName){let c=document.importNode(t,!0);n.parentNode&&n.parentNode.replaceChild(c,n);return}we(n,r),Le(n,r)}var Z=!1,O,B=null,C=new Map,ct=30,R=new Map,lt=50,Me=/\/chunks\/runtime\.[^/]+\.js$/;function Ce(){if(typeof document=="undefined"||Z)return;Z=!0;let e=".docs-content, main, #root",t=150,n=200,r=null,c=null,a=new Map,u=null;function E(o){for(let i of e.split(", ")){let s=o.querySelector(i.trim());if(s)return s}return o.body}function h(o){if(o.hasAttribute("data-krate-external"))return!1;let i=o.getAttribute("href");return!(!i||i.startsWith("#")||i.startsWith("javascript:")||o.origin!==location.origin||o.target==="_blank")}function m(o){C.has(o)||fetch(o,{headers:{Accept:"text/html"}}).then(i=>i.ok?i.text():null).then(i=>{if(i){if(C.size>=ct){let s=C.keys().next().value;s!==void 0&&C.delete(s)}C.set(o,i)}}).catch(()=>{})}function v(){document.addEventListener("mouseover",g),document.addEventListener("focusin",g),typeof IntersectionObserver!="undefined"&&(u=new IntersectionObserver(o=>{for(let i of o)if(i.isIntersecting){let s=i.target,f=s.getAttribute("href");if(f&&h(s)){let p=new URL(f,location.origin).href;m(p)}u.unobserve(i.target)}},{rootMargin:"200px"}),d())}function d(){u&&document.querySelectorAll("a[data-prefetch]").forEach(o=>{u.observe(o)})}function l(){document.removeEventListener("mouseover",g),document.removeEventListener("focusin",g);for(let o of a.values())clearTimeout(o);a.clear(),u&&(u.disconnect(),u=null)}function g(o){let i=o.target.closest("a[data-prefetch]");if(!i||!h(i))return;let s=i.getAttribute("href");if(!s)return;let f=new URL(s,location.origin).href;if(C.has(f))return;let p=a.get(i);p&&clearTimeout(p);let b=setTimeout(()=>{a.delete(i),m(f)},n);a.set(i,b)}function T(o){let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT),s=i.nextNode();for(;s;){let f=s;for(let p of Object.keys(f))p.indexOf("__krate_")===0&&delete f[p];s=i.nextNode()}}let y=null;function ee(){let o=E(document),i=document.querySelector("template[data-krate-loading]");i&&i.content&&o&&(y=i.content.cloneNode(!0),document.body.appendChild(y)),o&&(o.style.transition=`opacity ${t}ms ease`,o.style.opacity="0")}function S(){y&&y.parentNode&&y.parentNode.removeChild(y),y=null;let o=E(document);o&&(o.style.opacity="1")}function q(o,i,s,f={}){let{replace:p=!1,scroll:b=!0,restoreScroll:H=!1}=f,K=new DOMParser().parseFromString(o,"text/html"),fe=E(K),W=E(document);if(!fe||!W){location.href=i;return}let ae=K.querySelector("title");ae&&(document.title=ae.textContent||""),typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),T(W),J(W,fe);let ue=K.querySelectorAll('link[rel="stylesheet"]'),de=new Set;ue.forEach(x=>{let A=x.getAttribute("href");A&&de.add(A)}),document.querySelectorAll('link[rel="stylesheet"]').forEach(x=>{let A=x.getAttribute("href");A&&!de.has(A)&&x.remove()});let pe=new Set;document.querySelectorAll('link[rel="stylesheet"]').forEach(x=>{pe.add(x.href)}),ue.forEach(x=>{let A=x.getAttribute("href");if(A&&!pe.has(A)){let U=document.createElement("link");U.rel="stylesheet",U.href=A,document.head.appendChild(U)}}),He(s,i).then(()=>{_e(),d()}),S();let De=location.pathname+location.search;if(p)history.replaceState({},"",i);else{if(!H){if(R.size>=lt){let x=R.keys().next().value;x!==void 0&&R.delete(x)}R.set(De,window.scrollY)}history.pushState({},"",i)}te(i,{restoreScroll:H,scroll:b}),ne(),window.dispatchEvent(new CustomEvent("krate:navigate",{detail:{url:i}}))}function k(o){let i=o.indexOf("#");if(i<0||i===o.length-1)return!1;let s=o.slice(i);try{let f=document.querySelector(s);if(f)return f.scrollIntoView({behavior:"smooth",block:"start"}),!0}catch(f){return!1}return!1}function te(o,i){if(i.restoreScroll){let s=R.get(o);if(s!==void 0){window.scrollTo(0,s);return}}k(o)||i.scroll&&window.scrollTo(0,0)}function ne(){let o=location.pathname;document.querySelectorAll("a[data-krate-link]").forEach(i=>{let s=i.getAttribute("href");if(!s){i.removeAttribute("aria-current");return}let f=s;try{f=new URL(s,location.origin).pathname}catch(b){return}f===o||o==="/"&&(f===""||f==="/")||f!=="/"&&f.length>1&&o.startsWith(f)?i.setAttribute("aria-current","page"):i.removeAttribute("aria-current")})}function He(o,i){return o.length===0?Promise.resolve():Promise.all(o.map(s=>{let f=s.getAttribute("src");return f?Pe(f,i):Promise.resolve()})).then(()=>{})}function Pe(o,i){return new Promise(s=>{let f=document.createElement("script"),p=oe(o,i);f.src=p,Me.test(p)||f.setAttribute("data-krate-spa",""),f.onload=()=>s(),f.onerror=()=>s(),document.body.appendChild(f)})}function oe(o,i){if(/^(https?:)?\/\//.test(o)||o.startsWith("/"))return new URL(o,i).href;let s=i;if(!s.endsWith("/")){let f=s.lastIndexOf("/");s=f>0?s.slice(0,f+1):"/"}return new URL(o,s).href}function _e(){typeof globalThis.__krate_hydrate=="function"&&globalThis.__krate_hydrate()}function Oe(o,i){typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),history.pushState({},"",i),document.open(),document.write(o),document.close()}function Re(){return r!==null?Promise.resolve(r):fetch("/404.html",{headers:{Accept:"text/html"}}).then(o=>o.ok?o.text():null).then(o=>(r=o,o)).catch(()=>null)}function qe(){return c!==null?Promise.resolve(c):fetch("/500.html",{headers:{Accept:"text/html"}}).then(o=>o.ok?o.text():null).then(o=>(c=o,o)).catch(()=>null)}function re(o,i){document.querySelectorAll("script[data-krate-spa]").forEach(p=>p.remove());let s=[],f=new Set;return document.querySelectorAll("script[src]").forEach(p=>{f.add(p.src)}),o.querySelectorAll("script[src]").forEach(p=>{let b=p.getAttribute("src");b&&!f.has(oe(b,i))&&s.push(p)}),s}function ie(o,i={}){let s=C.get(o);if(s){let b=new DOMParser().parseFromString(s,"text/html");q(s,o,re(b,o),i);return}ee(),O&&O.abort(),O=new AbortController;let f=O.signal;fetch(o,{headers:{Accept:"text/html"},signal:f}).then(p=>p.ok?p.text().then(b=>{let le=new DOMParser().parseFromString(b,"text/html");q(b,o,re(le,o),i)}):(p.status>=500?qe():Re()).then(H=>{H?Oe(H,o):location.href=o})).catch(p=>{(p==null?void 0:p.name)!=="AbortError"&&(S(),location.href=o)}).finally(()=>{O&&!f.aborted&&(O=void 0)})}let se=o=>{if(o.defaultPrevented||o.button!==0||o.metaKey||o.ctrlKey||o.shiftKey||o.altKey)return;let i=o.target.closest("a[data-krate-link]");if(!i||!h(i))return;o.preventDefault();let s=i.getAttribute("href");if(!s)return;let f=new URL(s,location.origin).href,p=i.hasAttribute("data-krate-replace"),b=i.getAttribute("data-krate-scroll")!=="false";if(s===location.pathname+location.search+location.hash){p&&history.replaceState({},"",s),te(f,{scroll:b});return}ie(f,{replace:p,scroll:b})},ce=()=>{ie(location.href,{restoreScroll:!0})};document.addEventListener("click",se),window.addEventListener("popstate",ce),v(),ne(),document.querySelectorAll("script[src]").forEach(o=>{Me.test(o.src)||o.setAttribute("data-krate-spa","")}),B=()=>{document.removeEventListener("click",se),window.removeEventListener("popstate",ce),l()}}function ft(){B&&(B(),B=null),Z=!1,Ce()}return Fe(at);})();
2
2
  for (const k in __krate_exports) { window[k] = __krate_exports[k]; }
@@ -1,2 +1,2 @@
1
- var __krate_exports=(()=>{var D=Object.defineProperty,Ve=Object.defineProperties,Ue=Object.getOwnPropertyDescriptor,ze=Object.getOwnPropertyDescriptors,Ke=Object.getOwnPropertyNames,O=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable;var be=(e,t,n)=>t in e?D(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fe=(e,t)=>{for(var n in t||(t={}))U.call(t,n)&&be(e,n,t[n]);if(O)for(var n of O(t))me.call(t,n)&&be(e,n,t[n]);return e},pe=(e,t)=>Ve(e,ze(t));var he=(e,t)=>{var n={};for(var r in e)U.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&O)for(var r of O(e))t.indexOf(r)<0&&me.call(e,r)&&(n[r]=e[r]);return n};var We=(e,t)=>{for(var n in t)D(e,n,{get:t[n],enumerable:!0})},Xe=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ke(t))!U.call(e,o)&&o!==n&&D(e,o,{get:()=>t[o],enumerable:!(r=Ue(t,o))||r.enumerable});return e};var je=e=>Xe(D({},"__esModule",{value:!0}),e);var bt={};We(bt,{Fragment:()=>ot,clearNodes:()=>Me,conditional:()=>lt,createEffect:()=>x,createMemo:()=>et,createSignal:()=>He,disposeAll:()=>Ge,disposeNode:()=>E,forwardRef:()=>tt,h:()=>_,hydrate:()=>st,initRouter:()=>Ce,insert:()=>rt,jsx:()=>xe,jsxs:()=>at,mount:()=>it,onCleanup:()=>$e,onMount:()=>Qe,reconcile:()=>ut,reconcileTrees:()=>Y,reinitRouter:()=>gt});var y=[],Te=[],z=!1,w=new Set,K=[],I=!1;function ve(e){return{fn:e,cleanups:[],disposed:!1,sources:new Set,running:!1,rerun:!1,queued:!1}}function W(e){if(!e.disposed){e.disposed=!0;for(let t of e.sources)t.delete(e);e.sources.clear();for(let t of e.cleanups)t();e.cleanups.length=0}}function Ge(){for(let e of w)W(e);w.clear(),K.length=0,I=!1}function He(e){let t=e,n=new Set;return[()=>{let l=y[y.length-1];return l&&!l.disposed&&(n.add(l),l.sources.add(n)),t},l=>{let c=typeof l=="function"?l(t):l;if(c!==t){t=c;let h=Array.from(n);for(let m of h){if(m.disposed){n.delete(m);continue}if(m.running){m.rerun=!0;continue}m.queued||(m.queued=!0,K.push(m))}Je()}}]}function Je(){I||(I=!0,queueMicrotask(Ye))}function Ye(){I=!1;let e=K.splice(0);for(let t of e)t.disposed||(t.queued=!1,t.rerun=!1,B(t),t.rerun&&!t.disposed&&(t.rerun=!1,B(t)))}function B(e){e.running=!0;for(let t of e.cleanups)t();e.cleanups.length=0,y.push(e);try{let t=e.fn();typeof t=="function"&&e.cleanups.push(t)}finally{y.pop(),e.running=!1}}function x(e){let t=ve(e);return w.add(t),B(t),()=>{W(t),w.delete(t)}}function $e(e){let t=y[y.length-1];t&&t.cleanups.push(e)}function Qe(e){Te.push(e),z||(z=!0,queueMicrotask(Ze))}function Ze(){z=!1;let e=Te.splice(0);for(let t of e)t()}function et(e){let[t,n]=He(void 0),r=ve(()=>{let l=e();n(l)});w.add(r),B(r);let o=y[y.length-1];return o&&o.cleanups.push(()=>{r.disposed||(W(r),w.delete(r))}),t}function tt(e){return t=>e(t,t.ref||(()=>{}))}var X=new WeakMap;function Ae(e,t){let n=X.get(e);n||(n=[],X.set(e,n)),n.push(t)}function E(e){let t=X.get(e);if(t){for(let n of t)n();t.length=0}for(let n=0;n<e.childNodes.length;n++)E(e.childNodes[n])}function nt(e){let t=e.nextSibling;for(;t;){if(t.nodeType===8&&t.nodeValue==="k")return t;t=t.nextSibling}return null}function Me(e,t){let n=e.parentNode;if(!n)return;let r=e.nextSibling;for(;r&&r!==t;){let o=r.nextSibling;E(r),n.removeChild(r),r=o}}function rt(e,t,n){let r=nt(n);r?(Me(n,r),j(e,t,r)):j(e,t,null)}function j(e,t,n){if(!(t==null||t===!1||t===!0)){if(typeof t=="string"||typeof t=="number")e.insertBefore(document.createTextNode(String(t)),n);else if(t instanceof Node)e.insertBefore(t,n);else if(Array.isArray(t))for(let r of t)j(e,r,n)}}function Ee(e,t,n){if(t==="class"||t==="className")n===!1||n===null||n===void 0?e.className="":e.className=String(n);else if(t==="style")typeof n=="string"?e.setAttribute("style",n):n&&typeof n=="object"&&Object.assign(e.style,n);else if(t.startsWith("on")&&typeof n=="function"){let r=t.slice(2).toLowerCase(),o=`__krate_${r}`,l=e[o];l&&e.removeEventListener(r,l),e.addEventListener(r,n),e[o]=n}else t==="ref"?typeof n=="function"&&n(e):t==="key"||n!=null&&n!==!1&&e.setAttribute(t,String(n))}function Le(e,t){if(!(t==null||t===!1||t===!0)){if(Array.isArray(t)){for(let n of t)Le(e,n);return}if(typeof t=="function"){let n=document.createTextNode("");e.appendChild(n),Ae(n,x(()=>{n.nodeValue=String(t())}));return}e.appendChild(t instanceof Node?t:document.createTextNode(String(t)))}}function _(e,t,...n){if(typeof e=="function")return e(pe(fe({},t||{}),{children:n}));let r=document.createElement(e);if(t)for(let[o,l]of Object.entries(t))typeof l=="function"&&!o.startsWith("on")?Ae(r,x(()=>Ee(r,o,l()))):Ee(r,o,l);for(let o of n)Le(r,o);return r}function ye(e){if(typeof e=="string"){let t=document.querySelector(e);if(!t)throw new Error(`Container "${e}" not found`);return t}return e}function it(e,t){let n=ye(t),r=!1;x(()=>{r||(r=!0,n.appendChild(e()))})}function st(e,t){let n=ye(t);if(n.childNodes.length===0){n.appendChild(e());return}let r=e();r&&E(r)}function ot(e){let t=document.createDocumentFragment(),n=e.children;if(n){let r=Array.isArray(n)?n:[n];for(let o of r)o instanceof Node?t.appendChild(o):t.appendChild(document.createTextNode(String(o)))}return t}function xe(e,t,n){let r=e;if(!t)return _(r,null);let h=t,{children:o}=h,l=he(h,["children"]),c=o!==void 0?Array.isArray(o)?o:[o]:[];return _(r,Object.keys(l).length>0?l:null,...c)}function at(e,t,n){return xe(e,t,n)}function ut(e,t,n,r,o,l){let c=[],h=t.nextSibling;for(;h&&h!==n;)c.push(h),h=h.nextSibling;if(l){let m=new Map;for(let g of c){let d=g.__k;d!=null&&m.set(d,g)}let f=[],M=new Set;for(let g=0;g<r.length;g++){let d=r[g],p=l(d);M.add(p);let H=o(d,g);H.__k=p,f.push(H)}for(let[g,d]of m)!M.has(g)&&d.parentNode===e&&(E(d),e.removeChild(d));for(let g=0;g<f.length;g++){let d=f[g],p=g===0?t:f[g-1];d!==p.nextSibling&&e.insertBefore(d,p.nextSibling)}}else{let m=Math.max(c.length,r.length);for(let f=0;f<m;f++)if(f<r.length){let M=o(r[f],f);f<c.length?c[f]!==M&&(E(c[f]),e.replaceChild(M,c[f])):e.insertBefore(M,n)}else f<c.length&&c[f].parentNode===e&&(E(c[f]),e.removeChild(c[f]))}}function lt(e,t,n,r,o,l){let c=null;x(()=>{let m=r()?o():l?l():null;c?m?(E(c),e.replaceChild(m,c)):(E(c),e.removeChild(c)):m&&e.insertBefore(m,n),c=m})}function N(e){if(e.nodeType===Node.COMMENT_NODE){let t=e.nodeValue||"";return t.indexOf("k:")===0?t:null}if(e.nodeType===Node.ELEMENT_NODE){let t=e,n=t.getAttribute("data-k");if(n)return n;let r=t.getAttribute("id");if(r)return"#"+r}return null}function Se(e,t){let n=new Set;for(let r=0;r<t.attributes.length;r++){let o=t.attributes[r].name,l=t.attributes[r].value;n.add(o),e.getAttribute(o)!==l&&e.setAttribute(o,l)}for(let r=0;r<e.attributes.length;r++){let o=e.attributes[r].name;n.has(o)||e.removeAttribute(o)}}function G(e,t){let n=document.importNode(t,!0);return e.parentNode&&(E(e),e.parentNode.replaceChild(n,e)),n}function ke(e,t){return e.nodeType!==t.nodeType?!1:e.nodeType===Node.ELEMENT_NODE?e.tagName===t.tagName:!0}function J(e,t){if(!ke(e,t))return G(e,t);if(e.nodeType===Node.TEXT_NODE)return e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e;if(e.nodeType===Node.COMMENT_NODE)return e.nodeValue!==t.nodeValue?G(e,t):e;if(e.nodeType!==Node.ELEMENT_NODE)return e;let n=e,r=t;return N(n)!==N(r)?G(n,r):(Se(n,r),we(n,r),n)}function we(e,t){let n=Array.from(e.childNodes),r=Array.from(t.childNodes);if(n.length===r.length){let g=!0;for(let d=0;d<r.length;d++)if(N(n[d])!==N(r[d])){g=!1;break}if(g){for(let d=0;d<r.length;d++)J(n[d],r[d]);return}}let o=new Map,l=[];n.forEach((g,d)=>{let p=N(g);p!=null?o.has(p)||o.set(p,d):l.push(d)});let c=new Set,h=0,m=null,f=0,M=()=>{for(;f<l.length&&c.has(l[f]);)f++;return f<l.length?l[f]:-1};for(let g of r){let d=N(g),p;if(d!=null&&o.has(d)){let H=o.get(d);o.delete(d),c.add(H);let v=n[H];H<h?e.insertBefore(v,m):h=H,p=J(v,g)}else if(d==null){let H=M();if(H>=0&&ke(n[H],g)){c.add(H);let v=n[H];v.parentNode===e&&v.nextSibling!==m&&e.insertBefore(v,m),p=J(v,g)}else p=document.importNode(g,!0),e.insertBefore(p,m)}else p=document.importNode(g,!0),e.insertBefore(p,m);m=p.nextSibling}n.forEach((g,d)=>{!c.has(d)&&g.parentNode===e&&(E(g),e.removeChild(g))})}function Y(e,t){if(e.nodeType!==Node.ELEMENT_NODE||t.nodeType!==Node.ELEMENT_NODE)return;let n=e,r=t;if(n.tagName!==r.tagName){let o=document.importNode(t,!0);n.parentNode&&n.parentNode.replaceChild(o,n);return}Se(n,r),we(n,r)}var $=!1,C,R=null,S=new Map,ct=30,P=new Map,dt=50,Ne=/\/chunks\/runtime\.[^/]+\.js$/;function Ce(){if(typeof document=="undefined"||$)return;$=!0;let e=".docs-content, main, #root",t=150,n=200,r=null,o=null,l=new Map,c=null;function h(i){for(let s of e.split(", ")){let a=i.querySelector(s.trim());if(a)return a}return i.body}function m(i){if(i.hasAttribute("data-krate-external"))return!1;let s=i.getAttribute("href");return!(!s||s.startsWith("#")||s.startsWith("javascript:")||i.origin!==location.origin||i.target==="_blank")}function f(i){S.has(i)||fetch(i,{headers:{Accept:"text/html"}}).then(s=>s.ok?s.text():null).then(s=>{if(s){if(S.size>=ct){let a=S.keys().next().value;a!==void 0&&S.delete(a)}S.set(i,s)}}).catch(()=>{})}function M(){document.addEventListener("mouseover",p),document.addEventListener("focusin",p),typeof IntersectionObserver!="undefined"&&(c=new IntersectionObserver(i=>{for(let s of i)if(s.isIntersecting){let a=s.target,u=a.getAttribute("href");if(u&&m(a)){let b=new URL(u,location.origin).href;f(b)}c.unobserve(s.target)}},{rootMargin:"200px"}),g())}function g(){c&&document.querySelectorAll("a[data-prefetch]").forEach(i=>{c.observe(i)})}function d(){document.removeEventListener("mouseover",p),document.removeEventListener("focusin",p);for(let i of l.values())clearTimeout(i);l.clear(),c&&(c.disconnect(),c=null)}function p(i){let s=i.target.closest("a[data-prefetch]");if(!s||!m(s))return;let a=s.getAttribute("href");if(!a)return;let u=new URL(a,location.origin).href;if(S.has(u))return;let b=l.get(s);b&&clearTimeout(b);let T=setTimeout(()=>{l.delete(s),f(u)},n);l.set(s,T)}function H(i){let s=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT),a=s.nextNode();for(;a;){let u=a;for(let b of Object.keys(u))b.indexOf("__krate_")===0&&delete u[b];a=s.nextNode()}}let v=null;function Pe(){let i=h(document),s=document.querySelector("template[data-krate-loading]");s&&s.content&&i&&(v=s.content.cloneNode(!0),document.body.appendChild(v)),i&&(i.style.transition=`opacity ${t}ms ease`,i.style.opacity="0")}function Q(){v&&v.parentNode&&v.parentNode.removeChild(v),v=null;let i=h(document);i&&(i.style.opacity="1")}function Z(i,s,a,u={}){let{replace:b=!1,scroll:T=!0,restoreScroll:k=!1}=u,q=new DOMParser().parseFromString(i,"text/html"),ue=h(q),F=h(document);if(!ue||!F){location.href=s;return}let le=q.querySelector("title");le&&(document.title=le.textContent||""),typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),H(F),Y(F,ue);let ce=q.querySelectorAll('link[rel="stylesheet"]'),de=new Set;ce.forEach(A=>{let L=A.getAttribute("href");L&&de.add(L)}),document.querySelectorAll('link[rel="stylesheet"]').forEach(A=>{let L=A.getAttribute("href");L&&!de.has(L)&&A.remove()});let ge=new Set;document.querySelectorAll('link[rel="stylesheet"]').forEach(A=>{ge.add(A.href)}),ce.forEach(A=>{let L=A.getAttribute("href");if(L&&!ge.has(L)){let V=document.createElement("link");V.rel="stylesheet",V.href=L,document.head.appendChild(V)}}),De(a,s).then(()=>{Be(),g()}),Q();let Fe=location.pathname+location.search;if(b)history.replaceState({},"",s);else{if(!k){if(P.size>=dt){let A=P.keys().next().value;A!==void 0&&P.delete(A)}P.set(Fe,window.scrollY)}history.pushState({},"",s)}ee(s,{restoreScroll:k,scroll:T}),te(),window.dispatchEvent(new CustomEvent("krate:navigate",{detail:{url:s}}))}function Oe(i){let s=i.indexOf("#");if(s<0||s===i.length-1)return!1;let a=i.slice(s);try{let u=document.querySelector(a);if(u)return u.scrollIntoView({behavior:"smooth",block:"start"}),!0}catch(u){return!1}return!1}function ee(i,s){if(s.restoreScroll){let a=P.get(i);if(a!==void 0){window.scrollTo(0,a);return}}Oe(i)||s.scroll&&window.scrollTo(0,0)}function te(){let i=location.pathname;document.querySelectorAll("a[data-krate-link]").forEach(s=>{let a=s.getAttribute("href");if(!a){s.removeAttribute("aria-current");return}let u=a;try{u=new URL(a,location.origin).pathname}catch(T){return}u===i||i==="/"&&(u===""||u==="/")||u!=="/"&&u.length>1&&i.startsWith(u)?s.setAttribute("aria-current","page"):s.removeAttribute("aria-current")})}function De(i,s){return i.length===0?Promise.resolve():Promise.all(i.map(a=>{let u=a.getAttribute("src");return u?Ie(u,s):Promise.resolve()})).then(()=>{})}function Ie(i,s){return new Promise(a=>{let u=document.createElement("script"),b=ne(i,s);u.src=b,Ne.test(b)||u.setAttribute("data-krate-spa",""),u.onload=()=>a(),u.onerror=()=>a(),document.body.appendChild(u)})}function ne(i,s){if(/^(https?:)?\/\//.test(i)||i.startsWith("/"))return new URL(i,s).href;let a=s;if(!a.endsWith("/")){let u=a.lastIndexOf("/");a=u>0?a.slice(0,u+1):"/"}return new URL(i,a).href}function Be(){typeof globalThis.__krate_hydrate=="function"&&globalThis.__krate_hydrate()}function _e(i,s){typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),history.pushState({},"",s),document.open(),document.write(i),document.close()}function Re(){return r!==null?Promise.resolve(r):fetch("/404.html",{headers:{Accept:"text/html"}}).then(i=>i.ok?i.text():null).then(i=>(r=i,i)).catch(()=>null)}function qe(){return o!==null?Promise.resolve(o):fetch("/500.html",{headers:{Accept:"text/html"}}).then(i=>i.ok?i.text():null).then(i=>(o=i,i)).catch(()=>null)}function re(i,s){document.querySelectorAll("script[data-krate-spa]").forEach(b=>b.remove());let a=[],u=new Set;return document.querySelectorAll("script[src]").forEach(b=>{u.add(b.src)}),i.querySelectorAll("script[src]").forEach(b=>{let T=b.getAttribute("src");T&&!u.has(ne(T,s))&&a.push(b)}),a}function ie(i,s={}){let a=S.get(i);if(a){let T=new DOMParser().parseFromString(a,"text/html");Z(a,i,re(T,i),s);return}Pe(),C&&C.abort(),C=new AbortController;let u=C.signal;fetch(i,{headers:{Accept:"text/html"},signal:u}).then(b=>b.ok?b.text().then(T=>{let ae=new DOMParser().parseFromString(T,"text/html");Z(T,i,re(ae,i),s)}):(b.status>=500?qe():Re()).then(k=>{k?_e(k,i):location.href=i})).catch(b=>{(b==null?void 0:b.name)!=="AbortError"&&(Q(),location.href=i)}).finally(()=>{C&&!u.aborted&&(C=void 0)})}let se=i=>{if(i.defaultPrevented||i.button!==0||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey)return;let s=i.target.closest("a[data-krate-link]");if(!s||!m(s))return;i.preventDefault();let a=s.getAttribute("href");if(!a)return;let u=new URL(a,location.origin).href,b=s.hasAttribute("data-krate-replace"),T=s.getAttribute("data-krate-scroll")!=="false";if(a===location.pathname+location.search+location.hash){b&&history.replaceState({},"",a),ee(u,{scroll:T});return}ie(u,{replace:b,scroll:T})},oe=()=>{ie(location.href,{restoreScroll:!0})};document.addEventListener("click",se),window.addEventListener("popstate",oe),M(),te(),document.querySelectorAll("script[src]").forEach(i=>{Ne.test(i.src)||i.setAttribute("data-krate-spa","")}),R=()=>{document.removeEventListener("click",se),window.removeEventListener("popstate",oe),d()}}function gt(){R&&(R(),R=null),$=!1,Ce()}return je(bt);})();
1
+ var __krate_exports=(()=>{var _=Object.defineProperty,Ue=Object.defineProperties,ze=Object.getOwnPropertyDescriptor,Ke=Object.getOwnPropertyDescriptors,We=Object.getOwnPropertyNames,B=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,Te=Object.prototype.propertyIsEnumerable;var he=(e,t,n)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ve=(e,t)=>{for(var n in t||(t={}))j.call(t,n)&&he(e,n,t[n]);if(B)for(var n of B(t))Te.call(t,n)&&he(e,n,t[n]);return e},Ee=(e,t)=>Ue(e,Ke(t));var He=(e,t)=>{var n={};for(var r in e)j.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&B)for(var r of B(e))t.indexOf(r)<0&&Te.call(e,r)&&(n[r]=e[r]);return n};var je=(e,t)=>{for(var n in t)_(e,n,{get:t[n],enumerable:!0})},Xe=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of We(t))!j.call(e,o)&&o!==n&&_(e,o,{get:()=>t[o],enumerable:!(r=ze(t,o))||r.enumerable});return e};var Ge=e=>Xe(_({},"__esModule",{value:!0}),e);var mt={};je(mt,{Fragment:()=>at,clearNodes:()=>xe,conditional:()=>ct,createEffect:()=>x,createMemo:()=>et,createResource:()=>ot,createSignal:()=>w,disposeAll:()=>Je,disposeNode:()=>A,forwardRef:()=>tt,h:()=>V,hydrate:()=>st,initRouter:()=>De,insert:()=>rt,jsx:()=>we,jsxs:()=>ut,mount:()=>it,onCleanup:()=>Y,onMount:()=>Qe,reconcile:()=>lt,reconcileTrees:()=>te,reinitRouter:()=>bt});var k=[],Ae=[],X=!1,P=new Set,G=[],q=!1;function Me(e){return{fn:e,cleanups:[],disposed:!1,sources:new Set,running:!1,rerun:!1,queued:!1}}function J(e){if(!e.disposed){e.disposed=!0;for(let t of e.sources)t.delete(e);e.sources.clear();for(let t of e.cleanups)t();e.cleanups.length=0}}function Je(){for(let e of P)J(e);P.clear(),G.length=0,q=!1}function w(e){let t=e,n=new Set;return[()=>{let u=k[k.length-1];return u&&!u.disposed&&(n.add(u),u.sources.add(n)),t},u=>{let d=typeof u=="function"?u(t):u;if(d!==t){t=d;let h=Array.from(n);for(let m of h){if(m.disposed){n.delete(m);continue}if(m.running){m.rerun=!0;continue}m.queued||(m.queued=!0,G.push(m))}Ye()}}]}function Ye(){q||(q=!0,queueMicrotask($e))}function $e(){q=!1;let e=G.splice(0);for(let t of e)t.disposed||(t.queued=!1,t.rerun=!1,F(t),t.rerun&&!t.disposed&&(t.rerun=!1,F(t)))}function F(e){e.running=!0;for(let t of e.cleanups)t();e.cleanups.length=0,k.push(e);try{let t=e.fn();typeof t=="function"&&e.cleanups.push(t)}finally{k.pop(),e.running=!1}}function x(e){let t=Me(e);return P.add(t),F(t),()=>{J(t),P.delete(t)}}function Y(e){let t=k[k.length-1];t&&t.cleanups.push(e)}function Qe(e){Ae.push(e),X||(X=!0,queueMicrotask(Ze))}function Ze(){X=!1;let e=Ae.splice(0);for(let t of e)t()}function et(e){let[t,n]=w(void 0),r=Me(()=>{let u=e();n(u)});P.add(r),F(r);let o=k[k.length-1];return o&&o.cleanups.push(()=>{r.disposed||(J(r),P.delete(r))}),t}function tt(e){return t=>e(t,t.ref||(()=>{}))}var $=new WeakMap;function ye(e,t){let n=$.get(e);n||(n=[],$.set(e,n)),n.push(t)}function A(e){let t=$.get(e);if(t){for(let n of t)n();t.length=0}for(let n=0;n<e.childNodes.length;n++)A(e.childNodes[n])}function nt(e){let t=e.nextSibling;for(;t;){if(t.nodeType===8&&t.nodeValue==="k")return t;t=t.nextSibling}return null}function xe(e,t){let n=e.parentNode;if(!n)return;let r=e.nextSibling;for(;r&&r!==t;){let o=r.nextSibling;A(r),n.removeChild(r),r=o}}function rt(e,t,n){let r=nt(n);r?(xe(n,r),Q(e,t,r)):Q(e,t,null)}function Q(e,t,n){if(!(t==null||t===!1||t===!0)){if(typeof t=="string"||typeof t=="number")e.insertBefore(document.createTextNode(String(t)),n);else if(t instanceof Node)e.insertBefore(t,n);else if(Array.isArray(t))for(let r of t)Q(e,r,n)}}function Le(e,t,n){if(t==="class"||t==="className")n===!1||n===null||n===void 0?e.className="":e.className=String(n);else if(t==="style")typeof n=="string"?e.setAttribute("style",n):n&&typeof n=="object"&&Object.assign(e.style,n);else if(t.startsWith("on")&&typeof n=="function"){let r=t.slice(2).toLowerCase(),o=`__krate_${r}`,u=e[o];u&&e.removeEventListener(r,u),e.addEventListener(r,n),e[o]=n}else t==="ref"?typeof n=="function"&&n(e):t==="key"||n!=null&&n!==!1&&e.setAttribute(t,String(n))}function Se(e,t){if(!(t==null||t===!1||t===!0)){if(Array.isArray(t)){for(let n of t)Se(e,n);return}if(typeof t=="function"){let n=document.createTextNode("");e.appendChild(n),ye(n,x(()=>{n.nodeValue=String(t())}));return}e.appendChild(t instanceof Node?t:document.createTextNode(String(t)))}}function V(e,t,...n){if(typeof e=="function")return e(Ee(ve({},t||{}),{children:n}));let r=document.createElement(e);if(t)for(let[o,u]of Object.entries(t))typeof u=="function"&&!o.startsWith("on")?ye(r,x(()=>Le(r,o,u()))):Le(r,o,u);for(let o of n)Se(r,o);return r}function ke(e){if(typeof e=="string"){let t=document.querySelector(e);if(!t)throw new Error(`Container "${e}" not found`);return t}return e}function it(e,t){let n=ke(t),r=!1;x(()=>{r||(r=!0,n.appendChild(e()))})}function st(e,t){let n=ke(t);if(n.childNodes.length===0){n.appendChild(e());return}let r=e();r&&A(r)}function ot(e,t){let[n,r]=w(void 0),[o,u]=w(!0),[d,h]=w(void 0),[m,f]=w("unresolved"),[H,g]=w(0),l,p=()=>typeof e=="function"?e():e,v=async()=>{l&&l.abort(),l=new AbortController;let M=l,I=p();f(H()>0?"refreshing":"loading"),u(!0),h(void 0);try{let S=await t(I,{signal:M.signal});M.signal.aborted||(r(()=>S),f("ready"))}catch(S){(S==null?void 0:S.name)!=="AbortError"&&!M.signal.aborted&&(h(S),f("error"))}finally{M.signal.aborted||u(!1)}};x(()=>{typeof e=="function"&&e.length===0&&e(),H(),v(),Y(()=>{l&&(l.abort(),l=void 0)})});let T=function(){return n()};return Object.defineProperties(T,{loading:{get:()=>o()},error:{get:()=>d()},state:{get:()=>m()}}),[T,{mutate:M=>{r(M)},refetch:()=>{g(M=>M+1)}}]}function at(e){let t=document.createDocumentFragment(),n=e.children;if(n){let r=Array.isArray(n)?n:[n];for(let o of r)o instanceof Node?t.appendChild(o):t.appendChild(document.createTextNode(String(o)))}return t}function we(e,t,n){let r=e;if(!t)return V(r,null);let h=t,{children:o}=h,u=He(h,["children"]),d=o!==void 0?Array.isArray(o)?o:[o]:[];return V(r,Object.keys(u).length>0?u:null,...d)}function ut(e,t,n){return we(e,t,n)}function lt(e,t,n,r,o,u){let d=[],h=t.nextSibling;for(;h&&h!==n;)d.push(h),h=h.nextSibling;if(u){let m=new Map;for(let g of d){let l=g.__k;l!=null&&m.set(l,g)}let f=[],H=new Set;for(let g=0;g<r.length;g++){let l=r[g],p=u(l);H.add(p);let v=o(l,g);v.__k=p,f.push(v)}for(let[g,l]of m)!H.has(g)&&l.parentNode===e&&(A(l),e.removeChild(l));for(let g=0;g<f.length;g++){let l=f[g],p=g===0?t:f[g-1];l!==p.nextSibling&&e.insertBefore(l,p.nextSibling)}}else{let m=Math.max(d.length,r.length);for(let f=0;f<m;f++)if(f<r.length){let H=o(r[f],f);f<d.length?d[f]!==H&&(A(d[f]),e.replaceChild(H,d[f])):e.insertBefore(H,n)}else f<d.length&&d[f].parentNode===e&&(A(d[f]),e.removeChild(d[f]))}}function ct(e,t,n,r,o,u){let d=null;x(()=>{let m=r()?o():u?u():null;d?m?(A(d),e.replaceChild(m,d)):(A(d),e.removeChild(d)):m&&e.insertBefore(m,n),d=m})}function O(e){if(e.nodeType===Node.COMMENT_NODE){let t=e.nodeValue||"";return t.indexOf("k:")===0?t:null}if(e.nodeType===Node.ELEMENT_NODE){let t=e,n=t.getAttribute("data-k");if(n)return n;let r=t.getAttribute("id");if(r)return"#"+r}return null}function Ce(e,t){let n=new Set;for(let r=0;r<t.attributes.length;r++){let o=t.attributes[r].name,u=t.attributes[r].value;n.add(o),e.getAttribute(o)!==u&&e.setAttribute(o,u)}for(let r=0;r<e.attributes.length;r++){let o=e.attributes[r].name;n.has(o)||e.removeAttribute(o)}}function Z(e,t){let n=document.importNode(t,!0);return e.parentNode&&(A(e),e.parentNode.replaceChild(n,e)),n}function Ne(e,t){return e.nodeType!==t.nodeType?!1:e.nodeType===Node.ELEMENT_NODE?e.tagName===t.tagName:!0}function ee(e,t){if(!Ne(e,t))return Z(e,t);if(e.nodeType===Node.TEXT_NODE)return e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e;if(e.nodeType===Node.COMMENT_NODE)return e.nodeValue!==t.nodeValue?Z(e,t):e;if(e.nodeType!==Node.ELEMENT_NODE)return e;let n=e,r=t;return O(n)!==O(r)?Z(n,r):(Ce(n,r),Pe(n,r),n)}function Pe(e,t){let n=Array.from(e.childNodes),r=Array.from(t.childNodes);if(n.length===r.length){let g=!0;for(let l=0;l<r.length;l++)if(O(n[l])!==O(r[l])){g=!1;break}if(g){for(let l=0;l<r.length;l++)ee(n[l],r[l]);return}}let o=new Map,u=[];n.forEach((g,l)=>{let p=O(g);p!=null?o.has(p)||o.set(p,l):u.push(l)});let d=new Set,h=0,m=null,f=0,H=()=>{for(;f<u.length&&d.has(u[f]);)f++;return f<u.length?u[f]:-1};for(let g of r){let l=O(g),p;if(l!=null&&o.has(l)){let v=o.get(l);o.delete(l),d.add(v);let T=n[v];v<h?e.insertBefore(T,m):h=v,p=ee(T,g)}else if(l==null){let v=H();if(v>=0&&Ne(n[v],g)){d.add(v);let T=n[v];T.parentNode===e&&T.nextSibling!==m&&e.insertBefore(T,m),p=ee(T,g)}else p=document.importNode(g,!0),e.insertBefore(p,m)}else p=document.importNode(g,!0),e.insertBefore(p,m);m=p.nextSibling}n.forEach((g,l)=>{!d.has(l)&&g.parentNode===e&&(A(g),e.removeChild(g))})}function te(e,t){if(e.nodeType!==Node.ELEMENT_NODE||t.nodeType!==Node.ELEMENT_NODE)return;let n=e,r=t;if(n.tagName!==r.tagName){let o=document.importNode(t,!0);n.parentNode&&n.parentNode.replaceChild(o,n);return}Ce(n,r),Pe(n,r)}var ne=!1,D,U=null,C=new Map,dt=30,R=new Map,gt=50,Oe=/\/chunks\/runtime\.[^/]+\.js$/;function De(){if(typeof document=="undefined"||ne)return;ne=!0;let e=".docs-content, main, #root",t=150,n=200,r=null,o=null,u=new Map,d=null;function h(i){for(let s of e.split(", ")){let a=i.querySelector(s.trim());if(a)return a}return i.body}function m(i){if(i.hasAttribute("data-krate-external"))return!1;let s=i.getAttribute("href");return!(!s||s.startsWith("#")||s.startsWith("javascript:")||i.origin!==location.origin||i.target==="_blank")}function f(i){C.has(i)||fetch(i,{headers:{Accept:"text/html"}}).then(s=>s.ok?s.text():null).then(s=>{if(s){if(C.size>=dt){let a=C.keys().next().value;a!==void 0&&C.delete(a)}C.set(i,s)}}).catch(()=>{})}function H(){document.addEventListener("mouseover",p),document.addEventListener("focusin",p),typeof IntersectionObserver!="undefined"&&(d=new IntersectionObserver(i=>{for(let s of i)if(s.isIntersecting){let a=s.target,c=a.getAttribute("href");if(c&&m(a)){let b=new URL(c,location.origin).href;f(b)}d.unobserve(s.target)}},{rootMargin:"200px"}),g())}function g(){d&&document.querySelectorAll("a[data-prefetch]").forEach(i=>{d.observe(i)})}function l(){document.removeEventListener("mouseover",p),document.removeEventListener("focusin",p);for(let i of u.values())clearTimeout(i);u.clear(),d&&(d.disconnect(),d=null)}function p(i){let s=i.target.closest("a[data-prefetch]");if(!s||!m(s))return;let a=s.getAttribute("href");if(!a)return;let c=new URL(a,location.origin).href;if(C.has(c))return;let b=u.get(s);b&&clearTimeout(b);let E=setTimeout(()=>{u.delete(s),f(c)},n);u.set(s,E)}function v(i){let s=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT),a=s.nextNode();for(;a;){let c=a;for(let b of Object.keys(c))b.indexOf("__krate_")===0&&delete c[b];a=s.nextNode()}}let T=null;function re(){let i=h(document),s=document.querySelector("template[data-krate-loading]");s&&s.content&&i&&(T=s.content.cloneNode(!0),document.body.appendChild(T)),i&&(i.style.transition=`opacity ${t}ms ease`,i.style.opacity="0")}function M(){T&&T.parentNode&&T.parentNode.removeChild(T),T=null;let i=h(document);i&&(i.style.opacity="1")}function I(i,s,a,c={}){let{replace:b=!1,scroll:E=!0,restoreScroll:N=!1}=c,z=new DOMParser().parseFromString(i,"text/html"),ge=h(z),K=h(document);if(!ge||!K){location.href=s;return}let be=z.querySelector("title");be&&(document.title=be.textContent||""),typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),v(K),te(K,ge);let me=z.querySelectorAll('link[rel="stylesheet"]'),fe=new Set;me.forEach(L=>{let y=L.getAttribute("href");y&&fe.add(y)}),document.querySelectorAll('link[rel="stylesheet"]').forEach(L=>{let y=L.getAttribute("href");y&&!fe.has(y)&&L.remove()});let pe=new Set;document.querySelectorAll('link[rel="stylesheet"]').forEach(L=>{pe.add(L.href)}),me.forEach(L=>{let y=L.getAttribute("href");if(y&&!pe.has(y)){let W=document.createElement("link");W.rel="stylesheet",W.href=y,document.head.appendChild(W)}}),Re(a,s).then(()=>{Be(),g()}),M();let Ve=location.pathname+location.search;if(b)history.replaceState({},"",s);else{if(!N){if(R.size>=gt){let L=R.keys().next().value;L!==void 0&&R.delete(L)}R.set(Ve,window.scrollY)}history.pushState({},"",s)}ie(s,{restoreScroll:N,scroll:E}),se(),window.dispatchEvent(new CustomEvent("krate:navigate",{detail:{url:s}}))}function S(i){let s=i.indexOf("#");if(s<0||s===i.length-1)return!1;let a=i.slice(s);try{let c=document.querySelector(a);if(c)return c.scrollIntoView({behavior:"smooth",block:"start"}),!0}catch(c){return!1}return!1}function ie(i,s){if(s.restoreScroll){let a=R.get(i);if(a!==void 0){window.scrollTo(0,a);return}}S(i)||s.scroll&&window.scrollTo(0,0)}function se(){let i=location.pathname;document.querySelectorAll("a[data-krate-link]").forEach(s=>{let a=s.getAttribute("href");if(!a){s.removeAttribute("aria-current");return}let c=a;try{c=new URL(a,location.origin).pathname}catch(E){return}c===i||i==="/"&&(c===""||c==="/")||c!=="/"&&c.length>1&&i.startsWith(c)?s.setAttribute("aria-current","page"):s.removeAttribute("aria-current")})}function Re(i,s){return i.length===0?Promise.resolve():Promise.all(i.map(a=>{let c=a.getAttribute("src");return c?Ie(c,s):Promise.resolve()})).then(()=>{})}function Ie(i,s){return new Promise(a=>{let c=document.createElement("script"),b=oe(i,s);c.src=b,Oe.test(b)||c.setAttribute("data-krate-spa",""),c.onload=()=>a(),c.onerror=()=>a(),document.body.appendChild(c)})}function oe(i,s){if(/^(https?:)?\/\//.test(i)||i.startsWith("/"))return new URL(i,s).href;let a=s;if(!a.endsWith("/")){let c=a.lastIndexOf("/");a=c>0?a.slice(0,c+1):"/"}return new URL(i,a).href}function Be(){typeof globalThis.__krate_hydrate=="function"&&globalThis.__krate_hydrate()}function _e(i,s){typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),history.pushState({},"",s),document.open(),document.write(i),document.close()}function qe(){return r!==null?Promise.resolve(r):fetch("/404.html",{headers:{Accept:"text/html"}}).then(i=>i.ok?i.text():null).then(i=>(r=i,i)).catch(()=>null)}function Fe(){return o!==null?Promise.resolve(o):fetch("/500.html",{headers:{Accept:"text/html"}}).then(i=>i.ok?i.text():null).then(i=>(o=i,i)).catch(()=>null)}function ae(i,s){document.querySelectorAll("script[data-krate-spa]").forEach(b=>b.remove());let a=[],c=new Set;return document.querySelectorAll("script[src]").forEach(b=>{c.add(b.src)}),i.querySelectorAll("script[src]").forEach(b=>{let E=b.getAttribute("src");E&&!c.has(oe(E,s))&&a.push(b)}),a}function ue(i,s={}){let a=C.get(i);if(a){let E=new DOMParser().parseFromString(a,"text/html");I(a,i,ae(E,i),s);return}re(),D&&D.abort(),D=new AbortController;let c=D.signal;fetch(i,{headers:{Accept:"text/html"},signal:c}).then(b=>b.ok?b.text().then(E=>{let de=new DOMParser().parseFromString(E,"text/html");I(E,i,ae(de,i),s)}):(b.status>=500?Fe():qe()).then(N=>{N?_e(N,i):location.href=i})).catch(b=>{(b==null?void 0:b.name)!=="AbortError"&&(M(),location.href=i)}).finally(()=>{D&&!c.aborted&&(D=void 0)})}let le=i=>{if(i.defaultPrevented||i.button!==0||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey)return;let s=i.target.closest("a[data-krate-link]");if(!s||!m(s))return;i.preventDefault();let a=s.getAttribute("href");if(!a)return;let c=new URL(a,location.origin).href,b=s.hasAttribute("data-krate-replace"),E=s.getAttribute("data-krate-scroll")!=="false";if(a===location.pathname+location.search+location.hash){b&&history.replaceState({},"",a),ie(c,{scroll:E});return}ue(c,{replace:b,scroll:E})},ce=()=>{ue(location.href,{restoreScroll:!0})};document.addEventListener("click",le),window.addEventListener("popstate",ce),H(),se(),document.querySelectorAll("script[src]").forEach(i=>{Oe.test(i.src)||i.setAttribute("data-krate-spa","")}),U=()=>{document.removeEventListener("click",le),window.removeEventListener("popstate",ce),l()}}function bt(){U&&(U(),U=null),ne=!1,De()}return Ge(mt);})();
2
2
  for (const k in __krate_exports) { window[k] = __krate_exports[k]; }
package/dist/resource.js CHANGED
@@ -56,10 +56,17 @@ export function createResource(source, fetcher) {
56
56
  }
57
57
  });
58
58
  });
59
- const resource = Object.assign(data, {
60
- get loading() { return loading(); },
61
- get error() { return error(); },
62
- get state() { return state(); },
59
+ // Note: use Object.defineProperties, NOT Object.assign, for these getters.
60
+ // Object.assign evaluates source getters via [[Set]] and copies the *value*
61
+ // as a plain data property, snapshotting state/loading/error once at creation
62
+ // so they never track reactive updates. defineProperties installs live accessors.
63
+ const resource = function () {
64
+ return data();
65
+ };
66
+ Object.defineProperties(resource, {
67
+ loading: { get: () => loading() },
68
+ error: { get: () => error() },
69
+ state: { get: () => state() },
63
70
  });
64
71
  const actions = {
65
72
  mutate: (fn) => {
@@ -111,48 +111,11 @@ async function renderPage(req) {
111
111
  }
112
112
  try {
113
113
  const mod = await loadPageModule(page);
114
- let props = {};
115
- let redirect;
116
- let notFound = false;
117
- // Run data-fetching hooks. getServerSideProps runs here (per-request);
118
- // getStaticProps normally runs at build time but is honored here so SSR /
119
- // streaming pages with async props render real data instead of {}.
120
- const dataFn = mod.getServerSideProps || mod.getStaticProps;
121
- if (typeof dataFn === "function") {
122
- try {
123
- const data = await dataFn({
124
- params: req.params,
125
- query: req.query,
126
- headers: req.headers,
127
- method: req.method,
128
- url: req.url,
129
- });
130
- if (data && typeof data === "object") {
131
- if (data.notFound) {
132
- notFound = true;
133
- }
134
- else if (data.redirect) {
135
- redirect =
136
- typeof data.redirect === "string"
137
- ? data.redirect
138
- : data.redirect.destination || data.redirect;
139
- }
140
- else if (data.props && typeof data.props === "object") {
141
- props = data.props;
142
- }
143
- }
144
- }
145
- catch (err) {
146
- console.error(`[krate] ${dataFn.name || "getServerSideProps"} failed for ${req.route}:`, err);
147
- return { html: "", status: 500 };
148
- }
149
- }
150
- if (notFound) {
151
- return { html: "", status: 404, notFound: true };
152
- }
153
- if (redirect) {
154
- return { html: "", status: 302, redirect };
155
- }
114
+ // Page-level data fetching (getStaticProps/getServerSideProps) has been
115
+ // removed; per-request data is provided by server components (@server),
116
+ // runtime components (@runtime), and middleware instead. The default export
117
+ // is rendered here with no injected page props.
118
+ const props = {};
156
119
  // Get the default export (the component)
157
120
  const Component = mod.default;
158
121
  if (!Component) {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@krate/runtime",
3
- "version": "0.3.0-beta.1",
3
+ "version": "0.3.0-beta.3",
4
4
  "description": "Client-side runtime for Krate — signals, hydration, SPA router, resources, and context.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
- "homepage": "https://github.com/kratejs/krate",
7
+ "homepage": "https://krate.js.org",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/kratejs/krate.git"