olova 2.0.39 → 2.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +305 -12
- package/dist/client.d.ts +9 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +8 -0
- package/dist/client.js.map +1 -0
- package/dist/core/config.d.ts +179 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +33 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +7 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/types.d.ts +16 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/data/hooks.d.ts +5 -0
- package/dist/data/hooks.d.ts.map +1 -0
- package/dist/data/hooks.js +19 -0
- package/dist/data/hooks.js.map +1 -0
- package/dist/data/index.d.ts +9 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/index.js +9 -0
- package/dist/data/index.js.map +1 -0
- package/dist/data/provider.d.ts +10 -0
- package/dist/data/provider.d.ts.map +1 -0
- package/dist/data/provider.js +10 -0
- package/dist/data/provider.js.map +1 -0
- package/dist/data/serialize.d.ts +10 -0
- package/dist/data/serialize.d.ts.map +1 -0
- package/dist/data/serialize.js +16 -0
- package/dist/data/serialize.js.map +1 -0
- package/dist/data/types.d.ts +9 -0
- package/dist/data/types.d.ts.map +1 -0
- package/dist/data/types.js +2 -0
- package/dist/data/types.js.map +1 -0
- package/dist/head/Head.d.ts +8 -0
- package/dist/head/Head.d.ts.map +1 -0
- package/dist/head/Head.js +56 -0
- package/dist/head/Head.js.map +1 -0
- package/dist/head/HeadProvider.d.ts +31 -0
- package/dist/head/HeadProvider.d.ts.map +1 -0
- package/dist/head/HeadProvider.js +17 -0
- package/dist/head/HeadProvider.js.map +1 -0
- package/dist/head/index.d.ts +8 -0
- package/dist/head/index.d.ts.map +1 -0
- package/dist/head/index.js +8 -0
- package/dist/head/index.js.map +1 -0
- package/dist/head/ssr.d.ts +9 -0
- package/dist/head/ssr.d.ts.map +1 -0
- package/dist/head/ssr.js +35 -0
- package/dist/head/ssr.js.map +1 -0
- package/dist/hydration/context.d.ts +14 -0
- package/dist/hydration/context.d.ts.map +1 -0
- package/dist/hydration/context.js +20 -0
- package/dist/hydration/context.js.map +1 -0
- package/dist/hydration/index.d.ts +15 -0
- package/dist/hydration/index.d.ts.map +1 -0
- package/dist/hydration/index.js +25 -0
- package/dist/hydration/index.js.map +1 -0
- package/dist/hydration/payload.d.ts +46 -0
- package/dist/hydration/payload.d.ts.map +1 -0
- package/dist/hydration/payload.js +99 -0
- package/dist/hydration/payload.js.map +1 -0
- package/dist/hydration/scheduler.d.ts +16 -0
- package/dist/hydration/scheduler.d.ts.map +1 -0
- package/dist/hydration/scheduler.js +83 -0
- package/dist/hydration/scheduler.js.map +1 -0
- package/dist/hydration/seo.d.ts +10 -0
- package/dist/hydration/seo.d.ts.map +1 -0
- package/dist/hydration/seo.js +110 -0
- package/dist/hydration/seo.js.map +1 -0
- package/dist/hydration/serialization.d.ts +30 -0
- package/dist/hydration/serialization.d.ts.map +1 -0
- package/dist/hydration/serialization.js +99 -0
- package/dist/hydration/serialization.js.map +1 -0
- package/dist/hydration/types.d.ts +104 -0
- package/dist/hydration/types.d.ts.map +1 -0
- package/dist/hydration/types.js +2 -0
- package/dist/hydration/types.js.map +1 -0
- package/dist/index.d.ts +15 -84
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin/cache.d.ts +66 -0
- package/dist/plugin/cache.d.ts.map +1 -0
- package/dist/plugin/cache.js +129 -0
- package/dist/plugin/cache.js.map +1 -0
- package/dist/plugin/index.d.ts +8 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +8 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/plugin.d.ts +25 -0
- package/dist/plugin/plugin.d.ts.map +1 -0
- package/dist/plugin/plugin.js +601 -0
- package/dist/plugin/plugin.js.map +1 -0
- package/dist/router/Link.d.ts +7 -0
- package/dist/router/Link.d.ts.map +1 -0
- package/dist/router/Link.js +53 -0
- package/dist/router/Link.js.map +1 -0
- package/dist/router/Router.d.ts +7 -0
- package/dist/router/Router.d.ts.map +1 -0
- package/dist/router/Router.js +263 -0
- package/dist/router/Router.js.map +1 -0
- package/dist/router/context.d.ts +13 -0
- package/dist/router/context.d.ts.map +1 -0
- package/dist/router/context.js +47 -0
- package/dist/router/context.js.map +1 -0
- package/dist/router/hooks.d.ts +30 -0
- package/dist/router/hooks.d.ts.map +1 -0
- package/dist/router/hooks.js +59 -0
- package/dist/router/hooks.js.map +1 -0
- package/dist/router/index.d.ts +13 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/index.js +14 -0
- package/dist/router/index.js.map +1 -0
- package/dist/router/matching.d.ts +19 -0
- package/dist/router/matching.d.ts.map +1 -0
- package/dist/router/matching.js +115 -0
- package/dist/router/matching.js.map +1 -0
- package/dist/router/navigation.d.ts +26 -0
- package/dist/router/navigation.d.ts.map +1 -0
- package/dist/router/navigation.js +65 -0
- package/dist/router/navigation.js.map +1 -0
- package/dist/router/types.d.ts +61 -0
- package/dist/router/types.d.ts.map +1 -0
- package/dist/router/types.js +6 -0
- package/dist/router/types.js.map +1 -0
- package/dist/server.d.ts +10 -16
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +7 -19
- package/dist/server.js.map +1 -1
- package/dist/streaming/html.d.ts +29 -0
- package/dist/streaming/html.d.ts.map +1 -0
- package/dist/streaming/html.js +72 -0
- package/dist/streaming/html.js.map +1 -0
- package/dist/streaming/index.d.ts +7 -0
- package/dist/streaming/index.d.ts.map +1 -0
- package/dist/streaming/index.js +7 -0
- package/dist/streaming/index.js.map +1 -0
- package/dist/streaming/render.d.ts +32 -0
- package/dist/streaming/render.d.ts.map +1 -0
- package/dist/streaming/render.js +83 -0
- package/dist/streaming/render.js.map +1 -0
- package/dist/streaming/utils.d.ts +30 -0
- package/dist/streaming/utils.d.ts.map +1 -0
- package/dist/streaming/utils.js +61 -0
- package/dist/streaming/utils.js.map +1 -0
- package/package.json +43 -35
- package/dist/router.d.ts +0 -3
- package/dist/router.js +0 -229
- package/dist/router.js.map +0 -1
- package/dist/vite.d.ts +0 -98
- package/dist/vite.js +0 -1828
- package/dist/vite.js.map +0 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Link Component
|
|
4
|
+
* Client-side navigation link with prefetching
|
|
5
|
+
*/
|
|
6
|
+
import { useEffect, useCallback, useRef } from 'react';
|
|
7
|
+
import { navigate, replace } from './navigation';
|
|
8
|
+
import { prefetchRoute } from './matching';
|
|
9
|
+
export function Link({ href, children, prefetch: shouldPrefetch = true, scroll = true, replace: shouldReplace = false, shallow = false, ...props }) {
|
|
10
|
+
const prefetchedRef = useRef(false);
|
|
11
|
+
const linkRef = useRef(null);
|
|
12
|
+
const getRoutes = useCallback(() => {
|
|
13
|
+
return window.__OLOVA_ROUTES__ || [];
|
|
14
|
+
}, []);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!shouldPrefetch || prefetchedRef.current || !linkRef.current)
|
|
17
|
+
return;
|
|
18
|
+
const observer = new IntersectionObserver((entries) => {
|
|
19
|
+
if (entries[0].isIntersecting && !prefetchedRef.current) {
|
|
20
|
+
prefetchedRef.current = true;
|
|
21
|
+
prefetchRoute(getRoutes(), href);
|
|
22
|
+
}
|
|
23
|
+
}, { rootMargin: '200px' });
|
|
24
|
+
observer.observe(linkRef.current);
|
|
25
|
+
return () => observer.disconnect();
|
|
26
|
+
}, [href, shouldPrefetch, getRoutes]);
|
|
27
|
+
const handleMouseEnter = useCallback(() => {
|
|
28
|
+
if (!prefetchedRef.current) {
|
|
29
|
+
prefetchedRef.current = true;
|
|
30
|
+
prefetchRoute(getRoutes(), href);
|
|
31
|
+
}
|
|
32
|
+
}, [href, getRoutes]);
|
|
33
|
+
const handleClick = useCallback((e) => {
|
|
34
|
+
if (e.ctrlKey ||
|
|
35
|
+
e.metaKey ||
|
|
36
|
+
e.shiftKey ||
|
|
37
|
+
e.button !== 0 ||
|
|
38
|
+
props.target === '_blank' ||
|
|
39
|
+
href.startsWith('http') ||
|
|
40
|
+
href.startsWith('//')) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
if (shouldReplace) {
|
|
45
|
+
replace(href, { scroll, shallow });
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
navigate(href, { scroll, shallow });
|
|
49
|
+
}
|
|
50
|
+
}, [href, scroll, shallow, shouldReplace, props.target]);
|
|
51
|
+
return (_jsx("a", { ref: linkRef, href: href, onClick: handleClick, onMouseEnter: handleMouseEnter, ...props, children: children }));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=Link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Link.js","sourceRoot":"","sources":["../../src/router/Link.tsx"],"names":[],"mappings":";AAAA;;;GAGG;AAEH,OAAc,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,UAAU,IAAI,CAAC,EACnB,IAAI,EACJ,QAAQ,EACR,QAAQ,EAAE,cAAc,GAAG,IAAI,EAC/B,MAAM,GAAG,IAAI,EACb,OAAO,EAAE,aAAa,GAAG,KAAK,EAC9B,OAAO,GAAG,KAAK,EACf,GAAG,KAAK,EACE;IACV,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,MAAM,OAAO,GAAG,MAAM,CAAoB,IAAI,CAAC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YACd,KAAK,CAAC,MAAM,KAAK,QAAQ;YACzB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;YACvB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EACrB,CAAC;YACD,OAAO;QACT,CAAC;QAED,CAAC,CAAC,cAAc,EAAE,CAAC;QAEnB,IAAI,aAAa,EAAE,CAAC;YAClB,OAAO,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;QACtC,CAAC;IACH,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAEzD,OAAO,CACL,YACE,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,WAAW,EACpB,YAAY,EAAE,gBAAgB,KAC1B,KAAK,YAER,QAAQ,GACP,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RouterProps } from './types';
|
|
2
|
+
export declare function Router({ routes }: RouterProps): import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
+
export declare function NotFound(): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function ErrorPage(): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function LoadingIndicator(): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function NavigationProgress(): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=Router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../src/router/Router.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAS,WAAW,EAAqB,MAAM,SAAS,CAAC;AA4FrE,wBAAgB,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,WAAW,kDAgK7C;AAMD,wBAAgB,QAAQ,4CAQvB;AAED,wBAAgB,SAAS,4CAiBxB;AAED,wBAAgB,gBAAgB,4CAc/B;AAED,wBAAgB,kBAAkB,4CAajC"}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, Suspense, startTransition, useRef, useMemo, } from 'react';
|
|
3
|
+
import { RouterContext, ParamsContext, routerEvents, NAVIGATE_EVENT, pageCache, metadataCache } from './context';
|
|
4
|
+
import { navigate, replace } from './navigation';
|
|
5
|
+
import { findRoute, prefetchRoute } from './matching';
|
|
6
|
+
import { Link } from './Link';
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// METADATA HANDLING
|
|
9
|
+
// ============================================================================
|
|
10
|
+
function applyMetadata(metadata) {
|
|
11
|
+
if (!metadata)
|
|
12
|
+
return;
|
|
13
|
+
if (metadata.title) {
|
|
14
|
+
document.title = metadata.title;
|
|
15
|
+
}
|
|
16
|
+
const metaTags = {
|
|
17
|
+
description: metadata.description,
|
|
18
|
+
keywords: metadata.keywords,
|
|
19
|
+
};
|
|
20
|
+
for (const [name, content] of Object.entries(metaTags)) {
|
|
21
|
+
if (content) {
|
|
22
|
+
let meta = document.querySelector(`meta[name="${name}"]`);
|
|
23
|
+
if (!meta) {
|
|
24
|
+
meta = document.createElement('meta');
|
|
25
|
+
meta.setAttribute('name', name);
|
|
26
|
+
document.head.appendChild(meta);
|
|
27
|
+
}
|
|
28
|
+
meta.setAttribute('content', content);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (metadata.openGraph) {
|
|
32
|
+
const og = metadata.openGraph;
|
|
33
|
+
const ogTags = {
|
|
34
|
+
'og:title': og.title,
|
|
35
|
+
'og:description': og.description,
|
|
36
|
+
'og:type': og.type,
|
|
37
|
+
'og:url': og.url,
|
|
38
|
+
'og:image': og.image,
|
|
39
|
+
};
|
|
40
|
+
for (const [property, content] of Object.entries(ogTags)) {
|
|
41
|
+
if (content) {
|
|
42
|
+
let meta = document.querySelector(`meta[property="${property}"]`);
|
|
43
|
+
if (!meta) {
|
|
44
|
+
meta = document.createElement('meta');
|
|
45
|
+
meta.setAttribute('property', property);
|
|
46
|
+
document.head.appendChild(meta);
|
|
47
|
+
}
|
|
48
|
+
meta.setAttribute('content', content);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// ============================================================================
|
|
54
|
+
// QUERY STRING PARSING
|
|
55
|
+
// ============================================================================
|
|
56
|
+
function parseQueryString(search) {
|
|
57
|
+
const params = new URLSearchParams(search);
|
|
58
|
+
const result = {};
|
|
59
|
+
params.forEach((value, key) => {
|
|
60
|
+
if (result[key]) {
|
|
61
|
+
if (Array.isArray(result[key])) {
|
|
62
|
+
result[key].push(value);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
result[key] = [result[key], value];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
result[key] = value;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
// ============================================================================
|
|
75
|
+
// ROUTER COMPONENT
|
|
76
|
+
// ============================================================================
|
|
77
|
+
export function Router({ routes }) {
|
|
78
|
+
const [currentPath, setCurrentPath] = useState(() => {
|
|
79
|
+
if (typeof window === 'undefined')
|
|
80
|
+
return '/';
|
|
81
|
+
const path = window.location.pathname;
|
|
82
|
+
return path.endsWith('/') && path !== '/' ? path.slice(0, -1) : path;
|
|
83
|
+
});
|
|
84
|
+
const [query, setQuery] = useState(() => {
|
|
85
|
+
if (typeof window === 'undefined')
|
|
86
|
+
return {};
|
|
87
|
+
return parseQueryString(window.location.search);
|
|
88
|
+
});
|
|
89
|
+
const [PageComponent, setPageComponent] = useState(null);
|
|
90
|
+
const [params, setParams] = useState({});
|
|
91
|
+
const [isNavigating, setIsNavigating] = useState(false);
|
|
92
|
+
const [isReady, setIsReady] = useState(false);
|
|
93
|
+
const isHydrating = useRef(true);
|
|
94
|
+
const routesRef = useRef(routes);
|
|
95
|
+
routesRef.current = routes;
|
|
96
|
+
// Handle navigation events
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
const handleNavigate = (e) => {
|
|
99
|
+
const customEvent = e;
|
|
100
|
+
const newPath = customEvent.detail?.path || window.location.pathname;
|
|
101
|
+
const normalizedPath = newPath.endsWith('/') && newPath !== '/'
|
|
102
|
+
? newPath.slice(0, -1)
|
|
103
|
+
: newPath;
|
|
104
|
+
isHydrating.current = false;
|
|
105
|
+
startTransition(() => {
|
|
106
|
+
setCurrentPath(normalizedPath);
|
|
107
|
+
setQuery(parseQueryString(window.location.search));
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
const handlePopState = () => {
|
|
111
|
+
const path = window.location.pathname;
|
|
112
|
+
const normalizedPath = path.endsWith('/') && path !== '/'
|
|
113
|
+
? path.slice(0, -1)
|
|
114
|
+
: path;
|
|
115
|
+
isHydrating.current = false;
|
|
116
|
+
startTransition(() => {
|
|
117
|
+
setCurrentPath(normalizedPath);
|
|
118
|
+
setQuery(parseQueryString(window.location.search));
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
const handleHashChange = () => {
|
|
122
|
+
routerEvents.emit('hashChangeStart', window.location.hash);
|
|
123
|
+
routerEvents.emit('hashChangeComplete', window.location.hash);
|
|
124
|
+
};
|
|
125
|
+
window.addEventListener(NAVIGATE_EVENT, handleNavigate);
|
|
126
|
+
window.addEventListener('popstate', handlePopState);
|
|
127
|
+
window.addEventListener('hashchange', handleHashChange);
|
|
128
|
+
return () => {
|
|
129
|
+
window.removeEventListener(NAVIGATE_EVENT, handleNavigate);
|
|
130
|
+
window.removeEventListener('popstate', handlePopState);
|
|
131
|
+
window.removeEventListener('hashchange', handleHashChange);
|
|
132
|
+
};
|
|
133
|
+
}, []);
|
|
134
|
+
// Load page component when path changes
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
const { route, params: extractedParams } = findRoute(routes, currentPath);
|
|
137
|
+
if (!route) {
|
|
138
|
+
setPageComponent(() => NotFound);
|
|
139
|
+
setParams({});
|
|
140
|
+
setIsReady(true);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
setParams(extractedParams);
|
|
144
|
+
const cacheKey = route.path;
|
|
145
|
+
if (pageCache.has(cacheKey)) {
|
|
146
|
+
const cached = pageCache.get(cacheKey);
|
|
147
|
+
if (metadataCache.has(cacheKey)) {
|
|
148
|
+
applyMetadata(metadataCache.get(cacheKey));
|
|
149
|
+
}
|
|
150
|
+
startTransition(() => {
|
|
151
|
+
setPageComponent(() => cached);
|
|
152
|
+
setIsNavigating(false);
|
|
153
|
+
setIsReady(true);
|
|
154
|
+
});
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
if (!isHydrating.current) {
|
|
158
|
+
setIsNavigating(true);
|
|
159
|
+
}
|
|
160
|
+
route.component().then(module => {
|
|
161
|
+
pageCache.set(cacheKey, module.default);
|
|
162
|
+
if (module.metadata) {
|
|
163
|
+
metadataCache.set(cacheKey, module.metadata);
|
|
164
|
+
applyMetadata(module.metadata);
|
|
165
|
+
}
|
|
166
|
+
startTransition(() => {
|
|
167
|
+
setPageComponent(() => module.default);
|
|
168
|
+
setIsNavigating(false);
|
|
169
|
+
setIsReady(true);
|
|
170
|
+
isHydrating.current = false;
|
|
171
|
+
});
|
|
172
|
+
}).catch(error => {
|
|
173
|
+
console.error('[Olova] Failed to load page:', error);
|
|
174
|
+
routerEvents.emit('routeChangeError', error, currentPath);
|
|
175
|
+
setPageComponent(() => ErrorPage);
|
|
176
|
+
setIsNavigating(false);
|
|
177
|
+
setIsReady(true);
|
|
178
|
+
});
|
|
179
|
+
}, [currentPath, routes]);
|
|
180
|
+
const routerContextValue = useMemo(() => ({
|
|
181
|
+
pathname: currentPath,
|
|
182
|
+
params,
|
|
183
|
+
query,
|
|
184
|
+
asPath: typeof window !== 'undefined'
|
|
185
|
+
? currentPath + window.location.search + window.location.hash
|
|
186
|
+
: currentPath,
|
|
187
|
+
push: navigate,
|
|
188
|
+
replace,
|
|
189
|
+
back: () => typeof window !== 'undefined' && window.history.back(),
|
|
190
|
+
forward: () => typeof window !== 'undefined' && window.history.forward(),
|
|
191
|
+
prefetch: (url) => prefetchRoute(routesRef.current, url),
|
|
192
|
+
reload: () => typeof window !== 'undefined' && window.location.reload(),
|
|
193
|
+
isReady,
|
|
194
|
+
isNavigating,
|
|
195
|
+
isFallback: false,
|
|
196
|
+
events: routerEvents,
|
|
197
|
+
}), [currentPath, params, query, isReady, isNavigating]);
|
|
198
|
+
if (!PageComponent && isHydrating.current) {
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
if (!PageComponent) {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
return (_jsx(RouterContext.Provider, { value: routerContextValue, children: _jsx(ParamsContext.Provider, { value: params, children: _jsxs(Suspense, { fallback: _jsx(LoadingIndicator, {}), children: [_jsx(PageComponent, { params: params, searchParams: query }), isNavigating && _jsx(NavigationProgress, {})] }) }) }));
|
|
205
|
+
}
|
|
206
|
+
// ============================================================================
|
|
207
|
+
// BUILT-IN COMPONENTS
|
|
208
|
+
// ============================================================================
|
|
209
|
+
export function NotFound() {
|
|
210
|
+
return (_jsxs("div", { style: { padding: '4rem 2rem', textAlign: 'center' }, children: [_jsx("h1", { style: { fontSize: '4rem', margin: 0 }, children: "404" }), _jsx("p", { style: { fontSize: '1.25rem', color: '#666' }, children: "This page could not be found." }), _jsx(Link, { href: "/", style: { color: '#0070f3' }, children: "Go back home" })] }));
|
|
211
|
+
}
|
|
212
|
+
export function ErrorPage() {
|
|
213
|
+
return (_jsxs("div", { style: { padding: '4rem 2rem', textAlign: 'center' }, children: [_jsx("h1", { style: { fontSize: '2rem', margin: 0 }, children: "Something went wrong" }), _jsx("p", { style: { fontSize: '1rem', color: '#666' }, children: "Failed to load this page." }), _jsx("button", { onClick: () => window.location.reload(), style: {
|
|
214
|
+
padding: '0.5rem 1rem',
|
|
215
|
+
background: '#0070f3',
|
|
216
|
+
color: 'white',
|
|
217
|
+
border: 'none',
|
|
218
|
+
borderRadius: '4px',
|
|
219
|
+
cursor: 'pointer'
|
|
220
|
+
}, children: "Try again" })] }));
|
|
221
|
+
}
|
|
222
|
+
export function LoadingIndicator() {
|
|
223
|
+
return (_jsx("div", { style: { padding: '2rem', textAlign: 'center' }, children: _jsx("div", { style: {
|
|
224
|
+
width: '40px',
|
|
225
|
+
height: '40px',
|
|
226
|
+
border: '3px solid #f3f3f3',
|
|
227
|
+
borderTop: '3px solid #0070f3',
|
|
228
|
+
borderRadius: '50%',
|
|
229
|
+
animation: 'olova-spin 1s linear infinite',
|
|
230
|
+
margin: '0 auto'
|
|
231
|
+
} }) }));
|
|
232
|
+
}
|
|
233
|
+
export function NavigationProgress() {
|
|
234
|
+
return (_jsx("div", { style: {
|
|
235
|
+
position: 'fixed',
|
|
236
|
+
top: 0,
|
|
237
|
+
left: 0,
|
|
238
|
+
right: 0,
|
|
239
|
+
height: '3px',
|
|
240
|
+
background: 'linear-gradient(90deg, #0070f3, #00a8ff)',
|
|
241
|
+
animation: 'olova-loading 1s ease-in-out infinite',
|
|
242
|
+
zIndex: 9999,
|
|
243
|
+
} }));
|
|
244
|
+
}
|
|
245
|
+
// ============================================================================
|
|
246
|
+
// CSS INJECTION
|
|
247
|
+
// ============================================================================
|
|
248
|
+
if (typeof document !== 'undefined') {
|
|
249
|
+
const style = document.createElement('style');
|
|
250
|
+
style.textContent = `
|
|
251
|
+
@keyframes olova-loading {
|
|
252
|
+
0% { transform: translateX(-100%); }
|
|
253
|
+
50% { transform: translateX(0); }
|
|
254
|
+
100% { transform: translateX(100%); }
|
|
255
|
+
}
|
|
256
|
+
@keyframes olova-spin {
|
|
257
|
+
0% { transform: rotate(0deg); }
|
|
258
|
+
100% { transform: rotate(360deg); }
|
|
259
|
+
}
|
|
260
|
+
`;
|
|
261
|
+
document.head.appendChild(style);
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=Router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Router.js","sourceRoot":"","sources":["../../src/router/Router.tsx"],"names":[],"mappings":";AAAA,OAAc,EACZ,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,eAAe,EACf,MAAM,EACN,OAAO,GACR,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,aAAa,EACb,aAAa,EACb,YAAY,EACZ,cAAc,EACd,SAAS,EACT,aAAa,EACd,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E,SAAS,aAAa,CAAC,QAAa;IAClC,IAAI,CAAC,QAAQ;QAAE,OAAO;IAEtB,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;QACnB,QAAQ,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;IAClC,CAAC;IAED,MAAM,QAAQ,GAA2B;QACvC,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,QAAQ,EAAE,QAAQ,CAAC,QAAQ;KAC5B,CAAC;IAEF,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvD,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC;YAC1D,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;gBACtC,IAAI,CAAC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MAAM,EAAE,IAAI;SACb,GAAI,CACN,CAAC;AACJ,CAAC;AAED,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;IACpC,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,WAAW,GAAG;;;;;;;;;;GAUnB,CAAC;IACF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Router Context
|
|
3
|
+
* React contexts and shared state for the router
|
|
4
|
+
*/
|
|
5
|
+
import type { RouterContextType, RouterEvents } from './types';
|
|
6
|
+
export declare const pageCache: Map<string, import("react").ComponentType<any>>;
|
|
7
|
+
export declare const prefetchPromises: Map<string, Promise<void>>;
|
|
8
|
+
export declare const metadataCache: Map<string, any>;
|
|
9
|
+
export declare const NAVIGATE_EVENT = "olova:navigate";
|
|
10
|
+
export declare const routerEvents: RouterEvents;
|
|
11
|
+
export declare const RouterContext: import("react").Context<RouterContextType>;
|
|
12
|
+
export declare const ParamsContext: import("react").Context<Record<string, string | string[]>>;
|
|
13
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/router/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EAGb,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,SAAS,iDAA8C,CAAC;AACrE,eAAO,MAAM,gBAAgB,4BAAmC,CAAC;AACjE,eAAO,MAAM,aAAa,kBAAyB,CAAC;AAGpD,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAK/C,eAAO,MAAM,YAAY,EAAE,YAa1B,CAAC;AAGF,eAAO,MAAM,aAAa,4CAexB,CAAC;AAGH,eAAO,MAAM,aAAa,4DAAuD,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Router Context
|
|
3
|
+
* React contexts and shared state for the router
|
|
4
|
+
*/
|
|
5
|
+
import { createContext } from 'react';
|
|
6
|
+
// Caches for page components and metadata
|
|
7
|
+
export const pageCache = new Map();
|
|
8
|
+
export const prefetchPromises = new Map();
|
|
9
|
+
export const metadataCache = new Map();
|
|
10
|
+
// Navigation event name
|
|
11
|
+
export const NAVIGATE_EVENT = 'olova:navigate';
|
|
12
|
+
// Event emitter for router events
|
|
13
|
+
const eventHandlers = new Map();
|
|
14
|
+
export const routerEvents = {
|
|
15
|
+
on(event, handler) {
|
|
16
|
+
if (!eventHandlers.has(event)) {
|
|
17
|
+
eventHandlers.set(event, new Set());
|
|
18
|
+
}
|
|
19
|
+
eventHandlers.get(event).add(handler);
|
|
20
|
+
},
|
|
21
|
+
off(event, handler) {
|
|
22
|
+
eventHandlers.get(event)?.delete(handler);
|
|
23
|
+
},
|
|
24
|
+
emit(event, ...args) {
|
|
25
|
+
eventHandlers.get(event)?.forEach(handler => handler(...args));
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
// Router context with default values
|
|
29
|
+
export const RouterContext = createContext({
|
|
30
|
+
pathname: '/',
|
|
31
|
+
params: {},
|
|
32
|
+
query: {},
|
|
33
|
+
asPath: '/',
|
|
34
|
+
push: async () => true,
|
|
35
|
+
replace: async () => true,
|
|
36
|
+
back: () => { },
|
|
37
|
+
forward: () => { },
|
|
38
|
+
prefetch: async () => { },
|
|
39
|
+
reload: () => { },
|
|
40
|
+
isReady: false,
|
|
41
|
+
isNavigating: false,
|
|
42
|
+
isFallback: false,
|
|
43
|
+
events: routerEvents,
|
|
44
|
+
});
|
|
45
|
+
// Params context for route parameters
|
|
46
|
+
export const ParamsContext = createContext({});
|
|
47
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1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,MAAM,EAAE,GAAG;IACX,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,IAAI;IACtB,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,IAAI;IACzB,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;IACjB,QAAQ,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC;IACxB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;IAChB,OAAO,EAAE,KAAK;IACd,YAAY,EAAE,KAAK;IACnB,UAAU,EAAE,KAAK;IACjB,MAAM,EAAE,YAAY;CACrB,CAAC,CAAC;AAEH,sCAAsC;AACtC,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAoC,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Router Hooks
|
|
3
|
+
* React hooks for navigation and route information
|
|
4
|
+
*/
|
|
5
|
+
import type { RouterContextType } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* Access the router context
|
|
8
|
+
*/
|
|
9
|
+
export declare function useRouter(): RouterContextType;
|
|
10
|
+
/**
|
|
11
|
+
* Access route parameters
|
|
12
|
+
*/
|
|
13
|
+
export declare function useParams<T extends Record<string, string | string[]> = Record<string, string | string[]>>(): T;
|
|
14
|
+
/**
|
|
15
|
+
* Get the current pathname
|
|
16
|
+
*/
|
|
17
|
+
export declare function usePathname(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Access URL search parameters
|
|
20
|
+
*/
|
|
21
|
+
export declare function useSearchParams(): URLSearchParams;
|
|
22
|
+
/**
|
|
23
|
+
* Get the first segment of the current layout
|
|
24
|
+
*/
|
|
25
|
+
export declare function useSelectedLayoutSegment(): string | null;
|
|
26
|
+
/**
|
|
27
|
+
* Get all segments of the current layout
|
|
28
|
+
*/
|
|
29
|
+
export declare function useSelectedLayoutSegments(): string[];
|
|
30
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/router/hooks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGjD;;GAEG;AACH,wBAAgB,SAAS,IAAI,iBAAiB,CAE7C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,CAE9G;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAGpC;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,eAAe,CAoBjD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,GAAG,IAAI,CAIxD;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,EAAE,CAGpD"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Router Hooks
|
|
3
|
+
* React hooks for navigation and route information
|
|
4
|
+
*/
|
|
5
|
+
import { useState, useEffect, useContext } from 'react';
|
|
6
|
+
import { RouterContext, ParamsContext, NAVIGATE_EVENT } from './context';
|
|
7
|
+
/**
|
|
8
|
+
* Access the router context
|
|
9
|
+
*/
|
|
10
|
+
export function useRouter() {
|
|
11
|
+
return useContext(RouterContext);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Access route parameters
|
|
15
|
+
*/
|
|
16
|
+
export function useParams() {
|
|
17
|
+
return useContext(ParamsContext);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get the current pathname
|
|
21
|
+
*/
|
|
22
|
+
export function usePathname() {
|
|
23
|
+
const { pathname } = useContext(RouterContext);
|
|
24
|
+
return pathname;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Access URL search parameters
|
|
28
|
+
*/
|
|
29
|
+
export function useSearchParams() {
|
|
30
|
+
const [searchParams, setSearchParams] = useState(() => new URLSearchParams(window.location.search));
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
const handleNavigate = () => {
|
|
33
|
+
setSearchParams(new URLSearchParams(window.location.search));
|
|
34
|
+
};
|
|
35
|
+
window.addEventListener(NAVIGATE_EVENT, handleNavigate);
|
|
36
|
+
window.addEventListener('popstate', handleNavigate);
|
|
37
|
+
return () => {
|
|
38
|
+
window.removeEventListener(NAVIGATE_EVENT, handleNavigate);
|
|
39
|
+
window.removeEventListener('popstate', handleNavigate);
|
|
40
|
+
};
|
|
41
|
+
}, []);
|
|
42
|
+
return searchParams;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Get the first segment of the current layout
|
|
46
|
+
*/
|
|
47
|
+
export function useSelectedLayoutSegment() {
|
|
48
|
+
const { pathname } = useRouter();
|
|
49
|
+
const segments = pathname.split('/').filter(Boolean);
|
|
50
|
+
return segments[0] || null;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Get all segments of the current layout
|
|
54
|
+
*/
|
|
55
|
+
export function useSelectedLayoutSegments() {
|
|
56
|
+
const { pathname } = useRouter();
|
|
57
|
+
return pathname.split('/').filter(Boolean);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/router/hooks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEzE;;GAEG;AACH,MAAM,UAAU,SAAS;IACvB,OAAO,UAAU,CAAC,aAAa,CAAC,CAAC;AACnC,CAAC;AAED;;GAEG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AyB;IACvC,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,CAAC;IACjC,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Olova Router Module
|
|
3
|
+
* Optimized Next.js-style routing system
|
|
4
|
+
*/
|
|
5
|
+
export * from './types';
|
|
6
|
+
export * from './context';
|
|
7
|
+
export * from './navigation';
|
|
8
|
+
export * from './matching';
|
|
9
|
+
export * from './hooks';
|
|
10
|
+
export * from './Link';
|
|
11
|
+
export * from './Router';
|
|
12
|
+
export { redirect, permanentRedirect, notFound } from './navigation';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AAGzB,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACT,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Olova Router Module
|
|
3
|
+
* Optimized Next.js-style routing system
|
|
4
|
+
*/
|
|
5
|
+
export * from './types';
|
|
6
|
+
export * from './context';
|
|
7
|
+
export * from './navigation';
|
|
8
|
+
export * from './matching';
|
|
9
|
+
export * from './hooks';
|
|
10
|
+
export * from './Link';
|
|
11
|
+
export * from './Router';
|
|
12
|
+
// Re-export common programmatic navigation functions
|
|
13
|
+
export { redirect, permanentRedirect, notFound } from './navigation';
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AAEzB,qDAAqD;AACrD,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACT,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Route Matching
|
|
3
|
+
* Route matching and prefetching logic
|
|
4
|
+
*/
|
|
5
|
+
import type { Route, MatchResult, FindRouteResult } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* Match a route path against the current path
|
|
8
|
+
* Supports dynamic routes, catch-all, and optional catch-all patterns
|
|
9
|
+
*/
|
|
10
|
+
export declare function matchRoute(routePath: string, currentPath: string): MatchResult;
|
|
11
|
+
/**
|
|
12
|
+
* Find the best matching route for a path
|
|
13
|
+
*/
|
|
14
|
+
export declare function findRoute(routes: Route[], path: string): FindRouteResult;
|
|
15
|
+
/**
|
|
16
|
+
* Prefetch a route's component
|
|
17
|
+
*/
|
|
18
|
+
export declare function prefetchRoute(routes: Route[], path: string): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=matching.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matching.d.ts","sourceRoot":"","sources":["../../src/router/matching.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAGnE;;;GAGG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,WAAW,CA8D9E;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,eAAe,CA2BxE;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBhF"}
|