@sprig-and-prose/sprig-ui-csr 0.2.2 → 0.2.4

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.
@@ -6,7 +6,7 @@ import { writable, derived, get } from 'svelte/store';
6
6
  * @typedef {{ raw:string, normalized?:string, source:SourceSpan }} TextBlock
7
7
  * @typedef {{ id:string, name:string, url:string, title?:string, describe?:TextBlock, note?:TextBlock }} RepositoryModel
8
8
  * @typedef {{ id:string, name:string, kind?:string, title?:string, describe?:TextBlock, note?:TextBlock, urls:string[], repositoryRef?:string, paths?:string[] }} ReferenceModel
9
- * @typedef {{ id:string, kind:'universe'|'anthology'|'series'|'book'|'chapter'|'concept'|'relates', name:string, title?:string, parent?:string, children:string[], container?:string, describe?:TextBlock, endpoints?:string[], from?:Record<string, any>, references?:string[] }} NodeModel
9
+ * @typedef {{ id:string, kind:'universe'|'anthology'|'series'|'book'|'chapter'|'concept'|'relates', name:string, title?:string, parent?:string, children:string[], container?:string, describe?:TextBlock, endpoints?:string[], from?:Record<string, any>, relationships?:{values:string[], source:SourceSpan}, references?:string[] }} NodeModel
10
10
  * @typedef {{ name:string, root:string }} UniverseModel
11
11
  * @typedef {{ version:1, universes:Record<string, UniverseModel>, nodes:Record<string, NodeModel>, edges:Record<string, any>, diagnostics:any[], repositories?:Record<string, RepositoryModel>, references?:Record<string, ReferenceModel>, generatedAt?:string }} UniverseGraph
12
12
  */
@@ -15,6 +15,69 @@ export const universeGraph = writable(/** @type {UniverseGraph|null} */ (null));
15
15
 
16
16
  export const currentUniverseName = writable(/** @type {string|null} */ (null));
17
17
 
18
+ // Hierarchy order: universe > anthology > series > book > chapter > concept
19
+ const HIERARCHY_ORDER = ['universe', 'anthology', 'series', 'book', 'chapter', 'concept'];
20
+
21
+ /**
22
+ * Get the expected primary child kind for a given parent kind
23
+ * @param {string} parentKind
24
+ * @returns {string | null}
25
+ */
26
+ function getExpectedPrimaryKind(parentKind) {
27
+ const index = HIERARCHY_ORDER.indexOf(parentKind);
28
+ return index >= 0 && index < HIERARCHY_ORDER.length - 1
29
+ ? HIERARCHY_ORDER[index + 1]
30
+ : null;
31
+ }
32
+
33
+ /**
34
+ * Organize children into primary and other groups based on hierarchy
35
+ * Primary shows the highest-level child type that exists
36
+ * Other shows all remaining children
37
+ * @param {NodeModel[]} children
38
+ * @param {string} parentKind
39
+ * @returns {{ primary: NodeModel[], other: NodeModel[] }}
40
+ */
41
+ export function organizeChildren(children, parentKind) {
42
+ const expectedPrimary = getExpectedPrimaryKind(parentKind);
43
+ if (!expectedPrimary) {
44
+ return { primary: children, other: [] };
45
+ }
46
+
47
+ // Filter out relates nodes
48
+ const validChildren = children.filter(child => child.kind !== 'relates');
49
+
50
+ // Find highest-level child type that exists
51
+ const childrenByKind = new Map();
52
+ for (const child of validChildren) {
53
+ if (!childrenByKind.has(child.kind)) {
54
+ childrenByKind.set(child.kind, []);
55
+ }
56
+ childrenByKind.get(child.kind).push(child);
57
+ }
58
+
59
+ // Determine primary: use expected if it exists, otherwise find highest existing
60
+ let primaryKind = expectedPrimary;
61
+ if (!childrenByKind.has(primaryKind)) {
62
+ // Find the highest-level kind that exists (closest to parent in hierarchy)
63
+ for (const kind of HIERARCHY_ORDER) {
64
+ if (childrenByKind.has(kind) && HIERARCHY_ORDER.indexOf(kind) > HIERARCHY_ORDER.indexOf(parentKind)) {
65
+ primaryKind = kind;
66
+ break;
67
+ }
68
+ }
69
+ // If we still didn't find a primary kind, use the first available kind
70
+ if (!childrenByKind.has(primaryKind) && childrenByKind.size > 0) {
71
+ primaryKind = Array.from(childrenByKind.keys())[0];
72
+ }
73
+ }
74
+
75
+ const primary = childrenByKind.get(primaryKind) || [];
76
+ const other = validChildren.filter(child => child.kind !== primaryKind);
77
+
78
+ return { primary, other };
79
+ }
80
+
18
81
  export const currentUniverse = derived(
19
82
  [universeGraph, currentUniverseName],
20
83
  ([$g, $name]) => $g?.universes?.[$name] ?? null,
@@ -29,10 +92,11 @@ export const rootChildren = derived(
29
92
  [universeGraph, universeRootNode],
30
93
  ([$g, $root]) => {
31
94
  if (!$g || !$root) return [];
32
- return ($root.children || [])
95
+ const children = ($root.children || [])
33
96
  .map((id) => $g.nodes[id])
34
97
  .filter(Boolean)
35
98
  .filter((node) => node.kind !== 'relates'); // Exclude relates nodes from contents
99
+ return organizeChildren(children, 'universe');
36
100
  },
37
101
  );
38
102
 
@@ -75,8 +139,9 @@ export const currentSeries = derived(
75
139
  export const seriesChildren = derived(
76
140
  [universeGraph, currentSeries],
77
141
  ([$g, $series]) => {
78
- if (!$g || !$series) return [];
79
- return ($series.children || []).map((id) => $g.nodes[id]).filter(Boolean);
142
+ if (!$g || !$series) return { primary: [], other: [] };
143
+ const children = ($series.children || []).map((id) => $g.nodes[id]).filter(Boolean);
144
+ return organizeChildren(children, 'series');
80
145
  },
81
146
  );
82
147
 
@@ -87,17 +152,39 @@ export const currentAnthology = derived(
87
152
  ([$g, $anthologyId]) => ($g && $anthologyId ? $g.nodes[$anthologyId] : null),
88
153
  );
89
154
 
90
- export const anthologySeries = derived(
155
+ export const currentBookId = writable(/** @type {string|null} */ (null));
156
+
157
+ export const currentBook = derived(
158
+ [universeGraph, currentBookId],
159
+ ([$g, $bookId]) => ($g && $bookId ? $g.nodes[$bookId] : null),
160
+ );
161
+
162
+ export const bookChildren = derived(
163
+ [universeGraph, currentBook],
164
+ ([$g, $book]) => {
165
+ if (!$g || !$book) return { primary: [], other: [] };
166
+ const children = ($book.children || []).map((id) => $g.nodes[id]).filter(Boolean);
167
+ return organizeChildren(children, 'book');
168
+ },
169
+ );
170
+
171
+ export const anthologyChildren = derived(
91
172
  [universeGraph, currentAnthology],
92
173
  ([$g, $anthology]) => {
93
- if (!$g || !$anthology) return [];
94
- return ($anthology.children || [])
174
+ if (!$g || !$anthology) return { primary: [], other: [] };
175
+ const children = ($anthology.children || [])
95
176
  .map((id) => $g.nodes[id])
96
- .filter(Boolean)
97
- .filter((node) => node.kind === 'series');
177
+ .filter(Boolean);
178
+ return organizeChildren(children, 'anthology');
98
179
  },
99
180
  );
100
181
 
182
+ // Keep old name for backward compatibility during migration
183
+ export const anthologySeries = derived(
184
+ [anthologyChildren],
185
+ ([$organized]) => $organized.primary,
186
+ );
187
+
101
188
  /**
102
189
  * Get contextual relationships for a node
103
190
  * @param {UniverseGraph | null} graph
@@ -126,13 +213,23 @@ export function getRelationshipsForNode(graph, currentNodeId) {
126
213
  if (!otherNode) continue; // Skip if other node not found
127
214
 
128
215
  // Compute label
216
+ // Priority: 1) endpoint-specific (from block), 2) top-level relationships, 3) default
129
217
  let label = 'related to';
130
- const fromView = relNode.from?.[currentNodeId];
218
+ const currentNode = graph.nodes[currentNodeId];
219
+ // Try to find fromView by node ID first (resolved endpoints)
220
+ let fromView = relNode.from?.[currentNodeId];
221
+ // If not found, try by current node's name (in case resolution failed and it's still keyed by name)
222
+ if (!fromView && currentNode) {
223
+ fromView = relNode.from?.[currentNode.name];
224
+ }
131
225
  if (fromView?.relationships?.values?.length > 0) {
132
226
  label = fromView.relationships.values[0];
227
+ } else if (relNode.relationships?.values?.length > 0) {
228
+ label = relNode.relationships.values[0];
133
229
  }
134
230
 
135
231
  // Compute description
232
+ // Use the same fromView we found for relationships
136
233
  let desc = null;
137
234
  if (fromView?.describe?.normalized) {
138
235
  desc = fromView.describe.normalized;
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import { currentAnthology, anthologySeries, universeGraph, currentUniverseName, universeRootNode, getNodeRoute, currentAnthologyId } from '../lib/data/universeStore.js';
2
+ import { currentAnthology, anthologyChildren, universeGraph, currentUniverseName, universeRootNode, getNodeRoute, currentAnthologyId } from '../lib/data/universeStore.js';
3
3
  import { getDisplayTitle } from '../lib/format/title.js';
4
4
  import Prose from '../lib/components/Prose.svelte';
5
5
  import ContentsCard from '../lib/components/ContentsCard.svelte';
@@ -32,7 +32,10 @@
32
32
  </section>
33
33
 
34
34
  <aside class="index">
35
- <ContentsCard children={$anthologySeries} />
35
+ {#if $anthologyChildren.primary.length > 0 || $anthologyChildren.other.length > 0}
36
+ {@const allChildren = [...$anthologyChildren.primary, ...$anthologyChildren.other]}
37
+ <ContentsCard children={allChildren} />
38
+ {/if}
36
39
  </aside>
37
40
  </div>
38
41
 
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import { universeGraph, currentUniverseName, universeRootNode, getNodeRoute, getRelationshipsForNode, getAncestorChain } from '../lib/data/universeStore.js';
2
+ import { universeGraph, currentUniverseName, universeRootNode, getNodeRoute, getRelationshipsForNode, getAncestorChain, organizeChildren } from '../lib/data/universeStore.js';
3
3
  import { getDisplayTitle } from '../lib/format/title.js';
4
4
  import Prose from '../lib/components/Prose.svelte';
5
5
  import ContentsCard from '../lib/components/ContentsCard.svelte';
@@ -21,7 +21,8 @@
21
21
  // Decode the node ID from URL
22
22
  $: nodeId = decodeURIComponent(params.id);
23
23
  $: currentNode = $universeGraph?.nodes[nodeId];
24
- $: children = currentNode?.children?.map((id) => $universeGraph?.nodes[id]).filter(Boolean) || [];
24
+ $: rawChildren = currentNode?.children?.map((id) => $universeGraph?.nodes[id]).filter(Boolean) || [];
25
+ $: organizedChildren = currentNode ? organizeChildren(rawChildren, currentNode.kind) : { primary: [], other: [] };
25
26
  $: relationships = currentNode ? getRelationshipsForNode($universeGraph, nodeId) : [];
26
27
  $: ancestors = currentNode ? getAncestorChain($universeGraph, currentNode) : [];
27
28
  $: showContextLine = currentNode && (currentNode.kind === 'book' || currentNode.kind === 'chapter' || (currentNode.kind === 'concept' && currentNode.parent));
@@ -128,11 +129,34 @@
128
129
 
129
130
 
130
131
  $: subtitle = (() => {
132
+ if (!currentNode) return '';
131
133
  if (showContextLine) {
132
- if (currentNode.kind === 'book' && ancestors[0]) {
133
- const series = ancestors[0];
134
- const seriesRoute = getNodeRoute(series);
135
- return `A book in the <a href="${seriesRoute}">${getDisplayTitle(series)}</a> series`;
134
+ if (currentNode.kind === 'book') {
135
+ // Check if book belongs to a series
136
+ if (ancestors[0] && ancestors[0].kind === 'series') {
137
+ const series = ancestors[0];
138
+ const seriesRoute = getNodeRoute(series);
139
+ return `A book in the <a href="${seriesRoute}">${getDisplayTitle(series)}</a> series`;
140
+ }
141
+
142
+ // Check if book belongs to an anthology (but not a series)
143
+ if (currentNode.parent && $universeGraph) {
144
+ const parentNode = $universeGraph.nodes[currentNode.parent];
145
+ if (parentNode && parentNode.kind === 'anthology') {
146
+ const anthologyRoute = getNodeRoute(parentNode);
147
+ const anthologyName = getDisplayTitle(parentNode);
148
+ const universeLink = $universeRootNode
149
+ ? `<a href="/">${getDisplayTitle($universeRootNode) || params.universe}</a>`
150
+ : params.universe;
151
+ return `A book in <a href="${anthologyRoute}">${anthologyName}</a> (in ${universeLink})`;
152
+ }
153
+ }
154
+
155
+ // Standalone book - link to universe home page
156
+ const universeLink = $universeRootNode
157
+ ? `<a href="/">${getDisplayTitle($universeRootNode) || params.universe}</a>`
158
+ : params.universe;
159
+ return `A book in ${universeLink}`;
136
160
  } else if (currentNode.kind === 'chapter' && ancestors[0] && ancestors[1]) {
137
161
  const book = ancestors[0];
138
162
  const series = ancestors[1];
@@ -162,6 +186,13 @@
162
186
  }
163
187
  }
164
188
  }
189
+ // Fallback for books without ancestors - link to universe home page
190
+ if (currentNode.kind === 'book') {
191
+ const universeLink = $universeRootNode
192
+ ? `<a href="/">${getDisplayTitle($universeRootNode) || params.universe}</a>`
193
+ : params.universe;
194
+ return `A book in ${universeLink}`;
195
+ }
165
196
  return `${currentNode.kind} in ${params.universe}`;
166
197
  } else {
167
198
  if (currentNode.kind === 'concept') {
@@ -181,9 +212,10 @@
181
212
  <Prose textBlock={currentNode.describe} />
182
213
  </section>
183
214
 
184
- {#if children.length > 0}
215
+ {#if organizedChildren.primary.length > 0 || organizedChildren.other.length > 0}
216
+ {@const allChildren = [...organizedChildren.primary, ...organizedChildren.other]}
185
217
  <aside class="index">
186
- <ContentsCard children={children} currentNode={currentNode} />
218
+ <ContentsCard children={allChildren} currentNode={currentNode} />
187
219
  </aside>
188
220
  {/if}
189
221
  </div>
@@ -1,5 +1,5 @@
1
1
  <script>
2
- import { universeRootNode, rootChildren, rootAnthologies, rootUngroupedSeries, universeGraph } from '../lib/data/universeStore.js';
2
+ import { universeRootNode, rootChildren, universeGraph } from '../lib/data/universeStore.js';
3
3
  import UniverseHeader from '../lib/components/UniverseHeader.svelte';
4
4
  import Prose from '../lib/components/Prose.svelte';
5
5
  import ContentsCard from '../lib/components/ContentsCard.svelte';
@@ -15,15 +15,13 @@
15
15
  </section>
16
16
 
17
17
  <aside class="index">
18
- {#if $rootAnthologies.length > 0}
19
- <ContentsCard children={$rootAnthologies} title="Anthologies" />
20
- {#if $rootUngroupedSeries.length > 0}
21
- <div class="other-series">
22
- <ContentsCard children={$rootUngroupedSeries} title="Other series" />
23
- </div>
24
- {/if}
25
- {:else}
26
- <ContentsCard children={$rootChildren} title="Concepts in this universe" />
18
+ {#if $rootChildren.primary.length > 0}
19
+ <ContentsCard children={$rootChildren.primary} />
20
+ {/if}
21
+ {#if $rootChildren.other.length > 0}
22
+ <div class="other-contents">
23
+ <ContentsCard children={$rootChildren.other} title="Other" />
24
+ </div>
27
25
  {/if}
28
26
  </aside>
29
27
  </div>
@@ -55,7 +53,7 @@
55
53
  width: 100%;
56
54
  }
57
55
 
58
- .other-series {
56
+ .other-contents {
59
57
  margin-top: 1rem;
60
58
  }
61
59
 
@@ -151,7 +151,10 @@
151
151
  </section>
152
152
 
153
153
  <aside class="index">
154
- <ContentsCard children={$seriesChildren} />
154
+ {#if $seriesChildren.primary.length > 0 || $seriesChildren.other.length > 0}
155
+ {@const allChildren = [...$seriesChildren.primary, ...$seriesChildren.other]}
156
+ <ContentsCard children={allChildren} />
157
+ {/if}
155
158
  </aside>
156
159
  </div>
157
160
 
@@ -1,4 +0,0 @@
1
- var Ni=Object.defineProperty;var as=e=>{throw TypeError(e)};var Ti=(e,t,n)=>t in e?Ni(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var gt=(e,t,n)=>Ti(e,typeof t!="symbol"?t+"":t,n),Rr=(e,t,n)=>t.has(e)||as("Cannot "+n);var m=(e,t,n)=>(Rr(e,t,"read from private field"),n?n.call(e):t.get(e)),te=(e,t,n)=>t.has(e)?as("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),ee=(e,t,n,s)=>(Rr(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),Ce=(e,t,n)=>(Rr(e,t,"access private method"),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))s(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();const Ci="modulepreload",Li=function(e){return"/_ui/"+e},ls={},Pi=function(t,n,s){let i=Promise.resolve();if(n&&n.length>0){let l=function(u){return Promise.all(u.map(c=>Promise.resolve(c).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),f=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=l(n.map(u=>{if(u=Li(u),u in ls)return;ls[u]=!0;const c=u.endsWith(".css"),y=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${y}`))return;const d=document.createElement("link");if(d.rel=c?"stylesheet":Ci,c||(d.as="script"),d.crossOrigin="",d.href=u,f&&d.setAttribute("nonce",f),document.head.appendChild(d),c)return new Promise((v,k)=>{d.addEventListener("load",v),d.addEventListener("error",()=>k(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(l){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=l,window.dispatchEvent(a),!a.defaultPrevented)throw l}return i.then(l=>{for(const a of l||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})},Tr=!1;var As=Array.isArray,Ii=Array.prototype.indexOf,Er=Array.from,Rs=Object.defineProperty,An=Object.getOwnPropertyDescriptor,zs=Object.getOwnPropertyDescriptors,Mi=Object.prototype,Di=Array.prototype,Wr=Object.getPrototypeOf,fs=Object.isExtensible;const Zt=()=>{};function Oi(e){return e()}function pr(e){for(var t=0;t<e.length;t++)e[t]()}function Ns(){var e,t,n=new Promise((s,i)=>{e=s,t=i});return{promise:n,resolve:e,reject:t}}const De=2,hr=4,nr=8,Ts=1<<24,Ft=16,Ut=32,mn=64,Kr=128,dt=512,Me=1024,Ve=2048,zt=4096,st=8192,Mt=16384,Vr=32768,Mn=65536,us=1<<17,Cs=1<<18,jn=1<<19,Ls=1<<20,Pt=1<<25,_n=32768,Cr=1<<21,Yr=1<<22,Qt=1<<23,vn=Symbol("$state"),Fi=Symbol("legacy props"),Ui=Symbol(""),xn=new class extends Error{constructor(){super(...arguments);gt(this,"name","StaleReactionError");gt(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function Ps(e){return e===this.v}function Is(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Ms(e){return!Is(e,this.v)}function Ds(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function Bi(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function ji(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function qi(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Gi(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Hi(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Wi(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function Ki(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Vi(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Yi(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Zi(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}let qn=!1,Qi=!1;function Xi(){qn=!0}const Ji=1,eo=2,Os=4,to=8,no=16,ro=1,so=2,io=4,oo=8,ao=16,lo=1,fo=2,Le=Symbol(),uo="http://www.w3.org/1999/xhtml";let me=null;function Dn(e){me=e}function it(e,t=!1,n){me={p:me,i:!1,c:null,e:null,s:e,x:null,l:qn&&!t?{s:null,u:null,$:[]}:null}}function ot(e){var t=me,n=t.e;if(n!==null){t.e=null;for(var s of n)fi(s)}return t.i=!0,me=t.p,{}}function rr(){return!qn||me!==null&&me.l===null}let sn=[];function Fs(){var e=sn;sn=[],pr(e)}function Gn(e){if(sn.length===0&&!Vn){var t=sn;queueMicrotask(()=>{t===sn&&Fs()})}sn.push(e)}function co(){for(;sn.length>0;)Fs()}function vo(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function $n(e){if(typeof e!="object"||e===null||vn in e)return e;const t=Wr(e);if(t!==Mi&&t!==Di)return e;var n=new Map,s=As(e),i=qt(0),o=pn,l=a=>{if(pn===o)return a();var f=X,u=pn;Je(null),hs(o);var c=a();return Je(f),hs(u),c};return s&&n.set("length",qt(e.length)),new Proxy(e,{defineProperty(a,f,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&Ki();var c=n.get(f);return c===void 0?c=l(()=>{var y=qt(u.value);return n.set(f,y),y}):C(c,u.value,!0),!0},deleteProperty(a,f){var u=n.get(f);if(u===void 0){if(f in a){const c=l(()=>qt(Le));n.set(f,c),Yn(i)}}else C(u,Le),Yn(i);return!0},get(a,f,u){var v;if(f===vn)return e;var c=n.get(f),y=f in a;if(c===void 0&&(!y||(v=An(a,f))!=null&&v.writable)&&(c=l(()=>{var k=$n(y?a[f]:Le),N=qt(k);return N}),n.set(f,c)),c!==void 0){var d=r(c);return d===Le?void 0:d}return Reflect.get(a,f,u)},getOwnPropertyDescriptor(a,f){var u=Reflect.getOwnPropertyDescriptor(a,f);if(u&&"value"in u){var c=n.get(f);c&&(u.value=r(c))}else if(u===void 0){var y=n.get(f),d=y==null?void 0:y.v;if(y!==void 0&&d!==Le)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return u},has(a,f){var d;if(f===vn)return!0;var u=n.get(f),c=u!==void 0&&u.v!==Le||Reflect.has(a,f);if(u!==void 0||ae!==null&&(!c||(d=An(a,f))!=null&&d.writable)){u===void 0&&(u=l(()=>{var v=c?$n(a[f]):Le,k=qt(v);return k}),n.set(f,u));var y=r(u);if(y===Le)return!1}return c},set(a,f,u,c){var F;var y=n.get(f),d=f in a;if(s&&f==="length")for(var v=u;v<y.v;v+=1){var k=n.get(v+"");k!==void 0?C(k,Le):v in a&&(k=l(()=>qt(Le)),n.set(v+"",k))}if(y===void 0)(!d||(F=An(a,f))!=null&&F.writable)&&(y=l(()=>qt(void 0)),C(y,$n(u)),n.set(f,y));else{d=y.v!==Le;var N=l(()=>$n(u));C(y,N)}var b=Reflect.getOwnPropertyDescriptor(a,f);if(b!=null&&b.set&&b.set.call(c,u),!d){if(s&&typeof f=="string"){var x=n.get("length"),T=Number(f);Number.isInteger(T)&&T>=x.v&&C(x,T+1)}Yn(i)}return!0},ownKeys(a){r(i);var f=Reflect.ownKeys(a).filter(y=>{var d=n.get(y);return d===void 0||d.v!==Le});for(var[u,c]of n)c.v!==Le&&!(u in a)&&f.push(u);return f},setPrototypeOf(){Vi()}})}var cs,Us,Bs,js;function po(){if(cs===void 0){cs=window,Us=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Bs=An(t,"firstChild").get,js=An(t,"nextSibling").get,fs(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),fs(n)&&(n.__t=void 0)}}function Xt(e=""){return document.createTextNode(e)}function Vt(e){return Bs.call(e)}function sr(e){return js.call(e)}function w(e,t){return Vt(e)}function pe(e,t=!1){{var n=Vt(e);return n instanceof Comment&&n.data===""?sr(n):n}}function L(e,t=1,n=!1){let s=e;for(;t--;)s=sr(s);return s}function ho(e){e.textContent=""}function qs(){return!1}function Gs(e){var t=ae;if(t===null)return X.f|=Qt,e;if((t.f&Vr)===0){if((t.f&Kr)===0)throw e;t.b.error(e)}else On(e,t)}function On(e,t){for(;t!==null;){if((t.f&Kr)!==0)try{t.b.error(e);return}catch(n){e=n}t=t.parent}throw e}const _o=-7169;function $e(e,t){e.f=e.f&_o|t}function Zr(e){(e.f&dt)!==0||e.deps===null?$e(e,Me):$e(e,zt)}function Hs(e){if(e!==null)for(const t of e)(t.f&De)===0||(t.f&_n)===0||(t.f^=_n,Hs(t.deps))}function Ws(e,t,n){(e.f&Ve)!==0?t.add(e):(e.f&zt)!==0&&n.add(e),Hs(e.deps),$e(e,Me)}const lr=new Set;let ne=null,ur=null,Pe=null,ct=[],Sr=null,Lr=!1,Vn=!1;var Nn,Tn,on,an,Jn,Cn,Ln,pt,Pr,Ir,Ks,Vs;const br=class br{constructor(){te(this,pt);gt(this,"committed",!1);gt(this,"current",new Map);gt(this,"previous",new Map);te(this,Nn,new Set);te(this,Tn,new Set);te(this,on,0);te(this,an,0);te(this,Jn,null);te(this,Cn,new Set);te(this,Ln,new Set);gt(this,"skipped_effects",new Set);gt(this,"is_fork",!1)}is_deferred(){return this.is_fork||m(this,an)>0}process(t){var i;ct=[],ur=null,this.apply();var n=[],s=[];for(const o of t)Ce(this,pt,Pr).call(this,o,n,s);this.is_fork||Ce(this,pt,Ks).call(this),this.is_deferred()?(Ce(this,pt,Ir).call(this,s),Ce(this,pt,Ir).call(this,n)):(ur=this,ne=null,vs(s),vs(n),ur=null,(i=m(this,Jn))==null||i.resolve()),Pe=null}capture(t,n){n!==Le&&!this.previous.has(t)&&this.previous.set(t,n),(t.f&Qt)===0&&(this.current.set(t,t.v),Pe==null||Pe.set(t,t.v))}activate(){ne=this,this.apply()}deactivate(){ne===this&&(ne=null,Pe=null)}flush(){if(this.activate(),ct.length>0){if(Ys(),ne!==null&&ne!==this)return}else m(this,on)===0&&this.process([]);this.deactivate()}discard(){for(const t of m(this,Tn))t(this);m(this,Tn).clear()}increment(t){ee(this,on,m(this,on)+1),t&&ee(this,an,m(this,an)+1)}decrement(t){ee(this,on,m(this,on)-1),t&&ee(this,an,m(this,an)-1),this.revive()}revive(){for(const t of m(this,Cn))m(this,Ln).delete(t),$e(t,Ve),Dt(t);for(const t of m(this,Ln))$e(t,zt),Dt(t);this.flush()}oncommit(t){m(this,Nn).add(t)}ondiscard(t){m(this,Tn).add(t)}settled(){return(m(this,Jn)??ee(this,Jn,Ns())).promise}static ensure(){if(ne===null){const t=ne=new br;lr.add(ne),Vn||br.enqueue(()=>{ne===t&&t.flush()})}return ne}static enqueue(t){Gn(t)}apply(){}};Nn=new WeakMap,Tn=new WeakMap,on=new WeakMap,an=new WeakMap,Jn=new WeakMap,Cn=new WeakMap,Ln=new WeakMap,pt=new WeakSet,Pr=function(t,n,s){t.f^=Me;for(var i=t.first,o=null;i!==null;){var l=i.f,a=(l&(Ut|mn))!==0,f=a&&(l&Me)!==0,u=f||(l&st)!==0||this.skipped_effects.has(i);if(!u&&i.fn!==null){a?i.f^=Me:o!==null&&(l&(hr|nr|Ts))!==0?o.b.defer_effect(i):(l&hr)!==0?n.push(i):Hn(i)&&((l&Ft)!==0&&m(this,Cn).add(i),Un(i));var c=i.first;if(c!==null){i=c;continue}}var y=i.parent;for(i=i.next;i===null&&y!==null;)y===o&&(o=null),i=y.next,y=y.parent}},Ir=function(t){for(var n=0;n<t.length;n+=1)Ws(t[n],m(this,Cn),m(this,Ln))},Ks=function(){if(m(this,an)===0){for(const t of m(this,Nn))t();m(this,Nn).clear()}m(this,on)===0&&Ce(this,pt,Vs).call(this)},Vs=function(){var i;if(lr.size>1){this.previous.clear();var t=Pe,n=!0;for(const o of lr){if(o===this){n=!1;continue}const l=[];for(const[f,u]of this.current){if(o.current.has(f))if(n&&u!==o.current.get(f))o.current.set(f,u);else continue;l.push(f)}if(l.length===0)continue;const a=[...o.current.keys()].filter(f=>!this.current.has(f));if(a.length>0){var s=ct;ct=[];const f=new Set,u=new Map;for(const c of l)Zs(c,a,f,u);if(ct.length>0){ne=o,o.apply();for(const c of ct)Ce(i=o,pt,Pr).call(i,c,[],[]);o.deactivate()}ct=s}}ne=null,Pe=t}this.committed=!0,lr.delete(this)};let It=br;function go(e){var t=Vn;Vn=!0;try{for(var n;;){if(co(),ct.length===0&&(ne==null||ne.flush(),ct.length===0))return Sr=null,n;Ys()}}finally{Vn=t}}function Ys(){var e=dn;Lr=!0;var t=null;try{var n=0;for(gr(!0);ct.length>0;){var s=It.ensure();if(n++>1e3){var i,o;mo()}s.process(ct),Jt.clear()}}finally{Lr=!1,gr(e),Sr=null}}function mo(){try{Hi()}catch(e){On(e,Sr)}}let mt=null;function vs(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var s=e[n++];if((s.f&(Mt|st))===0&&Hn(s)&&(mt=new Set,Un(s),s.deps===null&&s.first===null&&s.nodes===null&&(s.teardown===null&&s.ac===null?di(s):s.fn=null),(mt==null?void 0:mt.size)>0)){Jt.clear();for(const i of mt){if((i.f&(Mt|st))!==0)continue;const o=[i];let l=i.parent;for(;l!==null;)mt.has(l)&&(mt.delete(l),o.push(l)),l=l.parent;for(let a=o.length-1;a>=0;a--){const f=o[a];(f.f&(Mt|st))===0&&Un(f)}}mt.clear()}}mt=null}}function Zs(e,t,n,s){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const i of e.reactions){const o=i.f;(o&De)!==0?Zs(i,t,n,s):(o&(Yr|Ft))!==0&&(o&Ve)===0&&Qs(i,t,s)&&($e(i,Ve),Dt(i))}}function Qs(e,t,n){const s=n.get(e);if(s!==void 0)return s;if(e.deps!==null)for(const i of e.deps){if(t.includes(i))return!0;if((i.f&De)!==0&&Qs(i,t,n))return n.set(i,!0),!0}return n.set(e,!1),!1}function Dt(e){for(var t=Sr=e;t.parent!==null;){t=t.parent;var n=t.f;if(Lr&&t===ae&&(n&Ft)!==0&&(n&Cs)===0)return;if((n&(mn|Ut))!==0){if((n&Me)===0)return;t.f^=Me}}ct.push(t)}function yo(e){let t=0,n=gn(0),s;return()=>{Xr()&&(r(n),ir(()=>(t===0&&(s=_(()=>e(()=>Yn(n)))),t+=1,()=>{Gn(()=>{t-=1,t===0&&(s==null||s(),s=void 0,Yn(n))})})))}}var bo=Mn|jn|Kr;function ko(e,t,n){new wo(e,t,n)}var ft,Hr,St,ln,xt,ut,Xe,$t,Lt,Ht,fn,Wt,un,Pn,In,Kt,kr,ze,Eo,So,Mr,cr,vr,Dr;class wo{constructor(t,n,s){te(this,ze);gt(this,"parent");gt(this,"is_pending",!1);te(this,ft);te(this,Hr,null);te(this,St);te(this,ln);te(this,xt);te(this,ut,null);te(this,Xe,null);te(this,$t,null);te(this,Lt,null);te(this,Ht,null);te(this,fn,0);te(this,Wt,0);te(this,un,!1);te(this,Pn,new Set);te(this,In,new Set);te(this,Kt,null);te(this,kr,yo(()=>(ee(this,Kt,gn(m(this,fn))),()=>{ee(this,Kt,null)})));ee(this,ft,t),ee(this,St,n),ee(this,ln,s),this.parent=ae.b,this.is_pending=!!m(this,St).pending,ee(this,xt,es(()=>{ae.b=this;{var i=Ce(this,ze,Mr).call(this);try{ee(this,ut,vt(()=>s(i)))}catch(o){this.error(o)}m(this,Wt)>0?Ce(this,ze,vr).call(this):this.is_pending=!1}return()=>{var o;(o=m(this,Ht))==null||o.remove()}},bo))}defer_effect(t){Ws(t,m(this,Pn),m(this,In))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!m(this,St).pending}update_pending_count(t){Ce(this,ze,Dr).call(this,t),ee(this,fn,m(this,fn)+t),m(this,Kt)&&Fn(m(this,Kt),m(this,fn))}get_effect_pending(){return m(this,kr).call(this),r(m(this,Kt))}error(t){var n=m(this,St).onerror;let s=m(this,St).failed;if(m(this,un)||!n&&!s)throw t;m(this,ut)&&(et(m(this,ut)),ee(this,ut,null)),m(this,Xe)&&(et(m(this,Xe)),ee(this,Xe,null)),m(this,$t)&&(et(m(this,$t)),ee(this,$t,null));var i=!1,o=!1;const l=()=>{if(i){vo();return}i=!0,o&&Zi(),It.ensure(),ee(this,fn,0),m(this,$t)!==null&&hn(m(this,$t),()=>{ee(this,$t,null)}),this.is_pending=this.has_pending_snippet(),ee(this,ut,Ce(this,ze,cr).call(this,()=>(ee(this,un,!1),vt(()=>m(this,ln).call(this,m(this,ft)))))),m(this,Wt)>0?Ce(this,ze,vr).call(this):this.is_pending=!1};var a=X;try{Je(null),o=!0,n==null||n(t,l),o=!1}catch(f){On(f,m(this,xt)&&m(this,xt).parent)}finally{Je(a)}s&&Gn(()=>{ee(this,$t,Ce(this,ze,cr).call(this,()=>{It.ensure(),ee(this,un,!0);try{return vt(()=>{s(m(this,ft),()=>t,()=>l)})}catch(f){return On(f,m(this,xt).parent),null}finally{ee(this,un,!1)}}))})}}ft=new WeakMap,Hr=new WeakMap,St=new WeakMap,ln=new WeakMap,xt=new WeakMap,ut=new WeakMap,Xe=new WeakMap,$t=new WeakMap,Lt=new WeakMap,Ht=new WeakMap,fn=new WeakMap,Wt=new WeakMap,un=new WeakMap,Pn=new WeakMap,In=new WeakMap,Kt=new WeakMap,kr=new WeakMap,ze=new WeakSet,Eo=function(){try{ee(this,ut,vt(()=>m(this,ln).call(this,m(this,ft))))}catch(t){this.error(t)}},So=function(){const t=m(this,St).pending;t&&(ee(this,Xe,vt(()=>t(m(this,ft)))),It.enqueue(()=>{var n=Ce(this,ze,Mr).call(this);ee(this,ut,Ce(this,ze,cr).call(this,()=>(It.ensure(),vt(()=>m(this,ln).call(this,n))))),m(this,Wt)>0?Ce(this,ze,vr).call(this):(hn(m(this,Xe),()=>{ee(this,Xe,null)}),this.is_pending=!1)}))},Mr=function(){var t=m(this,ft);return this.is_pending&&(ee(this,Ht,Xt()),m(this,ft).before(m(this,Ht)),t=m(this,Ht)),t},cr=function(t){var n=ae,s=X,i=me;Rt(m(this,xt)),Je(m(this,xt)),Dn(m(this,xt).ctx);try{return t()}catch(o){return Gs(o),null}finally{Rt(n),Je(s),Dn(i)}},vr=function(){const t=m(this,St).pending;m(this,ut)!==null&&(ee(this,Lt,document.createDocumentFragment()),m(this,Lt).append(m(this,Ht)),_i(m(this,ut),m(this,Lt))),m(this,Xe)===null&&ee(this,Xe,vt(()=>t(m(this,ft))))},Dr=function(t){var n;if(!this.has_pending_snippet()){this.parent&&Ce(n=this.parent,ze,Dr).call(n,t);return}if(ee(this,Wt,m(this,Wt)+t),m(this,Wt)===0){this.is_pending=!1;for(const s of m(this,Pn))$e(s,Ve),Dt(s);for(const s of m(this,In))$e(s,zt),Dt(s);m(this,Pn).clear(),m(this,In).clear(),m(this,Xe)&&hn(m(this,Xe),()=>{ee(this,Xe,null)}),m(this,Lt)&&(m(this,ft).before(m(this,Lt)),ee(this,Lt,null))}};function xo(e,t,n,s){const i=rr()?xr:de;if(n.length===0&&e.length===0){s(t.map(i));return}var o=ne,l=ae,a=$o();function f(){Promise.all(n.map(u=>Ao(u))).then(u=>{a();try{s([...t.map(i),...u])}catch(c){(l.f&Mt)===0&&On(c,l)}o==null||o.deactivate(),_r()}).catch(u=>{On(u,l)})}e.length>0?Promise.all(e).then(()=>{a();try{return f()}finally{o==null||o.deactivate(),_r()}}):f()}function $o(){var e=ae,t=X,n=me,s=ne;return function(o=!0){Rt(e),Je(t),Dn(n),o&&(s==null||s.activate())}}function _r(){Rt(null),Je(null),Dn(null)}function xr(e){var t=De|Ve,n=X!==null&&(X.f&De)!==0?X:null;return ae!==null&&(ae.f|=jn),{ctx:me,deps:null,effects:null,equals:Ps,f:t,fn:e,reactions:null,rv:0,v:Le,wv:0,parent:n??ae,ac:null}}function Ao(e,t,n){let s=ae;s===null&&Bi();var i=s.b,o=void 0,l=gn(Le),a=!X,f=new Map;return Uo(()=>{var v;var u=Ns();o=u.promise;try{Promise.resolve(e()).then(u.resolve,u.reject).then(()=>{c===ne&&c.committed&&c.deactivate(),_r()})}catch(k){u.reject(k),_r()}var c=ne;if(a){var y=i.is_rendered();i.update_pending_count(1),c.increment(y),(v=f.get(c))==null||v.reject(xn),f.delete(c),f.set(c,u)}const d=(k,N=void 0)=>{if(c.activate(),N)N!==xn&&(l.f|=Qt,Fn(l,N));else{(l.f&Qt)!==0&&(l.f^=Qt),Fn(l,k);for(const[b,x]of f){if(f.delete(b),b===c)break;x.reject(xn)}}a&&(i.update_pending_count(-1),c.decrement(y))};u.promise.then(d,k=>d(null,k||"unknown"))}),Jr(()=>{for(const u of f.values())u.reject(xn)}),new Promise(u=>{function c(y){function d(){y===o?u(l):c(o)}y.then(d,d)}c(o)})}function de(e){const t=xr(e);return t.equals=Ms,t}function Xs(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)et(t[n])}}function Ro(e){for(var t=e.parent;t!==null;){if((t.f&De)===0)return(t.f&Mt)===0?t:null;t=t.parent}return null}function Qr(e){var t,n=ae;Rt(Ro(e));try{e.f&=~_n,Xs(e),t=ii(e)}finally{Rt(n)}return t}function Js(e){var t=Qr(e);if(!e.equals(t)&&(e.wv=ri(),(!(ne!=null&&ne.is_fork)||e.deps===null)&&(e.v=t,e.deps===null))){$e(e,Me);return}en||(Pe!==null?(Xr()||ne!=null&&ne.is_fork)&&Pe.set(e,t):Zr(e))}let Or=new Set;const Jt=new Map;let ei=!1;function gn(e,t){var n={f:0,v:e,reactions:null,equals:Ps,rv:0,wv:0};return n}function qt(e,t){const n=gn(e);return Co(n),n}function K(e,t=!1,n=!0){var i;const s=gn(e);return t||(s.equals=Ms),qn&&n&&me!==null&&me.l!==null&&((i=me.l).s??(i.s=[])).push(s),s}function C(e,t,n=!1){X!==null&&(!bt||(X.f&us)!==0)&&rr()&&(X.f&(De|Ft|Yr|us))!==0&&!(Ke!=null&&Ke.includes(e))&&Yi();let s=n?$n(t):t;return Fn(e,s)}function Fn(e,t){if(!e.equals(t)){var n=e.v;en?Jt.set(e,t):Jt.set(e,n),e.v=t;var s=It.ensure();if(s.capture(e,n),(e.f&De)!==0){const i=e;(e.f&Ve)!==0&&Qr(i),Zr(i)}e.wv=ri(),ti(e,Ve),rr()&&ae!==null&&(ae.f&Me)!==0&&(ae.f&(Ut|mn))===0&&(lt===null?Lo([e]):lt.push(e)),!s.is_fork&&Or.size>0&&!ei&&zo()}return t}function zo(){ei=!1;var e=dn;gr(!0);const t=Array.from(Or);try{for(const n of t)(n.f&Me)!==0&&$e(n,zt),Hn(n)&&Un(n)}finally{gr(e)}Or.clear()}function Yn(e){C(e,e.v+1)}function ti(e,t){var n=e.reactions;if(n!==null)for(var s=rr(),i=n.length,o=0;o<i;o++){var l=n[o],a=l.f;if(!(!s&&l===ae)){var f=(a&Ve)===0;if(f&&$e(l,t),(a&De)!==0){var u=l;Pe==null||Pe.delete(u),(a&_n)===0&&(a&dt&&(l.f|=_n),ti(u,zt))}else f&&((a&Ft)!==0&&mt!==null&&mt.add(l),Dt(l))}}}let ds=!1;function No(){ds||(ds=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{var t;if(!e.defaultPrevented)for(const n of e.target.elements)(t=n.__on_r)==null||t.call(n)})},{capture:!0}))}function $r(e){var t=X,n=ae;Je(null),Rt(null);try{return e()}finally{Je(t),Rt(n)}}function To(e,t,n,s=n){e.addEventListener(t,()=>$r(n));const i=e.__on_r;i?e.__on_r=()=>{i(),s(!0)}:e.__on_r=()=>s(!0),No()}let dn=!1;function gr(e){dn=e}let en=!1;function ps(e){en=e}let X=null,bt=!1;function Je(e){X=e}let ae=null;function Rt(e){ae=e}let Ke=null;function Co(e){X!==null&&(Ke===null?Ke=[e]:Ke.push(e))}let We=null,nt=0,lt=null;function Lo(e){lt=e}let ni=1,Xn=0,pn=Xn;function hs(e){pn=e}function ri(){return++ni}function Hn(e){var t=e.f;if((t&Ve)!==0)return!0;if(t&De&&(e.f&=~_n),(t&zt)!==0){for(var n=e.deps,s=n.length,i=0;i<s;i++){var o=n[i];if(Hn(o)&&Js(o),o.wv>e.wv)return!0}(t&dt)!==0&&Pe===null&&$e(e,Me)}return!1}function si(e,t,n=!0){var s=e.reactions;if(s!==null&&!(Ke!=null&&Ke.includes(e)))for(var i=0;i<s.length;i++){var o=s[i];(o.f&De)!==0?si(o,t,!1):t===o&&(n?$e(o,Ve):(o.f&Me)!==0&&$e(o,zt),Dt(o))}}function ii(e){var k;var t=We,n=nt,s=lt,i=X,o=Ke,l=me,a=bt,f=pn,u=e.f;We=null,nt=0,lt=null,X=(u&(Ut|mn))===0?e:null,Ke=null,Dn(e.ctx),bt=!1,pn=++Xn,e.ac!==null&&($r(()=>{e.ac.abort(xn)}),e.ac=null);try{e.f|=Cr;var c=e.fn,y=c(),d=e.deps;if(We!==null){var v;if(mr(e,nt),d!==null&&nt>0)for(d.length=nt+We.length,v=0;v<We.length;v++)d[nt+v]=We[v];else e.deps=d=We;if(Xr()&&(e.f&dt)!==0)for(v=nt;v<d.length;v++)((k=d[v]).reactions??(k.reactions=[])).push(e)}else d!==null&&nt<d.length&&(mr(e,nt),d.length=nt);if(rr()&&lt!==null&&!bt&&d!==null&&(e.f&(De|zt|Ve))===0)for(v=0;v<lt.length;v++)si(lt[v],e);return i!==null&&i!==e&&(Xn++,lt!==null&&(s===null?s=lt:s.push(...lt))),(e.f&Qt)!==0&&(e.f^=Qt),y}catch(N){return Gs(N)}finally{e.f^=Cr,We=t,nt=n,lt=s,X=i,Ke=o,Dn(l),bt=a,pn=f}}function Po(e,t){let n=t.reactions;if(n!==null){var s=Ii.call(n,e);if(s!==-1){var i=n.length-1;i===0?n=t.reactions=null:(n[s]=n[i],n.pop())}}if(n===null&&(t.f&De)!==0&&(We===null||!We.includes(t))){var o=t;(o.f&dt)!==0&&(o.f^=dt,o.f&=~_n),Zr(o),Xs(o),mr(o,0)}}function mr(e,t){var n=e.deps;if(n!==null)for(var s=t;s<n.length;s++)Po(e,n[s])}function Un(e){var t=e.f;if((t&Mt)===0){$e(e,Me);var n=ae,s=dn;ae=e,dn=!0;try{(t&(Ft|Ts))!==0?Bo(e):ci(e),ui(e);var i=ii(e);e.teardown=typeof i=="function"?i:null,e.wv=ni;var o;Tr&&Qi&&(e.f&Ve)!==0&&e.deps}finally{dn=s,ae=n}}}async function Io(){await Promise.resolve(),go()}function r(e){var t=e.f,n=(t&De)!==0;if(X!==null&&!bt){var s=ae!==null&&(ae.f&Mt)!==0;if(!s&&!(Ke!=null&&Ke.includes(e))){var i=X.deps;if((X.f&Cr)!==0)e.rv<Xn&&(e.rv=Xn,We===null&&i!==null&&i[nt]===e?nt++:We===null?We=[e]:We.includes(e)||We.push(e));else{(X.deps??(X.deps=[])).push(e);var o=e.reactions;o===null?e.reactions=[X]:o.includes(X)||o.push(X)}}}if(en&&Jt.has(e))return Jt.get(e);if(n){var l=e;if(en){var a=l.v;return((l.f&Me)===0&&l.reactions!==null||ai(l))&&(a=Qr(l)),Jt.set(l,a),a}var f=(l.f&dt)===0&&!bt&&X!==null&&(dn||(X.f&dt)!==0),u=l.deps===null;Hn(l)&&(f&&(l.f|=dt),Js(l)),f&&!u&&oi(l)}if(Pe!=null&&Pe.has(e))return Pe.get(e);if((e.f&Qt)!==0)throw e.v;return e.v}function oi(e){if(e.deps!==null){e.f|=dt;for(const t of e.deps)(t.reactions??(t.reactions=[])).push(e),(t.f&De)!==0&&(t.f&dt)===0&&oi(t)}}function ai(e){if(e.v===Le)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(Jt.has(t)||(t.f&De)!==0&&ai(t))return!0;return!1}function _(e){var t=bt;try{return bt=!0,e()}finally{bt=t}}function W(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(vn in e)Fr(e);else if(!Array.isArray(e))for(let t in e){const n=e[t];typeof n=="object"&&n&&vn in n&&Fr(n)}}}function Fr(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let s in e)try{Fr(e[s],t)}catch{}const n=Wr(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){const s=zs(n);for(let i in s){const o=s[i].get;if(o)try{o.call(e)}catch{}}}}}function li(e){ae===null&&(X===null&&Gi(),qi()),en&&ji()}function Mo(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Nt(e,t,n){var s=ae;s!==null&&(s.f&st)!==0&&(e|=st);var i={ctx:me,deps:null,nodes:null,f:e|Ve|dt,first:null,fn:t,last:null,next:null,parent:s,b:s&&s.b,prev:null,teardown:null,wv:0,ac:null};if(n)try{Un(i),i.f|=Vr}catch(a){throw et(i),a}else t!==null&&Dt(i);var o=i;if(n&&o.deps===null&&o.teardown===null&&o.nodes===null&&o.first===o.last&&(o.f&jn)===0&&(o=o.first,(e&Ft)!==0&&(e&Mn)!==0&&o!==null&&(o.f|=Mn)),o!==null&&(o.parent=s,s!==null&&Mo(o,s),X!==null&&(X.f&De)!==0&&(e&mn)===0)){var l=X;(l.effects??(l.effects=[])).push(o)}return i}function Xr(){return X!==null&&!bt}function Jr(e){const t=Nt(nr,null,!1);return $e(t,Me),t.teardown=e,t}function Ur(e){li();var t=ae.f,n=!X&&(t&Ut)!==0&&(t&Vr)===0;if(n){var s=me;(s.e??(s.e=[])).push(e)}else return fi(e)}function fi(e){return Nt(hr|Ls,e,!1)}function Do(e){return li(),Nt(nr|Ls,e,!0)}function Oo(e){It.ensure();const t=Nt(mn|jn,e,!0);return(n={})=>new Promise(s=>{n.outro?hn(t,()=>{et(t),s(void 0)}):(et(t),s(void 0))})}function Fo(e){return Nt(hr,e,!1)}function Z(e,t){var n=me,s={effect:null,ran:!1,deps:e};n.l.$.push(s),s.effect=ir(()=>{e(),!s.ran&&(s.ran=!0,_(t))})}function Bt(){var e=me;ir(()=>{for(var t of e.l.$){t.deps();var n=t.effect;(n.f&Me)!==0&&n.deps!==null&&$e(n,zt),Hn(n)&&Un(n),t.ran=!1}})}function Uo(e){return Nt(Yr|jn,e,!0)}function ir(e,t=0){return Nt(nr|t,e,!0)}function V(e,t=[],n=[],s=[]){xo(s,t,n,i=>{Nt(nr,()=>e(...i.map(r)),!0)})}function es(e,t=0){var n=Nt(Ft|t,e,!0);return n}function vt(e){return Nt(Ut|jn,e,!0)}function ui(e){var t=e.teardown;if(t!==null){const n=en,s=X;ps(!0),Je(null);try{t.call(null)}finally{ps(n),Je(s)}}}function ci(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const i=n.ac;i!==null&&$r(()=>{i.abort(xn)});var s=n.next;(n.f&mn)!==0?n.parent=null:et(n,t),n=s}}function Bo(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&Ut)===0&&et(t),t=n}}function et(e,t=!0){var n=!1;(t||(e.f&Cs)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(vi(e.nodes.start,e.nodes.end),n=!0),ci(e,t&&!n),mr(e,0),$e(e,Mt);var s=e.nodes&&e.nodes.t;if(s!==null)for(const o of s)o.stop();ui(e);var i=e.parent;i!==null&&i.first!==null&&di(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function vi(e,t){for(;e!==null;){var n=e===t?null:sr(e);e.remove(),e=n}}function di(e){var t=e.parent,n=e.prev,s=e.next;n!==null&&(n.next=s),s!==null&&(s.prev=n),t!==null&&(t.first===e&&(t.first=s),t.last===e&&(t.last=n))}function hn(e,t,n=!0){var s=[];pi(e,s,!0);var i=()=>{n&&et(e),t&&t()},o=s.length;if(o>0){var l=()=>--o||i();for(var a of s)a.out(l)}else i()}function pi(e,t,n){if((e.f&st)===0){e.f^=st;var s=e.nodes&&e.nodes.t;if(s!==null)for(const a of s)(a.is_global||n)&&t.push(a);for(var i=e.first;i!==null;){var o=i.next,l=(i.f&Mn)!==0||(i.f&Ut)!==0&&(e.f&Ft)!==0;pi(i,t,l?n:!1),i=o}}}function ts(e){hi(e,!0)}function hi(e,t){if((e.f&st)!==0){e.f^=st,(e.f&Me)===0&&($e(e,Ve),Dt(e));for(var n=e.first;n!==null;){var s=n.next,i=(n.f&Mn)!==0||(n.f&Ut)!==0;hi(n,i?t:!1),n=s}var o=e.nodes&&e.nodes.t;if(o!==null)for(const l of o)(l.is_global||t)&&l.in()}}function _i(e,t){if(e.nodes)for(var n=e.nodes.start,s=e.nodes.end;n!==null;){var i=n===s?null:sr(n);t.append(n),n=i}}const jo=["touchstart","touchmove"];function qo(e){return jo.includes(e)}const Go=new Set,_s=new Set;function Ho(e,t,n,s={}){function i(o){if(s.capture||Wn.call(t,o),!o.cancelBubble)return $r(()=>n==null?void 0:n.call(this,o))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?Gn(()=>{t.addEventListener(e,i,s)}):t.addEventListener(e,i,s),i}function dr(e,t,n,s,i){var o={capture:s,passive:i},l=Ho(e,t,n,o);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Jr(()=>{t.removeEventListener(e,l,o)})}let gs=null;function Wn(e){var b;var t=this,n=t.ownerDocument,s=e.type,i=((b=e.composedPath)==null?void 0:b.call(e))||[],o=i[0]||e.target;gs=e;var l=0,a=gs===e&&e.__root;if(a){var f=i.indexOf(a);if(f!==-1&&(t===document||t===window)){e.__root=t;return}var u=i.indexOf(t);if(u===-1)return;f<=u&&(l=f)}if(o=i[l]||e.target,o!==t){Rs(e,"currentTarget",{configurable:!0,get(){return o||n}});var c=X,y=ae;Je(null),Rt(null);try{for(var d,v=[];o!==null;){var k=o.assignedSlot||o.parentNode||o.host||null;try{var N=o["__"+s];N!=null&&(!o.disabled||e.target===o)&&N.call(o,e)}catch(x){d?v.push(x):d=x}if(e.cancelBubble||k===t||k===null)break;o=k}if(d){for(let x of v)queueMicrotask(()=>{throw x});throw d}}finally{e.__root=t,delete e.currentTarget,Je(c),Rt(y)}}}function gi(e){var t=document.createElement("template");return t.innerHTML=e.replaceAll("<!>","<!---->"),t.content}function yr(e,t){var n=ae;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function z(e,t){var n=(t&lo)!==0,s=(t&fo)!==0,i,o=!e.startsWith("<!>");return()=>{i===void 0&&(i=gi(o?e:"<!>"+e),n||(i=Vt(i)));var l=s||Us?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=Vt(l),f=l.lastChild;yr(a,f)}else yr(l,l);return l}}function ye(){var e=document.createDocumentFragment(),t=document.createComment(""),n=Xt();return e.append(t,n),yr(t,n),e}function S(e,t){e!==null&&e.before(t)}function H(e,t){var n=t==null?"":typeof t=="object"?t+"":t;n!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=n,e.nodeValue=n+"")}function Wo(e,t){return Ko(e,t)}const En=new Map;function Ko(e,{target:t,anchor:n,props:s={},events:i,context:o,intro:l=!0}){po();var a=new Set,f=y=>{for(var d=0;d<y.length;d++){var v=y[d];if(!a.has(v)){a.add(v);var k=qo(v);t.addEventListener(v,Wn,{passive:k});var N=En.get(v);N===void 0?(document.addEventListener(v,Wn,{passive:k}),En.set(v,1)):En.set(v,N+1)}}};f(Er(Go)),_s.add(f);var u=void 0,c=Oo(()=>{var y=n??t.appendChild(Xt());return ko(y,{pending:()=>{}},d=>{if(o){it({});var v=me;v.c=o}i&&(s.$$events=i),u=e(d,s)||{},o&&ot()}),()=>{var k;for(var d of a){t.removeEventListener(d,Wn);var v=En.get(d);--v===0?(document.removeEventListener(d,Wn),En.delete(d)):En.set(d,v)}_s.delete(f),y!==n&&((k=y.parentNode)==null||k.removeChild(y))}});return Vo.set(u,c),u}let Vo=new WeakMap;var yt,At,rt,cn,er,tr,wr;class Yo{constructor(t,n=!0){gt(this,"anchor");te(this,yt,new Map);te(this,At,new Map);te(this,rt,new Map);te(this,cn,new Set);te(this,er,!0);te(this,tr,()=>{var t=ne;if(m(this,yt).has(t)){var n=m(this,yt).get(t),s=m(this,At).get(n);if(s)ts(s),m(this,cn).delete(n);else{var i=m(this,rt).get(n);i&&(m(this,At).set(n,i.effect),m(this,rt).delete(n),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),s=i.effect)}for(const[o,l]of m(this,yt)){if(m(this,yt).delete(o),o===t)break;const a=m(this,rt).get(l);a&&(et(a.effect),m(this,rt).delete(l))}for(const[o,l]of m(this,At)){if(o===n||m(this,cn).has(o))continue;const a=()=>{if(Array.from(m(this,yt).values()).includes(o)){var u=document.createDocumentFragment();_i(l,u),u.append(Xt()),m(this,rt).set(o,{effect:l,fragment:u})}else et(l);m(this,cn).delete(o),m(this,At).delete(o)};m(this,er)||!s?(m(this,cn).add(o),hn(l,a,!1)):a()}}});te(this,wr,t=>{m(this,yt).delete(t);const n=Array.from(m(this,yt).values());for(const[s,i]of m(this,rt))n.includes(s)||(et(i.effect),m(this,rt).delete(s))});this.anchor=t,ee(this,er,n)}ensure(t,n){var s=ne,i=qs();if(n&&!m(this,At).has(t)&&!m(this,rt).has(t))if(i){var o=document.createDocumentFragment(),l=Xt();o.append(l),m(this,rt).set(t,{effect:vt(()=>n(l)),fragment:o})}else m(this,At).set(t,vt(()=>n(this.anchor)));if(m(this,yt).set(s,t),i){for(const[a,f]of m(this,At))a===t?s.skipped_effects.delete(f):s.skipped_effects.add(f);for(const[a,f]of m(this,rt))a===t?s.skipped_effects.delete(f.effect):s.skipped_effects.add(f.effect);s.oncommit(m(this,tr)),s.ondiscard(m(this,wr))}else m(this,tr).call(this)}}yt=new WeakMap,At=new WeakMap,rt=new WeakMap,cn=new WeakMap,er=new WeakMap,tr=new WeakMap,wr=new WeakMap;function I(e,t,n=!1){var s=new Yo(e),i=n?Mn:0;function o(l,a){s.ensure(l,a)}es(()=>{var l=!1;t((a,f=!0)=>{l=!0,o(f,a)}),l||o(!1,null)},i)}function je(e,t){return t}function Zo(e,t,n){for(var s=[],i=t.length,o,l=t.length,a=0;a<i;a++){let y=t[a];hn(y,()=>{if(o){if(o.pending.delete(y),o.done.add(y),o.pending.size===0){var d=e.outrogroups;Br(Er(o.done)),d.delete(o),d.size===0&&(e.outrogroups=null)}}else l-=1},!1)}if(l===0){var f=s.length===0&&n!==null;if(f){var u=n,c=u.parentNode;ho(c),c.append(u),e.items.clear()}Br(t,!f)}else o={pending:new Set(t),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(o)}function Br(e,t=!0){for(var n=0;n<e.length;n++)et(e[n],t)}var ms;function Ie(e,t,n,s,i,o=null){var l=e,a=new Map,f=(t&Os)!==0;if(f){var u=e;l=u.appendChild(Xt())}var c=null,y=de(()=>{var x=n();return As(x)?x:x==null?[]:Er(x)}),d,v=!0;function k(){b.fallback=c,Qo(b,d,l,t,s),c!==null&&(d.length===0?(c.f&Pt)===0?ts(c):(c.f^=Pt,Kn(c,null,l)):hn(c,()=>{c=null}))}var N=es(()=>{d=r(y);for(var x=d.length,T=new Set,F=ne,M=qs(),U=0;U<x;U+=1){var $=d[U],A=s($,U),R=v?null:a.get(A);R?(R.v&&Fn(R.v,$),R.i&&Fn(R.i,U),M&&F.skipped_effects.delete(R.e)):(R=Xo(a,v?l:ms??(ms=Xt()),$,A,U,i,t,n),v||(R.e.f|=Pt),a.set(A,R)),T.add(A)}if(x===0&&o&&!c&&(v?c=vt(()=>o(l)):(c=vt(()=>o(ms??(ms=Xt()))),c.f|=Pt)),!v)if(M){for(const[j,O]of a)T.has(j)||F.skipped_effects.add(O.e);F.oncommit(k),F.ondiscard(()=>{})}else k();r(y)}),b={effect:N,items:a,outrogroups:null,fallback:c};v=!1}function Qo(e,t,n,s,i){var O,g,p,h,E,D,ie,re,Q;var o=(s&to)!==0,l=t.length,a=e.items,f=e.effect.first,u,c=null,y,d=[],v=[],k,N,b,x;if(o)for(x=0;x<l;x+=1)k=t[x],N=i(k,x),b=a.get(N).e,(b.f&Pt)===0&&((g=(O=b.nodes)==null?void 0:O.a)==null||g.measure(),(y??(y=new Set)).add(b));for(x=0;x<l;x+=1){if(k=t[x],N=i(k,x),b=a.get(N).e,e.outrogroups!==null)for(const le of e.outrogroups)le.pending.delete(b),le.done.delete(b);if((b.f&Pt)!==0)if(b.f^=Pt,b===f)Kn(b,null,n);else{var T=c?c.next:f;b===e.effect.last&&(e.effect.last=b.prev),b.prev&&(b.prev.next=b.next),b.next&&(b.next.prev=b.prev),Gt(e,c,b),Gt(e,b,T),Kn(b,T,n),c=b,d=[],v=[],f=c.next;continue}if((b.f&st)!==0&&(ts(b),o&&((h=(p=b.nodes)==null?void 0:p.a)==null||h.unfix(),(y??(y=new Set)).delete(b))),b!==f){if(u!==void 0&&u.has(b)){if(d.length<v.length){var F=v[0],M;c=F.prev;var U=d[0],$=d[d.length-1];for(M=0;M<d.length;M+=1)Kn(d[M],F,n);for(M=0;M<v.length;M+=1)u.delete(v[M]);Gt(e,U.prev,$.next),Gt(e,c,U),Gt(e,$,F),f=F,c=$,x-=1,d=[],v=[]}else u.delete(b),Kn(b,f,n),Gt(e,b.prev,b.next),Gt(e,b,c===null?e.effect.first:c.next),Gt(e,c,b),c=b;continue}for(d=[],v=[];f!==null&&f!==b;)(u??(u=new Set)).add(f),v.push(f),f=f.next;if(f===null)continue}(b.f&Pt)===0&&d.push(b),c=b,f=b.next}if(e.outrogroups!==null){for(const le of e.outrogroups)le.pending.size===0&&(Br(Er(le.done)),(E=e.outrogroups)==null||E.delete(le));e.outrogroups.size===0&&(e.outrogroups=null)}if(f!==null||u!==void 0){var A=[];if(u!==void 0)for(b of u)(b.f&st)===0&&A.push(b);for(;f!==null;)(f.f&st)===0&&f!==e.fallback&&A.push(f),f=f.next;var R=A.length;if(R>0){var j=(s&Os)!==0&&l===0?n:null;if(o){for(x=0;x<R;x+=1)(ie=(D=A[x].nodes)==null?void 0:D.a)==null||ie.measure();for(x=0;x<R;x+=1)(Q=(re=A[x].nodes)==null?void 0:re.a)==null||Q.fix()}Zo(e,A,j)}}o&&Gn(()=>{var le,Oe;if(y!==void 0)for(b of y)(Oe=(le=b.nodes)==null?void 0:le.a)==null||Oe.apply()})}function Xo(e,t,n,s,i,o,l,a){var f=(l&Ji)!==0?(l&no)===0?K(n,!1,!1):gn(n):null,u=(l&eo)!==0?gn(i):null;return{v:f,i:u,e:vt(()=>(o(t,f??n,u??i,a),()=>{e.delete(s)}))}}function Kn(e,t,n){if(e.nodes)for(var s=e.nodes.start,i=e.nodes.end,o=t&&(t.f&Pt)===0?t.nodes.start:n;s!==null;){var l=sr(s);if(o.before(s),s===i)return;s=l}}function Gt(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Jo(e,t,n=!1,s=!1,i=!1){var o=e,l="";V(()=>{var a=ae;if(l!==(l=t()??"")&&(a.nodes!==null&&(vi(a.nodes.start,a.nodes.end),a.nodes=null),l!=="")){var f=l+"";n?f=`<svg>${f}</svg>`:s&&(f=`<math>${f}</math>`);var u=gi(f);if((n||s)&&(u=Vt(u)),yr(Vt(u),u.lastChild),n||s)for(;Vt(u);)o.before(Vt(u));else o.before(u)}})}const ys=[...`
2
- \r\f \v\uFEFF`];function ea(e,t,n){var s=""+e;if(n){for(var i in n)if(n[i])s=s?s+" "+i:i;else if(s.length)for(var o=i.length,l=0;(l=s.indexOf(i,l))>=0;){var a=l+o;(l===0||ys.includes(s[l-1]))&&(a===s.length||ys.includes(s[a]))?s=(l===0?"":s.substring(0,l))+s.substring(a+1):l=a}}return s===""?null:s}function ta(e,t,n,s,i,o){var l=e.__className;if(l!==n||l===void 0){var a=ea(n,s,o);a==null?e.removeAttribute("class"):e.className=a,e.__className=n}else if(o&&i!==o)for(var f in o){var u=!!o[f];(i==null||u!==!!i[f])&&e.classList.toggle(f,u)}return o}const na=Symbol("is custom element"),ra=Symbol("is html");function xe(e,t,n,s){var i=sa(e);i[t]!==(i[t]=n)&&(t==="loading"&&(e[Ui]=n),n==null?e.removeAttribute(t):typeof n!="string"&&ia(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function sa(e){return e.__attributes??(e.__attributes={[na]:e.nodeName.includes("-"),[ra]:e.namespaceURI===uo})}var bs=new Map;function ia(e){var t=e.getAttribute("is")||e.nodeName,n=bs.get(t);if(n)return n;bs.set(t,n=[]);for(var s,i=e,o=Element.prototype;o!==i;){s=zs(i);for(var l in s)s[l].set&&n.push(l);i=Wr(i)}return n}function oa(e,t,n=t){var s=new WeakSet;To(e,"input",async i=>{var o=i?e.defaultValue:e.value;if(o=zr(e)?Nr(o):o,n(o),ne!==null&&s.add(ne),await Io(),o!==(o=t())){var l=e.selectionStart,a=e.selectionEnd,f=e.value.length;if(e.value=o??"",a!==null){var u=e.value.length;l===a&&a===f&&u>f?(e.selectionStart=u,e.selectionEnd=u):(e.selectionStart=l,e.selectionEnd=Math.min(a,u))}}}),_(t)==null&&e.value&&(n(zr(e)?Nr(e.value):e.value),ne!==null&&s.add(ne)),ir(()=>{var i=t();if(e===document.activeElement){var o=ur??ne;if(s.has(o))return}zr(e)&&i===Nr(e.value)||e.type==="date"&&!i&&!e.value||i!==e.value&&(e.value=i??"")})}function zr(e){var t=e.type;return t==="number"||t==="range"}function Nr(e){return e===""?null:+e}function ks(e,t){return e===t||(e==null?void 0:e[vn])===t}function ws(e={},t,n,s){return Fo(()=>{var i,o;return ir(()=>{i=o,o=[],_(()=>{e!==n(...o)&&(t(e,...o),i&&ks(n(...i),e)&&t(null,...i))})}),()=>{Gn(()=>{o&&ks(n(...o),e)&&t(null,...o)})}}),e}function aa(e){return function(...t){var n=t[0];return n.preventDefault(),e==null?void 0:e.apply(this,t)}}function ht(e=!1){const t=me,n=t.l.u;if(!n)return;let s=()=>W(t.s);if(e){let i=0,o={};const l=xr(()=>{let a=!1;const f=t.s;for(const u in f)f[u]!==o[u]&&(o[u]=f[u],a=!0);return a&&i++,i});s=()=>r(l)}n.b.length&&Do(()=>{Es(t,s),pr(n.b)}),Ur(()=>{const i=_(()=>n.m.map(Oi));return()=>{for(const o of i)typeof o=="function"&&o()}}),n.a.length&&Ur(()=>{Es(t,s),pr(n.a)})}function Es(e,t){if(e.l.s)for(const n of e.l.s)r(n);t()}let fr=!1,jr=Symbol();function be(e,t,n){const s=n[t]??(n[t]={store:null,source:K(void 0),unsubscribe:Zt});if(s.store!==e&&!(jr in n))if(s.unsubscribe(),s.store=e??null,e==null)s.source.v=void 0,s.unsubscribe=Zt;else{var i=!0;s.unsubscribe=rs(e,o=>{i?s.source.v=o:C(s.source,o)}),i=!1}return e&&jr in n?Zn(e):r(s.source)}function tn(){const e={};function t(){Jr(()=>{for(var n in e)e[n].unsubscribe();Rs(e,jr,{enumerable:!1,value:!0})})}return[e,t]}function la(e){var t=fr;try{return fr=!1,[e(),fr]}finally{fr=t}}function tt(e,t,n,s){var F;var i=!qn||(n&so)!==0,o=(n&oo)!==0,l=(n&ao)!==0,a=s,f=!0,u=()=>(f&&(f=!1,a=l?_(s):s),a),c;if(o){var y=vn in e||Fi in e;c=((F=An(e,t))==null?void 0:F.set)??(y&&t in e?M=>e[t]=M:void 0)}var d,v=!1;o?[d,v]=la(()=>e[t]):d=e[t],d===void 0&&s!==void 0&&(d=u(),c&&(i&&Wi(),c(d)));var k;if(i?k=()=>{var M=e[t];return M===void 0?u():(f=!0,M)}:k=()=>{var M=e[t];return M!==void 0&&(a=void 0),M===void 0?a:M},i&&(n&io)===0)return k;if(c){var N=e.$$legacy;return(function(M,U){return arguments.length>0?((!i||!U||N||v)&&c(U?k():M),M):k()})}var b=!1,x=((n&ro)!==0?xr:de)(()=>(b=!1,k()));o&&r(x);var T=ae;return(function(M,U){if(arguments.length>0){const $=U?r(x):i&&o?$n(M):M;return C(x,$),b=!0,a!==void 0&&(a=$),M}return en&&b||(T.f&Mt)!==0?x.v:r(x)})}function ns(e){me===null&&Ds(),qn&&me.l!==null?fa(me).m.push(e):Ur(()=>{const t=_(e);if(typeof t=="function")return t})}function mi(e){me===null&&Ds(),ns(()=>()=>_(e))}function fa(e){var t=e.l;return t.u??(t.u={a:[],b:[],m:[]})}function rs(e,t,n){if(e==null)return t(void 0),n&&n(void 0),Zt;const s=_(()=>e.subscribe(t,n));return s.unsubscribe?()=>s.unsubscribe():s}const Sn=[];function ua(e,t){return{subscribe:yn(e,t).subscribe}}function yn(e,t=Zt){let n=null;const s=new Set;function i(a){if(Is(e,a)&&(e=a,n)){const f=!Sn.length;for(const u of s)u[1](),Sn.push(u,e);if(f){for(let u=0;u<Sn.length;u+=2)Sn[u][0](Sn[u+1]);Sn.length=0}}}function o(a){i(a(e))}function l(a,f=Zt){const u=[a,f];return s.add(u),s.size===1&&(n=t(i,o)||Zt),a(e),()=>{s.delete(u),s.size===0&&n&&(n(),n=null)}}return{set:i,update:o,subscribe:l}}function Tt(e,t,n){const s=!Array.isArray(e),i=s?[e]:e;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const o=t.length<2;return ua(n,(l,a)=>{let f=!1;const u=[];let c=0,y=Zt;const d=()=>{if(c)return;y();const k=t(s?u[0]:u,l,a);o?l(k):y=typeof k=="function"?k:Zt},v=i.map((k,N)=>rs(k,b=>{u[N]=b,c&=~(1<<N),f&&d()},()=>{c|=1<<N}));return f=!0,d(),function(){pr(v),y(),f=!1}})}function Zn(e){let t;return rs(e,n=>t=n)(),t}function ca(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function va(){if(typeof localStorage>"u")return"auto";const e=localStorage.getItem("theme");return e==="light"||e==="dark"?e:"auto"}function da(e){return e==="auto"?ca():e}const qr=va(),Yt=yn(qr);function ss(e){if(typeof document>"u")return;const t=da(e);document.documentElement.dataset.theme=t}let Rn=null,Qn=null;function yi(){typeof window>"u"||Rn||(Rn=window.matchMedia("(prefers-color-scheme: dark)"),Qn=()=>{const e=Yt.subscribe(t=>{e(),t==="auto"&&ss("auto")})},Rn.addEventListener("change",Qn))}function pa(){Rn&&Qn&&(Rn.removeEventListener("change",Qn),Rn=null,Qn=null)}Yt.subscribe(e=>{ss(e),typeof localStorage<"u"&&localStorage.setItem("theme",e),e==="auto"?yi():pa()});typeof window<"u"&&(ss(qr),qr==="auto"&&yi());const ha="5";var $s;typeof window<"u"&&(($s=window.__svelte??(window.__svelte={})).v??($s.v=new Set)).add(ha);Xi();const Ne=yn(null),Ot=yn(null),_a=Tt([Ne,Ot],([e,t])=>{var n;return((n=e==null?void 0:e.universes)==null?void 0:n[t])??null}),nn=Tt([Ne,_a],([e,t])=>t&&e?e.nodes[t.root]:null),ga=Tt([Ne,nn],([e,t])=>!e||!t?[]:(t.children||[]).map(n=>e.nodes[n]).filter(Boolean).filter(n=>n.kind!=="relates")),ma=Tt([Ne,nn],([e,t])=>!e||!t?[]:(t.children||[]).map(n=>e.nodes[n]).filter(Boolean).filter(n=>n.kind==="anthology")),ya=Tt([Ne,nn],([e,t])=>!e||!t?[]:(t.children||[]).map(s=>e.nodes[s]).filter(Boolean).filter(s=>s.kind==="series").filter(s=>{if(!s.parent)return!0;const i=e.nodes[s.parent];return!i||i.kind!=="anthology"})),is=yn(null),bi=Tt([Ne,is],([e,t])=>e&&t?e.nodes[t]:null),ba=Tt([Ne,bi],([e,t])=>!e||!t?[]:(t.children||[]).map(n=>e.nodes[n]).filter(Boolean)),ki=yn(null),wi=Tt([Ne,ki],([e,t])=>e&&t?e.nodes[t]:null),ka=Tt([Ne,wi],([e,t])=>!e||!t?[]:(t.children||[]).map(n=>e.nodes[n]).filter(Boolean).filter(n=>n.kind==="series"));function Ei(e,t){var o,l,a,f,u;if(!e||!t)return[];const n=Object.values(e.nodes).filter(c=>c.kind==="relates"),s=[];for(const c of n){if(!c.endpoints||!Array.isArray(c.endpoints)||!c.endpoints.includes(t))continue;const y=c.endpoints.find(b=>b!==t);if(!y)continue;const d=e.nodes[y];if(!d)continue;let v="related to";const k=(o=c.from)==null?void 0:o[t];((a=(l=k==null?void 0:k.relationships)==null?void 0:l.values)==null?void 0:a.length)>0&&(v=k.relationships.values[0]);let N=null;(f=k==null?void 0:k.describe)!=null&&f.normalized?N=k.describe.normalized:(u=c.describe)!=null&&u.normalized&&(N=c.describe.normalized),s.push({relNode:c,otherNode:d,label:v,desc:N})}const i={series:0,book:1,chapter:2,concept:3};return s.sort((c,y)=>{const d=c.otherNode.kind in i?i[c.otherNode.kind]:999,v=y.otherNode.kind in i?i[y.otherNode.kind]:999;return d!==v?d-v:c.otherNode.name.localeCompare(y.otherNode.name)}),s}const wa=Tt([Ne,is],([e,t])=>Ei(e,t));function Gr(e,t){if(!e||!t||!t.parent)return[];const n=[];let s=t.parent;for(;s;){const i=e.nodes[s];if(!i||(n.push(i),i.kind==="series"))break;s=i.parent}return n}function Be(e){if(!e||!e.id)return"#";const t=e.id.split(":");if(t.length<3)return`#${e.id}`;const n=t[0],s=t[1],i=t[2];return s==="series"?`/universes/${n}/series/${i}`:s==="anthology"?`/universes/${n}/anthology/${i}`:`/universes/${n}/concept/${encodeURIComponent(e.id)}`}function Ss(e){if(!e||!e.universes)return;const t=Zn(Ot),n=Object.keys(e.universes);n.length>0&&(!t||!e.universes[t])&&Ot.set(n[0])}async function Ea(e="/api/manifest",t=fetch){const n=await t(e,{cache:"no-store",headers:{"Cache-Control":"no-cache"}});if(!n.ok)throw new Error(`Failed to load ${e}: ${n.status}`);const s=await n.json();Ne.set(s);const i=n.headers.get("x-describe-render-mode");return{data:s,describeRenderMode:i}}function Sa(e){const t=e.replace(/^\/+|\/+$/g,"");if(!t||t==="")return{route:"home",params:{}};const n=t.match(/^universes\/([^/]+)\/series\/([^/]+)$/);if(n)return{route:"series",params:{universe:n[1],series:n[2]}};const s=t.match(/^universes\/([^/]+)\/anthology\/([^/]+)$/);if(s)return{route:"anthology",params:{universe:s[1],anthology:s[2]}};const i=t.match(/^universes\/([^/]+)\/concept\/(.+)$/);if(i)return{route:"concept",params:{universe:i[1],id:i[2]}};const o=t.match(/^universes\/([^/]+)\/reference\/(.+)$/);return o?{route:"reference",params:{universe:o[1],id:o[2]}}:null}function xs(){return Sa(window.location.pathname)}function Si(e){window.history.pushState({},"",e),window.dispatchEvent(new PopStateEvent("popstate"))}const xi=yn("lists");function G(e,t={}){if(e&&typeof e=="object"&&typeof e.title=="string"){const s=e.title.trim();if(s.length>0)return s}let n=null;return typeof e=="string"?n=e:e&&typeof e=="object"&&(n=e.name||e.id||e.slug||e.identifier||null),!n||typeof n!="string"||n.trim().length===0?"":xa(n)}function xa(e){let t=e.replace(/[_-]/g," ").trim();return t=t.replace(/([a-z])([A-Z])/g,"$1 $2"),t=t.replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2"),t=t.replace(/([0-9])([A-Za-z])/g,"$1 $2"),t=t.replace(/([A-Za-z])([0-9])/g,"$1 $2"),t.split(/\s+/).filter(s=>s.length>0).map(s=>s.length>=2&&s===s.toUpperCase()&&/^[A-Z]+$/.test(s)&&["API","UUID","ID","HTTP","HTTPS","XML","JSON","URL","URI","HTML","CSS","JS","TS","AB"].includes(s)||s.length===0?s:s.length===1?s.toUpperCase():s[0].toUpperCase()+s.slice(1).toLowerCase()).join(" ").replace(/\s+/g," ").trim()}var $a=z('<span class="result-context svelte-1ytcet"> </span>'),Aa=z('<a role="option"><div class="result-content svelte-1ytcet"><div class="result-title svelte-1ytcet"> </div> <div class="result-meta svelte-1ytcet"><span class="result-kind svelte-1ytcet"> </span> <!></div></div></a>'),Ra=z('<div class="results-dropdown svelte-1ytcet" role="listbox"></div>'),za=z('<div class="search-container svelte-1ytcet"><div class="search-wrapper svelte-1ytcet"><input type="text" placeholder="Search Series, Books, Chapters, Concepts… (Press / to focus)" class="search-input svelte-1ytcet" role="combobox" aria-label="Search" aria-autocomplete="list"/> <!></div></div>');function Na(e,t){it(t,!1);const n=()=>be(Ne,"$universeGraph",s),[s,i]=tn(),o=K(),l=K();let a=K(null),f=K(""),u=K([]),c=K(null),y="search-results-listbox",d=K(null),v=K(!1);function k(g,p){if(p.kind==="series")return null;if(p.kind==="book"){if(!p.parent)return null;const h=g.nodes[p.parent];return!h||h.kind!=="series"?null:`Book in ${G(h)}`}if(p.kind==="chapter"){const h=Gr(g,p);if(h.length===0)return null;const E=h.find(ie=>ie.kind==="book"),D=h.find(ie=>ie.kind==="series");return E&&D?`in ${G(E)} (in ${G(D)})`:E?`in ${G(E)}`:D?`in ${G(D)}`:null}if(p.kind==="concept"){if(!p.parent)return null;const h=Gr(g,p),E=g.nodes[p.parent];if(!E)return null;const D=h.find(re=>re.kind==="book"),ie=h.find(re=>re.kind==="series");return D&&ie?`in ${G(D)} (in ${G(ie)})`:D?`in ${G(D)}`:ie?`in ${G(ie)}`:E.kind==="series"?`in ${G(E)}`:E.kind==="anthology"?`in ${G(E)}`:null}return null}function N(g){if(!g||!g.nodes)return[];const p=[],h=["series","book","chapter","concept"];for(const E of Object.values(g.nodes)){if(!E||!h.includes(E.kind))continue;const D=Be(E),ie=k(g,E);p.push({node:E,name:E.name,kind:E.kind,id:E.id,route:D,context:ie})}if(g.references)for(const E of Object.values(g.references)){if(!E||!E.id)continue;const ie=`/universes/${E.id.split(":")[0]}/reference/${encodeURIComponent(E.id)}`;p.push({node:E,name:E.title||E.name,kind:"reference",id:E.id,route:ie,context:null})}return p}function b(g,p){if(!p.trim())return[];const h=p.toLowerCase().trim(),E=[],D=[];for(const re of g){const Q=re.name.toLowerCase();Q.startsWith(h)?E.push(re):Q.includes(h)&&D.push(re)}return E.sort((re,Q)=>re.name.localeCompare(Q.name)),D.sort((re,Q)=>re.name.localeCompare(Q.name)),[...E,...D].slice(0,10)}function x(){if(r(c)===null||!r(d))return;const g=`search-option-${r(c)}`,p=r(d).querySelector(`#${g}`);p&&p.scrollIntoView({block:"nearest",behavior:"smooth"})}function T(g){var p;if(g.key!=="Tab"){if(g.key==="ArrowDown"){if(g.preventDefault(),!r(l)||r(o).length===0)return;r(c)===null?C(c,0):C(c,Math.min(r(c)+1,r(o).length-1)),x();return}if(g.key==="ArrowUp"){if(g.preventDefault(),!r(l)||r(o).length===0)return;r(c)===null?C(c,r(o).length-1):C(c,Math.max(r(c)-1,0)),x();return}if(g.key==="Enter"&&r(l)&&r(c)!==null&&r(o)[r(c)]){g.preventDefault();const h=r(o)[r(c)];M(h);return}if(g.key==="Escape"){g.preventDefault(),C(v,!0),C(c,null),(p=r(a))==null||p.focus();return}}}function F(g){var E;const p=document.activeElement,h=p&&(p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p instanceof HTMLElement&&p.isContentEditable);g.key==="/"&&!h&&(g.preventDefault(),(E=r(a))==null||E.focus())}function M(g){C(f,""),C(l,!1),C(c,null),Si(g.route),window.dispatchEvent(new PopStateEvent("popstate"))}function U(g){C(c,g)}ns(()=>{window.addEventListener("keydown",F)}),mi(()=>{typeof window<"u"&&window.removeEventListener("keydown",F)}),Z(()=>n(),()=>{n()&&C(u,N(n()))}),Z(()=>(r(f),r(u)),()=>{C(o,r(f).trim()?b(r(u),r(f)):[])}),Z(()=>r(f),()=>{C(c,null),r(f).trim().length>0&&C(v,!1)}),Z(()=>(r(o),r(f),r(v)),()=>{C(l,r(o).length>0&&r(f).trim().length>0&&!r(v))}),Bt(),ht();var $=za(),A=w($),R=w(A);xe(R,"aria-controls",y),ws(R,g=>C(a,g),()=>r(a));var j=L(R,2);{var O=g=>{var p=Ra();xe(p,"id",y),Ie(p,7,()=>r(o),h=>h.id,(h,E,D)=>{const ie=de(()=>`search-option-${r(D)}`),re=de(()=>r(c)===r(D));var Q=Aa();let le;var Oe=w(Q),fe=w(Oe),Ae=w(fe),ke=L(fe,2),Te=w(ke),J=w(Te),we=L(Te,2);{var Fe=Y=>{var he=$a(),_e=w(he);V(()=>H(_e,(r(E),_(()=>r(E).context)))),S(Y,he)};I(we,Y=>{r(E),_(()=>r(E).context)&&Y(Fe)})}V(Y=>{xe(Q,"href",(r(E),_(()=>r(E).route))),le=ta(Q,1,"result-item svelte-1ytcet",null,le,{"result-item--active":r(re)}),xe(Q,"id",r(ie)),xe(Q,"aria-selected",r(re)),H(Ae,Y),H(J,(r(E),_(()=>r(E).kind)))},[()=>(W(G),r(E),_(()=>G(r(E).node)))]),dr("click",Q,aa(()=>M(r(E)))),dr("mouseenter",Q,()=>U(r(D))),S(h,Q)}),ws(p,h=>C(d,h),()=>r(d)),S(g,p)};I(j,g=>{r(l),r(o),_(()=>r(l)&&r(o).length>0)&&g(O)})}V(()=>{xe(R,"aria-expanded",r(l)),xe(R,"aria-activedescendant",r(c)!==null?`search-option-${r(c)}`:void 0)}),oa(R,()=>r(f),g=>C(f,g)),dr("keydown",R,T),S(e,$),ot(),i()}var Ta=z('<p class="subtitle svelte-162svzm"><!></p>'),Ca=z('<p class="subtitle svelte-162svzm"> </p>'),La=z('<header class="header svelte-162svzm"><div><h1 class="title svelte-162svzm"> </h1> <!></div></header>');function or(e,t){it(t,!1);let n=tt(t,"title",8),s=tt(t,"subtitle",8,null),i=tt(t,"subtitleNode",8,null);ht();var o=La(),l=w(o),a=w(l),f=w(a),u=L(a,2);{var c=d=>{var v=Ta(),k=w(v);Jo(k,s),S(d,v)},y=d=>{var v=ye(),k=pe(v);{var N=b=>{var x=Ca(),T=w(x);V(F=>H(T,F),[()=>(W(G),W(i()),_(()=>G(i())))]),S(b,x)};I(k,b=>{i()&&b(N)},!0)}S(d,v)};I(u,d=>{s()?d(c):d(y,!1)})}V(()=>H(f,n())),S(e,o),ot()}function Pa(e,t){it(t,!1);const n=K();let s=tt(t,"node",8);const i=o=>{if(!o)return"";const l=o.indexOf(".");return l>=0?o.slice(0,l+1):o};Z(()=>W(s()),()=>{var o,l,a,f;C(n,(o=s().describe)!=null&&o.normalized||(l=s().describe)!=null&&l.raw?i(((a=s().describe)==null?void 0:a.normalized)??((f=s().describe)==null?void 0:f.raw)):null)}),Bt(),ht();{let o=de(()=>(W(G),W(s()),_(()=>G(s()))));or(e,{get title(){return r(o)},get subtitle(){return r(n)}})}ot()}var Ia=z('<p class="svelte-1szor9z"> </p>'),Ma=z('<div class="prose sp-prose svelte-1szor9z"></div>'),Da=z('<div class="empty svelte-1szor9z">No description yet.</div>'),Oa=z('<p class="svelte-1szor9z"> </p>'),Fa=z('<li class="svelte-1szor9z"> </li>'),Ua=z('<ul class="svelte-1szor9z"></ul>'),Ba=z('<li class="svelte-1szor9z"> </li>'),ja=z('<ol class="svelte-1szor9z"></ol>'),qa=z('<div class="prose sp-prose svelte-1szor9z"></div>'),Ga=z('<div class="empty svelte-1szor9z">No description yet.</div>');function Bn(e,t){it(t,!1);const n=()=>be(xi,"$describeRenderMode",s),[s,i]=tn(),o=K(),l=K(),a=K(),f=K();let u=tt(t,"textBlock",8);const c=b=>b?b.split(/\n\s*\n/g).map(T=>T.split(`
3
- `).map(F=>F.trim()).filter(Boolean).join(" ")).filter(Boolean):[],y=b=>{if(!b)return[];const x=b.split(/\n\s*\n/g).filter(U=>U.trim()),T=[],F=/^[-—*]\s+/,M=/^\d+\.\s+/;for(const U of x){const $=U.split(`
4
- `).map(O=>O.trim()).filter(Boolean);if($.length===0)continue;let A=-1,R=-1;for(let O=0;O<$.length;O++)A===-1&&F.test($[O])&&(A=O),R===-1&&M.test($[O])&&(R=O);if(A>=0&&(R===-1||A<R)){if(A>0){const p=$.slice(0,A).join(" ");p.trim()&&T.push({type:"paragraph",content:p})}const O=[];let g=null;for(let p=A;p<$.length;p++)if(F.test($[p])){g!==null&&O.push(g);const h=$[p].match(/^[-—*]\s+(.+)$/);g=h&&h[1]?h[1]:""}else if(g!==null)g+=" "+$[p];else break;g!==null&&O.push(g),O.length>0&&T.push({type:"unordered-list",content:O});continue}if(R>=0){if(R>0){const p=$.slice(0,R).join(" ");p.trim()&&T.push({type:"paragraph",content:p})}const O=[];let g=null;for(let p=R;p<$.length;p++)if(M.test($[p])){g!==null&&O.push(g);const h=$[p].match(/^\d+\.\s+(.+)$/);g=h&&h[1]?h[1]:""}else if(g!==null)g+=" "+$[p];else break;g!==null&&O.push(g),O.length>0&&T.push({type:"ordered-list",content:O});continue}const j=$.join(" ");T.push({type:"paragraph",content:j})}return T};Z(()=>W(u()),()=>{var b,x;C(o,((b=u())==null?void 0:b.normalized)??((x=u())==null?void 0:x.raw)??"")}),Z(()=>n(),()=>{C(l,n())}),Z(()=>(r(l),r(o)),()=>{C(a,r(l)==="plain"?c(r(o)):null)}),Z(()=>(r(l),r(o)),()=>{C(f,r(l)==="lists"?y(r(o)):null)}),Bt(),ht();var d=ye(),v=pe(d);{var k=b=>{var x=ye(),T=pe(x);{var F=U=>{var $=Ma();Ie($,5,()=>r(a),je,(A,R)=>{var j=Ia(),O=w(j);V(()=>H(O,r(R))),S(A,j)}),S(U,$)},M=U=>{var $=Da();S(U,$)};I(T,U=>{r(a),_(()=>r(a)&&r(a).length)?U(F):U(M,!1)})}S(b,x)},N=b=>{var x=ye(),T=pe(x);{var F=M=>{var U=ye(),$=pe(U);{var A=j=>{var O=qa();Ie(O,5,()=>r(f),je,(g,p)=>{var h=ye(),E=pe(h);{var D=re=>{var Q=Oa(),le=w(Q);V(()=>H(le,(r(p),_(()=>r(p).content)))),S(re,Q)},ie=re=>{var Q=ye(),le=pe(Q);{var Oe=Ae=>{var ke=Ua();Ie(ke,5,()=>(r(p),_(()=>r(p).content)),je,(Te,J)=>{var we=Fa(),Fe=w(we);V(()=>H(Fe,r(J))),S(Te,we)}),S(Ae,ke)},fe=Ae=>{var ke=ye(),Te=pe(ke);{var J=we=>{var Fe=ja();Ie(Fe,5,()=>(r(p),_(()=>r(p).content)),je,(Y,he)=>{var _e=Ba(),q=w(_e);V(()=>H(q,r(he))),S(Y,_e)}),S(we,Fe)};I(Te,we=>{r(p),_(()=>r(p).type==="ordered-list")&&we(J)},!0)}S(Ae,ke)};I(le,Ae=>{r(p),_(()=>r(p).type==="unordered-list")?Ae(Oe):Ae(fe,!1)},!0)}S(re,Q)};I(E,re=>{r(p),_(()=>r(p).type==="paragraph")?re(D):re(ie,!1)})}S(g,h)}),S(j,O)},R=j=>{var O=Ga();S(j,O)};I($,j=>{r(f),_(()=>r(f)&&r(f).length)?j(A):j(R,!1)})}S(M,U)};I(T,M=>{r(l)==="lists"&&M(F)},!0)}S(b,x)};I(v,b=>{r(l)==="plain"?b(k):b(N,!1)})}S(e,d),ot(),i()}var Ha=z('<li class="item svelte-fr86xg"><a class="link sprig-link svelte-fr86xg"><span class="name svelte-fr86xg"> </span> <span class="kind svelte-fr86xg"> </span></a></li>'),Wa=z('<ul class="list svelte-fr86xg"></ul>'),Ka=z('<p class="empty svelte-fr86xg">No contents yet.</p>'),Va=z('<div class="card svelte-fr86xg"><div class="title svelte-fr86xg"> </div> <!></div>');function zn(e,t){it(t,!1);const n=K();let s=tt(t,"children",24,()=>[]),i=tt(t,"currentNode",8,null),o=tt(t,"title",8,null);Z(()=>(W(o()),W(i()),W(s()),G),()=>{var d;C(n,o()!==null?o():((d=i())==null?void 0:d.kind)==="book"&&s().length>0?`Contents (Chapters in ${G(i())})`:"Contents")}),Bt(),ht();var l=Va(),a=w(l),f=w(a),u=L(a,2);{var c=d=>{var v=Wa();Ie(v,5,s,je,(k,N)=>{var b=Ha(),x=w(b),T=w(x),F=w(T),M=L(T,2),U=w(M);V(($,A)=>{xe(x,"href",$),H(F,A),H(U,(r(N),_(()=>r(N).kind)))},[()=>(W(Be),r(N),_(()=>Be(r(N)))),()=>(W(G),r(N),_(()=>G(r(N))))]),S(k,b)}),S(d,v)},y=d=>{var v=Ka();S(d,v)};I(u,d=>{W(s()),_(()=>s().length>0)?d(c):d(y,!1)})}V(()=>H(f,r(n))),S(e,l),ot()}var Ya=z('<footer class="footer svelte-1ynevzn"><div class="left svelte-1ynevzn"><span class="label svelte-1ynevzn">Grounding</span> <span class="value svelte-1ynevzn">Coming soon</span></div> <div class="right svelte-1ynevzn"><span class="label svelte-1ynevzn">Nodes</span> <span class="value svelte-1ynevzn"> </span> <span class="dot svelte-1ynevzn">•</span> <span class="label svelte-1ynevzn">Relationships</span> <span class="value svelte-1ynevzn"> </span></div></footer>');function ar(e,t){it(t,!1);let n=tt(t,"graph",8,null);tt(t,"root",8,null);const s=c=>c?Object.keys(c).length:0;ht();var i=Ya(),o=L(w(i),2),l=L(w(o),2),a=w(l),f=L(l,6),u=w(f);V((c,y)=>{H(a,c),H(u,y)},[()=>(W(n()),_(()=>{var c;return s((c=n())==null?void 0:c.nodes)})),()=>(W(n()),_(()=>{var c;return s((c=n())==null?void 0:c.edges)}))]),S(e,i),ot()}var Za=z('<div class="other-series svelte-bpgxme"><!></div>'),Qa=z("<!> <!>",1),Xa=z('<!> <div class="grid svelte-bpgxme"><section class="narrative svelte-bpgxme"><!></section> <aside class="index svelte-bpgxme"><!></aside></div> <!>',1),Ja=z('<div class="loading svelte-bpgxme">Loading…</div>');function el(e,t){it(t,!1);const n=()=>be(nn,"$universeRootNode",a),s=()=>be(ma,"$rootAnthologies",a),i=()=>be(ya,"$rootUngroupedSeries",a),o=()=>be(ga,"$rootChildren",a),l=()=>be(Ne,"$universeGraph",a),[a,f]=tn();ht();var u=ye(),c=pe(u);{var y=v=>{var k=Xa(),N=pe(k);Pa(N,{get node(){return n()}});var b=L(N,2),x=w(b),T=w(x);Bn(T,{get textBlock(){return n().describe}});var F=L(x,2),M=w(F);{var U=R=>{var j=Qa(),O=pe(j);zn(O,{get children(){return s()},title:"Anthologies"});var g=L(O,2);{var p=h=>{var E=Za(),D=w(E);zn(D,{get children(){return i()},title:"Other series"}),S(h,E)};I(g,h=>{i().length>0&&h(p)})}S(R,j)},$=R=>{zn(R,{get children(){return o()},title:"Concepts in this universe"})};I(M,R=>{s().length>0?R(U):R($,!1)})}var A=L(b,2);ar(A,{get graph(){return l()},get root(){return n()}}),S(v,k)},d=v=>{var k=Ja();S(v,k)};I(c,v=>{n()?v(y):v(d,!1)})}S(e,u),ot(),f()}var tl=z('<p class="relationship-description svelte-1f5uo2k"> </p>'),nl=z('<li class="relationship-item svelte-1f5uo2k"><a class="relationship-link sprig-link svelte-1f5uo2k"><span class="relationship-label svelte-1f5uo2k"> </span> <span class="relationship-separator svelte-1f5uo2k"><i class="fas fa-arrow-right" aria-hidden="true"></i></span> <span class="relationship-name svelte-1f5uo2k"> </span> <span class="relationship-kind svelte-1f5uo2k"> </span></a> <!></li>'),rl=z('<section class="relationships svelte-1f5uo2k"><h2 class="relationships-title svelte-1f5uo2k">Relationships</h2> <ul class="relationships-list svelte-1f5uo2k"></ul></section>'),sl=z('<a class="reference-repo-pill sprig-link svelte-1f5uo2k" target="_blank" rel="noopener noreferrer"> </a>'),il=z('<span class="reference-kind svelte-1f5uo2k"> </span>'),ol=z('<div class="reference-row svelte-1f5uo2k"><a class="reference-path-link sprig-link svelte-1f5uo2k" target="_blank" rel="noopener noreferrer"> </a> <!></div>'),al=z('<span class="reference-kind svelte-1f5uo2k"> </span>'),ll=z('<li class="reference-links-item svelte-1f5uo2k"><div class="reference-row svelte-1f5uo2k"><a class="reference-path-link sprig-link svelte-1f5uo2k" target="_blank" rel="noopener noreferrer"> </a> <!></div></li>'),fl=z('<ul class="reference-links-list svelte-1f5uo2k"></ul>'),ul=z('<p class="reference-description svelte-1f5uo2k"> </p>'),cl=z('<p class="reference-note svelte-1f5uo2k"> </p>'),vl=z('<li class="reference-group-item svelte-1f5uo2k"><!> <!> <!></li>'),dl=z('<li class="reference-item svelte-1f5uo2k"><!> <ul class="reference-group-list svelte-1f5uo2k"></ul></li>'),pl=z('<section class="references svelte-1f5uo2k"><h2 class="references-title svelte-1f5uo2k">References</h2> <p class="references-subtitle svelte-1f5uo2k">Where this concept appears in code and docs.</p> <ul class="reference-list svelte-1f5uo2k"></ul></section>'),hl=z('<!> <div class="grid svelte-1f5uo2k"><section class="narrative svelte-1f5uo2k"><!></section> <aside class="index svelte-1f5uo2k"><!></aside></div> <!> <!> <!>',1),_l=z('<div class="loading svelte-1f5uo2k">Loading…</div>');function gl(e,t){it(t,!1);const n=()=>be(bi,"$currentSeries",a),s=()=>be(Ne,"$universeGraph",a),i=()=>be(nn,"$universeRootNode",a),o=()=>be(ba,"$seriesChildren",a),l=()=>be(wa,"$seriesRelationships",a),[a,f]=tn(),u=K(),c=K(),y=K(),d=K();let v=tt(t,"params",8);function k($,A){return A&&A.trim().length>0?A:$}function N($){var A;return!$.repositoryRef||!((A=s())!=null&&A.repositories)?null:s().repositories[$.repositoryRef]||null}function b($,A){if(!(A!=null&&A.parent)||!$)return null;const R=$.nodes[A.parent];return(R==null?void 0:R.kind)==="anthology"?R:null}function x($,A){if(!A||!$)return null;if(A.kind==="series")return b($,A);let R=A.parent;for(;R;){const j=$.nodes[R];if(!j)break;if(j.kind==="series")return b($,j);R=j.parent}return null}Z(()=>(W(v()),Ot),()=>{const $=`${v().universe}:series:${v().series}`;is.set($),Ot.set(v().universe)}),Z(()=>(n(),s(),i(),W(v()),Be),()=>{C(u,(()=>{if(!n()||!s())return i()?`A series in <a href="/">${G(i())||v().universe}</a>`:`A series in ${v().universe}`;const $=n().parent;if($){const A=s().nodes[$];if(A&&A.kind==="anthology"){const R=Be(A),j=G(A),O=i()?`<a href="/">${G(i())||v().universe}</a>`:v().universe;return`A series in <a href="${R}">${j}</a> (in ${O})`}}return i()?`A series in <a href="/">${G(i())||v().universe}</a>`:`A series in ${v().universe}`})())}),Z(()=>(n(),s()),()=>{var $;C(c,((($=n())==null?void 0:$.references)||[]).map(A=>{var R,j;return(j=(R=s())==null?void 0:R.references)==null?void 0:j[A]}).filter(Boolean))}),Z(()=>r(c),()=>{C(y,(()=>{const $=[],A=new Map;for(const R of r(c))if(R)if(R.repositoryRef){let j=A.get(R.repositoryRef);j||(j={repo:N(R),refs:[]},A.set(R.repositoryRef,j),$.push(j)),j.refs.push(R)}else $.push({repo:null,refs:[R]});return $})())}),Z(()=>(n(),s()),()=>{C(d,n()&&s()?b(s(),n()):null)}),Bt(),ht();var T=ye(),F=pe(T);{var M=$=>{var A=hl(),R=pe(A);{let fe=de(()=>(W(G),n(),_(()=>G(n()))));or(R,{get title(){return r(fe)},get subtitle(){return r(u)}})}var j=L(R,2),O=w(j),g=w(O);{var p=fe=>{Bn(fe,{get textBlock(){return n(),_(()=>n().describe)}})};I(g,fe=>{n(),_(()=>n().describe)&&fe(p)})}var h=L(O,2),E=w(h);zn(E,{get children(){return o()}});var D=L(j,2);{var ie=fe=>{var Ae=rl(),ke=L(w(Ae),2);Ie(ke,5,l,je,(Te,J)=>{const we=de(()=>(s(),r(J),_(()=>s()?x(s(),r(J).otherNode):null))),Fe=de(()=>(W(r(we)),r(d),_(()=>r(we)&&(!r(d)||r(d).id!==r(we).id)))),Y=de(()=>(W(r(Fe)),W(G),r(J),W(r(we)),_(()=>r(Fe)?`${G(r(J).otherNode)} (${G(r(we))})`:G(r(J).otherNode))));var he=nl(),_e=w(he),q=w(_e),P=w(q),ue=L(q,4),Re=w(ue),qe=L(ue,2),Ye=w(qe),Ee=L(_e,2);{var B=oe=>{var ve=tl(),Ge=w(ve);V(()=>H(Ge,(r(J),_(()=>r(J).desc)))),S(oe,ve)};I(Ee,oe=>{r(J),_(()=>r(J).desc)&&oe(B)})}V(oe=>{xe(_e,"href",oe),H(P,(r(J),_(()=>r(J).label))),H(Re,r(Y)),H(Ye,(r(J),_(()=>r(J).otherNode.kind)))},[()=>(W(Be),r(J),_(()=>Be(r(J).otherNode)))]),S(Te,he)}),S(fe,Ae)};I(D,fe=>{l(),_(()=>l().length>0)&&fe(ie)})}var re=L(D,2);{var Q=fe=>{var Ae=pl(),ke=L(w(Ae),4);Ie(ke,5,()=>r(y),je,(Te,J)=>{var we=dl(),Fe=w(we);{var Y=_e=>{var q=sl(),P=w(q);V(()=>{xe(q,"href",(r(J),_(()=>r(J).repo.url))),H(P,(r(J),_(()=>r(J).repo.title||r(J).repo.name)))}),S(_e,q)};I(Fe,_e=>{r(J),_(()=>r(J).repo)&&_e(Y)})}var he=L(Fe,2);Ie(he,5,()=>(r(J),_(()=>r(J).refs)),je,(_e,q)=>{var P=vl(),ue=w(P);{var Re=oe=>{var ve=ye(),Ge=pe(ve);{var kt=Ue=>{const at=de(()=>(r(q),_(()=>{var He;return k(r(q).urls[0],(He=r(q).paths)==null?void 0:He[0])})));var ge=ol(),ce=w(ge),se=w(ce),Se=L(ce,2);{var Qe=He=>{var _t=il(),jt=w(_t);V(()=>H(jt,(r(q),_(()=>r(q).kind)))),S(He,_t)};I(Se,He=>{r(q),_(()=>r(q).kind)&&He(Qe)})}V(()=>{xe(ce,"href",(r(q),_(()=>r(q).urls[0]))),H(se,r(at))}),S(Ue,ge)},Ze=Ue=>{var at=fl();Ie(at,5,()=>(r(q),_(()=>r(q).urls)),je,(ge,ce,se)=>{const Se=de(()=>(r(ce),r(q),_(()=>{var wt;return k(r(ce),(wt=r(q).paths)==null?void 0:wt[se])})));var Qe=ll(),He=w(Qe),_t=w(He),jt=w(_t),Ct=L(_t,2);{var bn=wt=>{var rn=al(),Et=w(rn);V(()=>H(Et,(r(q),_(()=>r(q).kind)))),S(wt,rn)};I(Ct,wt=>{r(q),_(()=>r(q).kind&&se===0)&&wt(bn)})}V(()=>{xe(_t,"href",r(ce)),H(jt,r(Se))}),S(ge,Qe)}),S(Ue,at)};I(Ge,Ue=>{r(q),_(()=>r(q).urls.length===1)?Ue(kt):Ue(Ze,!1)})}S(oe,ve)};I(ue,oe=>{r(q),_(()=>r(q).urls&&r(q).urls.length>0)&&oe(Re)})}var qe=L(ue,2);{var Ye=oe=>{var ve=ul(),Ge=w(ve);V(()=>H(Ge,(r(q),_(()=>r(q).describe.normalized)))),S(oe,ve)};I(qe,oe=>{r(q),_(()=>{var ve;return(ve=r(q).describe)==null?void 0:ve.normalized})&&oe(Ye)})}var Ee=L(qe,2);{var B=oe=>{var ve=cl(),Ge=w(ve);V(()=>H(Ge,(r(q),_(()=>r(q).note.normalized)))),S(oe,ve)};I(Ee,oe=>{r(q),_(()=>{var ve;return(ve=r(q).note)==null?void 0:ve.normalized})&&oe(B)})}S(_e,P)}),S(Te,we)}),S(fe,Ae)};I(re,fe=>{r(c),_(()=>r(c).length>0)&&fe(Q)})}var le=L(re,2);{var Oe=fe=>{ar(fe,{get graph(){return s()},get root(){return i()}})};I(le,fe=>{s()&&i()&&fe(Oe)})}S($,A)},U=$=>{var A=_l();S($,A)};I(F,$=>{n()?$(M):$(U,!1)})}S(e,T),ot(),f()}var ml=z('<!> <div class="grid svelte-10bbj5c"><section class="narrative svelte-10bbj5c"><!></section> <aside class="index svelte-10bbj5c"><!></aside></div> <!>',1),yl=z('<div class="loading svelte-10bbj5c">Loading…</div>');function bl(e,t){it(t,!1);const n=()=>be(nn,"$universeRootNode",l),s=()=>be(wi,"$currentAnthology",l),i=()=>be(ka,"$anthologySeries",l),o=()=>be(Ne,"$universeGraph",l),[l,a]=tn(),f=K();let u=tt(t,"params",8);Z(()=>(W(u()),Ot),()=>{const k=`${u().universe}:anthology:${u().anthology}`;ki.set(k),Ot.set(u().universe)}),Z(()=>(n(),W(u())),()=>{C(f,n()?`An anthology in <a href="/">${G(n())||u().universe}</a>`:`An anthology in ${u().universe}`)}),Bt(),ht();var c=ye(),y=pe(c);{var d=k=>{var N=ml(),b=pe(N);{let R=de(()=>(W(G),s(),_(()=>G(s()))));or(b,{get title(){return r(R)},get subtitle(){return r(f)}})}var x=L(b,2),T=w(x),F=w(T);{var M=R=>{Bn(R,{get textBlock(){return s(),_(()=>s().describe)}})};I(F,R=>{s(),_(()=>s().describe)&&R(M)})}var U=L(T,2),$=w(U);zn($,{get children(){return i()}});var A=L(x,2);ar(A,{get graph(){return o()},get root(){return n()}}),S(k,N)},v=k=>{var N=yl();S(k,N)};I(y,k=>{s()?k(d):k(v,!1)})}S(e,c),ot(),a()}var kl=z('<aside class="index svelte-9edgfz"><!></aside>'),wl=z('<li class="chapter-navigation-item svelte-9edgfz"><a class="chapter-navigation-link sprig-link svelte-9edgfz"> </a></li>'),El=z('<section class="chapter-navigation svelte-9edgfz"><h2 class="chapter-navigation-title svelte-9edgfz">In this book</h2> <ul class="chapter-navigation-list svelte-9edgfz"></ul></section>'),Sl=z('<p class="relationship-description svelte-9edgfz"> </p>'),xl=z('<li class="relationship-item svelte-9edgfz"><a class="relationship-link sprig-link svelte-9edgfz"><span class="relationship-label svelte-9edgfz"> </span> <span class="relationship-separator svelte-9edgfz"><i class="fas fa-arrow-right" aria-hidden="true"></i></span> <span class="relationship-name svelte-9edgfz"> </span> <span class="relationship-kind svelte-9edgfz"> </span></a> <!></li>'),$l=z('<section class="relationships svelte-9edgfz"><h2 class="relationships-title svelte-9edgfz">Relationships</h2> <ul class="relationships-list svelte-9edgfz"></ul></section>'),Al=z('<a class="reference-repo-pill sprig-link svelte-9edgfz" target="_blank" rel="noopener noreferrer"> </a>'),Rl=z('<span class="reference-kind svelte-9edgfz"> </span>'),zl=z('<div class="reference-row svelte-9edgfz"><a class="reference-path-link sprig-link svelte-9edgfz" target="_blank" rel="noopener noreferrer"> </a> <!></div>'),Nl=z('<span class="reference-kind svelte-9edgfz"> </span>'),Tl=z('<li class="reference-links-item svelte-9edgfz"><div class="reference-row svelte-9edgfz"><a class="reference-path-link sprig-link svelte-9edgfz" target="_blank" rel="noopener noreferrer"> </a> <!></div></li>'),Cl=z('<ul class="reference-links-list svelte-9edgfz"></ul>'),Ll=z('<p class="reference-description svelte-9edgfz"> </p>'),Pl=z('<p class="reference-note svelte-9edgfz"> </p>'),Il=z('<li class="reference-group-item svelte-9edgfz"><!> <!> <!></li>'),Ml=z('<li class="reference-item svelte-9edgfz"><!> <ul class="reference-group-list svelte-9edgfz"></ul></li>'),Dl=z('<section class="references svelte-9edgfz"><h2 class="references-title svelte-9edgfz">References</h2> <p class="references-subtitle svelte-9edgfz">Where this concept appears in code and docs.</p> <ul class="reference-list svelte-9edgfz"></ul></section>'),Ol=z('<span class="documentation-kind svelte-9edgfz"> </span>'),Fl=z('<p class="documentation-path svelte-9edgfz"> </p>'),Ul=z('<p class="documentation-description svelte-9edgfz"> </p>'),Bl=z('<li class="documentation-item svelte-9edgfz"><a class="documentation-link sprig-link svelte-9edgfz"><span class="documentation-title-text svelte-9edgfz"> </span> <!></a> <!> <!></li>'),jl=z('<section class="documentation svelte-9edgfz"><h2 class="documentation-title svelte-9edgfz">Documentation</h2> <p class="documentation-subtitle svelte-9edgfz">Additional documentation for this concept.</p> <ul class="documentation-list svelte-9edgfz"></ul></section>'),ql=z('<!> <div class="grid svelte-9edgfz"><section class="narrative svelte-9edgfz"><!></section> <!></div> <!> <!> <!> <!> <!>',1),Gl=z('<div class="loading svelte-9edgfz">Loading…</div>');function Hl(e,t){it(t,!1);const n=()=>be(Ne,"$universeGraph",i),s=()=>be(nn,"$universeRootNode",i),[i,o]=tn(),l=K(),a=K(),f=K(),u=K(),c=K(),y=K(),d=K(),v=K(),k=K(),N=K(),b=K(),x=K();let T=tt(t,"params",8);function F(g,p){if(!(p!=null&&p.parent)||!g)return null;const h=g.nodes[p.parent];return(h==null?void 0:h.kind)==="anthology"?h:null}function M(g,p){if(!p||!g)return null;if(p.kind==="series")return F(g,p);let h=p.parent;for(;h;){const E=g.nodes[h];if(!E)break;if(E.kind==="series")return F(g,E);h=E.parent}return null}function U(g,p){return p&&p.trim().length>0?p:g}function $(g){var p;return!g.repositoryRef||!((p=n())!=null&&p.repositories)?null:n().repositories[g.repositoryRef]||null}Z(()=>W(T()),()=>{Ot.set(T().universe)}),Z(()=>W(T()),()=>{C(l,decodeURIComponent(T().id))}),Z(()=>(n(),r(l)),()=>{var g;C(a,(g=n())==null?void 0:g.nodes[r(l)])}),Z(()=>(r(a),n()),()=>{var g,p;C(f,((p=(g=r(a))==null?void 0:g.children)==null?void 0:p.map(h=>{var E;return(E=n())==null?void 0:E.nodes[h]}).filter(Boolean))||[])}),Z(()=>(r(a),n(),r(l)),()=>{C(u,r(a)?Ei(n(),r(l)):[])}),Z(()=>(r(a),n()),()=>{C(c,r(a)?Gr(n(),r(a)):[])}),Z(()=>r(a),()=>{C(y,r(a)&&(r(a).kind==="book"||r(a).kind==="chapter"||r(a).kind==="concept"&&r(a).parent))}),Z(()=>r(a),()=>{var g;C(d,((g=r(a))==null?void 0:g.documentation)||[])}),Z(()=>(r(a),n()),()=>{C(v,r(a)&&n()?M(n(),r(a)):null)}),Z(()=>(r(a),n(),r(c)),()=>{C(k,(()=>{if(!r(a)||r(a).kind!=="chapter"||!n())return[];const g=r(c)[0];return!g||g.kind!=="book"?[]:(g.children||[]).map(p=>n().nodes[p]).filter(Boolean).filter(p=>p.kind==="chapter"&&p.id!==r(a).id)})())}),Z(()=>(r(a),n()),()=>{var g;C(N,(((g=r(a))==null?void 0:g.references)||[]).map(p=>{var h,E;return(E=(h=n())==null?void 0:h.references)==null?void 0:E[p]}).filter(Boolean))}),Z(()=>r(N),()=>{C(b,(()=>{const g=[],p=new Map;for(const h of r(N))if(h)if(h.repositoryRef){let E=p.get(h.repositoryRef);E||(E={repo:$(h),refs:[]},p.set(h.repositoryRef,E),g.push(E)),E.refs.push(h)}else g.push({repo:null,refs:[h]});return g})())}),Z(()=>(r(y),r(a),r(c),n(),W(T())),()=>{C(x,(()=>{if(r(y)){if(r(a).kind==="book"&&r(c)[0]){const g=r(c)[0];return`A book in the <a href="${Be(g)}">${G(g)}</a> series`}else if(r(a).kind==="chapter"&&r(c)[0]&&r(c)[1]){const g=r(c)[0],p=r(c)[1],h=Be(g),E=Be(p);return`A chapter in <a href="${h}">${G(g)}</a>, within the <a href="${E}">${G(p)}</a> series`}else if(r(a).kind==="concept"&&r(a).parent&&n()){const g=n().nodes[r(a).parent];if(g){const p=Be(g),h=G(g);if(g.kind==="book"&&r(c).length>0){const E=r(c).find(D=>D.kind==="series");if(E){const D=Be(E);return`A concept in <a href="${p}">${h}</a>, within the <a href="${D}">${G(E)}</a> series`}else return`A concept in <a href="${p}">${h}</a>`}else return g.kind==="series"?`A concept in the <a href="${p}">${h}</a> series`:g.kind==="anthology"?`A concept in <a href="${p}">${h}</a>`:`A concept in <a href="${p}">${h}</a>`}}return`${r(a).kind} in ${T().universe}`}else return r(a).kind==="concept"?`A concept in ${T().universe}`:`${r(a).kind} in ${T().universe}`})())}),Bt(),ht();var A=ye(),R=pe(A);{var j=g=>{var p=ql(),h=pe(p);{let Y=de(()=>(W(G),r(a),_(()=>G(r(a)))));or(h,{get title(){return r(Y)},get subtitle(){return r(x)}})}var E=L(h,2),D=w(E),ie=w(D);Bn(ie,{get textBlock(){return r(a),_(()=>r(a).describe)}});var re=L(D,2);{var Q=Y=>{var he=kl(),_e=w(he);zn(_e,{get children(){return r(f)},get currentNode(){return r(a)}}),S(Y,he)};I(re,Y=>{r(f),_(()=>r(f).length>0)&&Y(Q)})}var le=L(E,2);{var Oe=Y=>{var he=El(),_e=L(w(he),2);Ie(_e,5,()=>r(k),je,(q,P)=>{var ue=wl(),Re=w(ue),qe=w(Re);V((Ye,Ee)=>{xe(Re,"href",Ye),H(qe,Ee)},[()=>(W(Be),r(P),_(()=>Be(r(P)))),()=>(W(G),r(P),_(()=>G(r(P))))]),S(q,ue)}),S(Y,he)};I(le,Y=>{r(a),r(k),_(()=>r(a).kind==="chapter"&&r(k).length>0)&&Y(Oe)})}var fe=L(le,2);{var Ae=Y=>{var he=$l(),_e=L(w(he),2);Ie(_e,5,()=>r(u),je,(q,P)=>{const ue=de(()=>(n(),r(P),_(()=>n()?M(n(),r(P).otherNode):null))),Re=de(()=>(W(r(ue)),r(v),_(()=>r(ue)&&(!r(v)||r(v).id!==r(ue).id)))),qe=de(()=>(W(r(Re)),W(G),r(P),W(r(ue)),_(()=>r(Re)?`${G(r(P).otherNode)} (${G(r(ue))})`:G(r(P).otherNode))));var Ye=xl(),Ee=w(Ye),B=w(Ee),oe=w(B),ve=L(B,4),Ge=w(ve),kt=L(ve,2),Ze=w(kt),Ue=L(Ee,2);{var at=ge=>{var ce=Sl(),se=w(ce);V(()=>H(se,(r(P),_(()=>r(P).desc)))),S(ge,ce)};I(Ue,ge=>{r(P),_(()=>r(P).desc)&&ge(at)})}V(ge=>{xe(Ee,"href",ge),H(oe,(r(P),_(()=>r(P).label))),H(Ge,r(qe)),H(Ze,(r(P),_(()=>r(P).otherNode.kind)))},[()=>(W(Be),r(P),_(()=>Be(r(P).otherNode)))]),S(q,Ye)}),S(Y,he)};I(fe,Y=>{r(u),_(()=>r(u).length>0)&&Y(Ae)})}var ke=L(fe,2);{var Te=Y=>{var he=Dl(),_e=L(w(he),4);Ie(_e,5,()=>r(b),je,(q,P)=>{var ue=Ml(),Re=w(ue);{var qe=Ee=>{var B=Al(),oe=w(B);V(()=>{xe(B,"href",(r(P),_(()=>r(P).repo.url))),H(oe,(r(P),_(()=>r(P).repo.title||r(P).repo.name)))}),S(Ee,B)};I(Re,Ee=>{r(P),_(()=>r(P).repo)&&Ee(qe)})}var Ye=L(Re,2);Ie(Ye,5,()=>(r(P),_(()=>r(P).refs)),je,(Ee,B)=>{var oe=Il(),ve=w(oe);{var Ge=ge=>{var ce=ye(),se=pe(ce);{var Se=He=>{const _t=de(()=>(r(B),_(()=>{var Et;return U(r(B).urls[0],(Et=r(B).paths)==null?void 0:Et[0])})));var jt=zl(),Ct=w(jt),bn=w(Ct),wt=L(Ct,2);{var rn=Et=>{var kn=Rl(),Ar=w(kn);V(()=>H(Ar,(r(B),_(()=>r(B).kind)))),S(Et,kn)};I(wt,Et=>{r(B),_(()=>r(B).kind)&&Et(rn)})}V(()=>{xe(Ct,"href",(r(B),_(()=>r(B).urls[0]))),H(bn,r(_t))}),S(He,jt)},Qe=He=>{var _t=Cl();Ie(_t,5,()=>(r(B),_(()=>r(B).urls)),je,(jt,Ct,bn)=>{const wt=de(()=>(r(Ct),r(B),_(()=>{var wn;return U(r(Ct),(wn=r(B).paths)==null?void 0:wn[bn])})));var rn=Tl(),Et=w(rn),kn=w(Et),Ar=w(kn),Ai=L(kn,2);{var Ri=wn=>{var os=Nl(),zi=w(os);V(()=>H(zi,(r(B),_(()=>r(B).kind)))),S(wn,os)};I(Ai,wn=>{r(B),_(()=>r(B).kind&&bn===0)&&wn(Ri)})}V(()=>{xe(kn,"href",r(Ct)),H(Ar,r(wt))}),S(jt,rn)}),S(He,_t)};I(se,He=>{r(B),_(()=>r(B).urls.length===1)?He(Se):He(Qe,!1)})}S(ge,ce)};I(ve,ge=>{r(B),_(()=>r(B).urls&&r(B).urls.length>0)&&ge(Ge)})}var kt=L(ve,2);{var Ze=ge=>{var ce=Ll(),se=w(ce);V(()=>H(se,(r(B),_(()=>r(B).describe.normalized)))),S(ge,ce)};I(kt,ge=>{r(B),_(()=>{var ce;return(ce=r(B).describe)==null?void 0:ce.normalized})&&ge(Ze)})}var Ue=L(kt,2);{var at=ge=>{var ce=Pl(),se=w(ce);V(()=>H(se,(r(B),_(()=>r(B).note.normalized)))),S(ge,ce)};I(Ue,ge=>{r(B),_(()=>{var ce;return(ce=r(B).note)==null?void 0:ce.normalized})&&ge(at)})}S(Ee,oe)}),S(q,ue)}),S(Y,he)};I(ke,Y=>{r(N),_(()=>r(N).length>0)&&Y(Te)})}var J=L(ke,2);{var we=Y=>{var he=jl(),_e=L(w(he),4);Ie(_e,5,()=>r(d),je,(q,P)=>{const ue=de(()=>(r(P),_(()=>r(P).path.startsWith("/")?r(P).path.slice(1):r(P).path))),Re=de(()=>(W(r(ue)),_(()=>r(ue).startsWith("docs/")?r(ue).slice(5):r(ue)))),qe=de(()=>(W(r(Re)),_(()=>r(Re).split("/").map(se=>encodeURIComponent(se))))),Ye=de(()=>(W(T()),W(r(qe)),_(()=>`/universes/${T().universe}/docs/${r(qe).join("/")}`))),Ee=de(()=>(r(P),_(()=>r(P).title||r(P).path.split("/").pop()||r(P).path)));var B=Bl(),oe=w(B),ve=w(oe),Ge=w(ve),kt=L(ve,2);{var Ze=se=>{var Se=Ol(),Qe=w(Se);V(()=>H(Qe,(r(P),_(()=>r(P).kind)))),S(se,Se)};I(kt,se=>{r(P),_(()=>r(P).kind)&&se(Ze)})}var Ue=L(oe,2);{var at=se=>{var Se=Fl(),Qe=w(Se);V(()=>H(Qe,(r(P),_(()=>r(P).path)))),S(se,Se)};I(Ue,se=>{r(P),W(r(Ee)),_(()=>r(P).path!==r(Ee))&&se(at)})}var ge=L(Ue,2);{var ce=se=>{var Se=Ul(),Qe=w(Se);V(()=>H(Qe,(r(P),_(()=>r(P).describe.normalized)))),S(se,Se)};I(ge,se=>{r(P),_(()=>{var Se;return(Se=r(P).describe)==null?void 0:Se.normalized})&&se(ce)})}V(()=>{xe(oe,"href",r(Ye)),H(Ge,r(Ee))}),S(q,B)}),S(Y,he)};I(J,Y=>{r(d),_(()=>r(d).length>0)&&Y(we)})}var Fe=L(J,2);ar(Fe,{get graph(){return n()},get root(){return s()}}),S(g,p)},O=g=>{var p=Gl();S(g,p)};I(R,g=>{r(a)?g(j):g(O,!1)})}S(e,A),ot(),o()}var Wl=z('<section class="reference-section svelte-1gel1uo"><h2 class="reference-section-title svelte-1gel1uo">Note</h2> <!></section>'),Kl=z('<a class="reference-link sprig-link svelte-1gel1uo" target="_blank" rel="noopener noreferrer"> </a>'),Vl=z('<li class="reference-links-item svelte-1gel1uo"><a class="reference-link sprig-link svelte-1gel1uo" target="_blank" rel="noopener noreferrer"> </a></li>'),Yl=z('<ul class="reference-links-list svelte-1gel1uo"></ul>'),Zl=z('<!> <section class="reference-section svelte-1gel1uo"><!></section> <!> <section class="reference-section svelte-1gel1uo"><h2 class="reference-section-title svelte-1gel1uo">Links</h2> <!></section> <!>',1),Ql=z('<div class="loading svelte-1gel1uo">Reference not found.</div>');function Xl(e,t){it(t,!1);const n=()=>be(Ne,"$universeGraph",i),s=()=>be(nn,"$universeRootNode",i),[i,o]=tn(),l=K(),a=K();let f=tt(t,"params",8);function u(k,N){return N&&N.trim().length>0?N:k}Z(()=>W(f()),()=>{Ot.set(f().universe)}),Z(()=>W(f()),()=>{C(l,decodeURIComponent(f().id))}),Z(()=>(n(),r(l)),()=>{var k,N;C(a,(N=(k=n())==null?void 0:k.references)==null?void 0:N[r(l)])}),Bt(),ht();var c=ye(),y=pe(c);{var d=k=>{const N=de(()=>(r(a),_(()=>r(a).title||r(a).name)));var b=Zl(),x=pe(b);{let p=de(()=>(r(a),_(()=>r(a).kind||"")));or(x,{get title(){return r(N)},get subtitle(){return r(p)}})}var T=L(x,2),F=w(T);{var M=p=>{Bn(p,{get textBlock(){return r(a),_(()=>r(a).describe)}})};I(F,p=>{r(a),_(()=>r(a).describe)&&p(M)})}var U=L(T,2);{var $=p=>{var h=Wl(),E=L(w(h),2);Bn(E,{get textBlock(){return r(a),_(()=>r(a).note)}}),S(p,h)};I(U,p=>{r(a),_(()=>r(a).note)&&p($)})}var A=L(U,2),R=L(w(A),2);{var j=p=>{const h=de(()=>(r(a),_(()=>{var ie;return u(r(a).urls[0],(ie=r(a).paths)==null?void 0:ie[0])})));var E=Kl(),D=w(E);V(()=>{xe(E,"href",(r(a),_(()=>r(a).urls[0]))),H(D,r(h))}),S(p,E)},O=p=>{var h=Yl();Ie(h,5,()=>(r(a),_(()=>r(a).urls)),je,(E,D,ie)=>{const re=de(()=>(r(D),r(a),_(()=>{var fe;return u(r(D),(fe=r(a).paths)==null?void 0:fe[ie])})));var Q=Vl(),le=w(Q),Oe=w(le);V(()=>{xe(le,"href",r(D)),H(Oe,r(re))}),S(E,Q)}),S(p,h)};I(R,p=>{r(a),_(()=>r(a).urls.length===1)?p(j):p(O,!1)})}var g=L(A,2);ar(g,{get graph(){return n()},get root(){return s()}}),S(k,b)},v=k=>{var N=Ql();S(k,N)};I(y,k=>{r(a)?k(d):k(v,!1)})}S(e,c),ot(),o()}var Jl=z('<div class="loading svelte-1n46o8q">Loading…</div>'),ef=z('<div class="error svelte-1n46o8q"> </div>'),tf=z('<div class="error svelte-1n46o8q"> </div>'),nf=z('<div class="error svelte-1n46o8q">Invalid route</div>'),rf=z('<div class="app sprig-design svelte-1n46o8q"><div class="page svelte-1n46o8q"><div class="top-bar svelte-1n46o8q"><!> <button class="theme-toggle svelte-1n46o8q" type="button" aria-label="Toggle theme"> </button></div> <main class="main-content svelte-1n46o8q"><!></main></div></div>');function sf(e,t){it(t,!1);const n=()=>be(Ne,"$universeGraph",i),s=()=>be(Yt,"$theme",i),[i,o]=tn(),l=K(),a=K(),f=K(),u=K(),c=K();let y=K(!0),d=K(null),v=K(xs());function k(){Yt.update(h=>h==="light"?"dark":h==="dark"?"auto":"light")}async function N(){try{C(y,!0),C(d,null);const{describeRenderMode:h}=await Ea("/api/manifest");(h==="lists"||h==="plain")&&xi.set(h)}catch(h){const E=h instanceof Error?h.message:"Failed to load manifest";C(d,E),console.error("Error loading manifest:",h)}finally{C(y,!1)}}function b(){C(v,xs())}function x(h){if(!(h.target instanceof HTMLElement))return;const E=h.target.closest("a");if(!E)return;const D=E.getAttribute("href");D&&(D.startsWith("http://")||D.startsWith("https://")||D.startsWith("mailto:")||D.startsWith("#")||(D.startsWith("/")||!D.includes("://"))&&(h.preventDefault(),Si(D),b()))}window.addEventListener("popstate",b),document.addEventListener("click",x);let T=null;ns(()=>{if(typeof EventSource<"u")try{T=new EventSource("/api/events"),console.log("SSE EventSource created"),T.addEventListener("manifest",async h=>{console.log("SSE manifest event received:",h.data),await N()}),T.addEventListener("open",()=>{console.log("SSE connection opened")}),T.addEventListener("error",h=>{T&&T.readyState===EventSource.CLOSED?console.log("SSE connection closed"):T&&T.readyState===EventSource.CONNECTING&&console.log("SSE reconnecting...")})}catch(h){console.error("Failed to create EventSource:",h)}N()}),mi(()=>{T&&(T.close(),console.log("SSE EventSource closed"))}),Z(()=>r(v),()=>{var h;C(l,((h=r(v))==null?void 0:h.route)==="series"?r(v).params:null)}),Z(()=>r(v),()=>{var h;C(a,((h=r(v))==null?void 0:h.route)==="anthology"?r(v).params:null)}),Z(()=>r(v),()=>{var h;C(f,((h=r(v))==null?void 0:h.route)==="concept"?r(v).params:null)}),Z(()=>r(v),()=>{var h;C(u,((h=r(v))==null?void 0:h.route)==="reference"?r(v).params:null)}),Z(()=>(n(),r(v),Ss),()=>{var h;n()&&((h=r(v))==null?void 0:h.route)==="home"&&Ss(n())}),Z(()=>s(),()=>{C(c,s()==="auto"?"Auto":s()==="dark"?"Light":"Dark")}),Bt(),ht();var F=rf(),M=w(F),U=w(M),$=w(U);Na($,{});var A=L($,2),R=w(A),j=L(U,2),O=w(j);{var g=h=>{var E=Jl();S(h,E)},p=h=>{var E=ye(),D=pe(E);{var ie=Q=>{var le=ef(),Oe=w(le);V(()=>H(Oe,`Error: ${r(d)??""}`)),S(Q,le)},re=Q=>{var le=ye(),Oe=pe(le);{var fe=ke=>{var Te=ye(),J=pe(Te);{var we=Y=>{el(Y,{})},Fe=Y=>{var he=ye(),_e=pe(he);{var q=ue=>{gl(ue,{get params(){return r(l)}})},P=ue=>{var Re=ye(),qe=pe(Re);{var Ye=B=>{bl(B,{get params(){return r(a)}})},Ee=B=>{var oe=ye(),ve=pe(oe);{var Ge=Ze=>{Hl(Ze,{get params(){return r(f)}})},kt=Ze=>{var Ue=ye(),at=pe(Ue);{var ge=se=>{Xl(se,{get params(){return r(u)}})},ce=se=>{var Se=tf(),Qe=w(Se);V(()=>H(Qe,`Unknown route: ${r(v),_(()=>r(v).route)??""}`)),S(se,Se)};I(at,se=>{r(v),r(u),_(()=>r(v).route==="reference"&&r(u))?se(ge):se(ce,!1)},!0)}S(Ze,Ue)};I(ve,Ze=>{r(v),r(f),_(()=>r(v).route==="concept"&&r(f))?Ze(Ge):Ze(kt,!1)},!0)}S(B,oe)};I(qe,B=>{r(v),r(a),_(()=>r(v).route==="anthology"&&r(a))?B(Ye):B(Ee,!1)},!0)}S(ue,Re)};I(_e,ue=>{r(v),r(l),_(()=>r(v).route==="series"&&r(l))?ue(q):ue(P,!1)},!0)}S(Y,he)};I(J,Y=>{r(v),_(()=>r(v).route==="home")?Y(we):Y(Fe,!1)})}S(ke,Te)},Ae=ke=>{var Te=nf();S(ke,Te)};I(Oe,ke=>{r(v)?ke(fe):ke(Ae,!1)},!0)}S(Q,le)};I(D,Q=>{r(d)?Q(ie):Q(re,!1)},!0)}S(h,E)};I(O,h=>{r(y)?h(g):h(p,!1)})}V(()=>H(R,r(c))),dr("click",A,k),S(e,F),ot(),o()}const $i=document.getElementById("app");if(!$i)throw new Error("Target element #app not found");Wo(sf,{target:$i});async function of(){try{let d=function(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"},v=function(A){return A==="auto"?d():A},k=function(A){const j=v(A)==="dark"?y.dark:y.light;if(j){document.body.style.backgroundImage=`url(${j})`,document.body.style.backgroundRepeat="repeat",document.body.style.backgroundSize="1024px 1024px",document.body.style.backgroundAttachment="fixed";const O=document.querySelector(".top-bar");O&&(O.style.backgroundImage=`url(${j})`,O.style.backgroundRepeat="repeat",O.style.backgroundSize="1024px 1024px",O.style.backgroundAttachment="fixed",O.style.backgroundPosition="0 0")}},M=function(){typeof window>"u"||T||(T=window.matchMedia("(prefers-color-scheme: dark)"),F=()=>{x==="auto"&&k("auto")},T.addEventListener("change",F))},U=function(){T&&F&&(T.removeEventListener("change",F),T=null,F=null)};var e=d,t=v,n=k,s=M,i=U;const o=await Pi(()=>import("./index-B6I7oo2K.js"),[]),{generateTexture:l,releaseObjectUrl:a,sprigGrey:f,parchment:u,subtle:c}=o,y={light:null,dark:null},{url:N}=await l({key:"sprig-ui-csr-light",palette:u,preset:c});y.light=N;const{url:b}=await l({key:"sprig-ui-csr-dark",palette:f,preset:c});y.dark=b;let x=Zn(Yt),T=null,F=null;const $=Yt.subscribe(A=>{x=A,k(A),A==="auto"?M():U()});k(Zn(Yt)),Zn(Yt)==="auto"&&M(),window.__textureCleanup=()=>{$(),U(),y.light&&a(y.light),y.dark&&a(y.dark)}}catch(o){console.error("Failed to generate texture:",o)}}setTimeout(of,0);