@krate/runtime 0.4.0-rc.4 → 0.4.0-rc.5

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/dist/krate-dev.js CHANGED
@@ -25,6 +25,111 @@ var __krate_exports = (() => {
25
25
  }
26
26
  return pathname;
27
27
  }
28
+ var B64_VLQ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
29
+ function decodeVLQ(str) {
30
+ const out = [];
31
+ let shift = 0;
32
+ let value = 0;
33
+ for (let i = 0; i < str.length; i++) {
34
+ const digit = B64_VLQ.indexOf(str[i]);
35
+ if (digit === -1) continue;
36
+ const cont = (digit & 32) !== 0;
37
+ value += (digit & 31) << shift;
38
+ if (cont) {
39
+ shift += 5;
40
+ continue;
41
+ }
42
+ const neg = (value & 1) === 1;
43
+ value >>= 1;
44
+ out.push(neg ? -value : value);
45
+ value = 0;
46
+ shift = 0;
47
+ }
48
+ return out;
49
+ }
50
+ function decodeMappings(mappings) {
51
+ const lines = [];
52
+ let src = 0;
53
+ let srcLine = 0;
54
+ let srcCol = 0;
55
+ for (const line of mappings.split(";")) {
56
+ const segs = [];
57
+ let genCol = 0;
58
+ if (line) {
59
+ for (const part of line.split(",")) {
60
+ if (!part) continue;
61
+ const nums = decodeVLQ(part);
62
+ genCol += nums[0] || 0;
63
+ if (nums.length >= 4) {
64
+ src += nums[1];
65
+ srcLine += nums[2];
66
+ srcCol += nums[3];
67
+ segs.push({ genCol, src, srcLine, srcCol });
68
+ }
69
+ }
70
+ }
71
+ lines.push(segs);
72
+ }
73
+ return lines;
74
+ }
75
+ var mapCache = /* @__PURE__ */ new Map();
76
+ async function loadSourceMap(url) {
77
+ const cached = mapCache.get(url);
78
+ if (cached) return cached;
79
+ const p = (async () => {
80
+ try {
81
+ if (/^[a-z]+:\/\//i.test(url) && !url.startsWith(location.origin)) return null;
82
+ const res = await fetch(url + ".map");
83
+ if (!res.ok) return null;
84
+ const json = await res.json();
85
+ if (!json || typeof json.mappings !== "string") return null;
86
+ return { sources: json.sources || [], lines: decodeMappings(json.mappings) };
87
+ } catch {
88
+ return null;
89
+ }
90
+ })();
91
+ mapCache.set(url, p);
92
+ return p;
93
+ }
94
+ function parseStackFrame(line) {
95
+ const patterns = [
96
+ /^(.*?)((?:https?:)?\/\/[^\s)]+|\/[^\s):]+):(\d+):(\d+)(.*)$/
97
+ ];
98
+ for (const re of patterns) {
99
+ const m = re.exec(line);
100
+ if (!m) continue;
101
+ return { prefix: m[1], url: m[2], line: Number(m[3]), col: Number(m[4]), suffix: m[5] };
102
+ }
103
+ return null;
104
+ }
105
+ function remapLocation(map, line, col) {
106
+ const segs = map.lines[line - 1];
107
+ if (!segs || segs.length === 0) return null;
108
+ let best = null;
109
+ for (const s of segs) {
110
+ if (s.genCol <= col - 1) best = s;
111
+ else break;
112
+ }
113
+ if (!best) best = segs[0];
114
+ const source = map.sources[best.src] || "";
115
+ return { source, line: best.srcLine + 1, col: best.srcCol + 1 };
116
+ }
117
+ async function symbolicateStack(stack) {
118
+ if (!stack || stack.indexOf(".js") === -1) return stack;
119
+ const lines = stack.split("\n");
120
+ const out = await Promise.all(
121
+ lines.map(async (line) => {
122
+ const frame = parseStackFrame(line);
123
+ if (!frame) return line;
124
+ const map = await loadSourceMap(frame.url);
125
+ if (!map) return line;
126
+ const loc = remapLocation(map, frame.line, frame.col);
127
+ if (!loc) return line;
128
+ return frame.prefix + loc.source + ":" + loc.line + ":" + loc.col + frame.suffix;
129
+ })
130
+ );
131
+ return out.join("\n");
132
+ }
28
133
  function routeMatches(pattern, pathname, basePath = "") {
29
134
  const a = norm(stripBase(pathname, basePath)).split("/");
30
135
  const b = norm(pattern).split("/");
@@ -44,7 +149,7 @@ var __krate_exports = (() => {
44
149
  :host { all: initial; }
45
150
  * { box-sizing: border-box; }
46
151
 
47
- /* ── palette ─────────────────────────────────────────────────────────── */
152
+ /* palette */
48
153
  :host {
49
154
  --red: #f87171;
50
155
  --green: #34d399;
@@ -55,7 +160,7 @@ var __krate_exports = (() => {
55
160
  --muted: #9ca3af;
56
161
  }
57
162
 
58
- /* ── toolbar ─────────────────────────────────────────────────────────── */
163
+ /* toolbar */
59
164
  .toolbar {
60
165
  position: fixed; left: 50%; bottom: 0; z-index: 2147483001;
61
166
  transform: translate(-50%, 54%);
@@ -96,7 +201,7 @@ var __krate_exports = (() => {
96
201
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
97
202
  }
98
203
 
99
- /* ── overlay ─────────────────────────────────────────────────────────── */
204
+ /* overlay */
100
205
  .overlay {
101
206
  position: fixed; inset: 0; z-index: 2147483000;
102
207
  background: rgba(9, 9, 11, 0.72); backdrop-filter: blur(6px);
@@ -263,7 +368,9 @@ var __krate_exports = (() => {
263
368
  sse.addEventListener("client-error", (e) => {
264
369
  try {
265
370
  const d = JSON.parse(e.data);
266
- if (d.clientError) this.addRuntime("Runtime Error", d.clientError.message, d.clientError.stack);
371
+ if (!d.clientError) return;
372
+ const err = d.clientError;
373
+ this.addRuntime("Runtime Error", err.message, err.stack);
267
374
  } catch {
268
375
  }
269
376
  });
@@ -271,15 +378,16 @@ var __krate_exports = (() => {
271
378
  captureRuntimeErrors() {
272
379
  window.addEventListener("error", (e) => {
273
380
  const stack = e.error?.stack || "";
381
+ const message = e.message || "Unknown error";
274
382
  this.report({
275
- message: e.message || "Unknown error",
383
+ message,
276
384
  stack,
277
385
  url: e.filename,
278
386
  line: e.lineno,
279
387
  col: e.colno,
280
388
  kind: "error"
281
389
  });
282
- this.addRuntime("Runtime Error", e.message || "Unknown error", stack);
390
+ this.addRuntime("Runtime Error", message, stack);
283
391
  });
284
392
  window.addEventListener("unhandledrejection", (e) => {
285
393
  const reason = e.reason;
@@ -304,9 +412,18 @@ var __krate_exports = (() => {
304
412
  }
305
413
  }
306
414
  addRuntime(title, message, stack) {
307
- this.runtimeErrors.push({ title, message, stack });
415
+ const entry = { title, message, stack };
416
+ this.runtimeErrors.push(entry);
308
417
  this.setStatus(false);
309
418
  this.render();
419
+ if (stack) {
420
+ void symbolicateStack(stack).then((mapped) => {
421
+ if (mapped && mapped !== stack) {
422
+ entry.stack = mapped;
423
+ this.render();
424
+ }
425
+ });
426
+ }
310
427
  }
311
428
  setStatus(ok) {
312
429
  if (!this.toolbar) return;
@@ -1,2 +1,2 @@
1
- var __krate_exports=(()=>{var X=Object.defineProperty;var st=Object.getOwnPropertyDescriptor;var ct=Object.getOwnPropertyNames;var at=Object.prototype.hasOwnProperty;var lt=(e,t)=>{for(var n in t)X(e,n,{get:t[n],enumerable:!0})},ut=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ct(t))!at.call(e,i)&&i!==n&&X(e,i,{get:()=>t[i],enumerable:!(r=st(t,i))||r.enumerable});return e};var ft=e=>ut(X({},"__esModule",{value:!0}),e);var en={};lt(en,{Slot:()=>Gt,clearNodes:()=>He,clearPersisted:()=>ht,cloneElement:()=>Zt,clsx:()=>he,cn:()=>Yt,conditional:()=>jt,createCSSChoice:()=>Tt,createCSSFlags:()=>St,createCSSGroup:()=>vt,createCSSRange:()=>Et,createCSSStack:()=>xt,createCSSToggle:()=>bt,createContext:()=>pt,createEffect:()=>A,createMemo:()=>Ct,createReducer:()=>Rt,createResource:()=>Vt,createSignal:()=>v,cva:()=>Jt,disposeAll:()=>yt,disposeNode:()=>k,forwardRef:()=>Pt,h:()=>Ht,hydrate:()=>Kt,initRouter:()=>Be,insert:()=>Ot,mount:()=>It,navigate:()=>Wt,onCleanup:()=>U,onMount:()=>Nt,readDurableState:()=>te,readPersisted:()=>ne,reconcile:()=>qt,reconcileTrees:()=>Dt,reinitRouter:()=>Ft,resetContexts:()=>G,resolvePersist:()=>ee,subscribePersist:()=>oe,twMerge:()=>me,useRef:()=>Lt,writePersisted:()=>re});var dt=0,_=new Map;function G(){for(let[e,t]of _)if(t.length>0){let n=t[0];_.set(e,[n])}}function pt(e){let t=dt++;return _.set(t,[e]),{id:t,defaultValue:e,Provider:n=>{let r=_.get(t)||[e];r.push(n.value),_.set(t,r);let i=document.createElement("div");if(i.style.display="contents",n.children)for(let c of n.children)c instanceof Node?i.appendChild(c):c!=null&&i.appendChild(document.createTextNode(String(c)));return r.pop(),r.length===0&&r.push(e),i},useContext:()=>{let n=_.get(t);return n&&n.length>0?n[n.length-1]:e}}}function gt(){let e=new Map;return{getItem:t=>e.has(t)?e.get(t):null,setItem:(t,n)=>{e.set(t,n)},removeItem:t=>{e.delete(t)}}}var Q=gt();function Le(){return typeof window<"u"}function Z(e){if(e&&typeof e=="object")return e;if(!Le())return Q;try{return e==="session"?window.sessionStorage:e==="memory"?Q:window.localStorage}catch{return Q}}function ee(e){let t=typeof e=="string"?{key:e}:e;if(!t.key)throw new Error("[krate] createSignal persist requires a key");let n=t.store??"local";return{key:t.key,store:n,serialize:t.serialize??(r=>JSON.stringify(r)),deserialize:t.deserialize??(r=>JSON.parse(r)),sync:t.sync??n==="local"}}function te(e,t){let r=globalThis.__KRATE_STATE__;if(!r||!Object.prototype.hasOwnProperty.call(r,e))return{found:!1};let i=r[e];if(typeof i=="string")try{return{found:!0,value:t(i)}}catch{return{found:!0,value:i}}return{found:!0,value:i}}function ne(e){let t=Z(e.store),n;try{n=t.getItem(e.key)}catch{return{found:!1}}if(n==null)return{found:!1};try{return{found:!0,value:e.deserialize(n)}}catch{return{found:!1}}}function re(e,t){let n=Z(e.store);try{n.setItem(e.key,e.serialize(t))}catch{}}function ht(e){let t=Z(e.store);try{t.removeItem(e.key)}catch{}}var j=new Map,Re=!1;function mt(){Re||!Le()||(Re=!0,window.addEventListener("storage",e=>{if(e.key===null)return;let t=j.get(e.key);if(t)for(let n of t)n(e.newValue)}))}function oe(e,t){if(!e.sync)return()=>{};let n=j.get(e.key)??new Set;return n.add(t),j.set(e.key,n),mt(),()=>{n.delete(t),n.size===0&&j.delete(e.key)}}var L=[],Pe=[],ie=!1,O=new Set,se=[],ce=[],D=!1;function Me(e){return{fn:e,cleanups:[],disposed:!1,sources:new Set,running:!1,rerun:!1,queued:!1}}function ae(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 yt(){for(let e of O)ae(e);O.clear();for(let e of se)try{e()}catch{}se.length=0,ce.length=0,D=!1,G()}function Tt(e,t){return v(e)}function bt(e,t){return v(e)}function St(e,t){let n={};for(let i of e){let[c]=v(!1);n[i]=c}return[n,(i,c)=>{}]}function vt(e,t){return v(e)}function Et(e,t){return v(e)}function xt(e,t){let n=()=>e[0];return[{top:n,peek:n},{push:r=>{},pop:()=>{},clear:()=>{}}]}function v(e,t){let n=e,r=null;if(t?.persist){r=ee(t.persist);let u=te(r.key,r.deserialize);if(u.found)n=u.value;else{let a=ne(r);a.found&&(n=a.value)}}let i=new Set,c=()=>{let u=L[L.length-1];return u&&!u.disposed&&(i.add(u),u.sources.add(i)),n},f=()=>{let u=Array.from(i);for(let a of u){if(a.disposed){i.delete(a);continue}if(a.running){a.rerun=!0;continue}a.queued||(a.queued=!0,ce.push(a))}wt()},b=u=>{let a=typeof u=="function"?u(n):u;a!==n&&(n=a,r&&re(r,n),f())};if(r&&r.sync){let u=r,a=oe(u,S=>{if(S!==null)try{let g=u.deserialize(S);g!==n&&(n=g,f())}catch{}});U(a)}return[c,b]}function wt(){D||(D=!0,queueMicrotask(kt))}function kt(){D=!1;let e=ce.splice(0);for(let t of e)t.disposed||(t.queued=!1,t.rerun=!1,z(t),t.rerun&&!t.disposed&&(t.rerun=!1,z(t)))}function z(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 A(e){let t=Me(e);return O.add(t),z(t),()=>{ae(t),O.delete(t)}}function U(e){let t=L[L.length-1];t?t.cleanups.push(e):se.push(e)}function Nt(e){Pe.push(e),ie||(ie=!0,queueMicrotask(At))}function At(){ie=!1;let e=Pe.splice(0);for(let t of e)t()}function Ct(e){let[t,n]=v(void 0),r=Me(()=>{let c=e();n(c)});O.add(r),z(r);let i=L[L.length-1];return i&&i.cleanups.push(()=>{r.disposed||(ae(r),O.delete(r))}),t}function Rt(e,t){let[n,r]=v(t);return[n,c=>r(f=>e(f,c))]}function Lt(e){return{current:e}}function Pt(e){return t=>e(t,t.ref||(()=>{}))}var Mt={doubleclick:"dblclick",focus:"focusin",blur:"focusout",change:"input"},le=new WeakMap;function Oe(e,t){let n=le.get(e);n||(n=[],le.set(e,n)),n.push(t)}function k(e){let t=le.get(e);if(t){for(let n of t)n();t.length=0}for(let n=0;n<e.childNodes.length;n++)k(e.childNodes[n])}function _t(e){let t=e.nextSibling;for(;t;){if(t.nodeType===8&&t.nodeValue==="k")return t;t=t.nextSibling}return null}function He(e,t){let n=e.parentNode;if(!n)return;let r=e.nextSibling;for(;r&&r!==t;){let i=r.nextSibling;k(r),n.removeChild(r),r=i}}function Ot(e,t,n){let r=_t(n);r?(He(n,r),ue(e,t,r)):ue(e,t,null)}function ue(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)ue(e,r,n)}}function _e(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(),i=Mt[r]||r,c=`__krate_${i}`,f=e[c];f&&e.removeEventListener(i,f),e.addEventListener(i,n),e[c]=n}else t==="value"||t==="checked"||t==="selected"?t==="value"?e.value=n==null||n===!1?"":n:e[t]=!!n:t==="ref"?typeof n=="function"?n(e):n&&typeof n=="object"&&"current"in n&&(n.current=e):t==="key"||n!=null&&n!==!1&&e.setAttribute(t,String(n))}function Ie(e,t){if(!(t==null||t===!1||t===!0)){if(Array.isArray(t)){for(let n of t)Ie(e,n);return}if(typeof t=="function"){let n=document.createTextNode("");e.appendChild(n),Oe(n,A(()=>{n.nodeValue=String(t())}));return}e.appendChild(t instanceof Node?t:document.createTextNode(String(t)))}}function Ht(e,t,...n){if(typeof e=="function")return e({...t||{},children:n});let r=document.createElement(e);if(t)for(let[i,c]of Object.entries(t))typeof c=="function"&&!i.startsWith("on")?Oe(r,A(()=>_e(r,i,c()))):_e(r,i,c);for(let i of n)Ie(r,i);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;A(()=>{r||(r=!0,n.appendChild(e()))})}function Kt(e,t){let n=Ke(t);if(n.childNodes.length===0){n.appendChild(e());return}let r=e();r&&k(r)}function Vt(e,t){let[n,r]=v(void 0),[i,c]=v(!0),[f,b]=v(void 0),[u,a]=v("unresolved"),[S,g]=v(0),d,y=()=>typeof e=="function"?e():e,T=async()=>{d&&d.abort(),d=new AbortController;let N=d,V=y();a(S()>0?"refreshing":"loading"),c(!0),b(void 0);try{let C=await t(V,{signal:N.signal});N.signal.aborted||(r(()=>C),a("ready"))}catch(C){C?.name!=="AbortError"&&!N.signal.aborted&&(b(C),a("error"))}finally{N.signal.aborted||c(!1)}};A(()=>{typeof e=="function"&&e.length===0&&e(),S(),T(),U(()=>{d&&(d.abort(),d=void 0)})});let E=function(){return n()};return Object.defineProperties(E,{loading:{get:()=>i()},error:{get:()=>f()},state:{get:()=>u()}}),[E,{mutate:N=>{r(N)},refetch:()=>{g(N=>N+1)}}]}function qt(e,t,n,r,i,c){let f=[],b=t.nextSibling;for(;b&&b!==n;)f.push(b),b=b.nextSibling;if(c){let u=new Map;for(let g of f){let d=g.__k;d!=null&&u.set(d,g)}let a=[],S=new Set;for(let g=0;g<r.length;g++){let d=r[g],y=c(d);S.add(y);let T=i(d,g);T.__k=y,a.push(T)}for(let[g,d]of u)!S.has(g)&&d.parentNode===e&&(k(d),e.removeChild(d));for(let g=0;g<a.length;g++){let d=a[g],y=g===0?t:a[g-1];d!==y.nextSibling&&e.insertBefore(d,y.nextSibling)}}else{let u=Math.max(f.length,r.length);for(let a=0;a<u;a++)if(a<r.length){let S=i(r[a],a);a<f.length?f[a]!==S&&(k(f[a]),e.replaceChild(S,f[a])):e.insertBefore(S,n)}else a<f.length&&f[a].parentNode===e&&(k(f[a]),e.removeChild(f[a]))}}function jt(e,t,n,r,i,c){let f=null;A(()=>{let u=r()?i():c?c():null;f?u?(k(f),e.replaceChild(u,f)):(k(f),e.removeChild(f)):u&&e.insertBefore(u,n),f=u})}function H(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 Ve(e,t){let n=new Set;for(let r=0;r<t.attributes.length;r++){let i=t.attributes[r].name,c=t.attributes[r].value;n.add(i),e.getAttribute(i)!==c&&e.setAttribute(i,c)}for(let r=0;r<e.attributes.length;r++){let i=e.attributes[r].name;n.has(i)||e.removeAttribute(i)}}function fe(e,t){let n=document.importNode(t,!0);return e.parentNode&&(k(e),e.parentNode.replaceChild(n,e)),n}function qe(e,t){return e.nodeType!==t.nodeType?!1:e.nodeType===Node.ELEMENT_NODE?e.tagName===t.tagName:!0}function de(e,t){if(!qe(e,t))return fe(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?fe(e,t):e;if(e.nodeType!==Node.ELEMENT_NODE)return e;let n=e,r=t;return H(n)!==H(r)?fe(n,r):(Ve(n,r),je(n,r),n)}function je(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(H(n[d])!==H(r[d])){g=!1;break}if(g){for(let d=0;d<r.length;d++)de(n[d],r[d]);return}}let i=new Map,c=[];n.forEach((g,d)=>{let y=H(g);y!=null?i.has(y)||i.set(y,d):c.push(d)});let f=new Set,b=0,u=null,a=0,S=()=>{for(;a<c.length&&f.has(c[a]);)a++;return a<c.length?c[a]:-1};for(let g of r){let d=H(g),y;if(d!=null&&i.has(d)){let T=i.get(d);i.delete(d),f.add(T);let E=n[T];T<b?e.insertBefore(E,u):b=T,y=de(E,g)}else if(d==null){let T=S();if(T>=0&&qe(n[T],g)){f.add(T);let E=n[T];E.parentNode===e&&E.nextSibling!==u&&e.insertBefore(E,u),y=de(E,g)}else y=document.importNode(g,!0),e.insertBefore(y,u)}else y=document.importNode(g,!0),e.insertBefore(y,u);u=y.nextSibling}n.forEach((g,d)=>{!f.has(d)&&g.parentNode===e&&(k(g),e.removeChild(g))})}function Dt(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 i=document.importNode(t,!0);n.parentNode&&n.parentNode.replaceChild(i,n);return}Ve(n,r),je(n,r)}var pe=!1,I,W=null,B=0,P=new Map,zt=30,K=new Map,Ut=50,De=/\/chunks\/runtime\.[^/]+\.js$/;function Ue(){return globalThis.__KRATE_CFG__||{}}function Bt(){let e=Ue().basePath||"";return!e||e==="/"?"":"/"+e.replace(/^\/+|\/+$/g,"")}function ze(e){let t=Bt();if(t&&(e===t||e.startsWith(t+"/"))){let n=e.slice(t.length);return n===""?"/":n}return e}var F=null;function Wt(e,t={}){return F?(F(e,t),!1):(typeof location<"u"&&(location.href=e),!0)}function Be(){if(typeof document>"u"||pe)return;pe=!0;let e="#root, main, .docs-content",t=150,n=200,r=null,i=null,c=new Map,f=null;function b(o){for(let s of e.split(", ")){let l=o.querySelector(s.trim());if(l)return l}return o.body}function u(o){if(o.hasAttribute("data-krate-external"))return!1;let s=o.getAttribute("href");return!(!s||s.startsWith("#")||s.startsWith("javascript:")||o.origin!==location.origin||o.target==="_blank")}function a(o){P.has(o)||fetch(o,{headers:{Accept:"text/html"}}).then(s=>s.ok?s.text():null).then(s=>{if(s){if(P.size>=zt){let l=P.keys().next().value;l!==void 0&&P.delete(l)}P.set(o,s)}}).catch(()=>{})}function S(){document.addEventListener("mouseover",y),document.addEventListener("focusin",y),typeof IntersectionObserver<"u"&&(f=new IntersectionObserver(o=>{for(let s of o)if(s.isIntersecting){let l=s.target,p=l.getAttribute("href");if(p&&u(l)){let h=new URL(p,location.origin).href;a(h)}f.unobserve(s.target)}},{rootMargin:"200px"}),g())}function g(){f&&document.querySelectorAll("a[data-prefetch]").forEach(o=>{f.observe(o)})}function d(){document.removeEventListener("mouseover",y),document.removeEventListener("focusin",y);for(let o of c.values())clearTimeout(o);c.clear(),f&&(f.disconnect(),f=null)}function y(o){let s=o.target.closest("a[data-prefetch]");if(!s||!u(s))return;let l=s.getAttribute("href");if(!l)return;let p=new URL(l,location.origin).href;if(P.has(p))return;let h=c.get(s);h&&clearTimeout(h);let m=setTimeout(()=>{c.delete(s),a(p)},n);c.set(s,m)}let T=null;function E(){if(C())return;let o=b(document),s=document.querySelector("template[data-krate-loading]");s&&s.content&&o&&(T=s.content.cloneNode(!0),document.body.appendChild(T)),o&&(o.style.transition=`opacity ${t}ms ease`,o.style.opacity="0")}function $(){if(C())return;T&&T.parentNode&&T.parentNode.removeChild(T),T=null;let o=b(document);o&&(o.style.opacity="1")}function N(o){try{let s=globalThis.__krate_onNavigation;typeof s=="function"&&s(o)}catch{}}function V(o,s){try{window.dispatchEvent(new CustomEvent(o,{detail:{url:s}}))}catch{}}function C(){if(Ue().viewTransitions===!1)return!1;if(typeof window<"u"&&window.matchMedia)try{if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return!1}catch{}return typeof document.startViewTransition=="function"}function $e(o){let s=o.querySelectorAll('link[rel="stylesheet"]'),l=new Set;s.forEach(h=>{let m=h.getAttribute("href");m&&l.add(new URL(m,location.origin).href)}),document.querySelectorAll('link[rel="stylesheet"]').forEach(h=>{let m=h.href;m&&!l.has(m)&&h.remove()});let p=new Set;document.querySelectorAll('link[rel="stylesheet"]').forEach(h=>p.add(h.href)),s.forEach(h=>{let m=h.getAttribute("href");if(!m)return;let x=new URL(m,location.origin).href;if(!p.has(x)){let R=document.createElement("link");R.rel="stylesheet",R.href=x,document.head.appendChild(R)}})}function ye(o){o.querySelectorAll("[data-view-transition]").forEach(s=>{let l=s.getAttribute("data-view-transition");l&&(s.style.viewTransitionName=l)})}function Ye(){let o=b(document);if(o){o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1");try{o.focus({preventScroll:!0})}catch{try{o.focus()}catch{}}}}function Je(){let o=HTMLScriptElement.supports;if(!(typeof o!="function"||!o("speculationrules")))try{let s=document.createElement("script");s.type="speculationrules",s.textContent=JSON.stringify({prefetch:[{where:{and:[{href_matches:"/*"},{not:{href_matches:"/__krate/*"}},{not:{href_matches:"/api/*"}}]},eagerness:"moderate"}]}),document.head.appendChild(s)}catch{}}function Te(o){return o.getElementById("root")||o.body}let be='meta[name="description"], meta[property^="og:"], meta[name^="twitter:"], link[rel="canonical"], script[type="application/ld+json"]';function Xe(o){document.head.querySelectorAll(be).forEach(s=>s.remove()),o.head.querySelectorAll(be).forEach(s=>{document.head.appendChild(document.importNode(s,!0))})}function Se(o,s,l,p={}){let{replace:h=!1,scroll:m=!0,restoreScroll:x=!1}=p,M=new DOMParser().parseFromString(o,"text/html"),Ae=Te(M),Ce=Te(document);if(!Ae||!Ce){location.href=s;return}V("krate:navigate-start",s);let J=()=>{let w=M.querySelector("title");w&&(document.title=w.textContent||""),typeof globalThis.disposeAll=="function"&&globalThis.disposeAll();let q=Array.from(Ae.childNodes).map(it=>document.importNode(it,!0));Ce.replaceChildren(...q),$e(M),Xe(M),ye(document)};if(C())try{let w=document.startViewTransition(J);w&&w.finished&&typeof w.finished.catch=="function"&&w.finished.catch(()=>{})}catch{J()}else J();Qe(l,s).then(()=>{try{et(),g()}catch(w){try{let q=globalThis.__krate_onHydrationError;typeof q=="function"&&q(w)}catch{}location.href=s}}),$();let ot=location.pathname+location.search;if(h)history.replaceState({},"",s);else{if(!x){if(K.size>=Ut){let w=K.keys().next().value;w!==void 0&&K.delete(w)}K.set(ot,window.scrollY)}history.pushState({},"",s)}ve(s,{restoreScroll:x,scroll:m}),x||Ye(),Ee(),window.dispatchEvent(new CustomEvent("krate:navigate",{detail:{url:s}})),V("krate:navigate-end",s),N(s)}function Ge(o){let s=o.indexOf("#");if(s<0||s===o.length-1)return!1;let l=o.slice(s);try{let p=document.querySelector(l);if(p)return p.scrollIntoView({behavior:"smooth",block:"start"}),!0}catch{return!1}return!1}function ve(o,s){if(s.restoreScroll){let l=K.get(o);if(l!==void 0){window.scrollTo(0,l);return}}Ge(o)||s.scroll&&window.scrollTo(0,0)}function Ee(){let o=ze(location.pathname);document.querySelectorAll("a[data-krate-link]").forEach(s=>{let l=s.getAttribute("href");if(!l){s.removeAttribute("aria-current");return}let p=l;try{p=ze(new URL(l,location.origin).pathname)}catch{return}p===o||o==="/"&&(p===""||p==="/")||p!=="/"&&p.length>1&&o.startsWith(p)?s.setAttribute("aria-current","page"):s.removeAttribute("aria-current")})}function Qe(o,s){return o.length===0?Promise.resolve():Promise.all(o.map(l=>{let p=l.getAttribute("src");return p?Ze(p,s):Promise.resolve()})).then(()=>{})}function Ze(o,s){return new Promise(l=>{let p=document.createElement("script"),h=xe(o,s);p.src=h,De.test(h)||p.setAttribute("data-krate-spa",""),p.onload=()=>l(),p.onerror=()=>l(),document.body.appendChild(p)})}function xe(o,s){if(/^(https?:)?\/\//.test(o)||o.startsWith("/"))return new URL(o,s).href;let l=s;if(!l.endsWith("/")){let p=l.lastIndexOf("/");l=p>0?l.slice(0,p+1):"/"}return new URL(o,l).href}function et(){typeof globalThis.__krate_hydrate=="function"&&globalThis.__krate_hydrate()}function tt(o,s){typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),history.pushState({},"",s),N(s),document.open(),document.write(o),document.close()}function nt(){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 rt(){return i!==null?Promise.resolve(i):fetch("/500.html",{headers:{Accept:"text/html"}}).then(o=>o.ok?o.text():null).then(o=>(i=o,o)).catch(()=>null)}function we(o,s){document.querySelectorAll("script[data-krate-spa]").forEach(h=>h.remove());let l=[],p=new Set;return document.querySelectorAll("script[src]").forEach(h=>{p.add(h.src)}),o.querySelectorAll("script[src]").forEach(h=>{let m=h.getAttribute("src");m&&!p.has(xe(m,s))&&l.push(h)}),l}function Y(o,s={}){let l=++B,p=P.get(o);if(p){let x=new DOMParser().parseFromString(p,"text/html");Se(p,o,we(x,o),s);return}E(),I&&I.abort(),I=new AbortController;let h=I.signal;fetch(o,{headers:{Accept:"text/html"},signal:h}).then(m=>{if(l===B)return m.ok?m.text().then(x=>{if(l!==B)return;let M=new DOMParser().parseFromString(x,"text/html");Se(x,o,we(M,o),s)}):(m.status>=500?rt():nt()).then(R=>{l===B&&(R?tt(R,o):location.href=o)})}).catch(m=>{m?.name!=="AbortError"&&($(),location.href=o)}).finally(()=>{I&&!h.aborted&&(I=void 0)})}let ke=o=>{if(o.defaultPrevented||o.button!==0||o.metaKey||o.ctrlKey||o.shiftKey||o.altKey)return;let s=o.target.closest("a[data-krate-link]");if(!s||!u(s))return;o.preventDefault();let l=s.getAttribute("href");if(!l)return;let p=new URL(l,location.origin).href,h=s.hasAttribute("data-krate-replace"),m=s.getAttribute("data-krate-scroll")!=="false";if(l===location.pathname+location.search+location.hash){h&&history.replaceState({},"",l),ve(p,{scroll:m});return}Y(p,{replace:h,scroll:m})},Ne=()=>{Y(location.href,{restoreScroll:!0})};document.addEventListener("click",ke),window.addEventListener("popstate",Ne),S(),Je(),Ee(),ye(document),F=(o,s={})=>{let l=!0;try{l=new URL(o,location.href).origin===location.origin}catch{l=!1}if(!l){location.href=o;return}Y(new URL(o,location.href).href,s)},document.querySelectorAll("script[src]").forEach(o=>{De.test(o.src)||o.setAttribute("data-krate-spa","")}),W=()=>{document.removeEventListener("click",ke),window.removeEventListener("popstate",Ne),d(),F=null}}function Ft(){W&&(W(),W=null),pe=!1,Be()}function ge(e,t){if(!(e==null||e===!1||e===!0||e==="")){if(typeof e=="string"||typeof e=="number"){t.push(String(e));return}if(Array.isArray(e)){for(let n of e)ge(n,t);return}if(typeof e=="object")for(let n of Object.keys(e))e[n]&&t.push(n)}}function he(...e){let t=[];for(let n of e)ge(n,t);return t.join(" ")}function me(...e){let t=[];for(let i of e)ge(i,t);let n=new Map,r=[];for(let i of t){let c=$t(i);n.has(c)||r.push(c),n.set(c,i)}return r.map(i=>n.get(i)).join(" ")}function $t(e){let t=e,n="",r=t.lastIndexOf(":");r>=0&&(n=t.slice(0,r+1),t=t.slice(r+1));let i=t.indexOf("-"),c=i>=0?t.slice(0,i):t,f=i>=0?t.slice(i+1,i+2):"";return n+c+(f&&/[0-9]/.test(f)?"-"+f:"")}function Yt(...e){return me(he(...e))}function Jt(e,t){let n=t?.variants??{},r=t?.defaultVariants??{};return i=>{let c={};for(let u of Object.keys(n)){let a=i?.[u]??r[u];a!=null&&(c[u]=String(a))}let f=[e];for(let u of Object.keys(n)){let a=c[u];a&&n[u][a]&&f.push(n[u][a])}for(let u of t?.compoundVariants??[])if(Xt(u,c,r)){let a=u.class;typeof a=="string"&&f.push(a)}let b=i?.class??i?.className;return typeof b=="string"&&f.push(b),me(he(f))}}function Xt(e,t,n){for(let r of Object.keys(e)){if(r==="class")continue;let i=e[r],c=t[r]??n[r]??void 0;if(Array.isArray(i)){if(!i.includes(c))return!1}else if(i!==c)return!1}return!0}function Gt(e){let t=We(e?.children);return t?(Fe(t,e),t):null}function We(e){if(e==null)return null;if(Array.isArray(e)){for(let t of e){let n=We(t);if(n)return n}return null}return e instanceof Node?e:null}function Fe(e,t){if(e instanceof Element)for(let n of Object.keys(t)){if(n==="children"||n==="ref")continue;let r=t[n];if(!(r==null||r===!1)){if(n==="class"||n==="className"){let i=e.getAttribute("class"),c=i?i+" "+String(r):String(r);e.setAttribute("class",c);continue}if(n==="style"&&typeof r=="object"){for(let[i,c]of Object.entries(r))e.style.setProperty(Qt(i),String(c));continue}if(n.startsWith("on")&&typeof r=="function"){e[n]=r;continue}if(r===!0){e.setAttribute(n,"");continue}e.setAttribute(n,String(r))}}}function Qt(e){return e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Zt(e,t,...n){if(!(e instanceof Node))return e;if(t&&Fe(e,t),n.length>0&&e instanceof Element){e.textContent="";for(let r of n)r instanceof Node?e.appendChild(r):r!=null&&e.appendChild(document.createTextNode(String(r)))}return e}return ft(en);})();
1
+ var __krate_exports=(()=>{var G=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var lt=Object.getOwnPropertyNames;var ut=Object.prototype.hasOwnProperty;var ft=(e,t)=>{for(var n in t)G(e,n,{get:t[n],enumerable:!0})},dt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of lt(t))!ut.call(e,i)&&i!==n&&G(e,i,{get:()=>t[i],enumerable:!(r=at(t,i))||r.enumerable});return e};var pt=e=>dt(G({},"__esModule",{value:!0}),e);var rn={};ft(rn,{Slot:()=>en,clearNodes:()=>Ie,clearPersisted:()=>St,cloneElement:()=>nn,clsx:()=>ye,cn:()=>Gt,conditional:()=>zt,createCSSChoice:()=>bt,createCSSFlags:()=>Et,createCSSGroup:()=>wt,createCSSRange:()=>kt,createCSSStack:()=>Ct,createCSSToggle:()=>xt,createContext:()=>Z,createEffect:()=>N,createMemo:()=>Pt,createReducer:()=>Mt,createResource:()=>Dt,createScope:()=>ht,createScopeFlags:()=>mt,createSignal:()=>b,cva:()=>Qt,disposeAll:()=>vt,disposeNode:()=>k,forwardRef:()=>Ot,h:()=>Vt,hydrate:()=>jt,initRouter:()=>We,insert:()=>It,mount:()=>qt,navigate:()=>Yt,onCleanup:()=>U,onMount:()=>Rt,readDurableState:()=>re,readPersisted:()=>oe,reconcile:()=>Ft,reconcileTrees:()=>Ut,reinitRouter:()=>Jt,resetContexts:()=>Q,resolvePersist:()=>ne,subscribePersist:()=>se,twMerge:()=>Se,useRef:()=>_t,writePersisted:()=>ie});var gt=0,_=new Map;function Q(){for(let[e,t]of _)if(t.length>0){let n=t[0];_.set(e,[n])}}function ht(){return Z({})}function mt(){return Z({})}function Z(e){let t=gt++;_.set(t,[e]);let n=()=>{let r=_.get(t);return r&&r.length>0?r[r.length-1]:e};return{id:t,defaultValue:e,Provider:r=>{let i=_.get(t)||[e];i.push(r.value),_.set(t,i);let c=document.createElement("div");if(c.style.display="contents",r.children)for(let a of r.children)a instanceof Node?c.appendChild(a):a!=null&&c.appendChild(document.createTextNode(String(a)));return i.pop(),i.length===0&&i.push(e),c},useContext:n,use:n}}function yt(){let e=new Map;return{getItem:t=>e.has(t)?e.get(t):null,setItem:(t,n)=>{e.set(t,n)},removeItem:t=>{e.delete(t)}}}var ee=yt();function Me(){return typeof window<"u"}function te(e){if(e&&typeof e=="object")return e;if(!Me())return ee;try{return e==="session"?window.sessionStorage:e==="memory"?ee:window.localStorage}catch{return ee}}function ne(e){let t=typeof e=="string"?{key:e}:e;if(!t.key)throw new Error("[krate] createSignal persist requires a key");let n=t.store??"local";return{key:t.key,store:n,serialize:t.serialize??(r=>JSON.stringify(r)),deserialize:t.deserialize??(r=>JSON.parse(r)),sync:t.sync??n==="local"}}function re(e,t){let r=globalThis.__KRATE_STATE__;if(!r||!Object.prototype.hasOwnProperty.call(r,e))return{found:!1};let i=r[e];if(typeof i=="string")try{return{found:!0,value:t(i)}}catch{return{found:!0,value:i}}return{found:!0,value:i}}function oe(e){let t=te(e.store),n;try{n=t.getItem(e.key)}catch{return{found:!1}}if(n==null)return{found:!1};try{return{found:!0,value:e.deserialize(n)}}catch{return{found:!1}}}function ie(e,t){let n=te(e.store);try{n.setItem(e.key,e.serialize(t))}catch{}}function St(e){let t=te(e.store);try{t.removeItem(e.key)}catch{}}var j=new Map,Pe=!1;function Tt(){Pe||!Me()||(Pe=!0,window.addEventListener("storage",e=>{if(e.key===null)return;let t=j.get(e.key);if(t)for(let n of t)n(e.newValue)}))}function se(e,t){if(!e.sync)return()=>{};let n=j.get(e.key)??new Set;return n.add(t),j.set(e.key,n),Tt(),()=>{n.delete(t),n.size===0&&j.delete(e.key)}}var L=[],_e=[],ce=!1,O=new Set,ae=[],le=[],D=!1;function Oe(e){return{fn:e,cleanups:[],disposed:!1,sources:new Set,running:!1,rerun:!1,queued:!1}}function ue(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 vt(){for(let e of O)ue(e);O.clear();for(let e of ae)try{e()}catch{}ae.length=0,le.length=0,D=!1,Q()}function bt(e,t){return z(b(e))}function xt(e,t){return z(b(e))}function Et(e,t){let n={};for(let c of e){let[a]=b(!1);n[c]=a}let i=[n,(c,a)=>{}];return i.trigger=c=>({"data-krate-scope":"trigger",value:c}),i.panel=c=>({"data-krate-scope":"panel",value:c}),i.close=()=>({"data-krate-scope":"close"}),i}function wt(e,t){return z(b(e))}function kt(e,t){return z(b(e))}function z(e){let t=e;return t.trigger=n=>({"data-krate-scope":"trigger",value:n}),t.panel=n=>({"data-krate-scope":"panel",value:n}),t.close=()=>({"data-krate-scope":"close"}),t.current=()=>e[0](),t}function Ct(e,t){let n=()=>e[0];return[{top:n,peek:n},{push:r=>{},pop:()=>{},clear:()=>{}}]}function b(e,t){let n=e,r=null;if(t?.persist){r=ne(t.persist);let f=re(r.key,r.deserialize);if(f.found)n=f.value;else{let l=oe(r);l.found&&(n=l.value)}}let i=new Set,c=()=>{let f=L[L.length-1];return f&&!f.disposed&&(i.add(f),f.sources.add(i)),n},a=()=>{let f=Array.from(i);for(let l of f){if(l.disposed){i.delete(l);continue}if(l.running){l.rerun=!0;continue}l.queued||(l.queued=!0,le.push(l))}Nt()},S=f=>{let l=typeof f=="function"?f(n):f;l!==n&&(n=l,r&&ie(r,n),a())};if(r&&r.sync){let f=r,l=se(f,h=>{if(h!==null)try{let g=f.deserialize(h);g!==n&&(n=g,a())}catch{}});U(l)}return[c,S]}function Nt(){D||(D=!0,queueMicrotask(At))}function At(){D=!1;let e=le.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,L.push(e);try{let t=e.fn();typeof t=="function"&&e.cleanups.push(t)}finally{L.pop(),e.running=!1}}function N(e){let t=Oe(e);return O.add(t),F(t),()=>{ue(t),O.delete(t)}}function U(e){let t=L[L.length-1];t?t.cleanups.push(e):ae.push(e)}function Rt(e){_e.push(e),ce||(ce=!0,queueMicrotask(Lt))}function Lt(){ce=!1;let e=_e.splice(0);for(let t of e)t()}function Pt(e){let[t,n]=b(void 0),r=Oe(()=>{let c=e();n(c)});O.add(r),F(r);let i=L[L.length-1];return i&&i.cleanups.push(()=>{r.disposed||(ue(r),O.delete(r))}),t}function Mt(e,t){let[n,r]=b(t);return[n,c=>r(a=>e(a,c))]}function _t(e){return{current:e}}function Ot(e){return t=>e(t,t.ref||(()=>{}))}var Ht={doubleclick:"dblclick",focus:"focusin",blur:"focusout",change:"input"},fe=new WeakMap;function Ke(e,t){let n=fe.get(e);n||(n=[],fe.set(e,n)),n.push(t)}function k(e){let t=fe.get(e);if(t){for(let n of t)n();t.length=0}for(let n=0;n<e.childNodes.length;n++)k(e.childNodes[n])}function Kt(e){let t=e.nextSibling;for(;t;){if(t.nodeType===8&&t.nodeValue==="k")return t;t=t.nextSibling}return null}function Ie(e,t){let n=e.parentNode;if(!n)return;let r=e.nextSibling;for(;r&&r!==t;){let i=r.nextSibling;k(r),n.removeChild(r),r=i}}function It(e,t,n){let r=Kt(n);r?(Ie(n,r),de(e,t,r)):de(e,t,null)}function de(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)de(e,r,n)}}function He(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(),i=Ht[r]||r,c=`__krate_${i}`,a=e[c];a&&e.removeEventListener(i,a),e.addEventListener(i,n),e[c]=n}else t==="value"||t==="checked"||t==="selected"?t==="value"?e.value=n==null||n===!1?"":n:e[t]=!!n:t==="ref"?typeof n=="function"?n(e):n&&typeof n=="object"&&"current"in n&&(n.current=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),Ke(n,N(()=>{n.nodeValue=String(t())}));return}e.appendChild(t instanceof Node?t:document.createTextNode(String(t)))}}function Vt(e,t,...n){if(typeof e=="function")return e({...t||{},children:n});let r=document.createElement(e);if(t)for(let[i,c]of Object.entries(t))typeof c=="function"&&!i.startsWith("on")?Ke(r,N(()=>He(r,i,c()))):He(r,i,c);for(let i of n)Ve(r,i);return r}function qe(e){if(typeof e=="string"){let t=document.querySelector(e);if(!t)throw new Error(`Container "${e}" not found`);return t}return e}function qt(e,t){let n=qe(t),r=!1;N(()=>{r||(r=!0,n.appendChild(e()))})}function jt(e,t){let n=qe(t);if(n.childNodes.length===0){n.appendChild(e());return}let r=e();r&&k(r)}function Dt(e,t){let[n,r]=b(void 0),[i,c]=b(!0),[a,S]=b(void 0),[f,l]=b("unresolved"),[h,g]=b(0),p,v=()=>typeof e=="function"?e():e,T=async()=>{p&&p.abort(),p=new AbortController;let C=p,V=v();l(h()>0?"refreshing":"loading"),c(!0),S(void 0);try{let A=await t(V,{signal:C.signal});C.signal.aborted||(r(()=>A),l("ready"))}catch(A){A?.name!=="AbortError"&&!C.signal.aborted&&(S(A),l("error"))}finally{C.signal.aborted||c(!1)}};N(()=>{typeof e=="function"&&e.length===0&&e(),h(),T(),U(()=>{p&&(p.abort(),p=void 0)})});let x=function(){return n()};return Object.defineProperties(x,{loading:{get:()=>i()},error:{get:()=>a()},state:{get:()=>f()}}),[x,{mutate:C=>{r(C)},refetch:()=>{g(C=>C+1)}}]}function Ft(e,t,n,r,i,c){let a=[],S=t.nextSibling;for(;S&&S!==n;)a.push(S),S=S.nextSibling;if(c){let f=new Map;for(let h of a){let g=h.__k;g!=null&&!f.has(g)&&f.set(g,h)}let l=[];for(let h=0;h<r.length;h++){let g=c(r[h]),p=f.get(g);p?f.delete(g):(p=i(r[h],h),p.__k=g),l.push(p)}for(let h of f.values())h.parentNode===e&&(k(h),e.removeChild(h));for(let h=0;h<l.length;h++){let g=h===0?t:l[h-1];l[h]!==g.nextSibling&&e.insertBefore(l[h],g.nextSibling)}}else{let f=Math.max(a.length,r.length);for(let l=0;l<f;l++)if(l<r.length){let h=i(r[l],l);l<a.length?a[l]!==h&&(k(a[l]),e.replaceChild(h,a[l])):e.insertBefore(h,n)}else l<a.length&&a[l].parentNode===e&&(k(a[l]),e.removeChild(a[l]))}}function zt(e,t,n,r,i,c){let a=null;N(()=>{let f=r()?i():c?c():null;a?f?(k(a),e.replaceChild(f,a)):(k(a),e.removeChild(a)):f&&e.insertBefore(f,n),a=f})}function H(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 je(e,t){let n=new Set;for(let r=0;r<t.attributes.length;r++){let i=t.attributes[r].name,c=t.attributes[r].value;n.add(i),e.getAttribute(i)!==c&&e.setAttribute(i,c)}for(let r=0;r<e.attributes.length;r++){let i=e.attributes[r].name;n.has(i)||e.removeAttribute(i)}}function pe(e,t){let n=document.importNode(t,!0);return e.parentNode&&(k(e),e.parentNode.replaceChild(n,e)),n}function De(e,t){return e.nodeType!==t.nodeType?!1:e.nodeType===Node.ELEMENT_NODE?e.tagName===t.tagName:!0}function ge(e,t){if(!De(e,t))return pe(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?pe(e,t):e;if(e.nodeType!==Node.ELEMENT_NODE)return e;let n=e,r=t;return H(n)!==H(r)?pe(n,r):(je(n,r),Fe(n,r),n)}function Fe(e,t){let n=Array.from(e.childNodes),r=Array.from(t.childNodes);if(n.length===r.length){let g=!0;for(let p=0;p<r.length;p++)if(H(n[p])!==H(r[p])){g=!1;break}if(g){for(let p=0;p<r.length;p++)ge(n[p],r[p]);return}}let i=new Map,c=[];n.forEach((g,p)=>{let v=H(g);v!=null?i.has(v)||i.set(v,p):c.push(p)});let a=new Set,S=0,f=null,l=0,h=()=>{for(;l<c.length&&a.has(c[l]);)l++;return l<c.length?c[l]:-1};for(let g of r){let p=H(g),v;if(p!=null&&i.has(p)){let T=i.get(p);i.delete(p),a.add(T);let x=n[T];T<S?e.insertBefore(x,f):S=T,v=ge(x,g)}else if(p==null){let T=h();if(T>=0&&De(n[T],g)){a.add(T);let x=n[T];x.parentNode===e&&x.nextSibling!==f&&e.insertBefore(x,f),v=ge(x,g)}else v=document.importNode(g,!0),e.insertBefore(v,f)}else v=document.importNode(g,!0),e.insertBefore(v,f);f=v.nextSibling}n.forEach((g,p)=>{!a.has(p)&&g.parentNode===e&&(k(g),e.removeChild(g))})}function Ut(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 i=document.importNode(t,!0);n.parentNode&&n.parentNode.replaceChild(i,n);return}je(n,r),Fe(n,r)}var he=!1,K,W=null,B=0,P=new Map,Bt=30,I=new Map,Wt=50,ze=/\/chunks\/runtime\.[^/]+\.js$/;function Be(){return globalThis.__KRATE_CFG__||{}}function $t(){let e=Be().basePath||"";return!e||e==="/"?"":"/"+e.replace(/^\/+|\/+$/g,"")}function Ue(e){let t=$t();if(t&&(e===t||e.startsWith(t+"/"))){let n=e.slice(t.length);return n===""?"/":n}return e}var $=null;function Yt(e,t={}){return $?($(e,t),!1):(typeof location<"u"&&(location.href=e),!0)}function We(){if(typeof document>"u"||he)return;he=!0;let e="#root, main, .docs-content",t=150,n=200,r=null,i=null,c=new Map,a=null;function S(o){for(let s of e.split(", ")){let u=o.querySelector(s.trim());if(u)return u}return o.body}function f(o){if(o.hasAttribute("data-krate-external"))return!1;let s=o.getAttribute("href");return!(!s||s.startsWith("#")||s.startsWith("javascript:")||o.origin!==location.origin||o.target==="_blank")}function l(o){P.has(o)||fetch(o,{headers:{Accept:"text/html"}}).then(s=>s.ok?s.text():null).then(s=>{if(s){if(P.size>=Bt){let u=P.keys().next().value;u!==void 0&&P.delete(u)}P.set(o,s)}}).catch(()=>{})}function h(){document.addEventListener("mouseover",v),document.addEventListener("focusin",v),typeof IntersectionObserver<"u"&&(a=new IntersectionObserver(o=>{for(let s of o)if(s.isIntersecting){let u=s.target,d=u.getAttribute("href");if(d&&f(u)){let m=new URL(d,location.origin).href;l(m)}a.unobserve(s.target)}},{rootMargin:"200px"}),g())}function g(){a&&document.querySelectorAll("a[data-prefetch]").forEach(o=>{a.observe(o)})}function p(){document.removeEventListener("mouseover",v),document.removeEventListener("focusin",v);for(let o of c.values())clearTimeout(o);c.clear(),a&&(a.disconnect(),a=null)}function v(o){let s=o.target.closest("a[data-prefetch]");if(!s||!f(s))return;let u=s.getAttribute("href");if(!u)return;let d=new URL(u,location.origin).href;if(P.has(d))return;let m=c.get(s);m&&clearTimeout(m);let y=setTimeout(()=>{c.delete(s),l(d)},n);c.set(s,y)}let T=null;function x(){if(A())return;let o=S(document),s=document.querySelector("template[data-krate-loading]");s&&s.content&&o&&(T=s.content.cloneNode(!0),document.body.appendChild(T)),o&&(o.style.transition=`opacity ${t}ms ease`,o.style.opacity="0")}function Y(){if(A())return;T&&T.parentNode&&T.parentNode.removeChild(T),T=null;let o=S(document);o&&(o.style.opacity="1")}function C(o){try{let s=globalThis.__krate_onNavigation;typeof s=="function"&&s(o)}catch{}}function V(o,s){try{window.dispatchEvent(new CustomEvent(o,{detail:{url:s}}))}catch{}}function A(){if(Be().viewTransitions===!1)return!1;if(typeof window<"u"&&window.matchMedia)try{if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return!1}catch{}return typeof document.startViewTransition=="function"}function Je(o){let s=o.querySelectorAll('link[rel="stylesheet"]'),u=new Set;s.forEach(m=>{let y=m.getAttribute("href");y&&u.add(new URL(y,location.origin).href)}),document.querySelectorAll('link[rel="stylesheet"]').forEach(m=>{let y=m.href;y&&!u.has(y)&&m.remove()});let d=new Set;document.querySelectorAll('link[rel="stylesheet"]').forEach(m=>d.add(m.href)),s.forEach(m=>{let y=m.getAttribute("href");if(!y)return;let E=new URL(y,location.origin).href;if(!d.has(E)){let R=document.createElement("link");R.rel="stylesheet",R.href=E,document.head.appendChild(R)}})}function Te(o){o.querySelectorAll("[data-view-transition]").forEach(s=>{let u=s.getAttribute("data-view-transition");u&&(s.style.viewTransitionName=u)})}function Xe(){let o=S(document);if(o){o.hasAttribute("tabindex")||o.setAttribute("tabindex","-1");try{o.focus({preventScroll:!0})}catch{try{o.focus()}catch{}}}}function Ge(){let o=HTMLScriptElement.supports;if(!(typeof o!="function"||!o("speculationrules")))try{let s=document.createElement("script");s.type="speculationrules",s.textContent=JSON.stringify({prefetch:[{where:{and:[{href_matches:"/*"},{not:{href_matches:"/__krate/*"}},{not:{href_matches:"/api/*"}}]},eagerness:"moderate"}]}),document.head.appendChild(s)}catch{}}function ve(o){return o.getElementById("root")||o.body}let be='meta[name="description"], meta[property^="og:"], meta[name^="twitter:"], link[rel="canonical"], script[type="application/ld+json"]';function Qe(o){document.head.querySelectorAll(be).forEach(s=>s.remove()),o.head.querySelectorAll(be).forEach(s=>{document.head.appendChild(document.importNode(s,!0))})}function xe(o,s,u,d={}){let{replace:m=!1,scroll:y=!0,restoreScroll:E=!1}=d,M=new DOMParser().parseFromString(o,"text/html"),Re=ve(M),Le=ve(document);if(!Re||!Le){location.href=s;return}V("krate:navigate-start",s);let X=()=>{let w=M.querySelector("title");w&&(document.title=w.textContent||""),typeof globalThis.disposeAll=="function"&&globalThis.disposeAll();let q=Array.from(Re.childNodes).map(ct=>document.importNode(ct,!0));Le.replaceChildren(...q),Je(M),Qe(M),Te(document)};if(A())try{let w=document.startViewTransition(X);w&&w.finished&&typeof w.finished.catch=="function"&&w.finished.catch(()=>{})}catch{X()}else X();et(u,s).then(()=>{try{nt(),g()}catch(w){try{let q=globalThis.__krate_onHydrationError;typeof q=="function"&&q(w)}catch{}location.href=s}}),Y();let st=location.pathname+location.search;if(m)history.replaceState({},"",s);else{if(!E){if(I.size>=Wt){let w=I.keys().next().value;w!==void 0&&I.delete(w)}I.set(st,window.scrollY)}history.pushState({},"",s)}Ee(s,{restoreScroll:E,scroll:y}),E||Xe(),we(),window.dispatchEvent(new CustomEvent("krate:navigate",{detail:{url:s}})),V("krate:navigate-end",s),C(s)}function Ze(o){let s=o.indexOf("#");if(s<0||s===o.length-1)return!1;let u=o.slice(s);try{let d=document.querySelector(u);if(d)return d.scrollIntoView({behavior:"smooth",block:"start"}),!0}catch{return!1}return!1}function Ee(o,s){if(s.restoreScroll){let u=I.get(o);if(u!==void 0){window.scrollTo(0,u);return}}Ze(o)||s.scroll&&window.scrollTo(0,0)}function we(){let o=Ue(location.pathname);document.querySelectorAll("a[data-krate-link]").forEach(s=>{let u=s.getAttribute("href");if(!u){s.removeAttribute("aria-current");return}let d=u;try{d=Ue(new URL(u,location.origin).pathname)}catch{return}d===o||o==="/"&&(d===""||d==="/")||d!=="/"&&d.length>1&&o.startsWith(d)?s.setAttribute("aria-current","page"):s.removeAttribute("aria-current")})}function et(o,s){return o.length===0?Promise.resolve():Promise.all(o.map(u=>{let d=u.getAttribute("src");return d?tt(d,s):Promise.resolve()})).then(()=>{})}function tt(o,s){return new Promise(u=>{let d=document.createElement("script"),m=ke(o,s);d.src=m,ze.test(m)||d.setAttribute("data-krate-spa",""),d.onload=()=>u(),d.onerror=()=>u(),document.body.appendChild(d)})}function ke(o,s){if(/^(https?:)?\/\//.test(o)||o.startsWith("/"))return new URL(o,s).href;let u=s;if(!u.endsWith("/")){let d=u.lastIndexOf("/");u=d>0?u.slice(0,d+1):"/"}return new URL(o,u).href}function nt(){typeof globalThis.__krate_hydrate=="function"&&globalThis.__krate_hydrate()}function rt(o,s){typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),history.pushState({},"",s),C(s),document.open(),document.write(o),document.close()}function ot(){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 it(){return i!==null?Promise.resolve(i):fetch("/500.html",{headers:{Accept:"text/html"}}).then(o=>o.ok?o.text():null).then(o=>(i=o,o)).catch(()=>null)}function Ce(o,s){document.querySelectorAll("script[data-krate-spa]").forEach(m=>m.remove());let u=[],d=new Set;return document.querySelectorAll("script[src]").forEach(m=>{d.add(m.src)}),o.querySelectorAll("script[src]").forEach(m=>{let y=m.getAttribute("src");y&&!d.has(ke(y,s))&&u.push(m)}),u}function J(o,s={}){let u=++B,d=P.get(o);if(d){let E=new DOMParser().parseFromString(d,"text/html");xe(d,o,Ce(E,o),s);return}x(),K&&K.abort(),K=new AbortController;let m=K.signal;fetch(o,{headers:{Accept:"text/html"},signal:m}).then(y=>{if(u===B)return y.ok?y.text().then(E=>{if(u!==B)return;let M=new DOMParser().parseFromString(E,"text/html");xe(E,o,Ce(M,o),s)}):(y.status>=500?it():ot()).then(R=>{u===B&&(R?rt(R,o):location.href=o)})}).catch(y=>{y?.name!=="AbortError"&&(Y(),location.href=o)}).finally(()=>{K&&!m.aborted&&(K=void 0)})}let Ne=o=>{if(o.defaultPrevented||o.button!==0||o.metaKey||o.ctrlKey||o.shiftKey||o.altKey)return;let s=o.target.closest("a[data-krate-link]");if(!s||!f(s))return;o.preventDefault();let u=s.getAttribute("href");if(!u)return;let d=new URL(u,location.origin).href,m=s.hasAttribute("data-krate-replace"),y=s.getAttribute("data-krate-scroll")!=="false";if(u===location.pathname+location.search+location.hash){m&&history.replaceState({},"",u),Ee(d,{scroll:y});return}J(d,{replace:m,scroll:y})},Ae=()=>{J(location.href,{restoreScroll:!0})};document.addEventListener("click",Ne),window.addEventListener("popstate",Ae),h(),Ge(),we(),Te(document),$=(o,s={})=>{let u=!0;try{u=new URL(o,location.href).origin===location.origin}catch{u=!1}if(!u){location.href=o;return}J(new URL(o,location.href).href,s)},document.querySelectorAll("script[src]").forEach(o=>{ze.test(o.src)||o.setAttribute("data-krate-spa","")}),W=()=>{document.removeEventListener("click",Ne),window.removeEventListener("popstate",Ae),p(),$=null}}function Jt(){W&&(W(),W=null),he=!1,We()}function me(e,t){if(!(e==null||e===!1||e===!0||e==="")){if(typeof e=="string"||typeof e=="number"){t.push(String(e));return}if(Array.isArray(e)){for(let n of e)me(n,t);return}if(typeof e=="object")for(let n of Object.keys(e))e[n]&&t.push(n)}}function ye(...e){let t=[];for(let n of e)me(n,t);return t.join(" ")}function Se(...e){let t=[];for(let i of e)me(i,t);let n=new Map,r=[];for(let i of t){let c=Xt(i);n.has(c)||r.push(c),n.set(c,i)}return r.map(i=>n.get(i)).join(" ")}function Xt(e){let t=e,n="",r=t.lastIndexOf(":");r>=0&&(n=t.slice(0,r+1),t=t.slice(r+1));let i=t.indexOf("-"),c=i>=0?t.slice(0,i):t,a=i>=0?t.slice(i+1,i+2):"";return n+c+(a&&/[0-9]/.test(a)?"-"+a:"")}function Gt(...e){return Se(ye(...e))}function Qt(e,t){let n=t?.variants??{},r=t?.defaultVariants??{};return i=>{let c={};for(let f of Object.keys(n)){let l=i?.[f]??r[f];l!=null&&(c[f]=String(l))}let a=[e];for(let f of Object.keys(n)){let l=c[f];l&&n[f][l]&&a.push(n[f][l])}for(let f of t?.compoundVariants??[])if(Zt(f,c,r)){let l=f.class;typeof l=="string"&&a.push(l)}let S=i?.class??i?.className;return typeof S=="string"&&a.push(S),Se(ye(a))}}function Zt(e,t,n){for(let r of Object.keys(e)){if(r==="class")continue;let i=e[r],c=t[r]??n[r]??void 0;if(Array.isArray(i)){if(!i.includes(c))return!1}else if(i!==c)return!1}return!0}function en(e){let t=$e(e?.children);return t?(Ye(t,e),t):null}function $e(e){if(e==null)return null;if(Array.isArray(e)){for(let t of e){let n=$e(t);if(n)return n}return null}return e instanceof Node?e:null}function Ye(e,t){if(e instanceof Element)for(let n of Object.keys(t)){if(n==="children"||n==="ref")continue;let r=t[n];if(!(r==null||r===!1)){if(n==="class"||n==="className"){let i=e.getAttribute("class"),c=i?i+" "+String(r):String(r);e.setAttribute("class",c);continue}if(n==="style"&&typeof r=="object"){for(let[i,c]of Object.entries(r))e.style.setProperty(tn(i),String(c));continue}if(n.startsWith("on")&&typeof r=="function"){e[n]=r;continue}if(r===!0){e.setAttribute(n,"");continue}e.setAttribute(n,String(r))}}}function tn(e){return e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function nn(e,t,...n){if(!(e instanceof Node))return e;if(t&&Ye(e,t),n.length>0&&e instanceof Element){e.textContent="";for(let r of n)r instanceof Node?e.appendChild(r):r!=null&&e.appendChild(document.createTextNode(String(r)))}return e}return pt(rn);})();
2
2
  for (const k in __krate_exports) { window[k] = __krate_exports[k]; }
@@ -1,2 +1,2 @@
1
- var __krate_exports=(()=>{var $=Object.defineProperty;var ut=Object.getOwnPropertyDescriptor;var lt=Object.getOwnPropertyNames;var ct=Object.prototype.hasOwnProperty;var dt=(e,t)=>{for(var n in t)$(e,n,{get:t[n],enumerable:!0})},gt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of lt(t))!ct.call(e,s)&&s!==n&&$(e,s,{get:()=>t[s],enumerable:!(r=ut(t,s))||r.enumerable});return e};var ft=e=>gt($({},"__esModule",{value:!0}),e);var rn={};dt(rn,{Fragment:()=>Kt,Slot:()=>en,clearNodes:()=>_e,clearPersisted:()=>ht,cloneElement:()=>nn,clsx:()=>pe,cn:()=>$t,conditional:()=>Ft,createCSSChoice:()=>Et,createCSSFlags:()=>Ht,createCSSGroup:()=>yt,createCSSRange:()=>Mt,createCSSStack:()=>Lt,createCSSToggle:()=>At,createContext:()=>mt,createEffect:()=>S,createMemo:()=>Ct,createReducer:()=>Nt,createResource:()=>Vt,createSignal:()=>A,cva:()=>Qt,disposeAll:()=>vt,disposeNode:()=>L,forwardRef:()=>Rt,h:()=>j,hydrate:()=>Bt,initRouter:()=>We,insert:()=>_t,jsx:()=>Ve,jsxs:()=>qt,mount:()=>Dt,navigate:()=>Gt,onCleanup:()=>F,onMount:()=>kt,readDurableState:()=>ne,readPersisted:()=>re,reconcile:()=>zt,reconcileTrees:()=>jt,reinitRouter:()=>Jt,resetContexts:()=>Q,resolvePersist:()=>te,subscribePersist:()=>se,twMerge:()=>he,useRef:()=>Pt,writePersisted:()=>ie});var bt=0,R=new Map;function Q(){for(let[e,t]of R)if(t.length>0){let n=t[0];R.set(e,[n])}}function mt(e){let t=bt++;return R.set(t,[e]),{id:t,defaultValue:e,Provider:n=>{let r=R.get(t)||[e];r.push(n.value),R.set(t,r);let s=document.createElement("div");if(s.style.display="contents",n.children)for(let a of n.children)a instanceof Node?s.appendChild(a):a!=null&&s.appendChild(document.createTextNode(String(a)));return r.pop(),r.length===0&&r.push(e),s},useContext:()=>{let n=R.get(t);return n&&n.length>0?n[n.length-1]:e}}}function pt(){let e=new Map;return{getItem:t=>e.has(t)?e.get(t):null,setItem:(t,n)=>{e.set(t,n)},removeItem:t=>{e.delete(t)}}}var Z=pt();function Ne(){return typeof window<"u"}function ee(e){if(e&&typeof e=="object")return e;if(!Ne())return Z;try{return e==="session"?window.sessionStorage:e==="memory"?Z:window.localStorage}catch{return Z}}function te(e){let t=typeof e=="string"?{key:e}:e;if(!t.key)throw new Error("[krate] createSignal persist requires a key");let n=t.store??"local";return{key:t.key,store:n,serialize:t.serialize??(r=>JSON.stringify(r)),deserialize:t.deserialize??(r=>JSON.parse(r)),sync:t.sync??n==="local"}}function ne(e,t){let r=globalThis.__KRATE_STATE__;if(!r||!Object.prototype.hasOwnProperty.call(r,e))return{found:!1};let s=r[e];if(typeof s=="string")try{return{found:!0,value:t(s)}}catch{return{found:!0,value:s}}return{found:!0,value:s}}function re(e){let t=ee(e.store),n;try{n=t.getItem(e.key)}catch{return{found:!1}}if(n==null)return{found:!1};try{return{found:!0,value:e.deserialize(n)}}catch{return{found:!1}}}function ie(e,t){let n=ee(e.store);try{n.setItem(e.key,e.serialize(t))}catch{}}function ht(e){let t=ee(e.store);try{t.removeItem(e.key)}catch{}}var K=new Map,Ce=!1;function Tt(){Ce||!Ne()||(Ce=!0,window.addEventListener("storage",e=>{if(e.key===null)return;let t=K.get(e.key);if(t)for(let n of t)n(e.newValue)}))}function se(e,t){if(!e.sync)return()=>{};let n=K.get(e.key)??new Set;return n.add(t),K.set(e.key,n),Tt(),()=>{n.delete(t),n.size===0&&K.delete(e.key)}}var C=[],Pe=[],oe=!1,O=new Set,ae=[],ue=[],q=!1;function Re(e){return{fn:e,cleanups:[],disposed:!1,sources:new Set,running:!1,rerun:!1,queued:!1}}function le(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 vt(){for(let e of O)le(e);O.clear();for(let e of ae)try{e()}catch{}ae.length=0,ue.length=0,q=!1,Q()}function Et(e,t){return A(e)}function At(e,t){return A(e)}function Ht(e,t){let n={};for(let s of e){let[a]=A(!1);n[s]=a}return[n,(s,a)=>{}]}function yt(e,t){return A(e)}function Mt(e,t){return A(e)}function Lt(e,t){let n=()=>e[0];return[{top:n,peek:n},{push:r=>{},pop:()=>{},clear:()=>{}}]}function A(e,t){let n=e,r=null;if(t?.persist){r=te(t.persist);let d=ne(r.key,r.deserialize);if(d.found)n=d.value;else{let u=re(r);u.found&&(n=u.value)}}let s=new Set,a=()=>{let d=C[C.length-1];return d&&!d.disposed&&(s.add(d),d.sources.add(s)),n},c=()=>{let d=Array.from(s);for(let u of d){if(u.disposed){s.delete(u);continue}if(u.running){u.rerun=!0;continue}u.queued||(u.queued=!0,ue.push(u))}xt()},v=d=>{let u=typeof d=="function"?d(n):d;u!==n&&(n=u,r&&ie(r,n),c())};if(r&&r.sync){let d=r,u=se(d,E=>{if(E!==null)try{let b=d.deserialize(E);b!==n&&(n=b,c())}catch{}});F(u)}return[a,v]}function xt(){q||(q=!0,queueMicrotask(St))}function St(){q=!1;let e=ue.splice(0);for(let t of e)t.disposed||(t.queued=!1,t.rerun=!1,z(t),t.rerun&&!t.disposed&&(t.rerun=!1,z(t)))}function z(e){e.running=!0;for(let t of e.cleanups)t();e.cleanups.length=0,C.push(e);try{let t=e.fn();typeof t=="function"&&e.cleanups.push(t)}finally{C.pop(),e.running=!1}}function S(e){let t=Re(e);return O.add(t),z(t),()=>{le(t),O.delete(t)}}function F(e){let t=C[C.length-1];t?t.cleanups.push(e):ae.push(e)}function kt(e){Pe.push(e),oe||(oe=!0,queueMicrotask(wt))}function wt(){oe=!1;let e=Pe.splice(0);for(let t of e)t()}function Ct(e){let[t,n]=A(void 0),r=Re(()=>{let a=e();n(a)});O.add(r),z(r);let s=C[C.length-1];return s&&s.cleanups.push(()=>{r.disposed||(le(r),O.delete(r))}),t}function Nt(e,t){let[n,r]=A(t);return[n,a=>r(c=>e(c,a))]}function Pt(e){return{current:e}}function Rt(e){return t=>e(t,t.ref||(()=>{}))}var Ot={doubleclick:"dblclick",focus:"focusin",blur:"focusout",change:"input"},ce=new WeakMap;function Ie(e,t){let n=ce.get(e);n||(n=[],ce.set(e,n)),n.push(t)}function L(e){let t=ce.get(e);if(t){for(let n of t)n();t.length=0}for(let n=0;n<e.childNodes.length;n++)L(e.childNodes[n])}function It(e){let t=e.nextSibling;for(;t;){if(t.nodeType===8&&t.nodeValue==="k")return t;t=t.nextSibling}return null}function _e(e,t){let n=e.parentNode;if(!n)return;let r=e.nextSibling;for(;r&&r!==t;){let s=r.nextSibling;L(r),n.removeChild(r),r=s}}function _t(e,t,n){let r=It(n);r?(_e(n,r),de(e,t,r)):de(e,t,null)}function de(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)de(e,r,n)}}function Oe(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(),s=Ot[r]||r,a=`__krate_${s}`,c=e[a];c&&e.removeEventListener(s,c),e.addEventListener(s,n),e[a]=n}else t==="value"||t==="checked"||t==="selected"?t==="value"?e.value=n==null||n===!1?"":n:e[t]=!!n:t==="ref"?typeof n=="function"?n(e):n&&typeof n=="object"&&"current"in n&&(n.current=e):t==="key"||n!=null&&n!==!1&&e.setAttribute(t,String(n))}function De(e,t){if(!(t==null||t===!1||t===!0)){if(Array.isArray(t)){for(let n of t)De(e,n);return}if(typeof t=="function"){let n=document.createTextNode("");e.appendChild(n),Ie(n,S(()=>{n.nodeValue=String(t())}));return}e.appendChild(t instanceof Node?t:document.createTextNode(String(t)))}}function j(e,t,...n){if(typeof e=="function")return e({...t||{},children:n});let r=document.createElement(e);if(t)for(let[s,a]of Object.entries(t))typeof a=="function"&&!s.startsWith("on")?Ie(r,S(()=>Oe(r,s,a()))):Oe(r,s,a);for(let s of n)De(r,s);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 Dt(e,t){let n=Be(t),r=!1;S(()=>{r||(r=!0,n.appendChild(e()))})}function Bt(e,t){let n=Be(t);if(n.childNodes.length===0){n.appendChild(e());return}let r=e();r&&L(r)}function Vt(e,t){let[n,r]=A(void 0),[s,a]=A(!0),[c,v]=A(void 0),[d,u]=A("unresolved"),[E,b]=A(0),g,h=()=>typeof e=="function"?e():e,T=async()=>{g&&g.abort(),g=new AbortController;let x=g,B=h();u(E()>0?"refreshing":"loading"),a(!0),v(void 0);try{let k=await t(B,{signal:x.signal});x.signal.aborted||(r(()=>k),u("ready"))}catch(k){k?.name!=="AbortError"&&!x.signal.aborted&&(v(k),u("error"))}finally{x.signal.aborted||a(!1)}};S(()=>{typeof e=="function"&&e.length===0&&e(),E(),T(),F(()=>{g&&(g.abort(),g=void 0)})});let H=function(){return n()};return Object.defineProperties(H,{loading:{get:()=>s()},error:{get:()=>c()},state:{get:()=>d()}}),[H,{mutate:x=>{r(x)},refetch:()=>{b(x=>x+1)}}]}function Kt(e){let t=document.createDocumentFragment(),n=e.children;if(n){let r=Array.isArray(n)?n:[n];for(let s of r)s instanceof Node?t.appendChild(s):t.appendChild(document.createTextNode(String(s)))}return t}function Ve(e,t,n){let r=e;if(!t)return j(r,null);let{children:s,...a}=t,c=s!==void 0?Array.isArray(s)?s:[s]:[];return j(r,Object.keys(a).length>0?a:null,...c)}function qt(e,t,n){return Ve(e,t,n)}function zt(e,t,n,r,s,a){let c=[],v=t.nextSibling;for(;v&&v!==n;)c.push(v),v=v.nextSibling;if(a){let d=new Map;for(let b of c){let g=b.__k;g!=null&&d.set(g,b)}let u=[],E=new Set;for(let b=0;b<r.length;b++){let g=r[b],h=a(g);E.add(h);let T=s(g,b);T.__k=h,u.push(T)}for(let[b,g]of d)!E.has(b)&&g.parentNode===e&&(L(g),e.removeChild(g));for(let b=0;b<u.length;b++){let g=u[b],h=b===0?t:u[b-1];g!==h.nextSibling&&e.insertBefore(g,h.nextSibling)}}else{let d=Math.max(c.length,r.length);for(let u=0;u<d;u++)if(u<r.length){let E=s(r[u],u);u<c.length?c[u]!==E&&(L(c[u]),e.replaceChild(E,c[u])):e.insertBefore(E,n)}else u<c.length&&c[u].parentNode===e&&(L(c[u]),e.removeChild(c[u]))}}function Ft(e,t,n,r,s,a){let c=null;S(()=>{let d=r()?s():a?a():null;c?d?(L(c),e.replaceChild(d,c)):(L(c),e.removeChild(c)):d&&e.insertBefore(d,n),c=d})}function I(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 Ke(e,t){let n=new Set;for(let r=0;r<t.attributes.length;r++){let s=t.attributes[r].name,a=t.attributes[r].value;n.add(s),e.getAttribute(s)!==a&&e.setAttribute(s,a)}for(let r=0;r<e.attributes.length;r++){let s=e.attributes[r].name;n.has(s)||e.removeAttribute(s)}}function ge(e,t){let n=document.importNode(t,!0);return e.parentNode&&(L(e),e.parentNode.replaceChild(n,e)),n}function qe(e,t){return e.nodeType!==t.nodeType?!1:e.nodeType===Node.ELEMENT_NODE?e.tagName===t.tagName:!0}function fe(e,t){if(!qe(e,t))return ge(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?ge(e,t):e;if(e.nodeType!==Node.ELEMENT_NODE)return e;let n=e,r=t;return I(n)!==I(r)?ge(n,r):(Ke(n,r),ze(n,r),n)}function ze(e,t){let n=Array.from(e.childNodes),r=Array.from(t.childNodes);if(n.length===r.length){let b=!0;for(let g=0;g<r.length;g++)if(I(n[g])!==I(r[g])){b=!1;break}if(b){for(let g=0;g<r.length;g++)fe(n[g],r[g]);return}}let s=new Map,a=[];n.forEach((b,g)=>{let h=I(b);h!=null?s.has(h)||s.set(h,g):a.push(g)});let c=new Set,v=0,d=null,u=0,E=()=>{for(;u<a.length&&c.has(a[u]);)u++;return u<a.length?a[u]:-1};for(let b of r){let g=I(b),h;if(g!=null&&s.has(g)){let T=s.get(g);s.delete(g),c.add(T);let H=n[T];T<v?e.insertBefore(H,d):v=T,h=fe(H,b)}else if(g==null){let T=E();if(T>=0&&qe(n[T],b)){c.add(T);let H=n[T];H.parentNode===e&&H.nextSibling!==d&&e.insertBefore(H,d),h=fe(H,b)}else h=document.importNode(b,!0),e.insertBefore(h,d)}else h=document.importNode(b,!0),e.insertBefore(h,d);d=h.nextSibling}n.forEach((b,g)=>{!c.has(g)&&b.parentNode===e&&(L(b),e.removeChild(b))})}function jt(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 s=document.importNode(t,!0);n.parentNode&&n.parentNode.replaceChild(s,n);return}Ke(n,r),ze(n,r)}var be=!1,_,W=null,U=0,N=new Map,Ut=30,D=new Map,Wt=50,Fe=/\/chunks\/runtime\.[^/]+\.js$/;function Ue(){return globalThis.__KRATE_CFG__||{}}function Xt(){let e=Ue().basePath||"";return!e||e==="/"?"":"/"+e.replace(/^\/+|\/+$/g,"")}function je(e){let t=Xt();if(t&&(e===t||e.startsWith(t+"/"))){let n=e.slice(t.length);return n===""?"/":n}return e}var X=null;function Gt(e,t={}){return X?(X(e,t),!1):(typeof location<"u"&&(location.href=e),!0)}function We(){if(typeof document>"u"||be)return;be=!0;let e="#root, main, .docs-content",t=150,n=200,r=null,s=null,a=new Map,c=null;function v(i){for(let o of e.split(", ")){let l=i.querySelector(o.trim());if(l)return l}return i.body}function d(i){if(i.hasAttribute("data-krate-external"))return!1;let o=i.getAttribute("href");return!(!o||o.startsWith("#")||o.startsWith("javascript:")||i.origin!==location.origin||i.target==="_blank")}function u(i){N.has(i)||fetch(i,{headers:{Accept:"text/html"}}).then(o=>o.ok?o.text():null).then(o=>{if(o){if(N.size>=Ut){let l=N.keys().next().value;l!==void 0&&N.delete(l)}N.set(i,o)}}).catch(()=>{})}function E(){document.addEventListener("mouseover",h),document.addEventListener("focusin",h),typeof IntersectionObserver<"u"&&(c=new IntersectionObserver(i=>{for(let o of i)if(o.isIntersecting){let l=o.target,f=l.getAttribute("href");if(f&&d(l)){let m=new URL(f,location.origin).href;u(m)}c.unobserve(o.target)}},{rootMargin:"200px"}),b())}function b(){c&&document.querySelectorAll("a[data-prefetch]").forEach(i=>{c.observe(i)})}function g(){document.removeEventListener("mouseover",h),document.removeEventListener("focusin",h);for(let i of a.values())clearTimeout(i);a.clear(),c&&(c.disconnect(),c=null)}function h(i){let o=i.target.closest("a[data-prefetch]");if(!o||!d(o))return;let l=o.getAttribute("href");if(!l)return;let f=new URL(l,location.origin).href;if(N.has(f))return;let m=a.get(o);m&&clearTimeout(m);let p=setTimeout(()=>{a.delete(o),u(f)},n);a.set(o,p)}let T=null;function H(){if(k())return;let i=v(document),o=document.querySelector("template[data-krate-loading]");o&&o.content&&i&&(T=o.content.cloneNode(!0),document.body.appendChild(T)),i&&(i.style.transition=`opacity ${t}ms ease`,i.style.opacity="0")}function G(){if(k())return;T&&T.parentNode&&T.parentNode.removeChild(T),T=null;let i=v(document);i&&(i.style.opacity="1")}function x(i){try{let o=globalThis.__krate_onNavigation;typeof o=="function"&&o(i)}catch{}}function B(i,o){try{window.dispatchEvent(new CustomEvent(i,{detail:{url:o}}))}catch{}}function k(){if(Ue().viewTransitions===!1)return!1;if(typeof window<"u"&&window.matchMedia)try{if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return!1}catch{}return typeof document.startViewTransition=="function"}function Je(i){let o=i.querySelectorAll('link[rel="stylesheet"]'),l=new Set;o.forEach(m=>{let p=m.getAttribute("href");p&&l.add(new URL(p,location.origin).href)}),document.querySelectorAll('link[rel="stylesheet"]').forEach(m=>{let p=m.href;p&&!l.has(p)&&m.remove()});let f=new Set;document.querySelectorAll('link[rel="stylesheet"]').forEach(m=>f.add(m.href)),o.forEach(m=>{let p=m.getAttribute("href");if(!p)return;let y=new URL(p,location.origin).href;if(!f.has(y)){let w=document.createElement("link");w.rel="stylesheet",w.href=y,document.head.appendChild(w)}})}function Te(i){i.querySelectorAll("[data-view-transition]").forEach(o=>{let l=o.getAttribute("data-view-transition");l&&(o.style.viewTransitionName=l)})}function Ye(){let i=v(document);if(i){i.hasAttribute("tabindex")||i.setAttribute("tabindex","-1");try{i.focus({preventScroll:!0})}catch{try{i.focus()}catch{}}}}function $e(){let i=HTMLScriptElement.supports;if(!(typeof i!="function"||!i("speculationrules")))try{let o=document.createElement("script");o.type="speculationrules",o.textContent=JSON.stringify({prefetch:[{where:{and:[{href_matches:"/*"},{not:{href_matches:"/__krate/*"}},{not:{href_matches:"/api/*"}}]},eagerness:"moderate"}]}),document.head.appendChild(o)}catch{}}function ve(i){return i.getElementById("root")||i.body}let Ee='meta[name="description"], meta[property^="og:"], meta[name^="twitter:"], link[rel="canonical"], script[type="application/ld+json"]';function Qe(i){document.head.querySelectorAll(Ee).forEach(o=>o.remove()),i.head.querySelectorAll(Ee).forEach(o=>{document.head.appendChild(document.importNode(o,!0))})}function Ae(i,o,l,f={}){let{replace:m=!1,scroll:p=!0,restoreScroll:y=!1}=f,P=new DOMParser().parseFromString(i,"text/html"),ke=ve(P),we=ve(document);if(!ke||!we){location.href=o;return}B("krate:navigate-start",o);let Y=()=>{let M=P.querySelector("title");M&&(document.title=M.textContent||""),typeof globalThis.disposeAll=="function"&&globalThis.disposeAll();let V=Array.from(ke.childNodes).map(at=>document.importNode(at,!0));we.replaceChildren(...V),Je(P),Qe(P),Te(document)};if(k())try{let M=document.startViewTransition(Y);M&&M.finished&&typeof M.finished.catch=="function"&&M.finished.catch(()=>{})}catch{Y()}else Y();et(l,o).then(()=>{try{nt(),b()}catch(M){try{let V=globalThis.__krate_onHydrationError;typeof V=="function"&&V(M)}catch{}location.href=o}}),G();let ot=location.pathname+location.search;if(m)history.replaceState({},"",o);else{if(!y){if(D.size>=Wt){let M=D.keys().next().value;M!==void 0&&D.delete(M)}D.set(ot,window.scrollY)}history.pushState({},"",o)}He(o,{restoreScroll:y,scroll:p}),y||Ye(),ye(),window.dispatchEvent(new CustomEvent("krate:navigate",{detail:{url:o}})),B("krate:navigate-end",o),x(o)}function Ze(i){let o=i.indexOf("#");if(o<0||o===i.length-1)return!1;let l=i.slice(o);try{let f=document.querySelector(l);if(f)return f.scrollIntoView({behavior:"smooth",block:"start"}),!0}catch{return!1}return!1}function He(i,o){if(o.restoreScroll){let l=D.get(i);if(l!==void 0){window.scrollTo(0,l);return}}Ze(i)||o.scroll&&window.scrollTo(0,0)}function ye(){let i=je(location.pathname);document.querySelectorAll("a[data-krate-link]").forEach(o=>{let l=o.getAttribute("href");if(!l){o.removeAttribute("aria-current");return}let f=l;try{f=je(new URL(l,location.origin).pathname)}catch{return}f===i||i==="/"&&(f===""||f==="/")||f!=="/"&&f.length>1&&i.startsWith(f)?o.setAttribute("aria-current","page"):o.removeAttribute("aria-current")})}function et(i,o){return i.length===0?Promise.resolve():Promise.all(i.map(l=>{let f=l.getAttribute("src");return f?tt(f,o):Promise.resolve()})).then(()=>{})}function tt(i,o){return new Promise(l=>{let f=document.createElement("script"),m=Me(i,o);f.src=m,Fe.test(m)||f.setAttribute("data-krate-spa",""),f.onload=()=>l(),f.onerror=()=>l(),document.body.appendChild(f)})}function Me(i,o){if(/^(https?:)?\/\//.test(i)||i.startsWith("/"))return new URL(i,o).href;let l=o;if(!l.endsWith("/")){let f=l.lastIndexOf("/");l=f>0?l.slice(0,f+1):"/"}return new URL(i,l).href}function nt(){typeof globalThis.__krate_hydrate=="function"&&globalThis.__krate_hydrate()}function rt(i,o){typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),history.pushState({},"",o),x(o),document.open(),document.write(i),document.close()}function it(){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 st(){return s!==null?Promise.resolve(s):fetch("/500.html",{headers:{Accept:"text/html"}}).then(i=>i.ok?i.text():null).then(i=>(s=i,i)).catch(()=>null)}function Le(i,o){document.querySelectorAll("script[data-krate-spa]").forEach(m=>m.remove());let l=[],f=new Set;return document.querySelectorAll("script[src]").forEach(m=>{f.add(m.src)}),i.querySelectorAll("script[src]").forEach(m=>{let p=m.getAttribute("src");p&&!f.has(Me(p,o))&&l.push(m)}),l}function J(i,o={}){let l=++U,f=N.get(i);if(f){let y=new DOMParser().parseFromString(f,"text/html");Ae(f,i,Le(y,i),o);return}H(),_&&_.abort(),_=new AbortController;let m=_.signal;fetch(i,{headers:{Accept:"text/html"},signal:m}).then(p=>{if(l===U)return p.ok?p.text().then(y=>{if(l!==U)return;let P=new DOMParser().parseFromString(y,"text/html");Ae(y,i,Le(P,i),o)}):(p.status>=500?st():it()).then(w=>{l===U&&(w?rt(w,i):location.href=i)})}).catch(p=>{p?.name!=="AbortError"&&(G(),location.href=i)}).finally(()=>{_&&!m.aborted&&(_=void 0)})}let xe=i=>{if(i.defaultPrevented||i.button!==0||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey)return;let o=i.target.closest("a[data-krate-link]");if(!o||!d(o))return;i.preventDefault();let l=o.getAttribute("href");if(!l)return;let f=new URL(l,location.origin).href,m=o.hasAttribute("data-krate-replace"),p=o.getAttribute("data-krate-scroll")!=="false";if(l===location.pathname+location.search+location.hash){m&&history.replaceState({},"",l),He(f,{scroll:p});return}J(f,{replace:m,scroll:p})},Se=()=>{J(location.href,{restoreScroll:!0})};document.addEventListener("click",xe),window.addEventListener("popstate",Se),E(),$e(),ye(),Te(document),X=(i,o={})=>{let l=!0;try{l=new URL(i,location.href).origin===location.origin}catch{l=!1}if(!l){location.href=i;return}J(new URL(i,location.href).href,o)},document.querySelectorAll("script[src]").forEach(i=>{Fe.test(i.src)||i.setAttribute("data-krate-spa","")}),W=()=>{document.removeEventListener("click",xe),window.removeEventListener("popstate",Se),g(),X=null}}function Jt(){W&&(W(),W=null),be=!1,We()}function me(e,t){if(!(e==null||e===!1||e===!0||e==="")){if(typeof e=="string"||typeof e=="number"){t.push(String(e));return}if(Array.isArray(e)){for(let n of e)me(n,t);return}if(typeof e=="object")for(let n of Object.keys(e))e[n]&&t.push(n)}}function pe(...e){let t=[];for(let n of e)me(n,t);return t.join(" ")}function he(...e){let t=[];for(let s of e)me(s,t);let n=new Map,r=[];for(let s of t){let a=Yt(s);n.has(a)||r.push(a),n.set(a,s)}return r.map(s=>n.get(s)).join(" ")}function Yt(e){let t=e,n="",r=t.lastIndexOf(":");r>=0&&(n=t.slice(0,r+1),t=t.slice(r+1));let s=t.indexOf("-"),a=s>=0?t.slice(0,s):t,c=s>=0?t.slice(s+1,s+2):"";return n+a+(c&&/[0-9]/.test(c)?"-"+c:"")}function $t(...e){return he(pe(...e))}function Qt(e,t){let n=t?.variants??{},r=t?.defaultVariants??{};return s=>{let a={};for(let d of Object.keys(n)){let u=s?.[d]??r[d];u!=null&&(a[d]=String(u))}let c=[e];for(let d of Object.keys(n)){let u=a[d];u&&n[d][u]&&c.push(n[d][u])}for(let d of t?.compoundVariants??[])if(Zt(d,a,r)){let u=d.class;typeof u=="string"&&c.push(u)}let v=s?.class??s?.className;return typeof v=="string"&&c.push(v),he(pe(c))}}function Zt(e,t,n){for(let r of Object.keys(e)){if(r==="class")continue;let s=e[r],a=t[r]??n[r]??void 0;if(Array.isArray(s)){if(!s.includes(a))return!1}else if(s!==a)return!1}return!0}function en(e){let t=Xe(e?.children);return t?(Ge(t,e),t):null}function Xe(e){if(e==null)return null;if(Array.isArray(e)){for(let t of e){let n=Xe(t);if(n)return n}return null}return e instanceof Node?e:null}function Ge(e,t){if(e instanceof Element)for(let n of Object.keys(t)){if(n==="children"||n==="ref")continue;let r=t[n];if(!(r==null||r===!1)){if(n==="class"||n==="className"){let s=e.getAttribute("class"),a=s?s+" "+String(r):String(r);e.setAttribute("class",a);continue}if(n==="style"&&typeof r=="object"){for(let[s,a]of Object.entries(r))e.style.setProperty(tn(s),String(a));continue}if(n.startsWith("on")&&typeof r=="function"){e[n]=r;continue}if(r===!0){e.setAttribute(n,"");continue}e.setAttribute(n,String(r))}}}function tn(e){return e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function nn(e,t,...n){if(!(e instanceof Node))return e;if(t&&Ge(e,t),n.length>0&&e instanceof Element){e.textContent="";for(let r of n)r instanceof Node?e.appendChild(r):r!=null&&e.appendChild(document.createTextNode(String(r)))}return e}return ft(rn);})();
1
+ var __krate_exports=(()=>{var Q=Object.defineProperty;var ct=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var gt=Object.prototype.hasOwnProperty;var ft=(e,t)=>{for(var n in t)Q(e,n,{get:t[n],enumerable:!0})},bt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of dt(t))!gt.call(e,s)&&s!==n&&Q(e,s,{get:()=>t[s],enumerable:!(r=ct(t,s))||r.enumerable});return e};var mt=e=>bt(Q({},"__esModule",{value:!0}),e);var an={};ft(an,{Fragment:()=>zt,Slot:()=>rn,clearNodes:()=>Ke,clearPersisted:()=>Et,cloneElement:()=>on,clsx:()=>Te,cn:()=>en,conditional:()=>Wt,createCSSChoice:()=>Ht,createCSSFlags:()=>Lt,createCSSGroup:()=>St,createCSSRange:()=>xt,createCSSStack:()=>kt,createCSSToggle:()=>Mt,createContext:()=>ee,createEffect:()=>x,createMemo:()=>Rt,createReducer:()=>Ot,createResource:()=>qt,createScope:()=>ht,createScopeFlags:()=>Tt,createSignal:()=>y,cva:()=>tn,disposeAll:()=>At,disposeNode:()=>L,forwardRef:()=>_t,h:()=>U,hydrate:()=>Ft,initRouter:()=>Ge,insert:()=>Bt,jsx:()=>Fe,jsxs:()=>jt,mount:()=>Vt,navigate:()=>$t,onCleanup:()=>j,onMount:()=>Pt,readDurableState:()=>ie,readPersisted:()=>se,reconcile:()=>Ut,reconcileTrees:()=>Xt,reinitRouter:()=>Qt,resetContexts:()=>Z,resolvePersist:()=>re,subscribePersist:()=>ae,twMerge:()=>ve,useRef:()=>It,writePersisted:()=>oe});var pt=0,R=new Map;function Z(){for(let[e,t]of R)if(t.length>0){let n=t[0];R.set(e,[n])}}function ht(){return ee({})}function Tt(){return ee({})}function ee(e){let t=pt++;R.set(t,[e]);let n=()=>{let r=R.get(t);return r&&r.length>0?r[r.length-1]:e};return{id:t,defaultValue:e,Provider:r=>{let s=R.get(t)||[e];s.push(r.value),R.set(t,s);let a=document.createElement("div");if(a.style.display="contents",r.children)for(let u of r.children)u instanceof Node?a.appendChild(u):u!=null&&a.appendChild(document.createTextNode(String(u)));return s.pop(),s.length===0&&s.push(e),a},useContext:n,use:n}}function vt(){let e=new Map;return{getItem:t=>e.has(t)?e.get(t):null,setItem:(t,n)=>{e.set(t,n)},removeItem:t=>{e.delete(t)}}}var te=vt();function Re(){return typeof window<"u"}function ne(e){if(e&&typeof e=="object")return e;if(!Re())return te;try{return e==="session"?window.sessionStorage:e==="memory"?te:window.localStorage}catch{return te}}function re(e){let t=typeof e=="string"?{key:e}:e;if(!t.key)throw new Error("[krate] createSignal persist requires a key");let n=t.store??"local";return{key:t.key,store:n,serialize:t.serialize??(r=>JSON.stringify(r)),deserialize:t.deserialize??(r=>JSON.parse(r)),sync:t.sync??n==="local"}}function ie(e,t){let r=globalThis.__KRATE_STATE__;if(!r||!Object.prototype.hasOwnProperty.call(r,e))return{found:!1};let s=r[e];if(typeof s=="string")try{return{found:!0,value:t(s)}}catch{return{found:!0,value:s}}return{found:!0,value:s}}function se(e){let t=ne(e.store),n;try{n=t.getItem(e.key)}catch{return{found:!1}}if(n==null)return{found:!1};try{return{found:!0,value:e.deserialize(n)}}catch{return{found:!1}}}function oe(e,t){let n=ne(e.store);try{n.setItem(e.key,e.serialize(t))}catch{}}function Et(e){let t=ne(e.store);try{t.removeItem(e.key)}catch{}}var V=new Map,Ne=!1;function yt(){Ne||!Re()||(Ne=!0,window.addEventListener("storage",e=>{if(e.key===null)return;let t=V.get(e.key);if(t)for(let n of t)n(e.newValue)}))}function ae(e,t){if(!e.sync)return()=>{};let n=V.get(e.key)??new Set;return n.add(t),V.set(e.key,n),yt(),()=>{n.delete(t),n.size===0&&V.delete(e.key)}}var C=[],Oe=[],ue=!1,O=new Set,le=[],ce=[],F=!1;function Ie(e){return{fn:e,cleanups:[],disposed:!1,sources:new Set,running:!1,rerun:!1,queued:!1}}function de(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 At(){for(let e of O)de(e);O.clear();for(let e of le)try{e()}catch{}le.length=0,ce.length=0,F=!1,Z()}function Ht(e,t){return z(y(e))}function Mt(e,t){return z(y(e))}function Lt(e,t){let n={};for(let a of e){let[u]=y(!1);n[a]=u}let s=[n,(a,u)=>{}];return s.trigger=a=>({"data-krate-scope":"trigger",value:a}),s.panel=a=>({"data-krate-scope":"panel",value:a}),s.close=()=>({"data-krate-scope":"close"}),s}function St(e,t){return z(y(e))}function xt(e,t){return z(y(e))}function z(e){let t=e;return t.trigger=n=>({"data-krate-scope":"trigger",value:n}),t.panel=n=>({"data-krate-scope":"panel",value:n}),t.close=()=>({"data-krate-scope":"close"}),t.current=()=>e[0](),t}function kt(e,t){let n=()=>e[0];return[{top:n,peek:n},{push:r=>{},pop:()=>{},clear:()=>{}}]}function y(e,t){let n=e,r=null;if(t?.persist){r=re(t.persist);let d=ie(r.key,r.deserialize);if(d.found)n=d.value;else{let l=se(r);l.found&&(n=l.value)}}let s=new Set,a=()=>{let d=C[C.length-1];return d&&!d.disposed&&(s.add(d),d.sources.add(s)),n},u=()=>{let d=Array.from(s);for(let l of d){if(l.disposed){s.delete(l);continue}if(l.running){l.rerun=!0;continue}l.queued||(l.queued=!0,ce.push(l))}wt()},T=d=>{let l=typeof d=="function"?d(n):d;l!==n&&(n=l,r&&oe(r,n),u())};if(r&&r.sync){let d=r,l=ae(d,m=>{if(m!==null)try{let b=d.deserialize(m);b!==n&&(n=b,u())}catch{}});j(l)}return[a,T]}function wt(){F||(F=!0,queueMicrotask(Ct))}function Ct(){F=!1;let e=ce.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,C.push(e);try{let t=e.fn();typeof t=="function"&&e.cleanups.push(t)}finally{C.pop(),e.running=!1}}function x(e){let t=Ie(e);return O.add(t),q(t),()=>{de(t),O.delete(t)}}function j(e){let t=C[C.length-1];t?t.cleanups.push(e):le.push(e)}function Pt(e){Oe.push(e),ue||(ue=!0,queueMicrotask(Nt))}function Nt(){ue=!1;let e=Oe.splice(0);for(let t of e)t()}function Rt(e){let[t,n]=y(void 0),r=Ie(()=>{let a=e();n(a)});O.add(r),q(r);let s=C[C.length-1];return s&&s.cleanups.push(()=>{r.disposed||(de(r),O.delete(r))}),t}function Ot(e,t){let[n,r]=y(t);return[n,a=>r(u=>e(u,a))]}function It(e){return{current:e}}function _t(e){return t=>e(t,t.ref||(()=>{}))}var Dt={doubleclick:"dblclick",focus:"focusin",blur:"focusout",change:"input"},ge=new WeakMap;function De(e,t){let n=ge.get(e);n||(n=[],ge.set(e,n)),n.push(t)}function L(e){let t=ge.get(e);if(t){for(let n of t)n();t.length=0}for(let n=0;n<e.childNodes.length;n++)L(e.childNodes[n])}function Kt(e){let t=e.nextSibling;for(;t;){if(t.nodeType===8&&t.nodeValue==="k")return t;t=t.nextSibling}return null}function Ke(e,t){let n=e.parentNode;if(!n)return;let r=e.nextSibling;for(;r&&r!==t;){let s=r.nextSibling;L(r),n.removeChild(r),r=s}}function Bt(e,t,n){let r=Kt(n);r?(Ke(n,r),fe(e,t,r)):fe(e,t,null)}function fe(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)fe(e,r,n)}}function _e(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(),s=Dt[r]||r,a=`__krate_${s}`,u=e[a];u&&e.removeEventListener(s,u),e.addEventListener(s,n),e[a]=n}else t==="value"||t==="checked"||t==="selected"?t==="value"?e.value=n==null||n===!1?"":n:e[t]=!!n:t==="ref"?typeof n=="function"?n(e):n&&typeof n=="object"&&"current"in n&&(n.current=e):t==="key"||n!=null&&n!==!1&&e.setAttribute(t,String(n))}function Be(e,t){if(!(t==null||t===!1||t===!0)){if(Array.isArray(t)){for(let n of t)Be(e,n);return}if(typeof t=="function"){let n=document.createTextNode("");e.appendChild(n),De(n,x(()=>{n.nodeValue=String(t())}));return}e.appendChild(t instanceof Node?t:document.createTextNode(String(t)))}}function U(e,t,...n){if(typeof e=="function")return e({...t||{},children:n});let r=document.createElement(e);if(t)for(let[s,a]of Object.entries(t))typeof a=="function"&&!s.startsWith("on")?De(r,x(()=>_e(r,s,a()))):_e(r,s,a);for(let s of n)Be(r,s);return r}function Ve(e){if(typeof e=="string"){let t=document.querySelector(e);if(!t)throw new Error(`Container "${e}" not found`);return t}return e}function Vt(e,t){let n=Ve(t),r=!1;x(()=>{r||(r=!0,n.appendChild(e()))})}function Ft(e,t){let n=Ve(t);if(n.childNodes.length===0){n.appendChild(e());return}let r=e();r&&L(r)}function qt(e,t){let[n,r]=y(void 0),[s,a]=y(!0),[u,T]=y(void 0),[d,l]=y("unresolved"),[m,b]=y(0),f,E=()=>typeof e=="function"?e():e,v=async()=>{f&&f.abort(),f=new AbortController;let S=f,K=E();l(m()>0?"refreshing":"loading"),a(!0),T(void 0);try{let k=await t(K,{signal:S.signal});S.signal.aborted||(r(()=>k),l("ready"))}catch(k){k?.name!=="AbortError"&&!S.signal.aborted&&(T(k),l("error"))}finally{S.signal.aborted||a(!1)}};x(()=>{typeof e=="function"&&e.length===0&&e(),m(),v(),j(()=>{f&&(f.abort(),f=void 0)})});let A=function(){return n()};return Object.defineProperties(A,{loading:{get:()=>s()},error:{get:()=>u()},state:{get:()=>d()}}),[A,{mutate:S=>{r(S)},refetch:()=>{b(S=>S+1)}}]}function zt(e){let t=document.createDocumentFragment(),n=e.children;if(n){let r=Array.isArray(n)?n:[n];for(let s of r)s instanceof Node?t.appendChild(s):t.appendChild(document.createTextNode(String(s)))}return t}function Fe(e,t,n){let r=e;if(!t)return U(r,null);let{children:s,...a}=t,u=s!==void 0?Array.isArray(s)?s:[s]:[];return U(r,Object.keys(a).length>0?a:null,...u)}function jt(e,t,n){return Fe(e,t,n)}function Ut(e,t,n,r,s,a){let u=[],T=t.nextSibling;for(;T&&T!==n;)u.push(T),T=T.nextSibling;if(a){let d=new Map;for(let m of u){let b=m.__k;b!=null&&!d.has(b)&&d.set(b,m)}let l=[];for(let m=0;m<r.length;m++){let b=a(r[m]),f=d.get(b);f?d.delete(b):(f=s(r[m],m),f.__k=b),l.push(f)}for(let m of d.values())m.parentNode===e&&(L(m),e.removeChild(m));for(let m=0;m<l.length;m++){let b=m===0?t:l[m-1];l[m]!==b.nextSibling&&e.insertBefore(l[m],b.nextSibling)}}else{let d=Math.max(u.length,r.length);for(let l=0;l<d;l++)if(l<r.length){let m=s(r[l],l);l<u.length?u[l]!==m&&(L(u[l]),e.replaceChild(m,u[l])):e.insertBefore(m,n)}else l<u.length&&u[l].parentNode===e&&(L(u[l]),e.removeChild(u[l]))}}function Wt(e,t,n,r,s,a){let u=null;x(()=>{let d=r()?s():a?a():null;u?d?(L(u),e.replaceChild(d,u)):(L(u),e.removeChild(u)):d&&e.insertBefore(d,n),u=d})}function I(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 qe(e,t){let n=new Set;for(let r=0;r<t.attributes.length;r++){let s=t.attributes[r].name,a=t.attributes[r].value;n.add(s),e.getAttribute(s)!==a&&e.setAttribute(s,a)}for(let r=0;r<e.attributes.length;r++){let s=e.attributes[r].name;n.has(s)||e.removeAttribute(s)}}function be(e,t){let n=document.importNode(t,!0);return e.parentNode&&(L(e),e.parentNode.replaceChild(n,e)),n}function ze(e,t){return e.nodeType!==t.nodeType?!1:e.nodeType===Node.ELEMENT_NODE?e.tagName===t.tagName:!0}function me(e,t){if(!ze(e,t))return be(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?be(e,t):e;if(e.nodeType!==Node.ELEMENT_NODE)return e;let n=e,r=t;return I(n)!==I(r)?be(n,r):(qe(n,r),je(n,r),n)}function je(e,t){let n=Array.from(e.childNodes),r=Array.from(t.childNodes);if(n.length===r.length){let b=!0;for(let f=0;f<r.length;f++)if(I(n[f])!==I(r[f])){b=!1;break}if(b){for(let f=0;f<r.length;f++)me(n[f],r[f]);return}}let s=new Map,a=[];n.forEach((b,f)=>{let E=I(b);E!=null?s.has(E)||s.set(E,f):a.push(f)});let u=new Set,T=0,d=null,l=0,m=()=>{for(;l<a.length&&u.has(a[l]);)l++;return l<a.length?a[l]:-1};for(let b of r){let f=I(b),E;if(f!=null&&s.has(f)){let v=s.get(f);s.delete(f),u.add(v);let A=n[v];v<T?e.insertBefore(A,d):T=v,E=me(A,b)}else if(f==null){let v=m();if(v>=0&&ze(n[v],b)){u.add(v);let A=n[v];A.parentNode===e&&A.nextSibling!==d&&e.insertBefore(A,d),E=me(A,b)}else E=document.importNode(b,!0),e.insertBefore(E,d)}else E=document.importNode(b,!0),e.insertBefore(E,d);d=E.nextSibling}n.forEach((b,f)=>{!u.has(f)&&b.parentNode===e&&(L(b),e.removeChild(b))})}function Xt(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 s=document.importNode(t,!0);n.parentNode&&n.parentNode.replaceChild(s,n);return}qe(n,r),je(n,r)}var pe=!1,_,X=null,W=0,P=new Map,Gt=30,D=new Map,Jt=50,Ue=/\/chunks\/runtime\.[^/]+\.js$/;function Xe(){return globalThis.__KRATE_CFG__||{}}function Yt(){let e=Xe().basePath||"";return!e||e==="/"?"":"/"+e.replace(/^\/+|\/+$/g,"")}function We(e){let t=Yt();if(t&&(e===t||e.startsWith(t+"/"))){let n=e.slice(t.length);return n===""?"/":n}return e}var G=null;function $t(e,t={}){return G?(G(e,t),!1):(typeof location<"u"&&(location.href=e),!0)}function Ge(){if(typeof document>"u"||pe)return;pe=!0;let e="#root, main, .docs-content",t=150,n=200,r=null,s=null,a=new Map,u=null;function T(i){for(let o of e.split(", ")){let c=i.querySelector(o.trim());if(c)return c}return i.body}function d(i){if(i.hasAttribute("data-krate-external"))return!1;let o=i.getAttribute("href");return!(!o||o.startsWith("#")||o.startsWith("javascript:")||i.origin!==location.origin||i.target==="_blank")}function l(i){P.has(i)||fetch(i,{headers:{Accept:"text/html"}}).then(o=>o.ok?o.text():null).then(o=>{if(o){if(P.size>=Gt){let c=P.keys().next().value;c!==void 0&&P.delete(c)}P.set(i,o)}}).catch(()=>{})}function m(){document.addEventListener("mouseover",E),document.addEventListener("focusin",E),typeof IntersectionObserver<"u"&&(u=new IntersectionObserver(i=>{for(let o of i)if(o.isIntersecting){let c=o.target,g=c.getAttribute("href");if(g&&d(c)){let p=new URL(g,location.origin).href;l(p)}u.unobserve(o.target)}},{rootMargin:"200px"}),b())}function b(){u&&document.querySelectorAll("a[data-prefetch]").forEach(i=>{u.observe(i)})}function f(){document.removeEventListener("mouseover",E),document.removeEventListener("focusin",E);for(let i of a.values())clearTimeout(i);a.clear(),u&&(u.disconnect(),u=null)}function E(i){let o=i.target.closest("a[data-prefetch]");if(!o||!d(o))return;let c=o.getAttribute("href");if(!c)return;let g=new URL(c,location.origin).href;if(P.has(g))return;let p=a.get(o);p&&clearTimeout(p);let h=setTimeout(()=>{a.delete(o),l(g)},n);a.set(o,h)}let v=null;function A(){if(k())return;let i=T(document),o=document.querySelector("template[data-krate-loading]");o&&o.content&&i&&(v=o.content.cloneNode(!0),document.body.appendChild(v)),i&&(i.style.transition=`opacity ${t}ms ease`,i.style.opacity="0")}function J(){if(k())return;v&&v.parentNode&&v.parentNode.removeChild(v),v=null;let i=T(document);i&&(i.style.opacity="1")}function S(i){try{let o=globalThis.__krate_onNavigation;typeof o=="function"&&o(i)}catch{}}function K(i,o){try{window.dispatchEvent(new CustomEvent(i,{detail:{url:o}}))}catch{}}function k(){if(Xe().viewTransitions===!1)return!1;if(typeof window<"u"&&window.matchMedia)try{if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return!1}catch{}return typeof document.startViewTransition=="function"}function $e(i){let o=i.querySelectorAll('link[rel="stylesheet"]'),c=new Set;o.forEach(p=>{let h=p.getAttribute("href");h&&c.add(new URL(h,location.origin).href)}),document.querySelectorAll('link[rel="stylesheet"]').forEach(p=>{let h=p.href;h&&!c.has(h)&&p.remove()});let g=new Set;document.querySelectorAll('link[rel="stylesheet"]').forEach(p=>g.add(p.href)),o.forEach(p=>{let h=p.getAttribute("href");if(!h)return;let H=new URL(h,location.origin).href;if(!g.has(H)){let w=document.createElement("link");w.rel="stylesheet",w.href=H,document.head.appendChild(w)}})}function Ee(i){i.querySelectorAll("[data-view-transition]").forEach(o=>{let c=o.getAttribute("data-view-transition");c&&(o.style.viewTransitionName=c)})}function Qe(){let i=T(document);if(i){i.hasAttribute("tabindex")||i.setAttribute("tabindex","-1");try{i.focus({preventScroll:!0})}catch{try{i.focus()}catch{}}}}function Ze(){let i=HTMLScriptElement.supports;if(!(typeof i!="function"||!i("speculationrules")))try{let o=document.createElement("script");o.type="speculationrules",o.textContent=JSON.stringify({prefetch:[{where:{and:[{href_matches:"/*"},{not:{href_matches:"/__krate/*"}},{not:{href_matches:"/api/*"}}]},eagerness:"moderate"}]}),document.head.appendChild(o)}catch{}}function ye(i){return i.getElementById("root")||i.body}let Ae='meta[name="description"], meta[property^="og:"], meta[name^="twitter:"], link[rel="canonical"], script[type="application/ld+json"]';function et(i){document.head.querySelectorAll(Ae).forEach(o=>o.remove()),i.head.querySelectorAll(Ae).forEach(o=>{document.head.appendChild(document.importNode(o,!0))})}function He(i,o,c,g={}){let{replace:p=!1,scroll:h=!0,restoreScroll:H=!1}=g,N=new DOMParser().parseFromString(i,"text/html"),Ce=ye(N),Pe=ye(document);if(!Ce||!Pe){location.href=o;return}K("krate:navigate-start",o);let $=()=>{let M=N.querySelector("title");M&&(document.title=M.textContent||""),typeof globalThis.disposeAll=="function"&&globalThis.disposeAll();let B=Array.from(Ce.childNodes).map(lt=>document.importNode(lt,!0));Pe.replaceChildren(...B),$e(N),et(N),Ee(document)};if(k())try{let M=document.startViewTransition($);M&&M.finished&&typeof M.finished.catch=="function"&&M.finished.catch(()=>{})}catch{$()}else $();nt(c,o).then(()=>{try{it(),b()}catch(M){try{let B=globalThis.__krate_onHydrationError;typeof B=="function"&&B(M)}catch{}location.href=o}}),J();let ut=location.pathname+location.search;if(p)history.replaceState({},"",o);else{if(!H){if(D.size>=Jt){let M=D.keys().next().value;M!==void 0&&D.delete(M)}D.set(ut,window.scrollY)}history.pushState({},"",o)}Me(o,{restoreScroll:H,scroll:h}),H||Qe(),Le(),window.dispatchEvent(new CustomEvent("krate:navigate",{detail:{url:o}})),K("krate:navigate-end",o),S(o)}function tt(i){let o=i.indexOf("#");if(o<0||o===i.length-1)return!1;let c=i.slice(o);try{let g=document.querySelector(c);if(g)return g.scrollIntoView({behavior:"smooth",block:"start"}),!0}catch{return!1}return!1}function Me(i,o){if(o.restoreScroll){let c=D.get(i);if(c!==void 0){window.scrollTo(0,c);return}}tt(i)||o.scroll&&window.scrollTo(0,0)}function Le(){let i=We(location.pathname);document.querySelectorAll("a[data-krate-link]").forEach(o=>{let c=o.getAttribute("href");if(!c){o.removeAttribute("aria-current");return}let g=c;try{g=We(new URL(c,location.origin).pathname)}catch{return}g===i||i==="/"&&(g===""||g==="/")||g!=="/"&&g.length>1&&i.startsWith(g)?o.setAttribute("aria-current","page"):o.removeAttribute("aria-current")})}function nt(i,o){return i.length===0?Promise.resolve():Promise.all(i.map(c=>{let g=c.getAttribute("src");return g?rt(g,o):Promise.resolve()})).then(()=>{})}function rt(i,o){return new Promise(c=>{let g=document.createElement("script"),p=Se(i,o);g.src=p,Ue.test(p)||g.setAttribute("data-krate-spa",""),g.onload=()=>c(),g.onerror=()=>c(),document.body.appendChild(g)})}function Se(i,o){if(/^(https?:)?\/\//.test(i)||i.startsWith("/"))return new URL(i,o).href;let c=o;if(!c.endsWith("/")){let g=c.lastIndexOf("/");c=g>0?c.slice(0,g+1):"/"}return new URL(i,c).href}function it(){typeof globalThis.__krate_hydrate=="function"&&globalThis.__krate_hydrate()}function st(i,o){typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),history.pushState({},"",o),S(o),document.open(),document.write(i),document.close()}function ot(){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 at(){return s!==null?Promise.resolve(s):fetch("/500.html",{headers:{Accept:"text/html"}}).then(i=>i.ok?i.text():null).then(i=>(s=i,i)).catch(()=>null)}function xe(i,o){document.querySelectorAll("script[data-krate-spa]").forEach(p=>p.remove());let c=[],g=new Set;return document.querySelectorAll("script[src]").forEach(p=>{g.add(p.src)}),i.querySelectorAll("script[src]").forEach(p=>{let h=p.getAttribute("src");h&&!g.has(Se(h,o))&&c.push(p)}),c}function Y(i,o={}){let c=++W,g=P.get(i);if(g){let H=new DOMParser().parseFromString(g,"text/html");He(g,i,xe(H,i),o);return}A(),_&&_.abort(),_=new AbortController;let p=_.signal;fetch(i,{headers:{Accept:"text/html"},signal:p}).then(h=>{if(c===W)return h.ok?h.text().then(H=>{if(c!==W)return;let N=new DOMParser().parseFromString(H,"text/html");He(H,i,xe(N,i),o)}):(h.status>=500?at():ot()).then(w=>{c===W&&(w?st(w,i):location.href=i)})}).catch(h=>{h?.name!=="AbortError"&&(J(),location.href=i)}).finally(()=>{_&&!p.aborted&&(_=void 0)})}let ke=i=>{if(i.defaultPrevented||i.button!==0||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey)return;let o=i.target.closest("a[data-krate-link]");if(!o||!d(o))return;i.preventDefault();let c=o.getAttribute("href");if(!c)return;let g=new URL(c,location.origin).href,p=o.hasAttribute("data-krate-replace"),h=o.getAttribute("data-krate-scroll")!=="false";if(c===location.pathname+location.search+location.hash){p&&history.replaceState({},"",c),Me(g,{scroll:h});return}Y(g,{replace:p,scroll:h})},we=()=>{Y(location.href,{restoreScroll:!0})};document.addEventListener("click",ke),window.addEventListener("popstate",we),m(),Ze(),Le(),Ee(document),G=(i,o={})=>{let c=!0;try{c=new URL(i,location.href).origin===location.origin}catch{c=!1}if(!c){location.href=i;return}Y(new URL(i,location.href).href,o)},document.querySelectorAll("script[src]").forEach(i=>{Ue.test(i.src)||i.setAttribute("data-krate-spa","")}),X=()=>{document.removeEventListener("click",ke),window.removeEventListener("popstate",we),f(),G=null}}function Qt(){X&&(X(),X=null),pe=!1,Ge()}function he(e,t){if(!(e==null||e===!1||e===!0||e==="")){if(typeof e=="string"||typeof e=="number"){t.push(String(e));return}if(Array.isArray(e)){for(let n of e)he(n,t);return}if(typeof e=="object")for(let n of Object.keys(e))e[n]&&t.push(n)}}function Te(...e){let t=[];for(let n of e)he(n,t);return t.join(" ")}function ve(...e){let t=[];for(let s of e)he(s,t);let n=new Map,r=[];for(let s of t){let a=Zt(s);n.has(a)||r.push(a),n.set(a,s)}return r.map(s=>n.get(s)).join(" ")}function Zt(e){let t=e,n="",r=t.lastIndexOf(":");r>=0&&(n=t.slice(0,r+1),t=t.slice(r+1));let s=t.indexOf("-"),a=s>=0?t.slice(0,s):t,u=s>=0?t.slice(s+1,s+2):"";return n+a+(u&&/[0-9]/.test(u)?"-"+u:"")}function en(...e){return ve(Te(...e))}function tn(e,t){let n=t?.variants??{},r=t?.defaultVariants??{};return s=>{let a={};for(let d of Object.keys(n)){let l=s?.[d]??r[d];l!=null&&(a[d]=String(l))}let u=[e];for(let d of Object.keys(n)){let l=a[d];l&&n[d][l]&&u.push(n[d][l])}for(let d of t?.compoundVariants??[])if(nn(d,a,r)){let l=d.class;typeof l=="string"&&u.push(l)}let T=s?.class??s?.className;return typeof T=="string"&&u.push(T),ve(Te(u))}}function nn(e,t,n){for(let r of Object.keys(e)){if(r==="class")continue;let s=e[r],a=t[r]??n[r]??void 0;if(Array.isArray(s)){if(!s.includes(a))return!1}else if(s!==a)return!1}return!0}function rn(e){let t=Je(e?.children);return t?(Ye(t,e),t):null}function Je(e){if(e==null)return null;if(Array.isArray(e)){for(let t of e){let n=Je(t);if(n)return n}return null}return e instanceof Node?e:null}function Ye(e,t){if(e instanceof Element)for(let n of Object.keys(t)){if(n==="children"||n==="ref")continue;let r=t[n];if(!(r==null||r===!1)){if(n==="class"||n==="className"){let s=e.getAttribute("class"),a=s?s+" "+String(r):String(r);e.setAttribute("class",a);continue}if(n==="style"&&typeof r=="object"){for(let[s,a]of Object.entries(r))e.style.setProperty(sn(s),String(a));continue}if(n.startsWith("on")&&typeof r=="function"){e[n]=r;continue}if(r===!0){e.setAttribute(n,"");continue}e.setAttribute(n,String(r))}}}function sn(e){return e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function on(e,t,...n){if(!(e instanceof Node))return e;if(t&&Ye(e,t),n.length>0&&e instanceof Element){e.textContent="";for(let r of n)r instanceof Node?e.appendChild(r):r!=null&&e.appendChild(document.createTextNode(String(r)))}return e}return mt(an);})();
2
2
  for (const k in __krate_exports) { window[k] = __krate_exports[k]; }
package/dist/reconcile.js CHANGED
@@ -21,37 +21,41 @@ export function reconcile(parent, startMarker, endMarker, items, mapFn, keyFn) {
21
21
  node = node.nextSibling;
22
22
  }
23
23
  if (keyFn) {
24
- // Keyed reconciliation
25
- const keyMap = new Map();
24
+ // Keyed reconciliation: reuse the existing node for a key still present
25
+ // (preserving DOM state such as focus/scroll), create nodes only for new
26
+ // keys, then drop stale nodes and reorder.
27
+ const existingByKey = new Map();
26
28
  for (const child of existing) {
27
29
  const key = child.__k;
28
- if (key != null)
29
- keyMap.set(key, child);
30
+ if (key != null && !existingByKey.has(key))
31
+ existingByKey.set(key, child);
30
32
  }
31
33
  const newNodes = [];
32
- const usedKeys = new Set();
33
34
  for (let i = 0; i < items.length; i++) {
34
- const item = items[i];
35
- const key = keyFn(item);
36
- usedKeys.add(key);
37
- const newNode = mapFn(item, i);
38
- newNode.__k = key;
39
- newNodes.push(newNode);
35
+ const key = keyFn(items[i]);
36
+ let node = existingByKey.get(key);
37
+ if (node) {
38
+ // Consume the key so a later duplicate key falls back to a fresh node.
39
+ existingByKey.delete(key);
40
+ }
41
+ else {
42
+ node = mapFn(items[i], i);
43
+ node.__k = key;
44
+ }
45
+ newNodes.push(node);
40
46
  }
41
- // Remove nodes whose keys are no longer present
42
- for (const [key, child] of keyMap) {
43
- if (!usedKeys.has(key) && child.parentNode === parent) {
47
+ // Remove nodes whose keys are no longer present.
48
+ for (const child of existingByKey.values()) {
49
+ if (child.parentNode === parent) {
44
50
  disposeNode(child);
45
51
  parent.removeChild(child);
46
52
  }
47
53
  }
48
- // Reorder: insert nodes in the correct order before endMarker
54
+ // Reorder: insert nodes in the correct order before endMarker.
49
55
  for (let i = 0; i < newNodes.length; i++) {
50
- const newNode = newNodes[i];
51
- // Find the node that should be before this one
52
56
  const prevNode = i === 0 ? startMarker : newNodes[i - 1];
53
- if (newNode !== prevNode.nextSibling) {
54
- parent.insertBefore(newNode, prevNode.nextSibling);
57
+ if (newNodes[i] !== prevNode.nextSibling) {
58
+ parent.insertBefore(newNodes[i], prevNode.nextSibling);
55
59
  }
56
60
  }
57
61
  }
@@ -115,7 +119,7 @@ export function conditional(parent, startMarker, endMarker, test, trueContent, f
115
119
  current = newNode;
116
120
  });
117
121
  }
118
- // ─── Tree reconciliation (SPA navigation) ───────────────────────────────────
122
+ // Tree reconciliation (SPA navigation)
119
123
  // Diffs a live DOM subtree against a freshly-parsed one, patching only what
120
124
  // changed. Unchanged nodes are kept in place so their state survives navigation:
121
125
  // element listeners attached at hydration (`__krate_<event>` props), media
@@ -272,7 +276,7 @@ function reconcileChildren(parent, newParent) {
272
276
  }
273
277
  }
274
278
  else {
275
- // Keyed but not present in old tree → insert new
279
+ // Keyed but not present in old tree -> insert new
276
280
  placedNode = document.importNode(newChild, true);
277
281
  parent.insertBefore(placedNode, anchor);
278
282
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,47 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { reconcile } from './reconcile';
3
+ function markers(parent) {
4
+ const start = document.createComment('s');
5
+ const end = document.createComment('e');
6
+ parent.append(start, end);
7
+ return { start, end };
8
+ }
9
+ function texts(parent, start, end) {
10
+ const out = [];
11
+ let n = start.nextSibling;
12
+ while (n && n !== end) {
13
+ out.push(n.textContent ?? '');
14
+ n = n.nextSibling;
15
+ }
16
+ return out;
17
+ }
18
+ const span = (s) => {
19
+ const el = document.createElement('span');
20
+ el.textContent = s;
21
+ return el;
22
+ };
23
+ describe('reconcile', () => {
24
+ it('renders, shrinks, grows and replaces unkeyed lists', () => {
25
+ const parent = document.createElement('div');
26
+ const { start, end } = markers(parent);
27
+ reconcile(parent, start, end, ['a', 'b', 'c'], span);
28
+ expect(texts(parent, start, end)).toEqual(['a', 'b', 'c']);
29
+ reconcile(parent, start, end, ['a', 'b'], span);
30
+ expect(texts(parent, start, end)).toEqual(['a', 'b']);
31
+ reconcile(parent, start, end, ['a', 'b', 'c', 'd'], span);
32
+ expect(texts(parent, start, end)).toEqual(['a', 'b', 'c', 'd']);
33
+ reconcile(parent, start, end, [], span);
34
+ expect(texts(parent, start, end)).toEqual([]);
35
+ });
36
+ it('keyed reconciliation keeps order and drops removed keys', () => {
37
+ const parent = document.createElement('div');
38
+ const { start, end } = markers(parent);
39
+ const map = (n) => span(String(n));
40
+ reconcile(parent, start, end, [1, 2, 3], map, (n) => n);
41
+ expect(texts(parent, start, end)).toEqual(['1', '2', '3']);
42
+ reconcile(parent, start, end, [2, 3, 4], map, (n) => n);
43
+ expect(texts(parent, start, end)).toEqual(['2', '3', '4']);
44
+ reconcile(parent, start, end, [4, 2], map, (n) => n);
45
+ expect(texts(parent, start, end)).toEqual(['4', '2']);
46
+ });
47
+ });
package/dist/router.js CHANGED
@@ -63,7 +63,7 @@ export function initRouter() {
63
63
  // marketing layout's <main> and the docs layout's `.docs-page`) swaps the
64
64
  // whole shell instead of reconciling mismatched tree shapes (which dropped
65
65
  // the docs navbar/sidebar while still loading its CSS). Within one shell the
66
- // diff preserves unchanged nodes (sidebar/TOC) by key, so docs↔docs stays
66
+ // diff preserves unchanged nodes (sidebar/TOC) by key, so docs<->docs stays
67
67
  // cheap.
68
68
  const CONTENT_SEL = '#root, main, .docs-content';
69
69
  const TRANSITION_MS = 150;
@@ -372,7 +372,7 @@ export function initRouter() {
372
372
  globalThis.disposeAll();
373
373
  }
374
374
  // Replace the entire app shell. This is deterministic for ANY page pair
375
- // (docs↔docs, marketing↔docs, different layouts): no structural mismatch
375
+ // (docs<->docs, marketing<->docs, different layouts): no structural mismatch
376
376
  // can drop chrome. The new page's scripts re-hydrate below, and View
377
377
  // Transitions keep the visual transition smooth.
378
378
  const nodes = Array.from(newContent.childNodes).map((n) => document.importNode(n, true));
@@ -513,7 +513,7 @@ export function initRouter() {
513
513
  const s = document.createElement('script');
514
514
  const resolved = resolveSrc(src, baseUrl);
515
515
  s.src = resolved;
516
- // Only page scripts are disposable across navigations — the shared
516
+ // Only page scripts are disposable across navigations - the shared
517
517
  // runtime chunk stays in place.
518
518
  if (!RUNTIME_CHUNK_RE.test(resolved))
519
519
  s.setAttribute('data-krate-spa', '');
@@ -602,7 +602,7 @@ export function initRouter() {
602
602
  }
603
603
  function fetchAndSwap(url, opts = {}) {
604
604
  const seq = ++navSeq;
605
- // Check prefetch cache first — already-loaded content swaps instantly.
605
+ // Check prefetch cache first - already-loaded content swaps instantly.
606
606
  const cached = prefetchCache.get(url);
607
607
  if (cached) {
608
608
  const parser = new DOMParser();
@@ -631,7 +631,7 @@ export function initRouter() {
631
631
  if (seq !== navSeq)
632
632
  return;
633
633
  if (html) {
634
- // Error pages contain full layout — full page replacement
634
+ // Error pages contain full layout - full page replacement
635
635
  replacePage(html, url);
636
636
  }
637
637
  else {
@@ -662,7 +662,7 @@ export function initRouter() {
662
662
  });
663
663
  }
664
664
  const clickHandler = (e) => {
665
- // Never intercept modified clicks (cmd/ctrl/shift/alt or middle button) —
665
+ // Never intercept modified clicks (cmd/ctrl/shift/alt or middle button) -
666
666
  // they should open in a new tab or trigger browser behavior.
667
667
  if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey)
668
668
  return;
@@ -1,4 +1,4 @@
1
- // @krate/runtime/server/jsx-runtime — Server-compatible JSX runtime.
1
+ // @krate/runtime/server/jsx-runtime - Server-compatible JSX runtime.
2
2
  // The functions are re-exported from ./server.js (single source of truth) so
3
3
  // the JSX transform and its types never drift between the two server subpaths.
4
4
  export { Fragment, jsx, jsxs } from './server.js';