@lattice-php/lattice 0.75.0 → 0.76.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/generated.d.ts +4 -4
- package/dist/vite.d.ts +5 -3
- package/dist/vite.js +79 -5
- package/dist/vite.js.map +1 -1
- package/dist-standalone/chunks/{chart-view-CPIF_gTM.js → chart-view-EcMorBmg.js} +1 -1
- package/dist-standalone/chunks/{date-picker-view-tr6cuOIN.js → date-picker-view-D2xcJDFM.js} +1 -1
- package/dist-standalone/chunks/{dist-BTYZr5rg.js → dist-D8M7nv0z.js} +1 -1
- package/dist-standalone/chunks/{dist-CDI2N5YZ.js → dist-DurQU2bu.js} +17 -17
- package/dist-standalone/chunks/{pattern-input-view-CjbnNynq.js → pattern-input-view-DL6WebsI.js} +1 -1
- package/dist-standalone/chunks/{rich-editor-view-4ZhBfx6i.js → rich-editor-view-us_aFe6t.js} +1 -1
- package/dist-standalone/chunks/{runtime-DOBKnaVB.js → runtime-BCd7_8vm.js} +5 -5
- package/dist-standalone/chunks/{subscriptions-B37pUVGa.js → subscriptions-C7dd-tOc.js} +1 -1
- package/dist-standalone/lattice.css +1 -1
- package/dist-standalone/lattice.js +1 -1
- package/dist-standalone/manifest.json +1 -1
- package/dist-standalone/runtime.js +1 -1
- package/package.json +6 -6
|
@@ -21,8 +21,8 @@ export type DataList = {
|
|
|
21
21
|
remote: RemoteAccess | null;
|
|
22
22
|
};
|
|
23
23
|
export type FilterNodeType = "filter.date-range" | "filter.media-folder" | "filter.media-type" | "filter.select" | "filter.ternary" | "filter.toggle";
|
|
24
|
-
export type FormFieldNodeType = "field.builder" | "field.checkbox" | "field.checkbox-group" | "field.choice" | "field.color-picker" | "field.date-input" | "field.date-time-input" | "field.file-upload" | "field.hidden-input" | "field.media-picker" | "field.number-input" | "field.otp" | "field.password-input" | "field.pattern-input" | "field.repeater" | "field.rich-editor" | "field.select" | "field.text-input" | "field.textarea" | "field.time-input" | "field.toggle" | "field.tree" | "wizard" | "wizard-step";
|
|
25
|
-
export type FormNodeType = "field.builder" | "field.checkbox" | "field.checkbox-group" | "field.choice" | "field.color-picker" | "field.date-input" | "field.date-time-input" | "field.file-upload" | "field.hidden-input" | "field.media-picker" | "field.number-input" | "field.otp" | "field.password-input" | "field.pattern-input" | "field.repeater" | "field.rich-editor" | "field.select" | "field.text-input" | "field.textarea" | "field.time-input" | "field.toggle" | "field.tree" | "form" | "wizard" | "wizard-step";
|
|
24
|
+
export type FormFieldNodeType = "field.builder" | "field.checkbox" | "field.checkbox-group" | "field.choice" | "field.color-picker" | "field.date-input" | "field.date-time-input" | "field.file-upload" | "field.hidden-input" | "field.media-dropzone" | "field.media-picker" | "field.number-input" | "field.otp" | "field.password-input" | "field.pattern-input" | "field.repeater" | "field.rich-editor" | "field.select" | "field.text-input" | "field.textarea" | "field.time-input" | "field.toggle" | "field.tree" | "wizard" | "wizard-step";
|
|
25
|
+
export type FormNodeType = "field.builder" | "field.checkbox" | "field.checkbox-group" | "field.choice" | "field.color-picker" | "field.date-input" | "field.date-time-input" | "field.file-upload" | "field.hidden-input" | "field.media-dropzone" | "field.media-picker" | "field.number-input" | "field.otp" | "field.password-input" | "field.pattern-input" | "field.repeater" | "field.rich-editor" | "field.select" | "field.text-input" | "field.textarea" | "field.time-input" | "field.toggle" | "field.tree" | "form" | "wizard" | "wizard-step";
|
|
26
26
|
export type Fragment = {
|
|
27
27
|
endpoint: string | null;
|
|
28
28
|
lazy: boolean;
|
|
@@ -41,8 +41,8 @@ export type Listen = {
|
|
|
41
41
|
readonly visibility: ChannelVisibility;
|
|
42
42
|
};
|
|
43
43
|
export type MapNodeType = "map";
|
|
44
|
-
export type MediumNodeType = "media.library";
|
|
45
|
-
export type NodeType = "accordion" | "action" | "action.bulk" | "action.group" | "api-reference" | "avatar" | "badge" | "blocks.editor" | "blocks.frame" | "blocks.rich-text" | "blocks.slot" | "blocks.unknown" | "blocks.view" | "board" | "breadcrumbs" | "button" | "calendar" | "callouts" | "card" | "chart" | "chat.box" | "chat.part.text" | "chat.part.tool-call" | "code-block" | "collapsible" | "description-list" | "dropdown" | "entry.badge" | "entry.boolean" | "entry.component" | "entry.date" | "entry.text" | "field.builder" | "field.checkbox" | "field.checkbox-group" | "field.choice" | "field.color-picker" | "field.date-input" | "field.date-time-input" | "field.file-upload" | "field.hidden-input" | "field.media-picker" | "field.number-input" | "field.otp" | "field.password-input" | "field.pattern-input" | "field.repeater" | "field.rich-editor" | "field.select" | "field.text-input" | "field.textarea" | "field.time-input" | "field.toggle" | "field.tree" | "floating-panel" | "form" | "fragment" | "grid" | "heading" | "icon" | "image" | "link" | "map" | "media.library" | "menu" | "menu-item" | "modal" | "notifications" | "outlet" | "pdf" | "popover" | "progress" | "raw-block" | "remote.data-list" | "search.box" | "search.categories" | "search.input" | "search.preview" | "search.recent" | "search.results" | "section" | "segmented-control" | "separator" | "sidebar" | "sidebar.footer" | "signature" | "stack" | "tab" | "table" | "table.row-click" | "tabs" | "text" | "tooltip" | "topbar" | "tree" | "wizard" | "wizard-step";
|
|
44
|
+
export type MediumNodeType = "media.dropzone-remove" | "media.library";
|
|
45
|
+
export type NodeType = "accordion" | "action" | "action.bulk" | "action.group" | "api-reference" | "avatar" | "badge" | "blocks.editor" | "blocks.frame" | "blocks.rich-text" | "blocks.slot" | "blocks.unknown" | "blocks.view" | "board" | "breadcrumbs" | "button" | "calendar" | "callouts" | "card" | "chart" | "chat.box" | "chat.part.text" | "chat.part.tool-call" | "code-block" | "collapsible" | "description-list" | "dropdown" | "entry.badge" | "entry.boolean" | "entry.component" | "entry.date" | "entry.text" | "field.builder" | "field.checkbox" | "field.checkbox-group" | "field.choice" | "field.color-picker" | "field.date-input" | "field.date-time-input" | "field.file-upload" | "field.hidden-input" | "field.media-dropzone" | "field.media-picker" | "field.number-input" | "field.otp" | "field.password-input" | "field.pattern-input" | "field.repeater" | "field.rich-editor" | "field.select" | "field.text-input" | "field.textarea" | "field.time-input" | "field.toggle" | "field.tree" | "floating-panel" | "form" | "fragment" | "grid" | "heading" | "icon" | "image" | "link" | "map" | "media.dropzone-remove" | "media.library" | "menu" | "menu-item" | "modal" | "notifications" | "outlet" | "pdf" | "popover" | "progress" | "raw-block" | "remote.data-list" | "search.box" | "search.categories" | "search.input" | "search.preview" | "search.recent" | "search.results" | "section" | "segmented-control" | "separator" | "sidebar" | "sidebar.footer" | "signature" | "stack" | "tab" | "table" | "table.row-click" | "tabs" | "text" | "tooltip" | "topbar" | "tree" | "wizard" | "wizard-step";
|
|
46
46
|
export type NotificationItem = {
|
|
47
47
|
readonly actions: Node[];
|
|
48
48
|
readonly body: Translatable | string | null;
|
package/dist/vite.d.ts
CHANGED
|
@@ -86,9 +86,10 @@ export declare function discoverComponentPackages(appRoot: string): LatticeCompo
|
|
|
86
86
|
* (the docs site, the standalone bundle, a package building itself) import it
|
|
87
87
|
* without this plugin at all. When `uiCssPath` is given (the app actually
|
|
88
88
|
* uses this plugin), both specifiers are instead aliased to a generated
|
|
89
|
-
* wrapper — `@import` of the real stylesheet
|
|
90
|
-
* `@source`/`@import
|
|
91
|
-
*
|
|
89
|
+
* wrapper — `@import` of the real stylesheet, every discovered package's
|
|
90
|
+
* `@source`/`@import`, and a `@source` per framework npm package — so a
|
|
91
|
+
* consumer's existing single import picks up every package's utilities with
|
|
92
|
+
* no per-package import or `@source` of their own. `virtual:lattice/css`
|
|
92
93
|
* exposes just the package-only half the same way, for anyone composing their
|
|
93
94
|
* own wrapper. Tailwind's `@import` resolver reads the resolved file straight
|
|
94
95
|
* off disk — it never calls back into a Vite plugin's `load` — so neither can
|
|
@@ -99,6 +100,7 @@ export declare function discoverComponentPackages(appRoot: string): LatticeCompo
|
|
|
99
100
|
*/
|
|
100
101
|
export declare function componentPackagesPlugin(packages: LatticeComponentPackage[], appRoot?: string, uiCssPath?: string, options?: {
|
|
101
102
|
requireComposer?: boolean;
|
|
103
|
+
frameworkSources?: string[];
|
|
102
104
|
}): Plugin;
|
|
103
105
|
export declare function latticeConfig(options?: LatticeViteOptions): ConfigWithTest;
|
|
104
106
|
export declare function resolveIconOptions(options: LatticeViteOptions, packages?: LatticeComponentPackage[]): SvgSpriteOptions | null;
|
package/dist/vite.js
CHANGED
|
@@ -10,7 +10,10 @@ function lattice(options = {}) {
|
|
|
10
10
|
const plugins = [
|
|
11
11
|
corePlugin(options),
|
|
12
12
|
optionalPeersPlugin(),
|
|
13
|
-
componentPackagesPlugin(packages, appRoot, resolveUiCssPath(options, appRoot, root), {
|
|
13
|
+
componentPackagesPlugin(packages, appRoot, resolveUiCssPath(options, appRoot, root), {
|
|
14
|
+
requireComposer: true,
|
|
15
|
+
frameworkSources: resolveFrameworkSourcePaths(options, appRoot, root)
|
|
16
|
+
}),
|
|
14
17
|
typescriptPlugin(options)
|
|
15
18
|
];
|
|
16
19
|
const iconOptions = resolveIconOptions(options, packages);
|
|
@@ -46,6 +49,72 @@ function resolveUiCssPath(options, appRoot, root) {
|
|
|
46
49
|
}
|
|
47
50
|
}
|
|
48
51
|
/**
|
|
52
|
+
* Every npm package whose components carry Tailwind utilities, paired with its
|
|
53
|
+
* directory in this monorepo. `@lattice-php/ui`'s stylesheet `@source`s its own
|
|
54
|
+
* compiled output for consumers that import it without this plugin, and stays
|
|
55
|
+
* on the list so the set is "all of them" rather than "all but the one another
|
|
56
|
+
* file happens to cover". Nothing reached the packages that depend on ui, so a
|
|
57
|
+
* utility only they use — `px-lt-cell-x`, table's
|
|
58
|
+
* `md:grid-cols-[var(--lattice-table-columns)]` row grid — was never compiled
|
|
59
|
+
* and the component rendered unstyled with no error anywhere.
|
|
60
|
+
*/
|
|
61
|
+
var FRAMEWORK_COMPONENT_PACKAGES = [
|
|
62
|
+
{
|
|
63
|
+
name: "@lattice-php/lattice",
|
|
64
|
+
dir: "framework"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "@lattice-php/core",
|
|
68
|
+
dir: "core"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "@lattice-php/action",
|
|
72
|
+
dir: "action"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "@lattice-php/form",
|
|
76
|
+
dir: "form"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: "@lattice-php/table",
|
|
80
|
+
dir: "table"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "@lattice-php/ui",
|
|
84
|
+
dir: "ui"
|
|
85
|
+
}
|
|
86
|
+
];
|
|
87
|
+
/**
|
|
88
|
+
* The directories Tailwind must scan for those packages' utilities — the
|
|
89
|
+
* uncompiled component sources in source-link mode, each installed package's
|
|
90
|
+
* compiled output otherwise. An app's `node_modules` is outside Tailwind's
|
|
91
|
+
* automatic content detection, so these only get scanned when named here.
|
|
92
|
+
* A package that isn't installed is skipped rather than fatal, matching
|
|
93
|
+
* `resolveUiCssPath`.
|
|
94
|
+
*/
|
|
95
|
+
function resolveFrameworkSourcePaths(options, appRoot, root) {
|
|
96
|
+
if (options.source) return FRAMEWORK_COMPONENT_PACKAGES.map(({ dir }) => path.resolve(root, "..", dir, "resources/js"));
|
|
97
|
+
return FRAMEWORK_COMPONENT_PACKAGES.flatMap(({ name }) => {
|
|
98
|
+
const packageDir = resolveInstalledPackageDir(appRoot, name);
|
|
99
|
+
const distDir = packageDir ? resolvePackageDistDir(packageDir) : void 0;
|
|
100
|
+
return distDir ? [distDir] : [];
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The directory holding a package's compiled output, read off the entry point
|
|
105
|
+
* it publishes rather than assumed to be `dist/`, so a package that changes
|
|
106
|
+
* its build output keeps being scanned.
|
|
107
|
+
*/
|
|
108
|
+
function resolvePackageDistDir(packageDir) {
|
|
109
|
+
try {
|
|
110
|
+
const packageJson = JSON.parse(readFileSync(path.join(packageDir, "package.json"), "utf8"));
|
|
111
|
+
const entry = packageJson.exports?.["."]?.import ?? packageJson.module ?? packageJson.main;
|
|
112
|
+
return typeof entry === "string" ? path.resolve(packageDir, path.dirname(entry)) : void 0;
|
|
113
|
+
} catch {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
49
118
|
* Locate an installed npm package's directory by walking up from `startDir`
|
|
50
119
|
* through each ancestor's `node_modules/<name>`, the same walk Node's own
|
|
51
120
|
* module resolution does — stopping at the first one whose `package.json`
|
|
@@ -156,9 +225,10 @@ function componentPackagesCss(packages) {
|
|
|
156
225
|
* (the docs site, the standalone bundle, a package building itself) import it
|
|
157
226
|
* without this plugin at all. When `uiCssPath` is given (the app actually
|
|
158
227
|
* uses this plugin), both specifiers are instead aliased to a generated
|
|
159
|
-
* wrapper — `@import` of the real stylesheet
|
|
160
|
-
* `@source`/`@import
|
|
161
|
-
*
|
|
228
|
+
* wrapper — `@import` of the real stylesheet, every discovered package's
|
|
229
|
+
* `@source`/`@import`, and a `@source` per framework npm package — so a
|
|
230
|
+
* consumer's existing single import picks up every package's utilities with
|
|
231
|
+
* no per-package import or `@source` of their own. `virtual:lattice/css`
|
|
162
232
|
* exposes just the package-only half the same way, for anyone composing their
|
|
163
233
|
* own wrapper. Tailwind's `@import` resolver reads the resolved file straight
|
|
164
234
|
* off disk — it never calls back into a Vite plugin's `load` — so neither can
|
|
@@ -198,7 +268,11 @@ function componentPackagesPlugin(packages, appRoot, uiCssPath, options = {}) {
|
|
|
198
268
|
}
|
|
199
269
|
if (generatedWrapperCssPath && uiCssPath) {
|
|
200
270
|
mkdirSync(path.dirname(generatedWrapperCssPath), { recursive: true });
|
|
201
|
-
writeFileSync(generatedWrapperCssPath, [
|
|
271
|
+
writeFileSync(generatedWrapperCssPath, [
|
|
272
|
+
`@import ${JSON.stringify(uiCssPath)};`,
|
|
273
|
+
componentPackagesCss(packages),
|
|
274
|
+
...(options.frameworkSources ?? []).map((dir) => `@source ${JSON.stringify(dir)};`)
|
|
275
|
+
].filter((section) => section !== "").join("\n"));
|
|
202
276
|
}
|
|
203
277
|
},
|
|
204
278
|
configResolved(config) {
|
package/dist/vite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","names":[],"sources":["../resources/js/vite.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { buildSprite, svgSprite } from \"@lattice-php/vite-svg-sprite\";\nimport type { IconTypesOptions, Sprite, SvgSpriteOptions } from \"@lattice-php/vite-svg-sprite\";\nimport { searchForWorkspaceRoot } from \"vite\";\nimport type { Plugin, PluginOption, UserConfig } from \"vite\";\nimport { refreshTypeScriptTypes } from \"./vite-typescript-refresh.ts\";\n\ntype InlineDependency = string | RegExp;\n\ntype ConfigWithTest = UserConfig & {\n test?: {\n server?: {\n deps?: {\n inline?: InlineDependency[];\n };\n };\n };\n};\n\nexport type LatticeViteIconsOptions = Omit<SvgSpriteOptions, \"dts\" | \"iconDirs\"> & {\n dirs?: string[];\n dts?: Partial<IconTypesOptions> | false;\n};\n\nexport type LatticeViteOptions = {\n appRoot?: string;\n icons?: boolean | LatticeViteIconsOptions;\n root?: string;\n source?: boolean;\n /** Refresh generated TypeScript types via the dev server. Defaults to `true`. */\n typescript?: boolean;\n};\n\ntype Roots = {\n appRoot: string;\n root: string;\n};\n\nexport function lattice(options: LatticeViteOptions = {}): PluginOption[] {\n const { appRoot, root } = resolveRoots(options);\n const packages = discoverComponentPackages(appRoot);\n const plugins: PluginOption[] = [\n corePlugin(options),\n optionalPeersPlugin(),\n componentPackagesPlugin(packages, appRoot, resolveUiCssPath(options, appRoot, root), {\n requireComposer: true,\n }),\n typescriptPlugin(options),\n ];\n const iconOptions = resolveIconOptions(options, packages);\n\n if (iconOptions) {\n plugins.push(svgSprite(iconOptions));\n }\n\n return plugins;\n}\n\n/**\n * Resolve the real, on-disk `@lattice-php/ui/css` file that\n * `componentPackagesPlugin` should wrap — source-link mode reads straight\n * from the sibling `ui` package the same way `latticeConfig`'s own alias\n * does; package-link mode reads the installed `@lattice-php/ui` package's\n * own `exports[\"./css\"]` and joins it against that package's directory,\n * exactly what a plain `import \"@lattice-php/ui/css\"` would resolve to.\n * This is computed, not resolved through Node's module resolution: the\n * wrapper `@import`s this path but isn't read until Tailwind processes the\n * build, so the target only has to be correct here, not already built —\n * `require.resolve` would demand the (often not-yet-built) dist file exist\n * at config time and throw otherwise. Returns `undefined` (skipping the\n * wrapper) only when `@lattice-php/ui` itself isn't installed — an app that\n * hasn't run `npm install` yet degrades the same way `discoverComponentPackages`\n * used to for a missing `vendor/`.\n */\nfunction resolveUiCssPath(\n options: LatticeViteOptions,\n appRoot: string,\n root: string,\n): string | undefined {\n if (options.source) {\n return path.resolve(root, \"../ui/resources/css/lattice.css\");\n }\n\n const packageDir = resolveInstalledPackageDir(appRoot, \"@lattice-php/ui\");\n\n if (!packageDir) {\n return undefined;\n }\n\n try {\n const packageJson = JSON.parse(readFileSync(path.join(packageDir, \"package.json\"), \"utf8\"));\n const cssExport = packageJson.exports?.[\"./css\"];\n const cssRelative = typeof cssExport === \"string\" ? cssExport : cssExport?.default;\n\n return typeof cssRelative === \"string\" ? path.resolve(packageDir, cssRelative) : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Locate an installed npm package's directory by walking up from `startDir`\n * through each ancestor's `node_modules/<name>`, the same walk Node's own\n * module resolution does — stopping at the first one whose `package.json`\n * actually exists, without requiring anything the package exports to exist.\n */\nfunction resolveInstalledPackageDir(startDir: string, name: string): string | undefined {\n let dir = startDir;\n\n for (;;) {\n const candidate = path.join(dir, \"node_modules\", name);\n\n if (existsSync(path.join(candidate, \"package.json\"))) {\n return candidate;\n }\n\n const parent = path.dirname(dir);\n\n if (parent === dir) {\n return undefined;\n }\n\n dir = parent;\n }\n}\n\n/** A Composer package that contributes a Lattice component plugin. */\nexport type LatticeComponentPackage = {\n name: string;\n /** Absolute path to the package's installed directory. */\n dir: string;\n /** Absolute path to the package's JS plugin entry. */\n plugin: string;\n /** Absolute path to the package's stylesheet, when it declares one. */\n css?: string;\n /** Absolute path to the package's icon directory, when it declares one. */\n icons?: string;\n};\n\ntype LatticeManifest = { plugin?: string; css?: string; icons?: string };\n\ntype InstalledPackage = {\n name: string;\n \"install-path\"?: string;\n extra?: { lattice?: LatticeManifest };\n};\n\ntype RootPackageJson = {\n name?: string;\n extra?: { lattice?: LatticeManifest };\n};\n\nfunction resolveManifestPaths(\n manifest: LatticeManifest,\n dir: string,\n): Pick<LatticeComponentPackage, \"css\" | \"icons\"> {\n return {\n ...(typeof manifest.css === \"string\" ? { css: path.resolve(dir, manifest.css) } : {}),\n ...(typeof manifest.icons === \"string\" ? { icons: path.resolve(dir, manifest.icons) } : {}),\n };\n}\n\n/**\n * Resolve every Composer package that declares `extra.lattice.plugin` into an\n * absolute plugin-entry path. `installPathsRelativeTo` is `vendor/composer` (the\n * dir `installed.json` records its `install-path`s against).\n */\nexport function collectComponentPackages(\n installed: { packages?: InstalledPackage[] } | InstalledPackage[],\n installPathsRelativeTo: string,\n): LatticeComponentPackage[] {\n const packages = Array.isArray(installed) ? installed : (installed.packages ?? []);\n\n return packages.flatMap((pkg) => {\n const manifest = pkg.extra?.lattice ?? {};\n const entry = manifest.plugin;\n\n if (typeof entry !== \"string\") {\n return [];\n }\n\n const dir = path.resolve(installPathsRelativeTo, pkg[\"install-path\"] ?? `../${pkg.name}`);\n\n return [\n {\n name: pkg.name,\n dir,\n plugin: path.resolve(dir, entry),\n ...resolveManifestPaths(manifest, dir),\n },\n ];\n });\n}\n\n/**\n * Resolve the composer ROOT project's own `extra.lattice.plugin` — Composer\n * never lists the root package in `installed.json`, so a component package\n * declaring the plugin entry in its own composer.json would otherwise be\n * invisible to its own dev server (e.g. inside a testbench workbench, where\n * the package itself is the app root).\n */\nexport function collectRootComponentPackage(\n composerJson: RootPackageJson,\n appRoot: string,\n): LatticeComponentPackage[] {\n const manifest = composerJson.extra?.lattice ?? {};\n\n if (typeof manifest.plugin !== \"string\" || typeof composerJson.name !== \"string\") {\n return [];\n }\n\n return [\n {\n name: composerJson.name,\n dir: appRoot,\n plugin: path.resolve(appRoot, manifest.plugin),\n ...resolveManifestPaths(manifest, appRoot),\n },\n ];\n}\n\n/**\n * Read `<appRoot>/vendor/composer/installed.json` and `<appRoot>/composer.json`\n * and collect every component package they contribute.\n */\nexport function discoverComponentPackages(appRoot: string): LatticeComponentPackage[] {\n const composerDir = path.resolve(appRoot, \"vendor/composer\");\n const installedJsonPath = path.join(composerDir, \"installed.json\");\n\n let installed: LatticeComponentPackage[] = [];\n\n try {\n const raw = readFileSync(installedJsonPath, \"utf8\");\n installed = collectComponentPackages(JSON.parse(raw), composerDir);\n } catch {\n installed = [];\n }\n\n let root: LatticeComponentPackage[] = [];\n\n try {\n const raw = readFileSync(path.join(appRoot, \"composer.json\"), \"utf8\");\n root = collectRootComponentPackage(JSON.parse(raw), appRoot);\n } catch {\n root = [];\n }\n\n return [...installed, ...root];\n}\n\nconst VIRTUAL_PLUGINS_ID = \"virtual:lattice/plugins\";\nconst RESOLVED_VIRTUAL_PLUGINS_ID = `\\0${VIRTUAL_PLUGINS_ID}`;\nconst VIRTUAL_CSS_ID = \"virtual:lattice/css\";\nconst RESOLVED_VIRTUAL_CSS_ID = `\\0${VIRTUAL_CSS_ID}`;\nconst GENERATED_CSS_RELATIVE_PATH = \"node_modules/.lattice/component-packages.css\";\nconst GENERATED_WRAPPER_CSS_RELATIVE_PATH = \"node_modules/.lattice/lattice.css\";\n\n/**\n * An `@import` of every discovered package's own stylesheet, followed by a\n * Tailwind `@source` per package so its component TSX is scanned for\n * utility classes. `@import` must precede every other rule in a stylesheet —\n * interleaving `@source`/`@import` per package instead silently drops every\n * import that comes after the first `@source`.\n */\nfunction componentPackagesCss(packages: LatticeComponentPackage[]): string {\n const imports = packages.flatMap((pkg) =>\n pkg.css ? [`@import ${JSON.stringify(pkg.css)};`] : [],\n );\n const sources = packages.map((pkg) => `@source ${JSON.stringify(path.dirname(pkg.plugin))};`);\n\n return [...imports, ...sources].join(\"\\n\");\n}\n\n/**\n * Exposes the discovered component packages as `virtual:lattice/plugins` — a\n * module whose default export is the array of their plugin objects,\n * ready for `extendRegistry(registry, ...plugins)`. Also grants Vite filesystem\n * access to each package dir so its source compiles from `vendor/` (or a symlink).\n *\n * Also wires the stylesheet counterpart: `@lattice-php/lattice/css` and\n * `@lattice-php/ui/css` normally resolve straight to the published, static\n * `lattice.css` — which must stay self-contained, since plenty of consumers\n * (the docs site, the standalone bundle, a package building itself) import it\n * without this plugin at all. When `uiCssPath` is given (the app actually\n * uses this plugin), both specifiers are instead aliased to a generated\n * wrapper — `@import` of the real stylesheet plus every discovered package's\n * `@source`/`@import` — so a consumer's existing single import picks up every\n * package with no per-package import of their own. `virtual:lattice/css`\n * exposes just the package-only half the same way, for anyone composing their\n * own wrapper. Tailwind's `@import` resolver reads the resolved file straight\n * off disk — it never calls back into a Vite plugin's `load` — so neither can\n * serve generated content directly; both are aliased to real files instead,\n * generated into `node_modules/.lattice/` in `buildStart`, and Vite's own\n * resolver (which Tailwind delegates to for `@import`) follows the alias to\n * them like any other file.\n */\nexport function componentPackagesPlugin(\n packages: LatticeComponentPackage[],\n appRoot?: string,\n uiCssPath?: string,\n options: { requireComposer?: boolean } = {},\n): Plugin {\n const installedJsonPath = appRoot\n ? path.resolve(appRoot, \"vendor/composer/installed.json\")\n : undefined;\n let generatedCssPath = \"\";\n let generatedWrapperCssPath = \"\";\n\n return {\n name: \"lattice:component-packages\",\n config(config) {\n const workspaceRoot = searchForWorkspaceRoot(config?.root ?? process.cwd());\n\n generatedCssPath = path.resolve(workspaceRoot, GENERATED_CSS_RELATIVE_PATH);\n\n // Vite's mergeAlias puts plugin-config aliases in front of the user config's,\n // so this specific `/css` alias wins over a user's broader package-dir alias.\n // Among plugins, a later plugin's alias wins on a key collision — this\n // plugin runs after `corePlugin` in `lattice()`, so it wins over\n // `latticeConfig`'s source-mode `@lattice-php/*/css` aliases too.\n const alias: Record<string, string> = {\n [VIRTUAL_CSS_ID]: generatedCssPath,\n ...(uiCssPath\n ? (() => {\n generatedWrapperCssPath = path.resolve(\n workspaceRoot,\n GENERATED_WRAPPER_CSS_RELATIVE_PATH,\n );\n\n return {\n \"@lattice-php/lattice/css\": generatedWrapperCssPath,\n \"@lattice-php/ui/css\": generatedWrapperCssPath,\n };\n })()\n : {}),\n ...Object.fromEntries(\n packages.flatMap((pkg) => (pkg.css ? [[`@${pkg.name}/css`, pkg.css]] : [])),\n ),\n };\n\n return {\n resolve: { alias },\n server: { fs: { allow: [workspaceRoot, ...packages.map((pkg) => pkg.dir)] } },\n };\n },\n buildStart() {\n if (generatedCssPath) {\n mkdirSync(path.dirname(generatedCssPath), { recursive: true });\n writeFileSync(generatedCssPath, componentPackagesCss(packages));\n }\n\n if (generatedWrapperCssPath && uiCssPath) {\n mkdirSync(path.dirname(generatedWrapperCssPath), { recursive: true });\n writeFileSync(\n generatedWrapperCssPath,\n [`@import ${JSON.stringify(uiCssPath)};`, componentPackagesCss(packages)].join(\"\\n\"),\n );\n }\n },\n configResolved(config) {\n // A consumer building for production without its Composer dependencies\n // would otherwise silently ship no component package at all. Only the\n // build command is gated: this package's own tests spin up dev/SSR\n // servers through `lattice()` with no vendor/ on purpose.\n if (\n options.requireComposer &&\n installedJsonPath &&\n config.command === \"build\" &&\n !existsSync(installedJsonPath)\n ) {\n throw new Error(\n `Lattice couldn't find ${installedJsonPath}. Run \\`composer install\\` before building.`,\n );\n }\n },\n configureServer(server) {\n if (!installedJsonPath) {\n return;\n }\n\n // A composer change can add or remove a component package, which this\n // plugin only discovers at startup — restart so it re-runs discovery\n // instead of silently continuing to serve the stale set.\n server.watcher.add(installedJsonPath);\n server.watcher.on(\"change\", (file) => {\n if (file === installedJsonPath) {\n server.restart();\n }\n });\n },\n resolveId(id) {\n if (id === VIRTUAL_PLUGINS_ID) {\n return RESOLVED_VIRTUAL_PLUGINS_ID;\n }\n\n if (id === VIRTUAL_CSS_ID) {\n return RESOLVED_VIRTUAL_CSS_ID;\n }\n\n return null;\n },\n load(id) {\n if (id === RESOLVED_VIRTUAL_CSS_ID) {\n return componentPackagesCss(packages);\n }\n\n if (id !== RESOLVED_VIRTUAL_PLUGINS_ID) {\n return null;\n }\n\n const imports = packages\n .map((pkg, index) => `import p${index} from ${JSON.stringify(pkg.plugin)};`)\n .join(\"\\n\");\n const list = packages.map((_, index) => `p${index}`).join(\", \");\n\n return `${imports}\\nexport default [${list}];\\n`;\n },\n };\n}\n\nexport function latticeConfig(options: LatticeViteOptions = {}): ConfigWithTest {\n const { appRoot, root } = resolveRoots(options);\n\n return {\n resolve: {\n // A react alias would break SSR: Vite only externalizes bare specifiers,\n // so an absolute path inlines react's CJS into the SSR module runner.\n // `dedupe` alone keeps the app on a single React copy, symlinks included.\n ...(options.source\n ? {\n alias: {\n \"@lattice-php/lattice/css\": path.resolve(root, \"../ui/resources/css/lattice.css\"),\n \"@lattice-php/lattice\": path.resolve(root, \"resources/js\"),\n \"@lattice-php/action\": path.resolve(root, \"../action/resources/js\"),\n \"@lattice-php/core\": path.resolve(root, \"../core/resources/js\"),\n \"@lattice-php/form\": path.resolve(root, \"../form/resources/js\"),\n \"@lattice-php/table\": path.resolve(root, \"../table/resources/js\"),\n \"@lattice-php/ui/css\": path.resolve(root, \"../ui/resources/css/lattice.css\"),\n \"@lattice-php/ui\": path.resolve(root, \"../ui/resources/js\"),\n },\n }\n : {}),\n dedupe: [\"@inertiajs/react\", \"react\", \"react-dom\"],\n },\n server: options.source\n ? {\n fs: {\n allow: [searchForWorkspaceRoot(appRoot), root],\n },\n }\n : undefined,\n test: {\n server: {\n deps: {\n inline: [\n \"@lattice-php/lattice\",\n \"@lattice-php/action\",\n \"@lattice-php/core\",\n \"@lattice-php/form\",\n \"@lattice-php/table\",\n \"@lattice-php/ui\",\n /[/\\\\]lattice[/\\\\]dist[/\\\\]/,\n /[/\\\\]lattice[/\\\\]node_modules[/\\\\]@radix-ui[/\\\\]/,\n /[/\\\\]lattice[/\\\\]node_modules[/\\\\]@tiptap[/\\\\]/,\n /[/\\\\]lattice[/\\\\]node_modules[/\\\\]react-i18next[/\\\\]/,\n ],\n },\n },\n },\n };\n}\n\nfunction corePlugin(options: LatticeViteOptions): Plugin {\n return {\n name: \"lattice\",\n config() {\n return latticeConfig(options);\n },\n };\n}\n\nconst OPTIONAL_PEER_STUB_PREFIX = \"\\0lattice-optional-peer/\";\n\n/**\n * Real-time listeners statically import their optional Echo peers. A consumer\n * that never uses real-time should still build, so stub a missing peer with\n * hooks that throw — the `RealtimeListeners` error boundary then degrades\n * gracefully and warns to install the peer, exactly as when it is absent.\n */\nconst OPTIONAL_PEER_STUBS: Record<string, string> = {\n \"@laravel/echo-react\": [\n \"const missing = () => {\",\n \" throw new Error(\",\n ' \"[lattice] Real-time listeners require @laravel/echo-react. Install it and call configureEcho().\",',\n \" );\",\n \"};\",\n \"export const useEcho = missing;\",\n \"export const useEchoPublic = missing;\",\n \"export const useEchoPresence = missing;\",\n \"export const useEchoNotification = missing;\",\n ].join(\"\\n\"),\n};\n\nfunction optionalPeersPlugin(): Plugin {\n return {\n name: \"lattice:optional-peers\",\n enforce: \"pre\",\n async resolveId(id) {\n if (!Object.prototype.hasOwnProperty.call(OPTIONAL_PEER_STUBS, id)) {\n return null;\n }\n\n const installed = await this.resolve(id, undefined, { skipSelf: true });\n\n return installed ? null : `${OPTIONAL_PEER_STUB_PREFIX}${id}`;\n },\n load(id) {\n if (!id.startsWith(OPTIONAL_PEER_STUB_PREFIX)) {\n return null;\n }\n\n return OPTIONAL_PEER_STUBS[id.slice(OPTIONAL_PEER_STUB_PREFIX.length)] ?? null;\n },\n };\n}\n\n/**\n * Refreshes `node.props` typings from the app's own `php artisan\n * lattice:typescript` whenever the dev server starts — installing or updating\n * a component package would otherwise leave its generated types stale until\n * someone remembers to run the command by hand. Dev-server only: a production\n * build machine may not have PHP installed, and the generated file is a dev\n * ergonomics artifact, not a build input.\n *\n * Module-private like its siblings `optionalPeersPlugin`/`corePlugin` — the\n * `refreshTypeScriptTypes` DI seam it defers to lives in\n * `./vite-typescript-refresh`, which isn't part of the published `vite`\n * subpath either (see that module for why).\n */\nfunction typescriptPlugin(options: LatticeViteOptions): Plugin {\n return {\n name: \"lattice:typescript\",\n apply: \"serve\",\n configureServer(server) {\n const typescript = options.typescript ?? true;\n\n if (typescript === false) {\n return;\n }\n\n const { appRoot } = resolveRoots(options);\n\n refreshTypeScriptTypes(appRoot, server.config.logger);\n },\n };\n}\n\nexport function resolveIconOptions(\n options: LatticeViteOptions,\n packages: LatticeComponentPackage[] = [],\n): SvgSpriteOptions | null {\n const icons = options.icons ?? true;\n\n if (icons === false) {\n return null;\n }\n\n const { root } = resolveRoots(options);\n const iconOptions = icons === true ? {} : icons;\n const { dirs = [], dts, ...spriteOptions } = iconOptions;\n const defaultTypes = {\n file: \"resources/js/types/sprite-icons.ts\",\n augmentModule: \"@lattice-php/ui\",\n augmentInterface: \"KnownIcons\",\n };\n\n return {\n ...spriteOptions,\n iconDirs: [\n path.resolve(root, \"../ui/resources/icons\"),\n ...packages.flatMap((pkg) => (pkg.icons ? [pkg.icons] : [])),\n ...dirs,\n ],\n ...(dts === false ? {} : { dts: { ...defaultTypes, ...dts } }),\n };\n}\n\n/**\n * Builds the same icon sprite the `lattice()` Vite plugin serves, outside of\n * Vite: ui's icon set, every discovered component package's icons, and the\n * app's own `icons.dirs`. The result is a `SpriteValue` for `SpriteProvider`\n * (`href: \"\"` inlines the markup), which is what a Storybook, a design-system\n * export, a prerender script, or a test needs to render `Icon` without a\n * dev server or an emitted asset.\n */\nexport function buildLatticeSprite(options: LatticeViteOptions = {}): Sprite & { href: \"\" } {\n const { appRoot } = resolveRoots(options);\n const iconOptions = resolveIconOptions(options, discoverComponentPackages(appRoot));\n\n if (!iconOptions) {\n return { href: \"\", ids: [], source: \"\" };\n }\n\n const { iconDirs = [], symbolId, svgoConfig } = iconOptions;\n\n return { href: \"\", ...buildSprite(iconDirs, { symbolId, svgoConfig }) };\n}\n\nfunction resolveRoots(options: LatticeViteOptions): Roots {\n const appRoot = options.appRoot ?? process.cwd();\n const root = options.root ?? path.resolve(appRoot, \"vendor/lattice-php/lattice\");\n\n return { appRoot, root };\n}\n"],"mappings":";;;;;;AAuCA,SAAgB,QAAQ,UAA8B,CAAC,GAAmB;CACxE,MAAM,EAAE,SAAS,SAAS,aAAa,OAAO;CAC9C,MAAM,WAAW,0BAA0B,OAAO;CAClD,MAAM,UAA0B;EAC9B,WAAW,OAAO;EAClB,oBAAoB;EACpB,wBAAwB,UAAU,SAAS,iBAAiB,SAAS,SAAS,IAAI,GAAG,EACnF,iBAAiB,KACnB,CAAC;EACD,iBAAiB,OAAO;CAC1B;CACA,MAAM,cAAc,mBAAmB,SAAS,QAAQ;CAExD,IAAI,aACF,QAAQ,KAAK,UAAU,WAAW,CAAC;CAGrC,OAAO;AACT;;;;;;;;;;;;;;;;;AAkBA,SAAS,iBACP,SACA,SACA,MACoB;CACpB,IAAI,QAAQ,QACV,OAAO,KAAK,QAAQ,MAAM,iCAAiC;CAG7D,MAAM,aAAa,2BAA2B,SAAS,iBAAiB;CAExE,IAAI,CAAC,YACH;CAGF,IAAI;EAEF,MAAM,YADc,KAAK,MAAM,aAAa,KAAK,KAAK,YAAY,cAAc,GAAG,MAAM,CACvE,CAAA,CAAY,UAAU;EACxC,MAAM,cAAc,OAAO,cAAc,WAAW,YAAY,WAAW;EAE3E,OAAO,OAAO,gBAAgB,WAAW,KAAK,QAAQ,YAAY,WAAW,IAAI,KAAA;CACnF,QAAQ;EACN;CACF;AACF;;;;;;;AAQA,SAAS,2BAA2B,UAAkB,MAAkC;CACtF,IAAI,MAAM;CAEV,SAAS;EACP,MAAM,YAAY,KAAK,KAAK,KAAK,gBAAgB,IAAI;EAErD,IAAI,WAAW,KAAK,KAAK,WAAW,cAAc,CAAC,GACjD,OAAO;EAGT,MAAM,SAAS,KAAK,QAAQ,GAAG;EAE/B,IAAI,WAAW,KACb;EAGF,MAAM;CACR;AACF;AA4BA,SAAS,qBACP,UACA,KACgD;CAChD,O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AC;EAAG,QAAQ;CAAG;CAGzC,MAAM,EAAE,WAAW,CAAC,GAAG,UAAU,eAAe;CAEhD,OAAO;EAAE,MAAM;EAAI,GAAG,YAAY,UAAU;GAAE;GAAU;EAAW,CAAC;CAAE;AACxE;AAEA,SAAS,aAAa,SAAoC;CACxD,MAAM,UAAU,QAAQ,WAAW,QAAQ,IAAI;CAG/C,OAAO;EAAE;EAAS,MAFL,QAAQ,QAAQ,KAAK,QAAQ,SAAS,4BAA4B;CAExD;AACzB"}
|
|
1
|
+
{"version":3,"file":"vite.js","names":[],"sources":["../resources/js/vite.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { buildSprite, svgSprite } from \"@lattice-php/vite-svg-sprite\";\nimport type { IconTypesOptions, Sprite, SvgSpriteOptions } from \"@lattice-php/vite-svg-sprite\";\nimport { searchForWorkspaceRoot } from \"vite\";\nimport type { Plugin, PluginOption, UserConfig } from \"vite\";\nimport { refreshTypeScriptTypes } from \"./vite-typescript-refresh.ts\";\n\ntype InlineDependency = string | RegExp;\n\ntype ConfigWithTest = UserConfig & {\n test?: {\n server?: {\n deps?: {\n inline?: InlineDependency[];\n };\n };\n };\n};\n\nexport type LatticeViteIconsOptions = Omit<SvgSpriteOptions, \"dts\" | \"iconDirs\"> & {\n dirs?: string[];\n dts?: Partial<IconTypesOptions> | false;\n};\n\nexport type LatticeViteOptions = {\n appRoot?: string;\n icons?: boolean | LatticeViteIconsOptions;\n root?: string;\n source?: boolean;\n /** Refresh generated TypeScript types via the dev server. Defaults to `true`. */\n typescript?: boolean;\n};\n\ntype Roots = {\n appRoot: string;\n root: string;\n};\n\nexport function lattice(options: LatticeViteOptions = {}): PluginOption[] {\n const { appRoot, root } = resolveRoots(options);\n const packages = discoverComponentPackages(appRoot);\n const plugins: PluginOption[] = [\n corePlugin(options),\n optionalPeersPlugin(),\n componentPackagesPlugin(packages, appRoot, resolveUiCssPath(options, appRoot, root), {\n requireComposer: true,\n frameworkSources: resolveFrameworkSourcePaths(options, appRoot, root),\n }),\n typescriptPlugin(options),\n ];\n const iconOptions = resolveIconOptions(options, packages);\n\n if (iconOptions) {\n plugins.push(svgSprite(iconOptions));\n }\n\n return plugins;\n}\n\n/**\n * Resolve the real, on-disk `@lattice-php/ui/css` file that\n * `componentPackagesPlugin` should wrap — source-link mode reads straight\n * from the sibling `ui` package the same way `latticeConfig`'s own alias\n * does; package-link mode reads the installed `@lattice-php/ui` package's\n * own `exports[\"./css\"]` and joins it against that package's directory,\n * exactly what a plain `import \"@lattice-php/ui/css\"` would resolve to.\n * This is computed, not resolved through Node's module resolution: the\n * wrapper `@import`s this path but isn't read until Tailwind processes the\n * build, so the target only has to be correct here, not already built —\n * `require.resolve` would demand the (often not-yet-built) dist file exist\n * at config time and throw otherwise. Returns `undefined` (skipping the\n * wrapper) only when `@lattice-php/ui` itself isn't installed — an app that\n * hasn't run `npm install` yet degrades the same way `discoverComponentPackages`\n * used to for a missing `vendor/`.\n */\nfunction resolveUiCssPath(\n options: LatticeViteOptions,\n appRoot: string,\n root: string,\n): string | undefined {\n if (options.source) {\n return path.resolve(root, \"../ui/resources/css/lattice.css\");\n }\n\n const packageDir = resolveInstalledPackageDir(appRoot, \"@lattice-php/ui\");\n\n if (!packageDir) {\n return undefined;\n }\n\n try {\n const packageJson = JSON.parse(readFileSync(path.join(packageDir, \"package.json\"), \"utf8\"));\n const cssExport = packageJson.exports?.[\"./css\"];\n const cssRelative = typeof cssExport === \"string\" ? cssExport : cssExport?.default;\n\n return typeof cssRelative === \"string\" ? path.resolve(packageDir, cssRelative) : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Every npm package whose components carry Tailwind utilities, paired with its\n * directory in this monorepo. `@lattice-php/ui`'s stylesheet `@source`s its own\n * compiled output for consumers that import it without this plugin, and stays\n * on the list so the set is \"all of them\" rather than \"all but the one another\n * file happens to cover\". Nothing reached the packages that depend on ui, so a\n * utility only they use — `px-lt-cell-x`, table's\n * `md:grid-cols-[var(--lattice-table-columns)]` row grid — was never compiled\n * and the component rendered unstyled with no error anywhere.\n */\nconst FRAMEWORK_COMPONENT_PACKAGES = [\n { name: \"@lattice-php/lattice\", dir: \"framework\" },\n { name: \"@lattice-php/core\", dir: \"core\" },\n { name: \"@lattice-php/action\", dir: \"action\" },\n { name: \"@lattice-php/form\", dir: \"form\" },\n { name: \"@lattice-php/table\", dir: \"table\" },\n { name: \"@lattice-php/ui\", dir: \"ui\" },\n];\n\n/**\n * The directories Tailwind must scan for those packages' utilities — the\n * uncompiled component sources in source-link mode, each installed package's\n * compiled output otherwise. An app's `node_modules` is outside Tailwind's\n * automatic content detection, so these only get scanned when named here.\n * A package that isn't installed is skipped rather than fatal, matching\n * `resolveUiCssPath`.\n */\nfunction resolveFrameworkSourcePaths(\n options: LatticeViteOptions,\n appRoot: string,\n root: string,\n): string[] {\n if (options.source) {\n return FRAMEWORK_COMPONENT_PACKAGES.map(({ dir }) =>\n path.resolve(root, \"..\", dir, \"resources/js\"),\n );\n }\n\n return FRAMEWORK_COMPONENT_PACKAGES.flatMap(({ name }) => {\n const packageDir = resolveInstalledPackageDir(appRoot, name);\n const distDir = packageDir ? resolvePackageDistDir(packageDir) : undefined;\n\n return distDir ? [distDir] : [];\n });\n}\n\n/**\n * The directory holding a package's compiled output, read off the entry point\n * it publishes rather than assumed to be `dist/`, so a package that changes\n * its build output keeps being scanned.\n */\nfunction resolvePackageDistDir(packageDir: string): string | undefined {\n try {\n const packageJson = JSON.parse(readFileSync(path.join(packageDir, \"package.json\"), \"utf8\"));\n const entry = packageJson.exports?.[\".\"]?.import ?? packageJson.module ?? packageJson.main;\n\n return typeof entry === \"string\" ? path.resolve(packageDir, path.dirname(entry)) : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Locate an installed npm package's directory by walking up from `startDir`\n * through each ancestor's `node_modules/<name>`, the same walk Node's own\n * module resolution does — stopping at the first one whose `package.json`\n * actually exists, without requiring anything the package exports to exist.\n */\nfunction resolveInstalledPackageDir(startDir: string, name: string): string | undefined {\n let dir = startDir;\n\n for (;;) {\n const candidate = path.join(dir, \"node_modules\", name);\n\n if (existsSync(path.join(candidate, \"package.json\"))) {\n return candidate;\n }\n\n const parent = path.dirname(dir);\n\n if (parent === dir) {\n return undefined;\n }\n\n dir = parent;\n }\n}\n\n/** A Composer package that contributes a Lattice component plugin. */\nexport type LatticeComponentPackage = {\n name: string;\n /** Absolute path to the package's installed directory. */\n dir: string;\n /** Absolute path to the package's JS plugin entry. */\n plugin: string;\n /** Absolute path to the package's stylesheet, when it declares one. */\n css?: string;\n /** Absolute path to the package's icon directory, when it declares one. */\n icons?: string;\n};\n\ntype LatticeManifest = { plugin?: string; css?: string; icons?: string };\n\ntype InstalledPackage = {\n name: string;\n \"install-path\"?: string;\n extra?: { lattice?: LatticeManifest };\n};\n\ntype RootPackageJson = {\n name?: string;\n extra?: { lattice?: LatticeManifest };\n};\n\nfunction resolveManifestPaths(\n manifest: LatticeManifest,\n dir: string,\n): Pick<LatticeComponentPackage, \"css\" | \"icons\"> {\n return {\n ...(typeof manifest.css === \"string\" ? { css: path.resolve(dir, manifest.css) } : {}),\n ...(typeof manifest.icons === \"string\" ? { icons: path.resolve(dir, manifest.icons) } : {}),\n };\n}\n\n/**\n * Resolve every Composer package that declares `extra.lattice.plugin` into an\n * absolute plugin-entry path. `installPathsRelativeTo` is `vendor/composer` (the\n * dir `installed.json` records its `install-path`s against).\n */\nexport function collectComponentPackages(\n installed: { packages?: InstalledPackage[] } | InstalledPackage[],\n installPathsRelativeTo: string,\n): LatticeComponentPackage[] {\n const packages = Array.isArray(installed) ? installed : (installed.packages ?? []);\n\n return packages.flatMap((pkg) => {\n const manifest = pkg.extra?.lattice ?? {};\n const entry = manifest.plugin;\n\n if (typeof entry !== \"string\") {\n return [];\n }\n\n const dir = path.resolve(installPathsRelativeTo, pkg[\"install-path\"] ?? `../${pkg.name}`);\n\n return [\n {\n name: pkg.name,\n dir,\n plugin: path.resolve(dir, entry),\n ...resolveManifestPaths(manifest, dir),\n },\n ];\n });\n}\n\n/**\n * Resolve the composer ROOT project's own `extra.lattice.plugin` — Composer\n * never lists the root package in `installed.json`, so a component package\n * declaring the plugin entry in its own composer.json would otherwise be\n * invisible to its own dev server (e.g. inside a testbench workbench, where\n * the package itself is the app root).\n */\nexport function collectRootComponentPackage(\n composerJson: RootPackageJson,\n appRoot: string,\n): LatticeComponentPackage[] {\n const manifest = composerJson.extra?.lattice ?? {};\n\n if (typeof manifest.plugin !== \"string\" || typeof composerJson.name !== \"string\") {\n return [];\n }\n\n return [\n {\n name: composerJson.name,\n dir: appRoot,\n plugin: path.resolve(appRoot, manifest.plugin),\n ...resolveManifestPaths(manifest, appRoot),\n },\n ];\n}\n\n/**\n * Read `<appRoot>/vendor/composer/installed.json` and `<appRoot>/composer.json`\n * and collect every component package they contribute.\n */\nexport function discoverComponentPackages(appRoot: string): LatticeComponentPackage[] {\n const composerDir = path.resolve(appRoot, \"vendor/composer\");\n const installedJsonPath = path.join(composerDir, \"installed.json\");\n\n let installed: LatticeComponentPackage[] = [];\n\n try {\n const raw = readFileSync(installedJsonPath, \"utf8\");\n installed = collectComponentPackages(JSON.parse(raw), composerDir);\n } catch {\n installed = [];\n }\n\n let root: LatticeComponentPackage[] = [];\n\n try {\n const raw = readFileSync(path.join(appRoot, \"composer.json\"), \"utf8\");\n root = collectRootComponentPackage(JSON.parse(raw), appRoot);\n } catch {\n root = [];\n }\n\n return [...installed, ...root];\n}\n\nconst VIRTUAL_PLUGINS_ID = \"virtual:lattice/plugins\";\nconst RESOLVED_VIRTUAL_PLUGINS_ID = `\\0${VIRTUAL_PLUGINS_ID}`;\nconst VIRTUAL_CSS_ID = \"virtual:lattice/css\";\nconst RESOLVED_VIRTUAL_CSS_ID = `\\0${VIRTUAL_CSS_ID}`;\nconst GENERATED_CSS_RELATIVE_PATH = \"node_modules/.lattice/component-packages.css\";\nconst GENERATED_WRAPPER_CSS_RELATIVE_PATH = \"node_modules/.lattice/lattice.css\";\n\n/**\n * An `@import` of every discovered package's own stylesheet, followed by a\n * Tailwind `@source` per package so its component TSX is scanned for\n * utility classes. `@import` must precede every other rule in a stylesheet —\n * interleaving `@source`/`@import` per package instead silently drops every\n * import that comes after the first `@source`.\n */\nfunction componentPackagesCss(packages: LatticeComponentPackage[]): string {\n const imports = packages.flatMap((pkg) =>\n pkg.css ? [`@import ${JSON.stringify(pkg.css)};`] : [],\n );\n const sources = packages.map((pkg) => `@source ${JSON.stringify(path.dirname(pkg.plugin))};`);\n\n return [...imports, ...sources].join(\"\\n\");\n}\n\n/**\n * Exposes the discovered component packages as `virtual:lattice/plugins` — a\n * module whose default export is the array of their plugin objects,\n * ready for `extendRegistry(registry, ...plugins)`. Also grants Vite filesystem\n * access to each package dir so its source compiles from `vendor/` (or a symlink).\n *\n * Also wires the stylesheet counterpart: `@lattice-php/lattice/css` and\n * `@lattice-php/ui/css` normally resolve straight to the published, static\n * `lattice.css` — which must stay self-contained, since plenty of consumers\n * (the docs site, the standalone bundle, a package building itself) import it\n * without this plugin at all. When `uiCssPath` is given (the app actually\n * uses this plugin), both specifiers are instead aliased to a generated\n * wrapper — `@import` of the real stylesheet, every discovered package's\n * `@source`/`@import`, and a `@source` per framework npm package — so a\n * consumer's existing single import picks up every package's utilities with\n * no per-package import or `@source` of their own. `virtual:lattice/css`\n * exposes just the package-only half the same way, for anyone composing their\n * own wrapper. Tailwind's `@import` resolver reads the resolved file straight\n * off disk — it never calls back into a Vite plugin's `load` — so neither can\n * serve generated content directly; both are aliased to real files instead,\n * generated into `node_modules/.lattice/` in `buildStart`, and Vite's own\n * resolver (which Tailwind delegates to for `@import`) follows the alias to\n * them like any other file.\n */\nexport function componentPackagesPlugin(\n packages: LatticeComponentPackage[],\n appRoot?: string,\n uiCssPath?: string,\n options: { requireComposer?: boolean; frameworkSources?: string[] } = {},\n): Plugin {\n const installedJsonPath = appRoot\n ? path.resolve(appRoot, \"vendor/composer/installed.json\")\n : undefined;\n let generatedCssPath = \"\";\n let generatedWrapperCssPath = \"\";\n\n return {\n name: \"lattice:component-packages\",\n config(config) {\n const workspaceRoot = searchForWorkspaceRoot(config?.root ?? process.cwd());\n\n generatedCssPath = path.resolve(workspaceRoot, GENERATED_CSS_RELATIVE_PATH);\n\n // Vite's mergeAlias puts plugin-config aliases in front of the user config's,\n // so this specific `/css` alias wins over a user's broader package-dir alias.\n // Among plugins, a later plugin's alias wins on a key collision — this\n // plugin runs after `corePlugin` in `lattice()`, so it wins over\n // `latticeConfig`'s source-mode `@lattice-php/*/css` aliases too.\n const alias: Record<string, string> = {\n [VIRTUAL_CSS_ID]: generatedCssPath,\n ...(uiCssPath\n ? (() => {\n generatedWrapperCssPath = path.resolve(\n workspaceRoot,\n GENERATED_WRAPPER_CSS_RELATIVE_PATH,\n );\n\n return {\n \"@lattice-php/lattice/css\": generatedWrapperCssPath,\n \"@lattice-php/ui/css\": generatedWrapperCssPath,\n };\n })()\n : {}),\n ...Object.fromEntries(\n packages.flatMap((pkg) => (pkg.css ? [[`@${pkg.name}/css`, pkg.css]] : [])),\n ),\n };\n\n return {\n resolve: { alias },\n server: { fs: { allow: [workspaceRoot, ...packages.map((pkg) => pkg.dir)] } },\n };\n },\n buildStart() {\n if (generatedCssPath) {\n mkdirSync(path.dirname(generatedCssPath), { recursive: true });\n writeFileSync(generatedCssPath, componentPackagesCss(packages));\n }\n\n if (generatedWrapperCssPath && uiCssPath) {\n mkdirSync(path.dirname(generatedWrapperCssPath), { recursive: true });\n writeFileSync(\n generatedWrapperCssPath,\n [\n `@import ${JSON.stringify(uiCssPath)};`,\n componentPackagesCss(packages),\n ...(options.frameworkSources ?? []).map((dir) => `@source ${JSON.stringify(dir)};`),\n ]\n .filter((section) => section !== \"\")\n .join(\"\\n\"),\n );\n }\n },\n configResolved(config) {\n // A consumer building for production without its Composer dependencies\n // would otherwise silently ship no component package at all. Only the\n // build command is gated: this package's own tests spin up dev/SSR\n // servers through `lattice()` with no vendor/ on purpose.\n if (\n options.requireComposer &&\n installedJsonPath &&\n config.command === \"build\" &&\n !existsSync(installedJsonPath)\n ) {\n throw new Error(\n `Lattice couldn't find ${installedJsonPath}. Run \\`composer install\\` before building.`,\n );\n }\n },\n configureServer(server) {\n if (!installedJsonPath) {\n return;\n }\n\n // A composer change can add or remove a component package, which this\n // plugin only discovers at startup — restart so it re-runs discovery\n // instead of silently continuing to serve the stale set.\n server.watcher.add(installedJsonPath);\n server.watcher.on(\"change\", (file) => {\n if (file === installedJsonPath) {\n server.restart();\n }\n });\n },\n resolveId(id) {\n if (id === VIRTUAL_PLUGINS_ID) {\n return RESOLVED_VIRTUAL_PLUGINS_ID;\n }\n\n if (id === VIRTUAL_CSS_ID) {\n return RESOLVED_VIRTUAL_CSS_ID;\n }\n\n return null;\n },\n load(id) {\n if (id === RESOLVED_VIRTUAL_CSS_ID) {\n return componentPackagesCss(packages);\n }\n\n if (id !== RESOLVED_VIRTUAL_PLUGINS_ID) {\n return null;\n }\n\n const imports = packages\n .map((pkg, index) => `import p${index} from ${JSON.stringify(pkg.plugin)};`)\n .join(\"\\n\");\n const list = packages.map((_, index) => `p${index}`).join(\", \");\n\n return `${imports}\\nexport default [${list}];\\n`;\n },\n };\n}\n\nexport function latticeConfig(options: LatticeViteOptions = {}): ConfigWithTest {\n const { appRoot, root } = resolveRoots(options);\n\n return {\n resolve: {\n // A react alias would break SSR: Vite only externalizes bare specifiers,\n // so an absolute path inlines react's CJS into the SSR module runner.\n // `dedupe` alone keeps the app on a single React copy, symlinks included.\n ...(options.source\n ? {\n alias: {\n \"@lattice-php/lattice/css\": path.resolve(root, \"../ui/resources/css/lattice.css\"),\n \"@lattice-php/lattice\": path.resolve(root, \"resources/js\"),\n \"@lattice-php/action\": path.resolve(root, \"../action/resources/js\"),\n \"@lattice-php/core\": path.resolve(root, \"../core/resources/js\"),\n \"@lattice-php/form\": path.resolve(root, \"../form/resources/js\"),\n \"@lattice-php/table\": path.resolve(root, \"../table/resources/js\"),\n \"@lattice-php/ui/css\": path.resolve(root, \"../ui/resources/css/lattice.css\"),\n \"@lattice-php/ui\": path.resolve(root, \"../ui/resources/js\"),\n },\n }\n : {}),\n dedupe: [\"@inertiajs/react\", \"react\", \"react-dom\"],\n },\n server: options.source\n ? {\n fs: {\n allow: [searchForWorkspaceRoot(appRoot), root],\n },\n }\n : undefined,\n test: {\n server: {\n deps: {\n inline: [\n \"@lattice-php/lattice\",\n \"@lattice-php/action\",\n \"@lattice-php/core\",\n \"@lattice-php/form\",\n \"@lattice-php/table\",\n \"@lattice-php/ui\",\n /[/\\\\]lattice[/\\\\]dist[/\\\\]/,\n /[/\\\\]lattice[/\\\\]node_modules[/\\\\]@radix-ui[/\\\\]/,\n /[/\\\\]lattice[/\\\\]node_modules[/\\\\]@tiptap[/\\\\]/,\n /[/\\\\]lattice[/\\\\]node_modules[/\\\\]react-i18next[/\\\\]/,\n ],\n },\n },\n },\n };\n}\n\nfunction corePlugin(options: LatticeViteOptions): Plugin {\n return {\n name: \"lattice\",\n config() {\n return latticeConfig(options);\n },\n };\n}\n\nconst OPTIONAL_PEER_STUB_PREFIX = \"\\0lattice-optional-peer/\";\n\n/**\n * Real-time listeners statically import their optional Echo peers. A consumer\n * that never uses real-time should still build, so stub a missing peer with\n * hooks that throw — the `RealtimeListeners` error boundary then degrades\n * gracefully and warns to install the peer, exactly as when it is absent.\n */\nconst OPTIONAL_PEER_STUBS: Record<string, string> = {\n \"@laravel/echo-react\": [\n \"const missing = () => {\",\n \" throw new Error(\",\n ' \"[lattice] Real-time listeners require @laravel/echo-react. Install it and call configureEcho().\",',\n \" );\",\n \"};\",\n \"export const useEcho = missing;\",\n \"export const useEchoPublic = missing;\",\n \"export const useEchoPresence = missing;\",\n \"export const useEchoNotification = missing;\",\n ].join(\"\\n\"),\n};\n\nfunction optionalPeersPlugin(): Plugin {\n return {\n name: \"lattice:optional-peers\",\n enforce: \"pre\",\n async resolveId(id) {\n if (!Object.prototype.hasOwnProperty.call(OPTIONAL_PEER_STUBS, id)) {\n return null;\n }\n\n const installed = await this.resolve(id, undefined, { skipSelf: true });\n\n return installed ? null : `${OPTIONAL_PEER_STUB_PREFIX}${id}`;\n },\n load(id) {\n if (!id.startsWith(OPTIONAL_PEER_STUB_PREFIX)) {\n return null;\n }\n\n return OPTIONAL_PEER_STUBS[id.slice(OPTIONAL_PEER_STUB_PREFIX.length)] ?? null;\n },\n };\n}\n\n/**\n * Refreshes `node.props` typings from the app's own `php artisan\n * lattice:typescript` whenever the dev server starts — installing or updating\n * a component package would otherwise leave its generated types stale until\n * someone remembers to run the command by hand. Dev-server only: a production\n * build machine may not have PHP installed, and the generated file is a dev\n * ergonomics artifact, not a build input.\n *\n * Module-private like its siblings `optionalPeersPlugin`/`corePlugin` — the\n * `refreshTypeScriptTypes` DI seam it defers to lives in\n * `./vite-typescript-refresh`, which isn't part of the published `vite`\n * subpath either (see that module for why).\n */\nfunction typescriptPlugin(options: LatticeViteOptions): Plugin {\n return {\n name: \"lattice:typescript\",\n apply: \"serve\",\n configureServer(server) {\n const typescript = options.typescript ?? true;\n\n if (typescript === false) {\n return;\n }\n\n const { appRoot } = resolveRoots(options);\n\n refreshTypeScriptTypes(appRoot, server.config.logger);\n },\n };\n}\n\nexport function resolveIconOptions(\n options: LatticeViteOptions,\n packages: LatticeComponentPackage[] = [],\n): SvgSpriteOptions | null {\n const icons = options.icons ?? true;\n\n if (icons === false) {\n return null;\n }\n\n const { root } = resolveRoots(options);\n const iconOptions = icons === true ? {} : icons;\n const { dirs = [], dts, ...spriteOptions } = iconOptions;\n const defaultTypes = {\n file: \"resources/js/types/sprite-icons.ts\",\n augmentModule: \"@lattice-php/ui\",\n augmentInterface: \"KnownIcons\",\n };\n\n return {\n ...spriteOptions,\n iconDirs: [\n path.resolve(root, \"../ui/resources/icons\"),\n ...packages.flatMap((pkg) => (pkg.icons ? [pkg.icons] : [])),\n ...dirs,\n ],\n ...(dts === false ? {} : { dts: { ...defaultTypes, ...dts } }),\n };\n}\n\n/**\n * Builds the same icon sprite the `lattice()` Vite plugin serves, outside of\n * Vite: ui's icon set, every discovered component package's icons, and the\n * app's own `icons.dirs`. The result is a `SpriteValue` for `SpriteProvider`\n * (`href: \"\"` inlines the markup), which is what a Storybook, a design-system\n * export, a prerender script, or a test needs to render `Icon` without a\n * dev server or an emitted asset.\n */\nexport function buildLatticeSprite(options: LatticeViteOptions = {}): Sprite & { href: \"\" } {\n const { appRoot } = resolveRoots(options);\n const iconOptions = resolveIconOptions(options, discoverComponentPackages(appRoot));\n\n if (!iconOptions) {\n return { href: \"\", ids: [], source: \"\" };\n }\n\n const { iconDirs = [], symbolId, svgoConfig } = iconOptions;\n\n return { href: \"\", ...buildSprite(iconDirs, { symbolId, svgoConfig }) };\n}\n\nfunction resolveRoots(options: LatticeViteOptions): Roots {\n const appRoot = options.appRoot ?? process.cwd();\n const root = options.root ?? path.resolve(appRoot, \"vendor/lattice-php/lattice\");\n\n return { appRoot, root };\n}\n"],"mappings":";;;;;;AAuCA,SAAgB,QAAQ,UAA8B,CAAC,GAAmB;CACxE,MAAM,EAAE,SAAS,SAAS,aAAa,OAAO;CAC9C,MAAM,WAAW,0BAA0B,OAAO;CAClD,MAAM,UAA0B;EAC9B,WAAW,OAAO;EAClB,oBAAoB;EACpB,wBAAwB,UAAU,SAAS,iBAAiB,SAAS,SAAS,IAAI,GAAG;GACnF,iBAAiB;GACjB,kBAAkB,4BAA4B,SAAS,SAAS,IAAI;EACtE,CAAC;EACD,iBAAiB,OAAO;CAC1B;CACA,MAAM,cAAc,mBAAmB,SAAS,QAAQ;CAExD,IAAI,aACF,QAAQ,KAAK,UAAU,WAAW,CAAC;CAGrC,OAAO;AACT;;;;;;;;;;;;;;;;;AAkBA,SAAS,iBACP,SACA,SACA,MACoB;CACpB,IAAI,QAAQ,QACV,OAAO,KAAK,QAAQ,MAAM,iCAAiC;CAG7D,MAAM,aAAa,2BAA2B,SAAS,iBAAiB;CAExE,IAAI,CAAC,YACH;CAGF,IAAI;EAEF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IAAI,KAAK,IAAI,CAAC,CAAE;GAC3D,GAAG;EACL;EACA,GAAI,QAAQ,QAAQ,CAAC,IAAI,EAAE,KAAK;GAAE,GAAG;GAAc,GAAG;EAAI,EAAE;CAC9D;AACF;;;;;;;;;AAUA,SAAgB,mBAAmB,UAA8B,CAAC,GAA0B;CAC1F,MAAM,EAAE,YAAY,aAAa,OAAO;CACxC,MAAM,cAAc,mBAAmB,SAAS,0BAA0B,OAAO,CAAC;CAElF,IAAI,CAAC,aACH,OAAO;EAAE,MAAM;EAAI,KAAK,CAAC;EAAG,QAAQ;CAAG;CAGzC,MAAM,EAAE,WAAW,CAAC,GAAG,UAAU,eAAe;CAEhD,OAAO;EAAE,MAAM;EAAI,GAAG,YAAY,UAAU;GAAE;GAAU;EAAW,CAAC;CAAE;AACxE;AAEA,SAAS,aAAa,SAAoC;CACxD,MAAM,UAAU,QAAQ,WAAW,QAAQ,IAAI;CAG/C,OAAO;EAAE;EAAS,MAFL,QAAQ,QAAQ,KAAK,QAAQ,SAAS,4BAA4B;CAExD;AACzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{t as r}from"./react-CwJFpaho.js";import{t as i}from"./materialize-CWqnSEHR.js";import{Bn as a,Fn as o,Gn as s,Hn as c,In as l,Kn as u,Ln as d,Mn as f,Nn as p,Pn as m,Rn as h,U as g,Un as _,Vn as v,W as y,Wn as b,Y as x,qn as S,zn as C}from"./runtime-DOBKnaVB.js";import{t as w}from"./react-dom-Dl-LT-t1.js";import{t as T}from"./jsx-runtime-NZYk81nU.js";import{t as E}from"./clsx-CjueKrWZ.js";import{n as D,t as O}from"./color-CXV-Y5Qv.js";import{t as k}from"./with-selector-Cse0iXU1.js";function A(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a<e.length;a++){let o=e[a];Array.isArray(o)&&t<r?i(o,t+1):n.push(o)}};return i(e,0),n}function j(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r,e);n.has(a)||n.set(a,i)}return Array.from(n.values())}function ee(e,t){return function(...n){return e.apply(this,n.slice(0,t))}}function M(e){return e}function te(e){return function(t){return a(t,e)}}function ne(e,t,n){return typeof n==`function`?re(e,t,function e(t,r,i,a,o,s){let c=n(t,r,i,a,o,s);return c===void 0?re(t,r,e,s,!1):!!c},new Map,!0):ne(e,t,()=>void 0)}function re(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return ie(e,t,n,r);case`function`:return Object.keys(t).length>0?re(e,{...t},n,r,i):s(e,t);default:return C(e)&&i?typeof t!=`string`||t===``:s(e,t)}}function ie(e,t,n,r){if(t==null)return!0;if(Array.isArray(t))return oe(e,t,n,r);if(t instanceof Map)return ae(e,t,n,r);if(t instanceof Set)return se(e,t,n,r);let i=Object.keys(t);if(e==null||S(e))return i.length===0;if(i.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let a=0;a<i.length;a++){let o=i[a];if(!S(e)&&!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!n(e[o],t[o],o,e,t,r))return!1}return!0}finally{r?.delete(t)}}function ae(e,t,n,r){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(let[i,a]of t.entries())if(n(e.get(i),a,i,e,t,r)===!1)return!1;return!0}function oe(e,t,n,r){if(t.length===0)return!0;if(!Array.isArray(e))return!1;let i=new Set;for(let a=0;a<t.length;a++){let o=t[a],s=!1;for(let c=0;c<e.length;c++){if(i.has(c))continue;let l=e[c],u=!1;if(n(l,o,a,e,t,r)&&(u=!0),u){i.add(c),s=!0;break}}if(!s)return!1}return!0}function se(e,t,n,r){return t.size===0||e instanceof Set&&oe([...e],[...t],n,r)}function ce(e,t){return ne(e,t,()=>void 0)}function le(e){return e=u(e),t=>ce(t,e)}function ue(e,t){switch(typeof e){case`object`:Object.is(e?.valueOf(),-0)&&(e=`-0`);break;case`number`:e=c(e)}return t=h(t),function(n){let r=a(n,e);return r===void 0?l(n,e):t===void 0?r===void 0:ce(r,t)}}function de(e){if(e==null)return M;switch(typeof e){case`function`:return e;case`object`:return Array.isArray(e)&&e.length===2?ue(e[0],e[1]):le(e);case`string`:case`symbol`:case`number`:return te(e)}}function fe(e){return m(e)?NaN:Number(e)}function pe(e){return e?(e=fe(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function me(e,t,n){return C(n)&&(typeof t==`number`&&_(n)&&d(t)&&t<n.length||typeof t==`string`&&t in n)?s(n[t],e):!1}function he(e){return typeof e==`symbol`?1:e===null?2:e===void 0?3:e===e?0:4}var ge=(e,t,n)=>{if(e!==t){let r=he(e),i=he(t);if(r===i&&r===0){if(e<t)return n===`desc`?1:-1;if(e>t)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0};function _e(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e;for(let e=0;e<t.length&&n!=null;++e)n=n[t[e]];return n},a=(e,t)=>t==null||e==null?t:typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):typeof t==`object`?t[e]:t,o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||p(e)?e:{key:e,path:v(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;r<o.length;r++){let i=ge(e.criteria[r],t.criteria[r],n[r]);if(i!==0)return i}return 0}).map(e=>e.original)}function ve(e,...t){let n=t.length;return n>1&&me(e,t[0],t[1])?t=[]:n>2&&me(t[0],t[1],t[2])&&(t=[t[0]]),_e(e,A(t),[`asc`])}function ye(e,t=M){return o(e)?j(Array.from(e),ee(de(t),1)):[]}function be(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return f(e,t,{leading:r,maxWait:t,trailing:i})}function xe(e,t,n){n&&typeof n!=`number`&&me(e,t,n)&&(t=n=void 0),e=pe(e),t===void 0?(t=e,e=0):t=pe(t),n=n===void 0?e<t?1:-1:pe(n);let r=Math.max(Math.ceil((t-e)/(n||1)),0),i=Array(r);for(let t=0;t<r;t++)i[t]=e,e+=n;return i}var Se=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function Ce(e){return typeof e==`string`&&Se.includes(e)}var N=t(r()),we=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function Te(e){return typeof e==`string`&&we.has(e)}function Ee(e){return typeof e==`string`&&e.startsWith(`data-`)}function De(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Te(n)||Ee(n))&&(t[n]=e[n]);return t}function Oe(e){if(e==null)return null;if((0,N.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return De(t)}return typeof e==`object`&&!Array.isArray(e)?De(e):null}function ke(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Te(n)||Ee(n)||Ce(n))&&(t[n]=e[n]);return t}function Ae(e){return e==null?null:(0,N.isValidElement)(e)?ke(e.props):typeof e==`object`&&!Array.isArray(e)?ke(e):null}var je=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function Me(){return Me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Me.apply(null,arguments)}function Ne(e,t){if(e==null)return{};var n,r,i=Pe(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Pe(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Fe=(0,N.forwardRef)((e,t)=>{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,u=Ne(e,je),d=a||{width:r,height:i,x:0,y:0},f=E(`recharts-surface`,o);return N.createElement(`svg`,Me({},ke(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),N.createElement(`title`,null,c),N.createElement(`desc`,null,l),n)}),Ie=[`children`,`className`];function Le(){return Le=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Le.apply(null,arguments)}function Re(e,t){if(e==null)return{};var n,r,i=ze(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ze(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var P=N.forwardRef((e,t)=>{var n=e.children,r=e.className,i=Re(e,Ie),a=E(`recharts-layer`,r);return N.createElement(`g`,Le({className:a},ke(i),{ref:t}),n)}),Be=4;function Ve(e){var t=10**(arguments.length>1&&arguments[1]!==void 0?arguments[1]:Be),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function He(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+Ve(i)+n},``)}var Ue=e=>e===0?0:e>0?1:-1,We=e=>typeof e==`number`&&e!=+e,Ge=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,F=e=>(typeof e==`number`||e instanceof Number)&&!We(e),Ke=e=>F(e)||typeof e==`string`,qe=0,Je=e=>{var t=++qe;return`${e||``}${t}`},Ye=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!F(e)&&typeof e!=`string`)return n;var i;if(Ge(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return We(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},Xe=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[String(e[r])])n[String(e[r])]=!0;else return!0;return!1};function I(e,t,n){return F(e)&&F(t)?Ve(e+n*(t-e)):t}function Ze(e,t,n){if(!(!e||!e.length))return e.find(e=>e&&(typeof t==`function`?t(e):a(e,t))===n)}var L=e=>e==null,Qe=e=>L(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function $e(e){return e!=null}function et(){}function tt(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function nt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function rt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?nt(Object(n),!0).forEach(function(t){it(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function it(e,t,n){return(t=at(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function at(e){var t=ot(e,`string`);return typeof t==`symbol`?t:t+``}function ot(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var st=e=>{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=tt(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?rt({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?rt({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?rt({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?rt({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?rt({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?rt({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?rt({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?rt({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(F(n.x)||Ge(n.x))&&(F(n.y)||Ge(n.y))?rt({x:c+Ye(n.x,g),y:l+Ye(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):rt({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},ct=[`top`,`left`,`right`,`bottom`];function lt(e){return e==null?!1:typeof e==`object`||ct.includes(e)}var ut=(0,N.createContext)(null),dt=()=>(0,N.useContext)(ut);function R(e){return function(){return e}}var ft=Math.cos,pt=Math.sin,mt=Math.sqrt,ht=Math.PI;ht/2;var gt=2*ht,_t=Math.PI,vt=2*_t,yt=1e-6,bt=vt-yt;function xt(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function St(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return xt;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var Ct=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?xt:St(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>yt)if(!(Math.abs(u*s-c*l)>yt)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((_t-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>yt&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>yt||Math.abs(this._y1-l)>yt)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%vt+vt),d>bt?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>yt&&this._append`A${n},${n},0,${+(d>=_t)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};Ct.prototype;function wt(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Ct(t)}Array.prototype.slice;function Tt(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Et(e){this._context=e}Et.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function Dt(e){return new Et(e)}function Ot(e){return e[0]}function kt(e){return e[1]}function At(e,t){var n=R(!0),r=null,i=Dt,a=null,o=wt(s);e=typeof e==`function`?e:e===void 0?Ot:R(e),t=typeof t==`function`?t:t===void 0?kt:R(t);function s(s){var c,l=(s=Tt(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:R(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:R(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:R(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function jt(e,t,n){var r=null,i=R(!0),a=null,o=Dt,s=null,c=wt(l);e=typeof e==`function`?e:e===void 0?Ot:R(+e),t=typeof t==`function`?t:R(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?kt:R(+n);function l(l){var u,d,f,p=(l=Tt(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u<p&&i(m=l[u],u,l))===h)if(h=!h)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return At().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:R(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:R(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:R(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:R(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:R(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:R(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:R(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var Mt=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function Nt(e){return new Mt(e,!0)}function Pt(e){return new Mt(e,!1)}var Ft={draw(e,t){let n=mt(t/ht);e.moveTo(n,0),e.arc(0,0,n,0,gt)}},It={draw(e,t){let n=mt(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},Lt=mt(1/3),Rt=Lt*2,zt={draw(e,t){let n=mt(t/Rt),r=n*Lt;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},Bt={draw(e,t){let n=mt(t),r=-n/2;e.rect(r,r,n,n)}},Vt=.8908130915292852,Ht=pt(ht/10)/pt(7*ht/10),Ut=pt(gt/10)*Ht,Wt=-ft(gt/10)*Ht,Gt={draw(e,t){let n=mt(t*Vt),r=Ut*n,i=Wt*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=gt*t/5,o=ft(a),s=pt(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},Kt=mt(3),qt={draw(e,t){let n=-mt(t/(Kt*3));e.moveTo(0,n*2),e.lineTo(-Kt*n,-n),e.lineTo(Kt*n,-n),e.closePath()}},Jt=-.5,Yt=mt(3)/2,Xt=1/mt(12),Zt=(Xt/2+1)*3,Qt={draw(e,t){let n=mt(t/Zt),r=n/2,i=n*Xt,a=r,o=n*Xt+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(Jt*r-Yt*i,Yt*r+Jt*i),e.lineTo(Jt*a-Yt*o,Yt*a+Jt*o),e.lineTo(Jt*s-Yt*c,Yt*s+Jt*c),e.lineTo(Jt*r+Yt*i,Jt*i-Yt*r),e.lineTo(Jt*a+Yt*o,Jt*o-Yt*a),e.lineTo(Jt*s+Yt*c,Jt*c-Yt*s),e.closePath()}};function $t(e,t){let n=null,r=wt(i);e=typeof e==`function`?e:R(e||Ft),t=typeof t==`function`?t:R(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:R(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:R(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function en(){}function tn(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function nn(e){this._context=e}nn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:tn(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:tn(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function rn(e){return new nn(e)}function an(e){this._context=e}an.prototype={areaStart:en,areaEnd:en,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:tn(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function on(e){return new an(e)}function sn(e){this._context=e}sn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:tn(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function cn(e){return new sn(e)}function ln(e){this._context=e}ln.prototype={areaStart:en,areaEnd:en,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function un(e){return new ln(e)}function dn(e){return e<0?-1:1}function fn(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(dn(a)+dn(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function pn(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function mn(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function hn(e){this._context=e}hn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:mn(this,this._t0,pn(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,mn(this,pn(this,n=fn(this,e,t)),n);break;default:mn(this,this._t0,n=fn(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function gn(e){this._context=new _n(e)}(gn.prototype=Object.create(hn.prototype)).point=function(e,t){hn.prototype.point.call(this,t,e)};function _n(e){this._context=e}_n.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function vn(e){return new hn(e)}function yn(e){return new gn(e)}function bn(e){this._context=e}bn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=xn(e),i=xn(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function xn(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function Sn(e){return new bn(e)}function Cn(e,t){this._context=e,this._t=t}Cn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function wn(e){return new Cn(e,.5)}function Tn(e){return new Cn(e,0)}function En(e){return new Cn(e,1)}function Dn(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n<o;++n)for(i=a,a=e[t[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function On(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function kn(e,t){return e[t]}function An(e){let t=[];return t.key=e,t}function jn(){var e=R([]),t=On,n=Dn,r=kn;function i(i){var a=Array.from(e.apply(this,arguments),An),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o<s;++o)(a[o][c]=[0,+r(e,a[o].key,c,i)]).data=e;for(o=0,l=Tt(t(a));o<s;++o)a[l[o]].index=o;return n(a,l),a}return i.keys=function(t){return arguments.length?(e=typeof t==`function`?t:R(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r=typeof e==`function`?e:R(+e),i):r},i.order=function(e){return arguments.length?(t=e==null?On:typeof e==`function`?e:R(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=e??Dn,i):n},i}function Mn(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=e[n][i][1]||0;if(o)for(n=0;n<r;++n)e[n][i][1]/=o}Dn(e,t)}}function Nn(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var o=0,s=0;o<i;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}Dn(e,t)}}function Pn(e,t){if(!(!((o=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r<a;++r){for(var s=0,c=0,l=0;s<o;++s){for(var u=e[t[s]],d=u[r][1]||0,f=(d-(u[r-1][1]||0))/2,p=0;p<s;++p){var m=e[t[p]],h=m[r][1]||0,g=m[r-1][1]||0;f+=h-g}c+=d,l+=f*d}i[r-1][1]+=i[r-1][0]=n,c&&(n-=l/c)}i[r-1][1]+=i[r-1][0]=n,Dn(e,t)}}var Fn=[`type`,`size`,`sizeType`];function In(){return In=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},In.apply(null,arguments)}function Ln(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Rn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ln(Object(n),!0).forEach(function(t){zn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ln(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zn(e,t,n){return(t=Bn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bn(e){var t=Vn(e,`string`);return typeof t==`symbol`?t:t+``}function Vn(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Hn(e,t){if(e==null)return{};var n,r,i=Un(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Un(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Wn={symbolCircle:Ft,symbolCross:It,symbolDiamond:zt,symbolSquare:Bt,symbolStar:Gt,symbolTriangle:qt,symbolWye:Qt},Gn=Math.PI/180,Kn=e=>Wn[`symbol${Qe(e)}`]||Ft,qn=(e,t,n)=>{if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*Gn;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},Jn=(e,t)=>{Wn[`symbol${Qe(e)}`]=t},Yn=e=>{var t=e.type,n=t===void 0?`circle`:t,r=e.size,i=r===void 0?64:r,a=e.sizeType,o=a===void 0?`area`:a,s=Rn(Rn({},Hn(e,Fn)),{},{type:n,size:i,sizeType:o}),c=`circle`;typeof n==`string`&&(c=n);var l=()=>{var e=Kn(c),t=$t().type(e).size(qn(i,o,c))();if(t!==null)return t},u=s.className,d=s.cx,f=s.cy,p=ke(s);return F(d)&&F(f)&&F(i)?N.createElement(`path`,In({},p,{className:E(`recharts-symbols`,u),transform:`translate(${d}, ${f})`,d:l()})):null};Yn.registerSymbol=Jn;var Xn=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,Zn=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,N.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{Ce(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},Qn=(e,t,n)=>r=>(e(t,n,r),null),$n=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];Ce(i)&&typeof a==`function`&&(r||={},r[i]=Qn(a,t,n))}),r};function er(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function tr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?er(Object(n),!0).forEach(function(t){nr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):er(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function nr(e,t,n){return(t=rr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rr(e){var t=ir(e,`string`);return typeof t==`symbol`?t:t+``}function ir(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function z(e,t){var n=tr({},e),r=t;return Object.keys(t).reduce((e,t)=>(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function ar(){return ar=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ar.apply(null,arguments)}function or(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function sr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?or(Object(n),!0).forEach(function(t){cr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):or(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function cr(e,t,n){return(t=lr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lr(e){var t=ur(e,`string`);return typeof t==`symbol`?t:t+``}function ur(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var dr=32,fr={align:`center`,iconSize:14,inactiveColor:`#ccc`,layout:`horizontal`,verticalAlign:`middle`,labelStyle:{}};function pr(e){if(typeof e==`object`&&e&&`strokeDasharray`in e)return String(e.strokeDasharray)}function mr(e){var t=e.data,n=e.iconType,r=e.inactiveColor,i=dr/2,a=dr/6,o=dr/3,s=t.inactive?r:t.color,c=n??t.type;if(c===`none`)return null;if(c===`plainline`)return N.createElement(`line`,{strokeWidth:4,fill:`none`,stroke:s,strokeDasharray:pr(t.payload),x1:0,y1:i,x2:dr,y2:i,className:`recharts-legend-icon`});if(c===`line`)return N.createElement(`path`,{strokeWidth:4,fill:`none`,stroke:s,d:`M0,${i}h${o}
|
|
1
|
+
import{n as e,r as t,t as n}from"./rolldown-runtime-hePW80VL.js";import{t as r}from"./react-CwJFpaho.js";import{t as i}from"./materialize-CWqnSEHR.js";import{Bn as a,Fn as o,Gn as s,Hn as c,In as l,Kn as u,Ln as d,Mn as f,Nn as p,Pn as m,Rn as h,U as g,Un as _,Vn as v,W as y,Wn as b,Y as x,qn as S,zn as C}from"./runtime-BCd7_8vm.js";import{t as w}from"./react-dom-Dl-LT-t1.js";import{t as T}from"./jsx-runtime-NZYk81nU.js";import{t as E}from"./clsx-CjueKrWZ.js";import{n as D,t as O}from"./color-CXV-Y5Qv.js";import{t as k}from"./with-selector-Cse0iXU1.js";function A(e,t=1){let n=[],r=Math.floor(t),i=(e,t)=>{for(let a=0;a<e.length;a++){let o=e[a];Array.isArray(o)&&t<r?i(o,t+1):n.push(o)}};return i(e,0),n}function j(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=e[r],a=t(i,r,e);n.has(a)||n.set(a,i)}return Array.from(n.values())}function ee(e,t){return function(...n){return e.apply(this,n.slice(0,t))}}function M(e){return e}function te(e){return function(t){return a(t,e)}}function ne(e,t,n){return typeof n==`function`?re(e,t,function e(t,r,i,a,o,s){let c=n(t,r,i,a,o,s);return c===void 0?re(t,r,e,s,!1):!!c},new Map,!0):ne(e,t,()=>void 0)}function re(e,t,n,r,i=!1){if(t===e)return!0;switch(typeof t){case`object`:return ie(e,t,n,r);case`function`:return Object.keys(t).length>0?re(e,{...t},n,r,i):s(e,t);default:return C(e)&&i?typeof t!=`string`||t===``:s(e,t)}}function ie(e,t,n,r){if(t==null)return!0;if(Array.isArray(t))return oe(e,t,n,r);if(t instanceof Map)return ae(e,t,n,r);if(t instanceof Set)return se(e,t,n,r);let i=Object.keys(t);if(e==null||S(e))return i.length===0;if(i.length===0)return!0;if(r?.has(t))return r.get(t)===e;r?.set(t,e);try{for(let a=0;a<i.length;a++){let o=i[a];if(!S(e)&&!(o in e)||t[o]===void 0&&e[o]!==void 0||t[o]===null&&e[o]!==null||!n(e[o],t[o],o,e,t,r))return!1}return!0}finally{r?.delete(t)}}function ae(e,t,n,r){if(t.size===0)return!0;if(!(e instanceof Map))return!1;for(let[i,a]of t.entries())if(n(e.get(i),a,i,e,t,r)===!1)return!1;return!0}function oe(e,t,n,r){if(t.length===0)return!0;if(!Array.isArray(e))return!1;let i=new Set;for(let a=0;a<t.length;a++){let o=t[a],s=!1;for(let c=0;c<e.length;c++){if(i.has(c))continue;let l=e[c],u=!1;if(n(l,o,a,e,t,r)&&(u=!0),u){i.add(c),s=!0;break}}if(!s)return!1}return!0}function se(e,t,n,r){return t.size===0||e instanceof Set&&oe([...e],[...t],n,r)}function ce(e,t){return ne(e,t,()=>void 0)}function le(e){return e=u(e),t=>ce(t,e)}function ue(e,t){switch(typeof e){case`object`:Object.is(e?.valueOf(),-0)&&(e=`-0`);break;case`number`:e=c(e)}return t=h(t),function(n){let r=a(n,e);return r===void 0?l(n,e):t===void 0?r===void 0:ce(r,t)}}function de(e){if(e==null)return M;switch(typeof e){case`function`:return e;case`object`:return Array.isArray(e)&&e.length===2?ue(e[0],e[1]):le(e);case`string`:case`symbol`:case`number`:return te(e)}}function fe(e){return m(e)?NaN:Number(e)}function pe(e){return e?(e=fe(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function me(e,t,n){return C(n)&&(typeof t==`number`&&_(n)&&d(t)&&t<n.length||typeof t==`string`&&t in n)?s(n[t],e):!1}function he(e){return typeof e==`symbol`?1:e===null?2:e===void 0?3:e===e?0:4}var ge=(e,t,n)=>{if(e!==t){let r=he(e),i=he(t);if(r===i&&r===0){if(e<t)return n===`desc`?1:-1;if(e>t)return n===`desc`?-1:1}return n===`desc`?i-r:r-i}return 0};function _e(e,t,n,r){if(e==null)return[];n=r?void 0:n,Array.isArray(e)||(e=Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(e=>String(e));let i=(e,t)=>{let n=e;for(let e=0;e<t.length&&n!=null;++e)n=n[t[e]];return n},a=(e,t)=>t==null||e==null?t:typeof e==`object`&&`key`in e?Object.hasOwn(t,e.key)?t[e.key]:i(t,e.path):typeof e==`function`?e(t):Array.isArray(e)?i(t,e):typeof t==`object`?t[e]:t,o=t.map(e=>(Array.isArray(e)&&e.length===1&&(e=e[0]),e==null||typeof e==`function`||Array.isArray(e)||p(e)?e:{key:e,path:v(e)}));return e.map(e=>({original:e,criteria:o.map(t=>a(t,e))})).slice().sort((e,t)=>{for(let r=0;r<o.length;r++){let i=ge(e.criteria[r],t.criteria[r],n[r]);if(i!==0)return i}return 0}).map(e=>e.original)}function ve(e,...t){let n=t.length;return n>1&&me(e,t[0],t[1])?t=[]:n>2&&me(t[0],t[1],t[2])&&(t=[t[0]]),_e(e,A(t),[`asc`])}function ye(e,t=M){return o(e)?j(Array.from(e),ee(de(t),1)):[]}function be(e,t=0,n={}){let{leading:r=!0,trailing:i=!0}=n;return f(e,t,{leading:r,maxWait:t,trailing:i})}function xe(e,t,n){n&&typeof n!=`number`&&me(e,t,n)&&(t=n=void 0),e=pe(e),t===void 0?(t=e,e=0):t=pe(t),n=n===void 0?e<t?1:-1:pe(n);let r=Math.max(Math.ceil((t-e)/(n||1)),0),i=Array(r);for(let t=0;t<r;t++)i[t]=e,e+=n;return i}var Se=`dangerouslySetInnerHTML.onCopy.onCopyCapture.onCut.onCutCapture.onPaste.onPasteCapture.onCompositionEnd.onCompositionEndCapture.onCompositionStart.onCompositionStartCapture.onCompositionUpdate.onCompositionUpdateCapture.onFocus.onFocusCapture.onBlur.onBlurCapture.onChange.onChangeCapture.onBeforeInput.onBeforeInputCapture.onInput.onInputCapture.onReset.onResetCapture.onSubmit.onSubmitCapture.onInvalid.onInvalidCapture.onLoad.onLoadCapture.onError.onErrorCapture.onKeyDown.onKeyDownCapture.onKeyPress.onKeyPressCapture.onKeyUp.onKeyUpCapture.onAbort.onAbortCapture.onCanPlay.onCanPlayCapture.onCanPlayThrough.onCanPlayThroughCapture.onDurationChange.onDurationChangeCapture.onEmptied.onEmptiedCapture.onEncrypted.onEncryptedCapture.onEnded.onEndedCapture.onLoadedData.onLoadedDataCapture.onLoadedMetadata.onLoadedMetadataCapture.onLoadStart.onLoadStartCapture.onPause.onPauseCapture.onPlay.onPlayCapture.onPlaying.onPlayingCapture.onProgress.onProgressCapture.onRateChange.onRateChangeCapture.onSeeked.onSeekedCapture.onSeeking.onSeekingCapture.onStalled.onStalledCapture.onSuspend.onSuspendCapture.onTimeUpdate.onTimeUpdateCapture.onVolumeChange.onVolumeChangeCapture.onWaiting.onWaitingCapture.onAuxClick.onAuxClickCapture.onClick.onClickCapture.onContextMenu.onContextMenuCapture.onDoubleClick.onDoubleClickCapture.onDrag.onDragCapture.onDragEnd.onDragEndCapture.onDragEnter.onDragEnterCapture.onDragExit.onDragExitCapture.onDragLeave.onDragLeaveCapture.onDragOver.onDragOverCapture.onDragStart.onDragStartCapture.onDrop.onDropCapture.onMouseDown.onMouseDownCapture.onMouseEnter.onMouseLeave.onMouseMove.onMouseMoveCapture.onMouseOut.onMouseOutCapture.onMouseOver.onMouseOverCapture.onMouseUp.onMouseUpCapture.onSelect.onSelectCapture.onTouchCancel.onTouchCancelCapture.onTouchEnd.onTouchEndCapture.onTouchMove.onTouchMoveCapture.onTouchStart.onTouchStartCapture.onPointerDown.onPointerDownCapture.onPointerMove.onPointerMoveCapture.onPointerUp.onPointerUpCapture.onPointerCancel.onPointerCancelCapture.onPointerEnter.onPointerEnterCapture.onPointerLeave.onPointerLeaveCapture.onPointerOver.onPointerOverCapture.onPointerOut.onPointerOutCapture.onGotPointerCapture.onGotPointerCaptureCapture.onLostPointerCapture.onLostPointerCaptureCapture.onScroll.onScrollCapture.onWheel.onWheelCapture.onAnimationStart.onAnimationStartCapture.onAnimationEnd.onAnimationEndCapture.onAnimationIteration.onAnimationIterationCapture.onTransitionEnd.onTransitionEndCapture`.split(`.`);function Ce(e){return typeof e==`string`&&Se.includes(e)}var N=t(r()),we=new Set(`aria-activedescendant.aria-atomic.aria-autocomplete.aria-busy.aria-checked.aria-colcount.aria-colindex.aria-colspan.aria-controls.aria-current.aria-describedby.aria-details.aria-disabled.aria-errormessage.aria-expanded.aria-flowto.aria-haspopup.aria-hidden.aria-invalid.aria-keyshortcuts.aria-label.aria-labelledby.aria-level.aria-live.aria-modal.aria-multiline.aria-multiselectable.aria-orientation.aria-owns.aria-placeholder.aria-posinset.aria-pressed.aria-readonly.aria-relevant.aria-required.aria-roledescription.aria-rowcount.aria-rowindex.aria-rowspan.aria-selected.aria-setsize.aria-sort.aria-valuemax.aria-valuemin.aria-valuenow.aria-valuetext.className.color.height.id.lang.max.media.method.min.name.style.target.width.role.tabIndex.accentHeight.accumulate.additive.alignmentBaseline.allowReorder.alphabetic.amplitude.arabicForm.ascent.attributeName.attributeType.autoReverse.azimuth.baseFrequency.baselineShift.baseProfile.bbox.begin.bias.by.calcMode.capHeight.clip.clipPath.clipPathUnits.clipRule.colorInterpolation.colorInterpolationFilters.colorProfile.colorRendering.contentScriptType.contentStyleType.cursor.cx.cy.d.decelerate.descent.diffuseConstant.direction.display.divisor.dominantBaseline.dur.dx.dy.edgeMode.elevation.enableBackground.end.exponent.externalResourcesRequired.fill.fillOpacity.fillRule.filter.filterRes.filterUnits.floodColor.floodOpacity.focusable.fontFamily.fontSize.fontSizeAdjust.fontStretch.fontStyle.fontVariant.fontWeight.format.from.fx.fy.g1.g2.glyphName.glyphOrientationHorizontal.glyphOrientationVertical.glyphRef.gradientTransform.gradientUnits.hanging.horizAdvX.horizOriginX.href.ideographic.imageRendering.in2.in.intercept.k1.k2.k3.k4.k.kernelMatrix.kernelUnitLength.kerning.keyPoints.keySplines.keyTimes.lengthAdjust.letterSpacing.lightingColor.limitingConeAngle.local.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.mathematical.mode.numOctaves.offset.opacity.operator.order.orient.orientation.origin.overflow.overlinePosition.overlineThickness.paintOrder.panose1.pathLength.patternContentUnits.patternTransform.patternUnits.pointerEvents.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.r.radius.refX.refY.renderingIntent.repeatCount.repeatDur.requiredExtensions.requiredFeatures.restart.result.rotate.rx.ry.seed.shapeRendering.slope.spacing.specularConstant.specularExponent.speed.spreadMethod.startOffset.stdDeviation.stemh.stemv.stitchTiles.stopColor.stopOpacity.strikethroughPosition.strikethroughThickness.string.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.surfaceScale.systemLanguage.tableValues.targetX.targetY.textAnchor.textDecoration.textLength.textRendering.to.transform.u1.u2.underlinePosition.underlineThickness.unicode.unicodeBidi.unicodeRange.unitsPerEm.vAlphabetic.values.vectorEffect.version.vertAdvY.vertOriginX.vertOriginY.vHanging.vIdeographic.viewTarget.visibility.vMathematical.widths.wordSpacing.writingMode.x1.x2.x.xChannelSelector.xHeight.xlinkActuate.xlinkArcrole.xlinkHref.xlinkRole.xlinkShow.xlinkTitle.xlinkType.xmlBase.xmlLang.xmlns.xmlnsXlink.xmlSpace.y1.y2.y.yChannelSelector.z.zoomAndPan.ref.key.angle`.split(`.`));function Te(e){return typeof e==`string`&&we.has(e)}function Ee(e){return typeof e==`string`&&e.startsWith(`data-`)}function De(e){if(typeof e!=`object`||!e)return{};var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Te(n)||Ee(n))&&(t[n]=e[n]);return t}function Oe(e){if(e==null)return null;if((0,N.isValidElement)(e)&&typeof e.props==`object`&&e.props!==null){var t=e.props;return De(t)}return typeof e==`object`&&!Array.isArray(e)?De(e):null}function ke(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Te(n)||Ee(n)||Ce(n))&&(t[n]=e[n]);return t}function Ae(e){return e==null?null:(0,N.isValidElement)(e)?ke(e.props):typeof e==`object`&&!Array.isArray(e)?ke(e):null}var je=[`children`,`width`,`height`,`viewBox`,`className`,`style`,`title`,`desc`];function Me(){return Me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Me.apply(null,arguments)}function Ne(e,t){if(e==null)return{};var n,r,i=Pe(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Pe(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Fe=(0,N.forwardRef)((e,t)=>{var n=e.children,r=e.width,i=e.height,a=e.viewBox,o=e.className,s=e.style,c=e.title,l=e.desc,u=Ne(e,je),d=a||{width:r,height:i,x:0,y:0},f=E(`recharts-surface`,o);return N.createElement(`svg`,Me({},ke(u),{className:f,width:r,height:i,style:s,viewBox:`${d.x} ${d.y} ${d.width} ${d.height}`,ref:t}),N.createElement(`title`,null,c),N.createElement(`desc`,null,l),n)}),Ie=[`children`,`className`];function Le(){return Le=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Le.apply(null,arguments)}function Re(e,t){if(e==null)return{};var n,r,i=ze(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function ze(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var P=N.forwardRef((e,t)=>{var n=e.children,r=e.className,i=Re(e,Ie),a=E(`recharts-layer`,r);return N.createElement(`g`,Le({className:a},ke(i),{ref:t}),n)}),Be=4;function Ve(e){var t=10**(arguments.length>1&&arguments[1]!==void 0?arguments[1]:Be),n=Math.round(e*t)/t;return Object.is(n,-0)?0:n}function He(e){var t=[...arguments].slice(1);return e.reduce((e,n,r)=>{var i=t[r-1];return typeof i==`string`?e+i+n:i===void 0?e+n:e+Ve(i)+n},``)}var Ue=e=>e===0?0:e>0?1:-1,We=e=>typeof e==`number`&&e!=+e,Ge=e=>typeof e==`string`&&e.length>1&&e.indexOf(`%`)===e.length-1,F=e=>(typeof e==`number`||e instanceof Number)&&!We(e),Ke=e=>F(e)||typeof e==`string`,qe=0,Je=e=>{var t=++qe;return`${e||``}${t}`},Ye=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0&&arguments[3];if(!F(e)&&typeof e!=`string`)return n;var i;if(Ge(e)){if(t==null)return n;var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return We(i)&&(i=n),r&&t!=null&&i>t&&(i=t),i},Xe=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r<t;r++)if(!n[String(e[r])])n[String(e[r])]=!0;else return!0;return!1};function I(e,t,n){return F(e)&&F(t)?Ve(e+n*(t-e)):t}function Ze(e,t,n){if(!(!e||!e.length))return e.find(e=>e&&(typeof t==`function`?t(e):a(e,t))===n)}var L=e=>e==null,Qe=e=>L(e)?e:`${e.charAt(0).toUpperCase()}${e.slice(1)}`;function $e(e){return e!=null}function et(){}function tt(e){if(e)return{x:e.x,y:e.y,upperWidth:`upperWidth`in e?e.upperWidth:e.width,lowerWidth:`lowerWidth`in e?e.lowerWidth:e.width,width:e.width,height:e.height}}function nt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function rt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?nt(Object(n),!0).forEach(function(t){it(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function it(e,t,n){return(t=at(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function at(e){var t=ot(e,`string`);return typeof t==`symbol`?t:t+``}function ot(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var st=e=>{var t=e.viewBox,n=e.position,r=e.offset,i=r===void 0?0:r,a=e.parentViewBox,o=e.clamp,s=tt(t),c=s.x,l=s.y,u=s.height,d=s.upperWidth,f=s.lowerWidth,p=c,m=c+(d-f)/2,h=(p+m)/2,g=(d+f)/2,_=p+d/2,v=u>=0?1:-1,y=v*i,b=v>0?`end`:`start`,x=v>0?`start`:`end`,S=d>=0?1:-1,C=S*i,w=S>0?`end`:`start`,T=S>0?`start`:`end`,E=a;if(n===`top`){var D={x:p+d/2,y:l-y,horizontalAnchor:`middle`,verticalAnchor:b};return o&&E&&(D.height=Math.max(l-E.y,0),D.width=d),D}if(n===`bottom`){var O={x:m+f/2,y:l+u+y,horizontalAnchor:`middle`,verticalAnchor:x};return o&&E&&(O.height=Math.max(E.y+E.height-(l+u),0),O.width=f),O}if(n===`left`){var k={x:h-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`};return o&&E&&(k.width=Math.max(k.x-E.x,0),k.height=u),k}if(n===`right`){var A={x:h+g+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`};return o&&E&&(A.width=Math.max(E.x+E.width-A.x,0),A.height=u),A}var j=o&&E?{width:g,height:u}:{};return n===`insideLeft`?rt({x:h+C,y:l+u/2,horizontalAnchor:T,verticalAnchor:`middle`},j):n===`insideRight`?rt({x:h+g-C,y:l+u/2,horizontalAnchor:w,verticalAnchor:`middle`},j):n===`insideTop`?rt({x:p+d/2,y:l+y,horizontalAnchor:`middle`,verticalAnchor:x},j):n===`insideBottom`?rt({x:m+f/2,y:l+u-y,horizontalAnchor:`middle`,verticalAnchor:b},j):n===`insideTopLeft`?rt({x:p+C,y:l+y,horizontalAnchor:T,verticalAnchor:x},j):n===`insideTopRight`?rt({x:p+d-C,y:l+y,horizontalAnchor:w,verticalAnchor:x},j):n===`insideBottomLeft`?rt({x:m+C,y:l+u-y,horizontalAnchor:T,verticalAnchor:b},j):n===`insideBottomRight`?rt({x:m+f-C,y:l+u-y,horizontalAnchor:w,verticalAnchor:b},j):n&&typeof n==`object`&&(F(n.x)||Ge(n.x))&&(F(n.y)||Ge(n.y))?rt({x:c+Ye(n.x,g),y:l+Ye(n.y,u),horizontalAnchor:`end`,verticalAnchor:`end`},j):rt({x:_,y:l+u/2,horizontalAnchor:`middle`,verticalAnchor:`middle`},j)},ct=[`top`,`left`,`right`,`bottom`];function lt(e){return e==null?!1:typeof e==`object`||ct.includes(e)}var ut=(0,N.createContext)(null),dt=()=>(0,N.useContext)(ut);function R(e){return function(){return e}}var ft=Math.cos,pt=Math.sin,mt=Math.sqrt,ht=Math.PI;ht/2;var gt=2*ht,_t=Math.PI,vt=2*_t,yt=1e-6,bt=vt-yt;function xt(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function St(e){let t=Math.floor(e);if(!(t>=0))throw Error(`invalid digits: ${e}`);if(t>15)return xt;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=Math.round(arguments[t]*n)/n+e[t]}}var Ct=class{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._=``,this._append=e==null?xt:St(e)}moveTo(e,t){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,t){this._append`L${this._x1=+e},${this._y1=+t}`}quadraticCurveTo(e,t,n,r){this._append`Q${+e},${+t},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(e,t,n,r,i,a){this._append`C${+e},${+t},${+n},${+r},${this._x1=+i},${this._y1=+a}`}arcTo(e,t,n,r,i){if(e=+e,t=+t,n=+n,r=+r,i=+i,i<0)throw Error(`negative radius: ${i}`);let a=this._x1,o=this._y1,s=n-e,c=r-t,l=a-e,u=o-t,d=l*l+u*u;if(this._x1===null)this._append`M${this._x1=e},${this._y1=t}`;else if(d>yt)if(!(Math.abs(u*s-c*l)>yt)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((_t-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>yt&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>yt||Math.abs(this._y1-l)>yt)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%vt+vt),d>bt?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>yt&&this._append`A${n},${n},0,${+(d>=_t)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};Ct.prototype;function wt(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new Ct(t)}Array.prototype.slice;function Tt(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function Et(e){this._context=e}Et.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t)}}};function Dt(e){return new Et(e)}function Ot(e){return e[0]}function kt(e){return e[1]}function At(e,t){var n=R(!0),r=null,i=Dt,a=null,o=wt(s);e=typeof e==`function`?e:e===void 0?Ot:R(e),t=typeof t==`function`?t:t===void 0?kt:R(t);function s(s){var c,l=(s=Tt(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c<l&&n(u=s[c],c,s))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(u,c,s),+t(u,c,s));if(f)return a=null,f+``||null}return s.x=function(t){return arguments.length?(e=typeof t==`function`?t:R(+t),s):e},s.y=function(e){return arguments.length?(t=typeof e==`function`?e:R(+e),s):t},s.defined=function(e){return arguments.length?(n=typeof e==`function`?e:R(!!e),s):n},s.curve=function(e){return arguments.length?(i=e,r!=null&&(a=i(r)),s):i},s.context=function(e){return arguments.length?(e==null?r=a=null:a=i(r=e),s):r},s}function jt(e,t,n){var r=null,i=R(!0),a=null,o=Dt,s=null,c=wt(l);e=typeof e==`function`?e:e===void 0?Ot:R(+e),t=typeof t==`function`?t:R(t===void 0?0:+t),n=typeof n==`function`?n:n===void 0?kt:R(+n);function l(l){var u,d,f,p=(l=Tt(l)).length,m,h=!1,g,_=Array(p),v=Array(p);for(a??(s=o(g=c())),u=0;u<=p;++u){if(!(u<p&&i(m=l[u],u,l))===h)if(h=!h)d=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return At().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:R(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:R(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:R(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:R(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:R(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:R(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:R(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var Mt=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t)}this._x0=e,this._y0=t}};function Nt(e){return new Mt(e,!0)}function Pt(e){return new Mt(e,!1)}var Ft={draw(e,t){let n=mt(t/ht);e.moveTo(n,0),e.arc(0,0,n,0,gt)}},It={draw(e,t){let n=mt(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},Lt=mt(1/3),Rt=Lt*2,zt={draw(e,t){let n=mt(t/Rt),r=n*Lt;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},Bt={draw(e,t){let n=mt(t),r=-n/2;e.rect(r,r,n,n)}},Vt=.8908130915292852,Ht=pt(ht/10)/pt(7*ht/10),Ut=pt(gt/10)*Ht,Wt=-ft(gt/10)*Ht,Gt={draw(e,t){let n=mt(t*Vt),r=Ut*n,i=Wt*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=gt*t/5,o=ft(a),s=pt(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},Kt=mt(3),qt={draw(e,t){let n=-mt(t/(Kt*3));e.moveTo(0,n*2),e.lineTo(-Kt*n,-n),e.lineTo(Kt*n,-n),e.closePath()}},Jt=-.5,Yt=mt(3)/2,Xt=1/mt(12),Zt=(Xt/2+1)*3,Qt={draw(e,t){let n=mt(t/Zt),r=n/2,i=n*Xt,a=r,o=n*Xt+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(Jt*r-Yt*i,Yt*r+Jt*i),e.lineTo(Jt*a-Yt*o,Yt*a+Jt*o),e.lineTo(Jt*s-Yt*c,Yt*s+Jt*c),e.lineTo(Jt*r+Yt*i,Jt*i-Yt*r),e.lineTo(Jt*a+Yt*o,Jt*o-Yt*a),e.lineTo(Jt*s+Yt*c,Jt*c-Yt*s),e.closePath()}};function $t(e,t){let n=null,r=wt(i);e=typeof e==`function`?e:R(e||Ft),t=typeof t==`function`?t:R(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:R(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:R(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function en(){}function tn(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function nn(e){this._context=e}nn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:tn(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:tn(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function rn(e){return new nn(e)}function an(e){this._context=e}an.prototype={areaStart:en,areaEnd:en,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:tn(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function on(e){return new an(e)}function sn(e){this._context=e}sn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:tn(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function cn(e){return new sn(e)}function ln(e){this._context=e}ln.prototype={areaStart:en,areaEnd:en,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function un(e){return new ln(e)}function dn(e){return e<0?-1:1}function fn(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(dn(a)+dn(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function pn(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function mn(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function hn(e){this._context=e}hn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:mn(this,this._t0,pn(this,this._t0))}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,e!==this._x1||t!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,mn(this,pn(this,n=fn(this,e,t)),n);break;default:mn(this,this._t0,n=fn(this,e,t))}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function gn(e){this._context=new _n(e)}(gn.prototype=Object.create(hn.prototype)).point=function(e,t){hn.prototype.point.call(this,t,e)};function _n(e){this._context=e}_n.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function vn(e){return new hn(e)}function yn(e){return new gn(e)}function bn(e){this._context=e}bn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=xn(e),i=xn(t),a=0,o=1;o<n;++a,++o)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[o],t[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function xn(e){var t,n=e.length-1,r,i=Array(n),a=Array(n),o=Array(n);for(i[0]=0,a[0]=2,o[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,o[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,o[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,o[t]-=r*o[t-1];for(i[n-1]=o[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function Sn(e){return new bn(e)}function Cn(e,t){this._context=e,this._t=t}Cn.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};function wn(e){return new Cn(e,.5)}function Tn(e){return new Cn(e,0)}function En(e){return new Cn(e,1)}function Dn(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n<o;++n)for(i=a,a=e[t[n]],r=0;r<s;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function On(e){for(var t=e.length,n=Array(t);--t>=0;)n[t]=t;return n}function kn(e,t){return e[t]}function An(e){let t=[];return t.key=e,t}function jn(){var e=R([]),t=On,n=Dn,r=kn;function i(i){var a=Array.from(e.apply(this,arguments),An),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o<s;++o)(a[o][c]=[0,+r(e,a[o].key,c,i)]).data=e;for(o=0,l=Tt(t(a));o<s;++o)a[l[o]].index=o;return n(a,l),a}return i.keys=function(t){return arguments.length?(e=typeof t==`function`?t:R(Array.from(t)),i):e},i.value=function(e){return arguments.length?(r=typeof e==`function`?e:R(+e),i):r},i.order=function(e){return arguments.length?(t=e==null?On:typeof e==`function`?e:R(Array.from(e)),i):t},i.offset=function(e){return arguments.length?(n=e??Dn,i):n},i}function Mn(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,o;i<a;++i){for(o=n=0;n<r;++n)o+=e[n][i][1]||0;if(o)for(n=0;n<r;++n)e[n][i][1]/=o}Dn(e,t)}}function Nn(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var o=0,s=0;o<i;++o)s+=e[o][n][1]||0;r[n][1]+=r[n][0]=-s/2}Dn(e,t)}}function Pn(e,t){if(!(!((o=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r<a;++r){for(var s=0,c=0,l=0;s<o;++s){for(var u=e[t[s]],d=u[r][1]||0,f=(d-(u[r-1][1]||0))/2,p=0;p<s;++p){var m=e[t[p]],h=m[r][1]||0,g=m[r-1][1]||0;f+=h-g}c+=d,l+=f*d}i[r-1][1]+=i[r-1][0]=n,c&&(n-=l/c)}i[r-1][1]+=i[r-1][0]=n,Dn(e,t)}}var Fn=[`type`,`size`,`sizeType`];function In(){return In=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},In.apply(null,arguments)}function Ln(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Rn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Ln(Object(n),!0).forEach(function(t){zn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ln(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zn(e,t,n){return(t=Bn(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Bn(e){var t=Vn(e,`string`);return typeof t==`symbol`?t:t+``}function Vn(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Hn(e,t){if(e==null)return{};var n,r,i=Un(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Un(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var Wn={symbolCircle:Ft,symbolCross:It,symbolDiamond:zt,symbolSquare:Bt,symbolStar:Gt,symbolTriangle:qt,symbolWye:Qt},Gn=Math.PI/180,Kn=e=>Wn[`symbol${Qe(e)}`]||Ft,qn=(e,t,n)=>{if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*Gn;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},Jn=(e,t)=>{Wn[`symbol${Qe(e)}`]=t},Yn=e=>{var t=e.type,n=t===void 0?`circle`:t,r=e.size,i=r===void 0?64:r,a=e.sizeType,o=a===void 0?`area`:a,s=Rn(Rn({},Hn(e,Fn)),{},{type:n,size:i,sizeType:o}),c=`circle`;typeof n==`string`&&(c=n);var l=()=>{var e=Kn(c),t=$t().type(e).size(qn(i,o,c))();if(t!==null)return t},u=s.className,d=s.cx,f=s.cy,p=ke(s);return F(d)&&F(f)&&F(i)?N.createElement(`path`,In({},p,{className:E(`recharts-symbols`,u),transform:`translate(${d}, ${f})`,d:l()})):null};Yn.registerSymbol=Jn;var Xn=e=>`radius`in e&&`startAngle`in e&&`endAngle`in e,Zn=(e,t)=>{if(!e||typeof e==`function`||typeof e==`boolean`)return null;var n=e;if((0,N.isValidElement)(e)&&(n=e.props),typeof n!=`object`&&typeof n!=`function`)return null;var r={};return Object.keys(n).forEach(e=>{Ce(e)&&typeof n[e]==`function`&&(r[e]=t||(t=>n[e](n,t)))}),r},Qn=(e,t,n)=>r=>(e(t,n,r),null),$n=(e,t,n)=>{if(e===null||typeof e!=`object`&&typeof e!=`function`)return null;var r=null;return Object.keys(e).forEach(i=>{var a=e[i];Ce(i)&&typeof a==`function`&&(r||={},r[i]=Qn(a,t,n))}),r};function er(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function tr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?er(Object(n),!0).forEach(function(t){nr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):er(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function nr(e,t,n){return(t=rr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function rr(e){var t=ir(e,`string`);return typeof t==`symbol`?t:t+``}function ir(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function z(e,t){var n=tr({},e),r=t;return Object.keys(t).reduce((e,t)=>(e[t]===void 0&&r[t]!==void 0&&(e[t]=r[t]),e),n)}function ar(){return ar=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ar.apply(null,arguments)}function or(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function sr(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?or(Object(n),!0).forEach(function(t){cr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):or(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function cr(e,t,n){return(t=lr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function lr(e){var t=ur(e,`string`);return typeof t==`symbol`?t:t+``}function ur(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var dr=32,fr={align:`center`,iconSize:14,inactiveColor:`#ccc`,layout:`horizontal`,verticalAlign:`middle`,labelStyle:{}};function pr(e){if(typeof e==`object`&&e&&`strokeDasharray`in e)return String(e.strokeDasharray)}function mr(e){var t=e.data,n=e.iconType,r=e.inactiveColor,i=dr/2,a=dr/6,o=dr/3,s=t.inactive?r:t.color,c=n??t.type;if(c===`none`)return null;if(c===`plainline`)return N.createElement(`line`,{strokeWidth:4,fill:`none`,stroke:s,strokeDasharray:pr(t.payload),x1:0,y1:i,x2:dr,y2:i,className:`recharts-legend-icon`});if(c===`line`)return N.createElement(`path`,{strokeWidth:4,fill:`none`,stroke:s,d:`M0,${i}h${o}
|
|
2
2
|
A${a},${a},0,1,1,${2*o},${i}
|
|
3
3
|
H${dr}M${2*o},${i}
|
|
4
4
|
A${a},${a},0,1,1,${o},${i}`,className:`recharts-legend-icon`});if(c===`rect`)return N.createElement(`path`,{stroke:`none`,fill:s,d:`M0,${dr/8}h${dr}v${dr*3/4}h${-dr}z`,className:`recharts-legend-icon`});if(N.isValidElement(t.legendIcon)){var l=sr({},t);return delete l.legendIcon,N.cloneElement(t.legendIcon,l)}return N.createElement(Yn,{fill:s,cx:i,cy:i,size:dr,sizeType:`diameter`,type:c})}function hr(e){var t=e.payload,n=e.iconSize,r=e.layout,i=e.formatter,a=e.inactiveColor,o=e.iconType,s=e.labelStyle,c={x:0,y:0,width:dr,height:dr},l={display:r===`horizontal`?`inline-block`:`block`,marginRight:10,whiteSpace:`nowrap`},u={display:`inline-block`,verticalAlign:`middle`,marginRight:4};return t.map((t,r)=>{var d=t.formatter||i,f=E({"recharts-legend-item":!0,[`legend-item-${r}`]:!0,inactive:t.inactive});if(t.type===`none`)return null;var p=typeof s==`object`?sr({},s):{};p.color=t.inactive?a:p.color||t.color,p.whiteSpace??=`normal`,p.overflowWrap??=`break-word`;var m=d?d(t.value,t,r):t.value;return N.createElement(`li`,ar({className:f,style:l,key:`legend-item-${r}`},$n(e,t,r)),N.createElement(Fe,{width:n,height:n,viewBox:c,style:u,"aria-label":t.value==null?`legend icon`:`${t.value} legend icon`},N.createElement(mr,{data:t,iconType:o,inactiveColor:a})),N.createElement(`span`,{className:`recharts-legend-item-text`,style:p},m))})}var gr=e=>{var t=z(e,fr),n=t.payload,r=t.layout,i=t.align;if(!n||!n.length)return null;var a={padding:0,margin:0,textAlign:r===`horizontal`?i:`left`};return N.createElement(`ul`,{className:`recharts-default-legend`,style:a},N.createElement(hr,ar({},t,{payload:n})))};function _r(e,t,n){return t===!0?ye(e,n):typeof t==`function`?ye(e,t):e}var vr=(0,N.createContext)(null),yr=k(),br=e=>e,B=()=>{var e=(0,N.useContext)(vr);return e?e.store.dispatch:br},xr=()=>{},Sr=()=>xr,Cr=(e,t)=>e===t;function V(e){var t=(0,N.useContext)(vr),n=(0,N.useMemo)(()=>t?t=>{if(t!=null)return e(t)}:xr,[t,e]);return(0,yr.useSyncExternalStoreWithSelector)(t?t.subscription.addNestedSub:Sr,t?t.store.getState:xr,t?t.store.getState:xr,n,Cr)}function wr(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!=`function`)throw TypeError(t)}function Tr(e,t=`expected all items to be functions, instead received the following types: `){if(!e.every(e=>typeof e==`function`)){let n=e.map(e=>typeof e==`function`?`function ${e.name||`unnamed`}()`:typeof e).join(`, `);throw TypeError(`${t}[${n}]`)}}var Er=e=>Array.isArray(e)?e:[e];function Dr(e){let t=Array.isArray(e[0])?e[0]:e;return Tr(t,`createSelector expects all input-selectors to be functions, but received the following types: `),t}function Or(e,t){let n=[],{length:r}=e;for(let i=0;i<r;i++)n.push(e[i].apply(null,t));return n}var kr=class{constructor(e){this.value=e}deref(){return this.value}},Ar=typeof WeakRef>`u`?kr:WeakRef,jr=0,Mr=1;function Nr(){return{s:jr,v:void 0,o:null,p:null}}function Pr(e){return e instanceof Ar?e.deref():e}function Fr(e,t={}){let n=Nr(),{resultEqualityCheck:r}=t,i,a=0;function o(){let t=n,{length:o}=arguments;for(let e=0,n=o;e<n;e++){let n=arguments[e];if(typeof n==`function`||typeof n==`object`&&n){let e=t.o;e===null&&(t.o=e=new WeakMap);let r=e.get(n);r===void 0?(t=Nr(),e.set(n,t)):t=r}else{let e=t.p;e===null&&(t.p=e=new Map);let r=e.get(n);r===void 0?(t=Nr(),e.set(n,t)):t=r}}let s=t,c;if(t.s===Mr)c=t.v;else if(c=e.apply(null,arguments),a++,r){let e=Pr(i);e!=null&&r(e,c)&&(c=e,a!==0&&a--),i=typeof c==`object`&&c||typeof c==`function`?new Ar(c):c}return s.s=Mr,s.v=c,c}return o.clearCache=()=>{n=Nr(),o.resetResultsCount()},o.resultsCount=()=>a,o.resetResultsCount=()=>{a=0},o}function Ir(e,...t){let n=typeof e==`function`?{memoize:e,memoizeOptions:t}:e,r=(...e)=>{let t=0,r=0,i,a={},o=e.pop();typeof o==`object`&&(a=o,o=e.pop()),wr(o,`createSelector expects an output function after the inputs, but received: [${typeof o}]`);let{memoize:s,memoizeOptions:c=[],argsMemoize:l=Fr,argsMemoizeOptions:u=[]}={...n,...a},d=Er(c),f=Er(u),p=Dr(e),m=s(function(){return t++,o.apply(null,arguments)},...d),h=l(function(){r++;let e=Or(p,arguments);return i=m.apply(null,e),i},...f);return Object.assign(h,{resultFunc:o,memoizedResultFunc:m,dependencies:p,dependencyRecomputations:()=>r,resetDependencyRecomputations:()=>{r=0},lastResult:()=>i,recomputations:()=>t,resetRecomputations:()=>{t=0},memoize:s,argsMemoize:l})};return Object.assign(r,{withTypes:()=>r}),r}var H=Ir(Fr),Lr=e=>e.legend.settings,Rr=e=>e.legend.size,zr=H([e=>e.legend.payload,Lr],(e,t)=>{var n=t.itemSorter,r=e.flat(1);return n?ve(r,n):r});function Br(){return V(zr)}function Vr(e,t){return Kr(e)||Gr(e,t)||Ur(e,t)||Hr()}function Hr(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|