ztd-charts-cli 0.11.2 → 0.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +32 -32
- package/dist/api.js +1 -1
- package/dist/{chunk-6RWRYJ22.js → chunk-VUZPZ5FT.js} +5 -5
- package/dist/cli.js +2 -2
- package/dist/client/flowMap.js +5 -5
- package/package.json +2 -2
package/dist/api.d.ts
CHANGED
|
@@ -21,8 +21,8 @@ interface ChartSummary {
|
|
|
21
21
|
}
|
|
22
22
|
declare function summarize(def: ChartDef): ChartSummary;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
* locale
|
|
24
|
+
* Chart list. Filters group and level by id ("flow", "basic") or by English or Korean name ("흐름", "기본").
|
|
25
|
+
* With locale "ko", names and descriptions are in Korean; English by default
|
|
26
26
|
*/
|
|
27
27
|
declare function listCharts(filter?: {
|
|
28
28
|
group?: string;
|
|
@@ -30,9 +30,9 @@ declare function listCharts(filter?: {
|
|
|
30
30
|
locale?: string;
|
|
31
31
|
}): ChartSummary[];
|
|
32
32
|
declare function resolveType(type: string): ChartDef | undefined;
|
|
33
|
-
/**
|
|
33
|
+
/** JSON Schema for all charts or for one chart. With locale "ko", descriptions are in Korean */
|
|
34
34
|
declare function getChartSchema(type?: string, locale?: string): JSONSchema;
|
|
35
|
-
/**
|
|
35
|
+
/** One chart's description, schema, example and React code. With locale "ko", the text and example are in Korean */
|
|
36
36
|
declare function getChartInfo(type: string, locale?: string): {
|
|
37
37
|
why: string;
|
|
38
38
|
options: {
|
|
@@ -44,7 +44,7 @@ declare function getChartInfo(type: string, locale?: string): {
|
|
|
44
44
|
schema: JSONSchema | null;
|
|
45
45
|
example: ChartSpec;
|
|
46
46
|
react: string;
|
|
47
|
-
/**
|
|
47
|
+
/** Named variants: options laid over the example's options, plus encoding for variants that add fields, such as a range band (ztd-charts example <type> --variant <id>) */
|
|
48
48
|
variants: ztd_charts_spec.ChartVariant[];
|
|
49
49
|
type: string;
|
|
50
50
|
component: string;
|
|
@@ -62,20 +62,20 @@ declare function getChartInfo(type: string, locale?: string): {
|
|
|
62
62
|
description: string;
|
|
63
63
|
}[];
|
|
64
64
|
};
|
|
65
|
-
/**
|
|
65
|
+
/** Validates a spec. With locale "ko", messages are in Korean */
|
|
66
66
|
declare function validate(spec: unknown, locale?: string): ValidationResult;
|
|
67
|
-
/**
|
|
67
|
+
/** A spec as React code (using the component directly). With locale "ko", the comments are in Korean */
|
|
68
68
|
declare function reactSnippet(spec: ChartSpec, opts?: {
|
|
69
69
|
dataVar?: string;
|
|
70
70
|
inlineData?: boolean;
|
|
71
71
|
locale?: string;
|
|
72
72
|
}): string;
|
|
73
|
-
/**
|
|
73
|
+
/** React code that uses the spec as is. The ChartSpec annotation keeps values such as card.legend: "auto" from widening to string, so it compiles in TS as is */
|
|
74
74
|
declare function specSnippet(spec: ChartSpec): string;
|
|
75
|
-
/**
|
|
75
|
+
/** Font files to use for PNGs that contain Korean text */
|
|
76
76
|
declare function findFonts(extra?: string[]): string[];
|
|
77
77
|
interface FetchOptions {
|
|
78
|
-
/** false
|
|
78
|
+
/** When false, blocks data URLs that point to a private network or this machine (addresses such as 127.0.0.1, 10.x, 192.168.x, 169.254.169.254). Default true; the MCP server uses false */
|
|
79
79
|
allowPrivate?: boolean;
|
|
80
80
|
}
|
|
81
81
|
interface RenderOptions extends FetchOptions {
|
|
@@ -83,14 +83,14 @@ interface RenderOptions extends FetchOptions {
|
|
|
83
83
|
width?: number;
|
|
84
84
|
height?: number;
|
|
85
85
|
theme?: "dark" | "light";
|
|
86
|
-
/** PNG
|
|
86
|
+
/** PNG scale. Default 2 */
|
|
87
87
|
scale?: number;
|
|
88
|
-
/**
|
|
88
|
+
/** Card frame. Default: true when spec.card is set */
|
|
89
89
|
frame?: boolean;
|
|
90
|
-
/** HTML
|
|
90
|
+
/** Embeds a script in the HTML that brings back animation and interaction */
|
|
91
91
|
interactive?: boolean;
|
|
92
92
|
fonts?: string[];
|
|
93
|
-
/**
|
|
93
|
+
/** Locale for chart text, number format and error messages. "ko" gives Korean (1.2만). Without it, the spec's options.locale, then "en-US" (1.2K) */
|
|
94
94
|
locale?: string;
|
|
95
95
|
}
|
|
96
96
|
interface RenderResult {
|
|
@@ -100,34 +100,34 @@ interface RenderResult {
|
|
|
100
100
|
html?: string;
|
|
101
101
|
width?: number;
|
|
102
102
|
height?: number;
|
|
103
|
-
/**
|
|
103
|
+
/** What was changed while rendering (such as emoji removed from the PNG). Shown like warnings */
|
|
104
104
|
notes?: string[];
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
107
|
+
* Removes emoji from SVG text before converting to PNG. resvg cannot draw color emoji fonts, so a whole text run containing an emoji comes out as boxes.
|
|
108
|
+
* Collapses the doubled spaces left where emoji were removed and trims leading and trailing spaces. Returns the number removed
|
|
109
109
|
*/
|
|
110
110
|
declare function stripEmoji(svg: string): {
|
|
111
111
|
svg: string;
|
|
112
112
|
removed: number;
|
|
113
113
|
};
|
|
114
|
-
/**
|
|
114
|
+
/** Time and size limits for fetching a data URL */
|
|
115
115
|
declare const FETCH_TIMEOUT_MS = 15000;
|
|
116
116
|
declare const MAX_FETCH_BYTES: number;
|
|
117
117
|
/**
|
|
118
|
-
* http(s)
|
|
119
|
-
* allowPrivate
|
|
120
|
-
*
|
|
118
|
+
* Fetches an http(s) URL within the time (FETCH_TIMEOUT_MS) and size (MAX_FETCH_BYTES) limits.
|
|
119
|
+
* When allowPrivate is false, blocks URLs that point to a private network or this machine (MCP server). On failure, throws an error that includes the URL.
|
|
120
|
+
* The returned Response holds only the fully received body and content-type
|
|
121
121
|
*/
|
|
122
122
|
declare function fetchUrl(url: string, locale?: string, opts?: FetchOptions): Promise<Response>;
|
|
123
123
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
124
|
+
* Renders a spec to SVG, PNG or HTML. Validates the spec first (URL data without field checks), fetches { url } data, then validates again with the rows.
|
|
125
|
+
* Fetching, validation and rendering use the same locale (locale, then the spec's options.locale)
|
|
126
126
|
*/
|
|
127
127
|
declare function render(input: ChartSpec, opts?: RenderOptions): Promise<RenderResult>;
|
|
128
128
|
/**
|
|
129
|
-
* SVG
|
|
130
|
-
* MCP
|
|
129
|
+
* SVG to PNG (resvg). Removes emoji and reports how many in notes, in the locale's language.
|
|
130
|
+
* MCP uses this to convert an already rendered SVG when it is too large to send as text
|
|
131
131
|
*/
|
|
132
132
|
declare function svgToPng(svg: string, opts?: {
|
|
133
133
|
scale?: number;
|
|
@@ -138,20 +138,20 @@ declare function svgToPng(svg: string, opts?: {
|
|
|
138
138
|
notes?: string[];
|
|
139
139
|
}>;
|
|
140
140
|
/**
|
|
141
|
-
*
|
|
141
|
+
* Maximum pixel count of one PNG. Allows up to 10,000 × 5,000px, or a 2400 × 1000px chart at scale 4 (about 38 million); at 4 bytes per pixel the bitmap tops out at about 200MB
|
|
142
142
|
*/
|
|
143
143
|
declare const PNG_MAX_PIXELS = 50000000;
|
|
144
144
|
/**
|
|
145
|
-
* PNG
|
|
146
|
-
*
|
|
147
|
-
*
|
|
145
|
+
* PNG scale. When the outer <svg> size of the SVG to render × scale² exceeds PNG_MAX_PIXELS, lowers the scale to stay within it (decided before the bitmap is allocated).
|
|
146
|
+
* The size is measured unshrunk (some documents, such as small multiples or long legends, are larger than the per-side chart limit).
|
|
147
|
+
* null, so nothing is drawn, when the outer <svg> has no pixel width and height, or they are 0 or less, or not finite (the limit cannot be proven)
|
|
148
148
|
*/
|
|
149
149
|
declare function pngZoom(svg: string, scale: number): number | null;
|
|
150
|
-
/** http(s)
|
|
150
|
+
/** Whether it is an http(s) URL. loadRows, CLI suggest and MCP suggest_chart use the same rule (case-insensitive) */
|
|
151
151
|
declare function isHttpUrl(source: string): boolean;
|
|
152
|
-
/**
|
|
152
|
+
/** A file path, URL, or CSV/JSON string to an array of rows */
|
|
153
153
|
declare function loadRows(source: string, locale?: string, opts?: FetchOptions): Promise<Record<string, unknown>[]>;
|
|
154
|
-
/**
|
|
154
|
+
/** Chart suggestions from data. With locale "ko", the reasons and card text are in Korean */
|
|
155
155
|
declare function suggest(rows: Record<string, unknown>[], opts?: {
|
|
156
156
|
limit?: number;
|
|
157
157
|
locale?: string;
|
package/dist/api.js
CHANGED
|
@@ -9,7 +9,7 @@ import { langOf, mapExportName, renderSpecToHTML, renderSpecToSVG, resolveDef, r
|
|
|
9
9
|
|
|
10
10
|
// src/messages.ts
|
|
11
11
|
import { plural } from "ztd-charts/server";
|
|
12
|
-
var VERSION = "0.11.
|
|
12
|
+
var VERSION = "0.11.3";
|
|
13
13
|
var SCHEMA_URL = "https://unpkg.com/ztd-charts/schema/chart-spec.schema.json";
|
|
14
14
|
var en = {
|
|
15
15
|
help: `ztd-charts ${VERSION} CLI for 44 React chart types
|
|
@@ -48,7 +48,7 @@ Examples
|
|
|
48
48
|
badOut: (file) => `Can't save ${file}: end the file name with .svg, .png or .html`,
|
|
49
49
|
unknownFilter: (flag, v, choices) => `--${flag} takes one of: ${choices.join(", ")}. Got: ${v}`,
|
|
50
50
|
error: (m) => `Error: ${m}`,
|
|
51
|
-
/** list
|
|
51
|
+
/** list table headers and column widths */
|
|
52
52
|
listHead: ["type", "name", "level", "group", "summary"],
|
|
53
53
|
listWidths: [12, 22, 14, 14],
|
|
54
54
|
listFoot: (n) => `
|
|
@@ -77,14 +77,14 @@ ${n} charts. Details: ztd-charts info <type>`,
|
|
|
77
77
|
`,
|
|
78
78
|
noFit: "No chart fits this data. Check the column names and formats",
|
|
79
79
|
score: "score",
|
|
80
|
-
/**
|
|
80
|
+
/** Fetching a data URL (render's data.url, suggest's URL) */
|
|
81
81
|
fetchFailed: (url, m) => `Couldn't load data from ${url}: ${m}`,
|
|
82
82
|
httpOnly: "only http:// and https:// addresses can be fetched",
|
|
83
83
|
timeout: (s) => `no response within ${s} seconds`,
|
|
84
84
|
tooLarge: (mb) => `the response is larger than ${mb} MB`,
|
|
85
85
|
privateUrl: "the address points to a private or local network, which is blocked. To allow it, run the MCP server with ZTD_CHARTS_ALLOW_PRIVATE_URLS=1",
|
|
86
86
|
tooManyRedirects: "too many redirects",
|
|
87
|
-
/** ztd-charts init
|
|
87
|
+
/** Example files that ztd-charts init creates */
|
|
88
88
|
init: (type) => ({
|
|
89
89
|
"charts/sales.csv": "month,channel,revenue\n2025-01,Search,120\n2025-01,Social,64\n2025-02,Search,128\n2025-02,Social,75\n2025-03,Search,131\n2025-03,Social,92\n2025-04,Search,140\n2025-04,Social,104\n",
|
|
90
90
|
"charts/Dashboard.tsx": dashboard(type, {
|
|
@@ -264,7 +264,7 @@ function getChartInfo(type, locale) {
|
|
|
264
264
|
schema: schemaForIn(def.type, lang),
|
|
265
265
|
example: def.example,
|
|
266
266
|
react: reactSnippet(def.example, { locale }),
|
|
267
|
-
/**
|
|
267
|
+
/** Named variants: options laid over the example's options, plus encoding for variants that add fields, such as a range band (ztd-charts example <type> --variant <id>) */
|
|
268
268
|
variants: variantsIn(def.type, lang)
|
|
269
269
|
};
|
|
270
270
|
}
|
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
resolveType,
|
|
14
14
|
suggest,
|
|
15
15
|
validate
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-VUZPZ5FT.js";
|
|
17
17
|
|
|
18
18
|
// src/cli.ts
|
|
19
19
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -189,7 +189,7 @@ ${info.react}`);
|
|
|
189
189
|
const scale = numberFlag(f, "scale");
|
|
190
190
|
const res = await render(spec, {
|
|
191
191
|
format,
|
|
192
|
-
//
|
|
192
|
+
// Each side goes up to MAX_CHART_SIZE (10,000px). Larger sizes are reduced to it
|
|
193
193
|
width: capChartSize(numberFlag(f, "width")),
|
|
194
194
|
height: capChartSize(numberFlag(f, "height")),
|
|
195
195
|
theme,
|
package/dist/client/flowMap.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var Ri=Object.create;var vr=Object.defineProperty;var Pi=Object.getOwnPropertyDescriptor;var Li=Object.getOwnPropertyNames;var _i=Object.getPrototypeOf,Di=Object.prototype.hasOwnProperty;var wn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Ei=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Li(t))!Di.call(e,o)&&o!==n&&vr(e,o,{get:()=>t[o],enumerable:!(r=Pi(t,o))||r.enumerable});return e};var
|
|
1
|
+
(()=>{var Ri=Object.create;var vr=Object.defineProperty;var Pi=Object.getOwnPropertyDescriptor;var Li=Object.getOwnPropertyNames;var _i=Object.getPrototypeOf,Di=Object.prototype.hasOwnProperty;var wn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Ei=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Li(t))!Di.call(e,o)&&o!==n&&vr(e,o,{get:()=>t[o],enumerable:!(r=Pi(t,o))||r.enumerable});return e};var N=(e,t,n)=>(n=e!=null?Ri(_i(e)):{},Ei(t||!e||!e.__esModule?vr(n,"default",{value:e,enumerable:!0}):n,e));var Z=wn((xc,Mr)=>{Mr.exports=globalThis.__ztdReact.react});var Tr=wn((kc,Sr)=>{Sr.exports=globalThis.__ztdReact["react-dom/client"]});var B=wn((_c,Qr)=>{Qr.exports=globalThis.__ztdReact["react/jsx-runtime"]});var hr=N(Z(),1),bi=N(Tr(),1);var Ft=N(Z(),1);var Kt=N(Z(),1);var Cr=N(Z(),1),qe=(0,Cr.createContext)(void 0);var Rr=N(Z(),1);var Ii=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],Nr='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',Ar='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',_e={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",accent2:"#FF8CC1",accent3:"#38C6F6",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:Nr,monoFamily:Ar,radius:18,radiusCode:14,radiusMark:4},$n={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",accent2:"#D8488C",accent3:"#659815",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:Nr,monoFamily:Ar,radius:18,radiusCode:14,radiusMark:4},vn={dark:_e,light:$n};function Lt(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function Mn(e){let t={};for(let n of Ii){let r=e[n];typeof r=="string"&&(t[Lt(n)]=r)}return e.fontFamily&&(t["--ztd-font"]=e.fontFamily),e.monoFamily&&(t["--ztd-mono"]=e.monoFamily),e.radius!==void 0&&(t["--ztd-radius"]=`${e.radius}px`),e.radiusCode!==void 0&&(t["--ztd-radius-code"]=`${e.radiusCode}px`),e.radiusMark!==void 0&&(t["--ztd-radius-mark"]=`${e.radiusMark}px`),t}function Sn(e,t){if(!t)return e;let n={...e};for(let r of Object.keys(t)){let o=t[r];o!==void 0&&(n[r]=o)}return n}var Oi=`
|
|
2
2
|
.ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
|
|
3
3
|
.ztd-root:focus{outline:none}
|
|
4
4
|
.ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${_e.accent});outline-offset:3px;border-radius:6px}
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
@keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
|
|
20
20
|
.ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
|
|
21
21
|
@media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
|
|
22
|
-
`;function Lt(e,t,n,r,o){if(e)return t?{opacity:0}:{animation:`ztd-${n} ${Math.round(o)}ms cubic-bezier(.22,.9,.3,1) ${Math.round(r)}ms backwards`}}function _t(e,t){let[n]=(0,Rr.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var Fr=!1;function ft(){if(Fr||typeof document>"u"||(Fr=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=Oi,document.head.appendChild(e)}var Dt=A(Z(),1),xe=typeof window<"u"&&typeof document<"u",Ne=xe?Dt.useLayoutEffect:Dt.useEffect;function Et(){return typeof performance<"u"?performance.now():Date.now()}function Q(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Ae(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var Pr={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},Lr={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var zi=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],ji={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function Bi(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function Gi(e){return Bi(zi,e)}function _r(e,t){let n=Gi(e);return{text:n?n[t]:e,...ji[n?.id??"basic"]}}var Dr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Ze(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Dr[t.toLowerCase()]&&(t=Dr[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(i=>i+i).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let a=parseInt(o,16);return o.length===6?[a>>16&255,a>>8&255,a&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let a=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),i=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return a.some(s=>Number.isNaN(s))?null:[a[0],a[1],a[2],Number.isNaN(i)?1:i]}return null}function Or(e){let t=n=>Math.round(Math.max(0,Math.min(255,n))).toString(16).padStart(2,"0");return`#${t(e[0])}${t(e[1])}${t(e[2])}${e[3]<1?t(e[3]*255):""}`.toUpperCase()}function Cn(e,t){let n=e[3];return[e[0]*n+t[0]*(1-n),e[1]*n+t[1]*(1-n),e[2]*n+t[2]*(1-n),1]}function Qe(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Er(e){return .2126*Qe(e[0])+.7152*Qe(e[1])+.0722*Qe(e[2])}function Nn(e,t,n){let r=typeof e=="string"?Ze(e):e,o=typeof t=="string"?Ze(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?Ze(n):n:null;o[3]<1&&a&&(o=Cn(o,a));let i=r[3]<1?Cn(r,o):r,s=Er(i),l=Er(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function Hi(e){return[Qe(e[0]),Qe(e[1]),Qe(e[2])]}function Tn(e){let t=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.max(0,Math.min(255,t*255))}function Ir(e){let[t,n,r]=Hi(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),i=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*a-.0040720468*i,1.9779984951*o-2.428592205*a+.4505937099*i,.0259040371*o+.7827717662*a-.808675766*i]}function Wi([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,a=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[Tn(4.0767416621*o-3.3077115913*a+.2309699292*i),Tn(-1.2684380046*o+2.6097574011*a-.3413193965*i),Tn(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function It(e,t,n){let r=Ze(e),o=Ze(t);if(!r||!o)return e;let a=Ir(r),i=Ir(o),s=Math.max(0,Math.min(1,n));return Or(Wi([a[0]*s+i[0]*(1-s),a[1]*s+i[1]*(1-s),a[2]*s+i[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function An(e,t,n){let r=t[0],o=-1;for(let a of t){let i=Nn(a,e,n);i>o&&(o=i,r=a)}return r}function re(e,t){let n=e.theme;switch(t){case"accent":return{role:t,fill:e.paint("accent"),text:e.paint("onAccent"),raw:n.accent};case"ink":return{role:t,fill:e.paint("ink"),text:e.paint("onInk"),raw:n.ink};case"strong":return{role:t,fill:e.paint("neutralStrong"),text:e.paint("onNeutralStrong"),raw:n.neutralStrong};case"soft":return{role:t,fill:e.paint("neutralSoft"),text:e.paint("ink"),raw:n.neutralSoft};default:return{role:"neutral",fill:e.paint("neutral"),text:e.paint("ink"),raw:n.neutral}}}function Vi(e,t){let n=An(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Nn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):An(t,["#FFFFFF","#000000"])}function Ot(e,t){let n=It(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Vi(e,n),raw:n}}function ke(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=re(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=re(e,"neutral");else if(s===0)r[i]=re(e,"ink");else if(s===a-1)r[i]=re(e,"neutral");else if(a===3)r[i]=re(e,"strong");else{let l=(s-1)/Math.max(1,a-2);r[i]=l<=.001?re(e,"strong"):Ot(e,1-l)}}),r}var Fn="mix:";function De(e){return e({theme:$n,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${Fn}${o}`}).map(n=>n.fill)}function zr(e,t){return t?.startsWith(Fn)?e.mix("neutralStrong","neutral",Number(t.slice(Fn.length))):e.color(t)}function ht(e,t,n){return ke(e,t+1,n).slice(0,t)}function jr(e,t,n,r="neutral"){let o=re(e,"accent"),a=re(e,r);return Array.from({length:t},(i,s)=>n.has(s)?o:a)}function Br(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=re(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=re(e,"neutral"):s===0?r[i]=re(e,"strong"):s===a-1?r[i]=re(e,"neutral"):r[i]=Ot(e,1-s/(a-1))}),r}var we=A(Z(),1);var zt=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),ue="en-US",Gr=new Map;function Rn(e,t){let n=t.maximumFractionDigits!==void 0||t.style==="currency"?t:{...t,maximumFractionDigits:Math.max(1,t.minimumFractionDigits??0)},r=e+JSON.stringify(n),o=Gr.get(r);return o||(o=new Intl.NumberFormat(e,n),Gr.set(r,o)),o}function Pn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function tt(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ue,...r}=t;return Pn(Rn(n,r).format(e))}var Ln=e=>e!==0&&Math.abs(e)<.05,_n=(e,t,n="")=>`${tt(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function et(e,t={}){if(!Number.isFinite(e))return"-";if(Ln(e)&&t.maximumFractionDigits===void 0)return _n(e,t.locale??ue,"%");let n=Math.abs(e);return`${tt(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Kr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ue,...r}=t;if(Q(n)==="ko"){let o=Math.abs(e),a=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],i=a.findIndex(([s])=>o>=s);for(i<0&&(i=a.length-1);;){let[s,l]=a[i],c=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**m)/10**m;if(i>0&&u>=a[i-1][0]/s){i--;continue}return(e<0&&u!==0?"-":"")+tt(u,{locale:n,...r,maximumFractionDigits:m})+l}}return Pn(Rn(n,{notation:"compact",...r}).format(e))}var Ki=(e,t=Q(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function ze(e,t=ue,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=Rn(t,o);return l=>Number.isFinite(l)?`${i}${Pn(s.format(l))}${a}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:a="",...i}=e;return r(i,o,a)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>et(o,{locale:t});case"ratio":return o=>et(o*100,{locale:t});case"compact":return o=>Kr(o,{locale:t});case"currency":return r(Ki(t));default:{let o=r({maximumFractionDigits:1});return a=>Ln(a)?_n(a,t):o(a)}}}function Xr(e,t=ue,n=0){return e!==void 0?ze(e,t):n>=1e5?r=>Ln(r)?_n(r,t):Kr(r,{locale:t}):r=>tt(r,{locale:t})}function Xi(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Dn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Yi=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Ui=["january","february","march","april","may","june","july","august","september","october","november","december"],Hr=e=>{let t=e.toLowerCase();return t.length<3?0:Ui.findIndex(n=>n.startsWith(t))+1},Wr=e=>+e+(+e<30?2e3:1900);function Yr(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Ji=[/^(\d{4})-(\d{1,2})(?:-(\d{1,2}))?$/,/^(\d{4})[./]\s*(\d{1,2})[./]\s*(\d{1,2})\.?$/,/^(19\d\d|20\d\d|2100)(\d\d)(\d\d)$/,/^(\d{4})년\s*(\d{1,2})월(?:\s*(\d{1,2})일)?$/],Ur=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Jr=/\{([^{}]+)\}/g;function jt(e,t){let n;for(let r of Ji)if(n=r.exec(e))return[+n[1],+n[2],+(n[3]??1),n[3]?1:2];if(/^\d{4}-\d/.test(e))return null;if(n=/^(\d{2})\.\s*(\d{1,2})\.\s*(\d{1,2})\.?$/.exec(e))return t?[Wr(n[3]),+n[2],+n[1],1]:[Wr(n[1]),+n[2],+n[3],1];if(n=/^(?:(\d{4})\s*-?\s*Q([1-4])|Q([1-4])\s*-?\s*(\d{4})|(\d{4})년\s*([1-4])분기)$/i.exec(e))return[+(n[1]??n[4]??n[5]),+(n[2]??n[3]??n[6])*3-2,1,3];if(n=Ur.exec(e)){let r=+n[1],o=+n[3],a=r>12||o<=12&&t===!0;return[+n[4],a?o:r,a?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=Hr(n[2]);return r?[+n[3],r,+n[1],1]:null}if(n=/^([a-z]{3,9})\.?\s+(?:(\d{1,2}),?\s+)?(\d{4})$/i.exec(e)){let r=Hr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var qr=e=>Yi.test(e)||jt(e)!==null;function Zr(e){let t;for(let n of e){let r=typeof n=="string"?Ur.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function Bt(e,t){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"){if(!Number.isFinite(e))return null;if(Number.isInteger(e)){if(Dn(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return Bt(`${e}`)}return new Date(Math.abs(e)>=1e9&&Math.abs(e)<1e10?e*1e3:e)}if(typeof e=="string"&&e.trim()){let n=e.trim(),r=jt(n,t);if(r)return Xi(r[0],r[1],r[2]);if(/^\d{4}$/.test(n))return new Date(Number(n),0,1);if(!/\d{4}/.test(n))return null;let o=new Date(n);return Number.isNaN(o.getTime())?null:o}return null}var Vr=new Map;function gt(e,t={month:"short",day:"numeric"}){let n=Bt(e);if(!n)return"-";let{locale:r=ue,...o}=t,a=r+JSON.stringify(o),i=Vr.get(a);return i||(i=new Intl.DateTimeFormat(r,o),Vr.set(a,i)),i.format(n)}var En=A(B(),1),Gt=(0,we.createContext)({theme:_e,cssVars:!0});function qi(e,t=_e){return e?typeof e=="string"?vn[e]??t:Sn(t,e):t}function Ht(e){let t=(0,we.useContext)(Gt),n=e.base?vn[e.base]:t.theme,r=(0,we.useMemo)(()=>qi(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,we.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,we.useMemo)(()=>Mn(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,En.jsx)(Gt.Provider,{value:i,children:(0,En.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Zi=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function eo(e){return Zi.has(e)}function Qi(e,t){let n=r=>t?`var(${Pt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?eo(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?eo(r)?e[r]:r:e[o],mix:(r,o,a)=>{let i=Math.round(Math.max(0,Math.min(1,a))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${i}%, ${n(o)})`:It(e[r],e[o],a)}}}function $e(e){let t=(0,we.useContext)(Gt);return(0,we.useMemo)(()=>{let n=Sn(t.theme,e);return Qi(n,t.cssVars)},[t.theme,t.cssVars,e])}function me(e){let t=(0,we.useContext)(Gt);return e??t.locale??ue}function to(e){return e?Mn(e):{}}var Wt=A(Z(),1),In=(0,Wt.createContext)(void 0);function no(e){let t=(0,Wt.useContext)(In);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var P=A(B(),1),es={legend:"Legend",replay:"Replay animation",replayTitle:"Replay",sample:"Sample data",loadError:"Couldn't load data",retry:"Try again",loading:"Loading",empty:"No data to show",source:"Source",shown:(e,t)=>`${e} of ${t} series shown`},ts={en:es,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var ns={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},On=e=>ts[Q(me(e))];function zn(e){let t=$e(e.theme),n=On(e.locale),[r,o]=(0,Vt.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.label)).length,c=(0,P.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((m,u)=>{let d=!s.has(m.label),f=d&&l===1,h=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(rs,{p:t,item:m,off:!d}),(0,P.jsx)("span",{style:d?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,P.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,P.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":d,"aria-disabled":f||void 0,onClick:()=>{f||(i(m.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:f?"default":void 0},children:h}):h},u)})});return i?(0,P.jsxs)(P.Fragment,{children:[c,(0,P.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:ns,children:r?n.shown(l,e.items.length):""})]}):c}function rs({p:e,item:t,off:n}){let r=zr(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,P.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,P.jsx)("line",{x1:1,x2:13,y1:4,y2:4,stroke:r,strokeWidth:2,strokeDasharray:o==="dash"?"3 2":void 0,strokeLinecap:"round"}),o==="line"?(0,P.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,P.jsx)("span",{"aria-hidden":"true",style:{width:9,height:9,flex:"none",borderRadius:o==="circle"?9:2.5,background:r,boxShadow:t.color==="neutral"||t.color==="neutralSoft"||!t.color?`inset 0 0 0 1px ${e.paint("line2")}`:void 0,opacity:n?.35:void 0}})}function os(e){let t=$e(e.theme),n=_r(e.level,Q(me(e.locale)));return(0,P.jsx)("span",{style:{background:t.paint(n.bg),color:t.paint(n.fg),borderRadius:8,padding:"3px 9px",fontSize:12.5,fontWeight:700,lineHeight:"18px",whiteSpace:"nowrap",flex:"none"},children:n.text})}function as(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,P.jsxs)(P.Fragment,{children:[e.slice(0,r),(0,P.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function ro(e){let t=$e(e.theme),n=On(e.locale),[r,o]=(0,Vt.useState)(0);Ne(()=>ft(),[]);let a=()=>{o(d=>d+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,P.jsx)(zn,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,c=e.replay||e.onReplay,m=e.source!==void 0||e.note!==void 0?(0,P.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,P.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,P.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,P.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,P.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,P.jsx)(os,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,P.jsxs)("section",{id:e.id,className:`ztd-card${e.className?` ${e.className}`:""}`,style:{background:t.paint("panel"),color:t.paint("ink"),border:`1px solid ${t.paint("line")}`,borderRadius:`var(--ztd-radius, ${t.theme.radius}px)`,padding:"20px 20px 16px",display:"flex",flexDirection:"column",gap:12,minWidth:0,boxSizing:"border-box",fontFamily:t.cssVars?`var(--ztd-font, ${t.theme.fontFamily})`:t.theme.fontFamily,wordBreak:"keep-all",textWrap:"balance",...e.style},children:[(0,P.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,P.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,P.jsx)("span",{style:{fontFamily:t.cssVars?`var(--ztd-mono, ${t.theme.monoFamily})`:t.theme.monoFamily,fontSize:17,fontWeight:700,color:t.paint("accentText"),letterSpacing:-.2,flex:"none"},children:l}):null,(0,P.jsx)(s,{style:{margin:0,fontSize:22,fontWeight:800,color:t.paint("ink"),letterSpacing:-.5,lineHeight:1.25,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:as(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,P.jsx)("button",{type:"button",className:"ztd-btn",onClick:a,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,P.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,P.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,P.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,P.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,P.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,P.jsx)("span",{}),i]}):null]}),(0,P.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,P.jsx)(In.Provider,{value:r,children:(0,P.jsx)(qe.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,P.jsxs)(P.Fragment,{children:[m,u]}):u]})}function jn(e){let t=$e(e.theme),n=On(e.locale),r=e.height??220;if(Ne(()=>ft(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,P.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,P.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,P.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,P.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,P.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onRetry,style:{marginTop:4,background:t.paint("ink"),color:t.paint("onInk"),border:"none",borderRadius:14,padding:"5px 14px",fontSize:12.5,fontWeight:700},children:n.retry}):null]})})}return e.loading?(0,P.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,a)=>(0,P.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${a*90}ms`}},a))}):e.empty?(0,P.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,P.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,P.jsx)(P.Fragment,{children:e.children})}var it=A(Z(),1);var de=A(Z(),1);var X=A(B(),1),Kt=60;var Xt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function oo(e){let{c:t,events:n}=e,r=(0,de.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,Ne(()=>{ft()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,de.useContext)(qe),c=e.ariaLabel??l??e.kind,m=(0,de.useMemo)(()=>s?`${n.length}${n.slice(0,Kt).map(v=>`${v.label}${v.series??""}${v.formatted??v.value??""}`).join("")}`:"",[n,s]),u=(0,de.useMemo)(()=>(0,X.jsx)(is,{label:c,events:n,t:t.t}),[c,m,t.t]),d=(0,de.useRef)(null);(0,de.useEffect)(()=>{let v=()=>{d.current=null};return window.addEventListener("scroll",v,{capture:!0,passive:!0}),window.addEventListener("resize",v,{passive:!0}),()=>{window.removeEventListener("scroll",v,{capture:!0}),window.removeEventListener("resize",v)}},[]),(0,de.useEffect)(()=>{d.current=null},[t.width,t.height]);let f=v=>{if(v.target!==v.currentTarget)return;if(e.onKey?.(v)){v.preventDefault();return}let S=t.active,O;switch(v.key){case"ArrowRight":case"ArrowDown":O=S===null?0:(S+1)%i;break;case"ArrowLeft":case"ArrowUp":O=S===null?i-1:(S-1+i)%i;break;case"Home":O=0;break;case"End":O=i-1;break;case"Escape":if(S===null)return;O=null;break;case"Enter":case" ":S!==null&&(v.preventDefault(),t.click(S));return;default:return}v.preventDefault(),t.setActive(O,"keyboard")},{via:h,node:g,setActive:y}=t;(0,de.useEffect)(()=>{if(h!=="touch"||!g)return;let v=S=>{g.contains(S.target)||y(null)};return document.addEventListener("pointerdown",v),()=>document.removeEventListener("pointerdown",v)},[h,g,y]);let p=t.active!==null?n[t.active]:null,$=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,x=$&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,M=typeof e.renderTip=="function"&&p?e.renderTip(p):null,k=e.announce??(t.via==="keyboard"&&p?`${p.label}${p.series?` ${p.series}`:""}: ${p.formatted??p.value??""} (${(t.active??0)+1}/${i})`:""),R;if($){let v=$.x*x,S=t.width*x,O=`clamp(${(4-v).toFixed(1)}px, -50%, calc(${(S-v-4).toFixed(1)}px - 100%))`,E=$.y<64;R={position:"absolute",left:v,top:$.y*x,transform:`translate(${O}, ${E?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*x-8)}}let N=v=>{d.current=null,v.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},j=v=>v?S=>{let O=d.current??(d.current=S.currentTarget.getBoundingClientRect());O.width&&v((S.clientX-O.left)/O.width*t.width,(S.clientY-O.top)/O.height*t.height,S)}:void 0,G=j(e.onPointerMove),D=j(e.onPointerDown),_=G||D?v=>{v.pointerType==="touch"&&G?.(v),D?.(v)}:void 0,F=j(e.onPointerUp),T=to(e.theme);return(0,X.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?f:void 0,onBlur:v=>{t.via==="keyboard"&&!v.currentTarget.contains(v.relatedTarget)&&t.setActive(null)},onPointerLeave:N,style:{width:"100%",maxWidth:t.measured?void 0:"100%",fontFamily:t.p.cssVars?`var(--ztd-font, ${t.p.theme.fontFamily})`:t.p.theme.fontFamily,color:t.p.paint("ink"),...T,...e.style},children:[t.pending?null:e.underlay,(0,X.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${a}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:G,onPointerDown:_,onPointerUp:F,onPointerCancel:F,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,X.jsx)("title",{id:o,children:c}),(0,X.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,X.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,$?(0,X.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:R,children:M??(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:$.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:$.title}),$.rows.map((v,S)=>(0,X.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,X.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(v.strong?"ink":"muted")},children:[v.color?(0,X.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:v.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,v.label]}),(0,X.jsx)("span",{style:{fontWeight:v.strong===!1?500:700},children:v.value})]},S))]})}):null,(0,X.jsx)("span",{className:"ztd-sr",style:Xt,"aria-live":"polite","aria-atomic":"true",children:k}),s&&!t.pending?u:null]})}function is({label:e,events:t,t:n}){return(0,X.jsx)("div",{className:"ztd-sr",style:Xt,children:(0,X.jsxs)("table",{children:[(0,X.jsx)("caption",{children:n.table(e)}),(0,X.jsxs)("tbody",{children:[t.slice(0,Kt).map((r,o)=>(0,X.jsxs)("tr",{children:[(0,X.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,X.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Kt?(0,X.jsx)("tr",{children:(0,X.jsx)("td",{colSpan:2,children:n.more(t.length-Kt)})}):null]})]})})}function pt(e){let t=e.baseline??"central";return(0,X.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var w=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),pe=w("label","string",!0,"Item name field"),oe=w("value","number",!0,"Value field"),ss=[pe,oe],ls=[pe,oe],cs=[w("label","string",!0,"Stage name"),w("value","number",!0,"Users at the stage")],us=[pe,oe],ms=[w("label","string",!0,"Leaf (lowest level) name"),oe,w("group","string",!1,"Parent group field")],ds=[w("label","string",!0,"Leaf name"),oe,w("group","string",!1,"Parent group field")],fs=[pe,w("value","number",!0,"Change (total rows may omit it)"),w("type","string",!1,'"total" makes a total bar')],hs=[pe,oe],gs=[w("x","string",!0,"Column field"),w("series","string",!0,"Stacked series field"),oe],ps=[w("x","string",!0,"Column field"),w("y","string",!0,"Row field"),oe],bs=[w("axis","string",!0,"Metric (axis) field"),w("value","number",!0,"Value field",{multi:!0}),w("series","string",!1,"Series field")],ys=[w("x","number",!0,"x value"),w("y","number",!0,"y value"),w("size","number",!1,"Circle size"),w("label","string",!1,"Name")],io=w("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),xs=[w("x","any",!0,"x field (date, number or category)"),w("y","number",!0,"y field. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field (long tables)"),w("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),io],ks=[w("x","any",!0,"x field"),w("y","number",!0,"y field. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field"),w("lower","number",!1,'Lower bound of the range band, with stack "none" only. In wide tables an array in the order of y',{multi:!0}),io],ws=[w("x","any",!0,"x field"),w("y","number",!0,"y field",{multi:!0}),w("series","string",!1,"Series field")],$s=[w("x","string",!0,"Category field"),w("y","number",!0,"Value field. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field"),w("line","number",!1,"Lines over vertical bars on the same axis, such as a target or last year. An array for several. Bars stay gray unless highlight is set, and with series the line averages rows of the same x",{multi:!0})],vs=[pe,oe],Ms=[w("value","number",!0,"Value field",{prop:"valueKey"}),w("target","number",!1,"Target field",{prop:"targetKey"})],Ss=[pe,w("value","number",!0,"Actual value field"),w("target","number",!1,"Target field")],Ts=[w("x","any",!1,"x field"),w("y","number",!0,"y field")],Cs=[pe,w("x","string",!1,"Period field (long tables)"),w("value","number",!1,"Value field (long tables)")],Ns=[pe,w("start","number",!0,"Before value"),w("end","number",!0,"After value")],As=[pe,oe],Fs=[w("value","number",!0,"Value field"),w("group","string",!1,"Group (row) field"),w("label","string",!1,"Dot name")],Rs=[w("group","string",!0,"Group field"),w("value","number",!0,"Value field")],Ps=[w("source","string",!0,"Source node"),w("target","string",!0,"Target node"),oe],Ls=[w("source","string",!0,"Sending group"),w("target","string",!0,"Receiving group"),oe],_s=[w("date","date",!0,"Date field"),oe],Ds=[w("x","any",!0,"Period field"),w("series","string",!0,"Item field"),w("rank","number",!1,"Rank field (1 is first)"),w("value","number",!1,"Value field (instead of rank, largest is first)")],Es=[w("group","string",!0,"Group field"),w("value","number",!0,"Value field")],Is=[w("label","string",!1,"Row name field")],Os=[w("x","date",!0,"Date (period) field"),w("open","number",!0,"Open price field"),w("high","number",!0,"High price field"),w("low","number",!0,"Low price field"),w("close","number",!0,"Close price field"),w("volume","number",!1,"Volume field")],zs=[pe,oe],js=[w("x","any",!0,"Period field (date or category)"),w("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field (long tables, back row only)"),w("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Bs=[w("value","number",!1,"Sample value field (raw rows)"),w("group","string",!1,"Group field. Up to 2 groups overlap"),w("x0","number",!1,"Bin start (pre-binned rows)"),w("x1","number",!1,"Bin end (pre-binned rows)"),w("count","number",!1,"Samples in the bin (pre-binned rows)")],Gs=[w("region","string",!0,"Region name or code, matched to a tile of options.map"),oe],Hs=[pe,oe,w("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],Ws=[w("source","string",!0,"Source node"),w("target","string",!0,"Target node"),w("value","number",!1,"Link weight. Without it every row counts 1")],Vs=[w("label","string",!0,"Row name. Items with the same name share a row"),w("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),w("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),w("group","string",!1,"Group field (one color per group, and the legend)"),w("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],Ks=[w("label","string",!0,"Node name field"),w("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),w("group","string",!1,"Parent group field (flat rows, as in the treemap)"),w("id","string",!1,"Row id for id/parent rows. Defaults to the label"),w("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],Xs=[w("region","string",!0,"Region name or code, matched to a region of options.map"),oe],Ys=[w("lon","number",!1,"Longitude (degrees)"),w("lat","number",!1,"Latitude (degrees)"),w("size","number",!1,"Value (circle area). Without it all circles match"),w("label","string",!1,"Place name"),w("region","string",!1,"Region of options.map, for rows without lon and lat"),w("group","string",!1,"Group field (one color per group)")],Us=[w("source","string",!0,"Start: a name in options.places or a region"),w("target","string",!0,"End"),w("value","number",!1,"Amount. Without it each row counts 1")],Js=[w("x","number",!0,"x value"),w("y","number",!0,"y value"),w("series","string",!1,"Series field (one color per series)"),w("label","string",!1,"Name")],ao={pie:ss,donut:ls,funnel:cs,waffle:us,treemap:ms,sunburst:ds,waterfall:fs,pareto:hs,marimekko:gs,heatmap:ps,radar:bs,bubble:ys,line:xs,area:ks,stream:ws,bar:$s,radialBar:vs,gauge:Ms,bullet:Ss,sparkline:Ts,slope:Cs,dumbbell:Ns,lollipop:As,beeswarm:Fs,ridgeline:Rs,sankey:Ps,chord:Ls,calendar:_s,bump:Ds,box:Es,parallel:Is,candlestick:Os,segmented:zs,skyline:js,histogram:Bs,scatter:Js,tileMap:Gs,barRace:Hs,network:Ws,timeline:Vs,tree:Ks,choropleth:Xs,symbolMap:Ys,flowMap:Us},nt={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"},tileMap:{component:"TileMap",name:"Tile grid map",nameKo:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"}};function so(e,t){return t==="ko"?e.nameKo:e.name}function lo(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var co=["line","area","bar","scatter"],uo=24,Bn=["line","area","bar","scatter","timeline"];function Gn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function mo(e,t,n){return Bn.includes(e)&&!Gn(e,t,n).length&&!(e==="scatter"&&Yt(n))}function Yt(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function fo(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var qs={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap"};function Ut(e){let t=ao[e]?e:qs[e]??Object.keys(nt).find(n=>n.toLowerCase()===e.toLowerCase()||nt[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!nt[t]))return{type:t,component:nt[t].component,name:nt[t].name,nameKo:nt[t].nameKo,encoding:ao[t]}}function ho(e){let t=new Set,n=a=>{Array.isArray(a)?a.forEach(n):typeof a=="string"&&a&&t.add(a)},r=e.encoding??{};for(let a of Ut(e.type)?.encoding.map(i=>i.name)??Object.keys(r))n(r[a]);let o=e.options??{};for(let a of["dimensions","start","end","ranges"])n(o[a]);return[...t]}function Jt(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Zs(e,t){if(e==null||typeof e!="object")return;let n=e;if(Jt(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!Jt(r,o))return;r=r[o]}return r}}function Fe(e){if(typeof e=="number")return Number.isFinite(e)?e:NaN;if(typeof e=="bigint")return Number(e);if(typeof e=="string"){let t=e.trim(),n=/^\(.*\)$/.test(t),r=t.replace(/[()\s%₩$€£¥원명건개회]/g,"").replace(/^\+/,"");if(!r||r.includes(",")&&!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(r))return NaN;let o=Number(r.replace(/,/g,""));return Number.isFinite(o)?n?-o:o:NaN}return e instanceof Date?e.getTime():typeof e=="boolean"?e?1:0:NaN}function je(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Zs(r,n)}function rt(e,t){let n=je(e,t);return(r,o)=>Fe(n(r,o))}function be(e,t){let n=je(e,t);return(r,o)=>{let a=n(r,o);return a==null?"":a instanceof Date?new Date(a.getTime()-a.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(a)}}function ve(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Qs(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
|
|
22
|
+
`;function _t(e,t,n,r,o){if(e)return t?{opacity:0}:{animation:`ztd-${n} ${Math.round(o)}ms cubic-bezier(.22,.9,.3,1) ${Math.round(r)}ms backwards`}}function Dt(e,t){let[n]=(0,Rr.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var Fr=!1;function ft(){if(Fr||typeof document>"u"||(Fr=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=Oi,document.head.appendChild(e)}var Et=N(Z(),1),xe=typeof window<"u"&&typeof document<"u",Ne=xe?Et.useLayoutEffect:Et.useEffect;function It(){return typeof performance<"u"?performance.now():Date.now()}function Q(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Ae(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var Pr={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},Lr={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var zi=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],ji={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function Bi(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function Gi(e){return Bi(zi,e)}function _r(e,t){let n=Gi(e);return{text:n?n[t]:e,...ji[n?.id??"basic"]}}var Dr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Ze(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Dr[t.toLowerCase()]&&(t=Dr[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(i=>i+i).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let a=parseInt(o,16);return o.length===6?[a>>16&255,a>>8&255,a&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let a=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),i=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return a.some(s=>Number.isNaN(s))?null:[a[0],a[1],a[2],Number.isNaN(i)?1:i]}return null}function Or(e){let t=n=>Math.round(Math.max(0,Math.min(255,n))).toString(16).padStart(2,"0");return`#${t(e[0])}${t(e[1])}${t(e[2])}${e[3]<1?t(e[3]*255):""}`.toUpperCase()}function Cn(e,t){let n=e[3];return[e[0]*n+t[0]*(1-n),e[1]*n+t[1]*(1-n),e[2]*n+t[2]*(1-n),1]}function Qe(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Er(e){return .2126*Qe(e[0])+.7152*Qe(e[1])+.0722*Qe(e[2])}function Nn(e,t,n){let r=typeof e=="string"?Ze(e):e,o=typeof t=="string"?Ze(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?Ze(n):n:null;o[3]<1&&a&&(o=Cn(o,a));let i=r[3]<1?Cn(r,o):r,s=Er(i),l=Er(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function Hi(e){return[Qe(e[0]),Qe(e[1]),Qe(e[2])]}function Tn(e){let t=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.max(0,Math.min(255,t*255))}function Ir(e){let[t,n,r]=Hi(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),i=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*a-.0040720468*i,1.9779984951*o-2.428592205*a+.4505937099*i,.0259040371*o+.7827717662*a-.808675766*i]}function Wi([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,a=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[Tn(4.0767416621*o-3.3077115913*a+.2309699292*i),Tn(-1.2684380046*o+2.6097574011*a-.3413193965*i),Tn(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function Ot(e,t,n){let r=Ze(e),o=Ze(t);if(!r||!o)return e;let a=Ir(r),i=Ir(o),s=Math.max(0,Math.min(1,n));return Or(Wi([a[0]*s+i[0]*(1-s),a[1]*s+i[1]*(1-s),a[2]*s+i[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function An(e,t,n){let r=t[0],o=-1;for(let a of t){let i=Nn(a,e,n);i>o&&(o=i,r=a)}return r}function re(e,t){let n=e.theme;switch(t){case"accent":return{role:t,fill:e.paint("accent"),text:e.paint("onAccent"),raw:n.accent};case"ink":return{role:t,fill:e.paint("ink"),text:e.paint("onInk"),raw:n.ink};case"strong":return{role:t,fill:e.paint("neutralStrong"),text:e.paint("onNeutralStrong"),raw:n.neutralStrong};case"soft":return{role:t,fill:e.paint("neutralSoft"),text:e.paint("ink"),raw:n.neutralSoft};default:return{role:"neutral",fill:e.paint("neutral"),text:e.paint("ink"),raw:n.neutral}}}function Vi(e,t){let n=An(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Nn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):An(t,["#FFFFFF","#000000"])}function zt(e,t){let n=Ot(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Vi(e,n),raw:n}}function ke(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=re(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=re(e,"neutral");else if(s===0)r[i]=re(e,"ink");else if(s===a-1)r[i]=re(e,"neutral");else if(a===3)r[i]=re(e,"strong");else{let l=(s-1)/Math.max(1,a-2);r[i]=l<=.001?re(e,"strong"):zt(e,1-l)}}),r}var Fn="mix:";function De(e){return e({theme:$n,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${Fn}${o}`}).map(n=>n.fill)}function zr(e,t){return t?.startsWith(Fn)?e.mix("neutralStrong","neutral",Number(t.slice(Fn.length))):e.color(t)}function ht(e,t,n){return ke(e,t+1,n).slice(0,t)}function jr(e,t,n,r="neutral"){let o=re(e,"accent"),a=re(e,r);return Array.from({length:t},(i,s)=>n.has(s)?o:a)}function Br(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=re(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=re(e,"neutral"):s===0?r[i]=re(e,"strong"):s===a-1?r[i]=re(e,"neutral"):r[i]=zt(e,1-s/(a-1))}),r}var we=N(Z(),1);var jt=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),ue="en-US",Gr=new Map;function Rn(e,t){let n=t.maximumFractionDigits!==void 0||t.style==="currency"?t:{...t,maximumFractionDigits:Math.max(1,t.minimumFractionDigits??0)},r=e+JSON.stringify(n),o=Gr.get(r);return o||(o=new Intl.NumberFormat(e,n),Gr.set(r,o)),o}function Pn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function tt(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ue,...r}=t;return Pn(Rn(n,r).format(e))}var Ln=e=>e!==0&&Math.abs(e)<.05,_n=(e,t,n="")=>`${tt(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function et(e,t={}){if(!Number.isFinite(e))return"-";if(Ln(e)&&t.maximumFractionDigits===void 0)return _n(e,t.locale??ue,"%");let n=Math.abs(e);return`${tt(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Kr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ue,...r}=t;if(Q(n)==="ko"){let o=Math.abs(e),a=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],i=a.findIndex(([s])=>o>=s);for(i<0&&(i=a.length-1);;){let[s,l]=a[i],c=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**m)/10**m;if(i>0&&u>=a[i-1][0]/s){i--;continue}return(e<0&&u!==0?"-":"")+tt(u,{locale:n,...r,maximumFractionDigits:m})+l}}return Pn(Rn(n,{notation:"compact",...r}).format(e))}var Ki=(e,t=Q(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function ze(e,t=ue,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=Rn(t,o);return l=>Number.isFinite(l)?`${i}${Pn(s.format(l))}${a}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:a="",...i}=e;return r(i,o,a)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>et(o,{locale:t});case"ratio":return o=>et(o*100,{locale:t});case"compact":return o=>Kr(o,{locale:t});case"currency":return r(Ki(t));default:{let o=r({maximumFractionDigits:1});return a=>Ln(a)?_n(a,t):o(a)}}}function Xr(e,t=ue,n=0){return e!==void 0?ze(e,t):n>=1e5?r=>Ln(r)?_n(r,t):Kr(r,{locale:t}):r=>tt(r,{locale:t})}function Xi(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Dn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Yi=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Ui=["january","february","march","april","may","june","july","august","september","october","november","december"],Hr=e=>{let t=e.toLowerCase();return t.length<3?0:Ui.findIndex(n=>n.startsWith(t))+1},Wr=e=>+e+(+e<30?2e3:1900);function Yr(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Ji=[/^(\d{4})-(\d{1,2})(?:-(\d{1,2}))?$/,/^(\d{4})[./]\s*(\d{1,2})[./]\s*(\d{1,2})\.?$/,/^(19\d\d|20\d\d|2100)(\d\d)(\d\d)$/,/^(\d{4})년\s*(\d{1,2})월(?:\s*(\d{1,2})일)?$/],Ur=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Jr=/\{([^{}]+)\}/g;function Bt(e,t){let n;for(let r of Ji)if(n=r.exec(e))return[+n[1],+n[2],+(n[3]??1),n[3]?1:2];if(/^\d{4}-\d/.test(e))return null;if(n=/^(\d{2})\.\s*(\d{1,2})\.\s*(\d{1,2})\.?$/.exec(e))return t?[Wr(n[3]),+n[2],+n[1],1]:[Wr(n[1]),+n[2],+n[3],1];if(n=/^(?:(\d{4})\s*-?\s*Q([1-4])|Q([1-4])\s*-?\s*(\d{4})|(\d{4})년\s*([1-4])분기)$/i.exec(e))return[+(n[1]??n[4]??n[5]),+(n[2]??n[3]??n[6])*3-2,1,3];if(n=Ur.exec(e)){let r=+n[1],o=+n[3],a=r>12||o<=12&&t===!0;return[+n[4],a?o:r,a?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=Hr(n[2]);return r?[+n[3],r,+n[1],1]:null}if(n=/^([a-z]{3,9})\.?\s+(?:(\d{1,2}),?\s+)?(\d{4})$/i.exec(e)){let r=Hr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var qr=e=>Yi.test(e)||Bt(e)!==null;function Zr(e){let t;for(let n of e){let r=typeof n=="string"?Ur.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function Gt(e,t){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"){if(!Number.isFinite(e))return null;if(Number.isInteger(e)){if(Dn(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return Gt(`${e}`)}return new Date(Math.abs(e)>=1e9&&Math.abs(e)<1e10?e*1e3:e)}if(typeof e=="string"&&e.trim()){let n=e.trim(),r=Bt(n,t);if(r)return Xi(r[0],r[1],r[2]);if(/^\d{4}$/.test(n))return new Date(Number(n),0,1);if(!/\d{4}/.test(n))return null;let o=new Date(n);return Number.isNaN(o.getTime())?null:o}return null}var Vr=new Map;function gt(e,t={month:"short",day:"numeric"}){let n=Gt(e);if(!n)return"-";let{locale:r=ue,...o}=t,a=r+JSON.stringify(o),i=Vr.get(a);return i||(i=new Intl.DateTimeFormat(r,o),Vr.set(a,i)),i.format(n)}var En=N(B(),1),Ht=(0,we.createContext)({theme:_e,cssVars:!0});function qi(e,t=_e){return e?typeof e=="string"?vn[e]??t:Sn(t,e):t}function Wt(e){let t=(0,we.useContext)(Ht),n=e.base?vn[e.base]:t.theme,r=(0,we.useMemo)(()=>qi(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,we.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,we.useMemo)(()=>Mn(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,En.jsx)(Ht.Provider,{value:i,children:(0,En.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Zi=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function eo(e){return Zi.has(e)}function Qi(e,t){let n=r=>t?`var(${Lt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?eo(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?eo(r)?e[r]:r:e[o],mix:(r,o,a)=>{let i=Math.round(Math.max(0,Math.min(1,a))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${i}%, ${n(o)})`:Ot(e[r],e[o],a)}}}function $e(e){let t=(0,we.useContext)(Ht);return(0,we.useMemo)(()=>{let n=Sn(t.theme,e);return Qi(n,t.cssVars)},[t.theme,t.cssVars,e])}function me(e){let t=(0,we.useContext)(Ht);return e??t.locale??ue}function to(e){return e?Mn(e):{}}var Vt=N(Z(),1),In=(0,Vt.createContext)(void 0);function no(e){let t=(0,Vt.useContext)(In);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var P=N(B(),1),es={legend:"Legend",replay:"Replay animation",replayTitle:"Replay",sample:"Sample data",loadError:"Couldn't load data",retry:"Try again",loading:"Loading",empty:"No data to show",source:"Source",shown:(e,t)=>`${e} of ${t} series shown`},ts={en:es,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var ns={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},On=e=>ts[Q(me(e))];function zn(e){let t=$e(e.theme),n=On(e.locale),[r,o]=(0,Kt.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.label)).length,c=(0,P.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((m,u)=>{let d=!s.has(m.label),f=d&&l===1,h=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(rs,{p:t,item:m,off:!d}),(0,P.jsx)("span",{style:d?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,P.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,P.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":d,"aria-disabled":f||void 0,onClick:()=>{f||(i(m.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:f?"default":void 0},children:h}):h},u)})});return i?(0,P.jsxs)(P.Fragment,{children:[c,(0,P.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:ns,children:r?n.shown(l,e.items.length):""})]}):c}function rs({p:e,item:t,off:n}){let r=zr(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,P.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,P.jsx)("line",{x1:1,x2:13,y1:4,y2:4,stroke:r,strokeWidth:2,strokeDasharray:o==="dash"?"3 2":void 0,strokeLinecap:"round"}),o==="line"?(0,P.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,P.jsx)("span",{"aria-hidden":"true",style:{width:9,height:9,flex:"none",borderRadius:o==="circle"?9:2.5,background:r,boxShadow:t.color==="neutral"||t.color==="neutralSoft"||!t.color?`inset 0 0 0 1px ${e.paint("line2")}`:void 0,opacity:n?.35:void 0}})}function os(e){let t=$e(e.theme),n=_r(e.level,Q(me(e.locale)));return(0,P.jsx)("span",{style:{background:t.paint(n.bg),color:t.paint(n.fg),borderRadius:8,padding:"3px 9px",fontSize:12.5,fontWeight:700,lineHeight:"18px",whiteSpace:"nowrap",flex:"none"},children:n.text})}function as(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,P.jsxs)(P.Fragment,{children:[e.slice(0,r),(0,P.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function ro(e){let t=$e(e.theme),n=On(e.locale),[r,o]=(0,Kt.useState)(0);Ne(()=>ft(),[]);let a=()=>{o(d=>d+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,P.jsx)(zn,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,c=e.replay||e.onReplay,m=e.source!==void 0||e.note!==void 0?(0,P.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,P.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,P.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,P.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,P.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,P.jsx)(os,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,P.jsxs)("section",{id:e.id,className:`ztd-card${e.className?` ${e.className}`:""}`,style:{background:t.paint("panel"),color:t.paint("ink"),border:`1px solid ${t.paint("line")}`,borderRadius:`var(--ztd-radius, ${t.theme.radius}px)`,padding:"20px 20px 16px",display:"flex",flexDirection:"column",gap:12,minWidth:0,boxSizing:"border-box",fontFamily:t.cssVars?`var(--ztd-font, ${t.theme.fontFamily})`:t.theme.fontFamily,wordBreak:"keep-all",textWrap:"balance",...e.style},children:[(0,P.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,P.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,P.jsx)("span",{style:{fontFamily:t.cssVars?`var(--ztd-mono, ${t.theme.monoFamily})`:t.theme.monoFamily,fontSize:17,fontWeight:700,color:t.paint("accentText"),letterSpacing:-.2,flex:"none"},children:l}):null,(0,P.jsx)(s,{style:{margin:0,fontSize:22,fontWeight:800,color:t.paint("ink"),letterSpacing:-.5,lineHeight:1.25,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:as(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,P.jsx)("button",{type:"button",className:"ztd-btn",onClick:a,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,P.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,P.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,P.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,P.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,P.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,P.jsx)("span",{}),i]}):null]}),(0,P.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,P.jsx)(In.Provider,{value:r,children:(0,P.jsx)(qe.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,P.jsxs)(P.Fragment,{children:[m,u]}):u]})}function jn(e){let t=$e(e.theme),n=On(e.locale),r=e.height??220;if(Ne(()=>ft(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,P.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,P.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,P.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,P.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,P.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onRetry,style:{marginTop:4,background:t.paint("ink"),color:t.paint("onInk"),border:"none",borderRadius:14,padding:"5px 14px",fontSize:12.5,fontWeight:700},children:n.retry}):null]})})}return e.loading?(0,P.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,a)=>(0,P.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${a*90}ms`}},a))}):e.empty?(0,P.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,P.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,P.jsx)(P.Fragment,{children:e.children})}var it=N(Z(),1);var de=N(Z(),1);var X=N(B(),1),Xt=60;var Yt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function oo(e){let{c:t,events:n}=e,r=(0,de.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,Ne(()=>{ft()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,de.useContext)(qe),c=e.ariaLabel??l??e.kind,m=(0,de.useMemo)(()=>s?`${n.length}${n.slice(0,Xt).map(v=>`${v.label}${v.series??""}${v.formatted??v.value??""}`).join("")}`:"",[n,s]),u=(0,de.useMemo)(()=>(0,X.jsx)(is,{label:c,events:n,t:t.t}),[c,m,t.t]),d=(0,de.useRef)(null);(0,de.useEffect)(()=>{let v=()=>{d.current=null};return window.addEventListener("scroll",v,{capture:!0,passive:!0}),window.addEventListener("resize",v,{passive:!0}),()=>{window.removeEventListener("scroll",v,{capture:!0}),window.removeEventListener("resize",v)}},[]),(0,de.useEffect)(()=>{d.current=null},[t.width,t.height]);let f=v=>{if(v.target!==v.currentTarget)return;if(e.onKey?.(v)){v.preventDefault();return}let S=t.active,z;switch(v.key){case"ArrowRight":case"ArrowDown":z=S===null?0:(S+1)%i;break;case"ArrowLeft":case"ArrowUp":z=S===null?i-1:(S-1+i)%i;break;case"Home":z=0;break;case"End":z=i-1;break;case"Escape":if(S===null)return;z=null;break;case"Enter":case" ":S!==null&&(v.preventDefault(),t.click(S));return;default:return}v.preventDefault(),t.setActive(z,"keyboard")},{via:h,node:g,setActive:y}=t;(0,de.useEffect)(()=>{if(h!=="touch"||!g)return;let v=S=>{g.contains(S.target)||y(null)};return document.addEventListener("pointerdown",v),()=>document.removeEventListener("pointerdown",v)},[h,g,y]);let p=t.active!==null?n[t.active]:null,$=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,x=$&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,M=typeof e.renderTip=="function"&&p?e.renderTip(p):null,k=e.announce??(t.via==="keyboard"&&p?`${p.label}${p.series?` ${p.series}`:""}: ${p.formatted??p.value??""} (${(t.active??0)+1}/${i})`:""),R;if($){let v=$.x*x,S=t.width*x,z=`clamp(${(4-v).toFixed(1)}px, -50%, calc(${(S-v-4).toFixed(1)}px - 100%))`,E=$.y<64;R={position:"absolute",left:v,top:$.y*x,transform:`translate(${z}, ${E?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*x-8)}}let A=v=>{d.current=null,v.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},O=v=>v?S=>{let z=d.current??(d.current=S.currentTarget.getBoundingClientRect());z.width&&v((S.clientX-z.left)/z.width*t.width,(S.clientY-z.top)/z.height*t.height,S)}:void 0,G=O(e.onPointerMove),D=O(e.onPointerDown),_=G||D?v=>{v.pointerType==="touch"&&G?.(v),D?.(v)}:void 0,F=O(e.onPointerUp),T=to(e.theme);return(0,X.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?f:void 0,onBlur:v=>{t.via==="keyboard"&&!v.currentTarget.contains(v.relatedTarget)&&t.setActive(null)},onPointerLeave:A,style:{width:"100%",maxWidth:t.measured?void 0:"100%",fontFamily:t.p.cssVars?`var(--ztd-font, ${t.p.theme.fontFamily})`:t.p.theme.fontFamily,color:t.p.paint("ink"),...T,...e.style},children:[t.pending?null:e.underlay,(0,X.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${a}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:G,onPointerDown:_,onPointerUp:F,onPointerCancel:F,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,X.jsx)("title",{id:o,children:c}),(0,X.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,X.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,$?(0,X.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:R,children:M??(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:$.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:$.title}),$.rows.map((v,S)=>(0,X.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,X.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(v.strong?"ink":"muted")},children:[v.color?(0,X.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:v.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,v.label]}),(0,X.jsx)("span",{style:{fontWeight:v.strong===!1?500:700},children:v.value})]},S))]})}):null,(0,X.jsx)("span",{className:"ztd-sr",style:Yt,"aria-live":"polite","aria-atomic":"true",children:k}),s&&!t.pending?u:null]})}function is({label:e,events:t,t:n}){return(0,X.jsx)("div",{className:"ztd-sr",style:Yt,children:(0,X.jsxs)("table",{children:[(0,X.jsx)("caption",{children:n.table(e)}),(0,X.jsxs)("tbody",{children:[t.slice(0,Xt).map((r,o)=>(0,X.jsxs)("tr",{children:[(0,X.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,X.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Xt?(0,X.jsx)("tr",{children:(0,X.jsx)("td",{colSpan:2,children:n.more(t.length-Xt)})}):null]})]})})}function pt(e){let t=e.baseline??"central";return(0,X.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var w=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),pe=w("label","string",!0,"Item name field"),oe=w("value","number",!0,"Value field"),ss=[pe,oe],ls=[pe,oe],cs=[w("label","string",!0,"Stage name"),w("value","number",!0,"Users at the stage")],us=[pe,oe],ms=[w("label","string",!0,"Leaf (lowest level) name"),oe,w("group","string",!1,"Parent group field")],ds=[w("label","string",!0,"Leaf name"),oe,w("group","string",!1,"Parent group field")],fs=[pe,w("value","number",!0,"Change (total rows may omit it)"),w("type","string",!1,'"total" makes a total bar')],hs=[pe,oe],gs=[w("x","string",!0,"Column field"),w("series","string",!0,"Stacked series field"),oe],ps=[w("x","string",!0,"Column field"),w("y","string",!0,"Row field"),oe],bs=[w("axis","string",!0,"Metric (axis) field"),w("value","number",!0,"Value field",{multi:!0}),w("series","string",!1,"Series field")],ys=[w("x","number",!0,"x value"),w("y","number",!0,"y value"),w("size","number",!1,"Circle size"),w("label","string",!1,"Name")],io=w("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),xs=[w("x","any",!0,"x field (date, number or category)"),w("y","number",!0,"y field. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field (long tables)"),w("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),io],ks=[w("x","any",!0,"x field"),w("y","number",!0,"y field. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field"),w("lower","number",!1,'Lower bound of the range band, with stack "none" only. In wide tables an array in the order of y',{multi:!0}),io],ws=[w("x","any",!0,"x field"),w("y","number",!0,"y field",{multi:!0}),w("series","string",!1,"Series field")],$s=[w("x","string",!0,"Category field"),w("y","number",!0,"Value field. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field"),w("line","number",!1,"Lines over vertical bars on the same axis, such as a target or last year. An array for several. Bars stay gray unless highlight is set, and with series the line averages rows of the same x",{multi:!0})],vs=[pe,oe],Ms=[w("value","number",!0,"Value field",{prop:"valueKey"}),w("target","number",!1,"Target field",{prop:"targetKey"})],Ss=[pe,w("value","number",!0,"Actual value field"),w("target","number",!1,"Target field")],Ts=[w("x","any",!1,"x field"),w("y","number",!0,"y field")],Cs=[pe,w("x","string",!1,"Period field (long tables)"),w("value","number",!1,"Value field (long tables)")],Ns=[pe,w("start","number",!0,"Before value"),w("end","number",!0,"After value")],As=[pe,oe],Fs=[w("value","number",!0,"Value field"),w("group","string",!1,"Group (row) field"),w("label","string",!1,"Dot name")],Rs=[w("group","string",!0,"Group field"),w("value","number",!0,"Value field")],Ps=[w("source","string",!0,"Source node"),w("target","string",!0,"Target node"),oe],Ls=[w("source","string",!0,"Sending group"),w("target","string",!0,"Receiving group"),oe],_s=[w("date","date",!0,"Date field"),oe],Ds=[w("x","any",!0,"Period field"),w("series","string",!0,"Item field"),w("rank","number",!1,"Rank field (1 is first)"),w("value","number",!1,"Value field (instead of rank, largest is first)")],Es=[w("group","string",!0,"Group field"),w("value","number",!0,"Value field")],Is=[w("label","string",!1,"Row name field")],Os=[w("x","date",!0,"Date (period) field"),w("open","number",!0,"Open price field"),w("high","number",!0,"High price field"),w("low","number",!0,"Low price field"),w("close","number",!0,"Close price field"),w("volume","number",!1,"Volume field")],zs=[pe,oe],js=[w("x","any",!0,"Period field (date or category)"),w("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field (long tables, back row only)"),w("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Bs=[w("value","number",!1,"Sample value field (raw rows)"),w("group","string",!1,"Group field. Up to 2 groups overlap"),w("x0","number",!1,"Bin start (pre-binned rows)"),w("x1","number",!1,"Bin end (pre-binned rows)"),w("count","number",!1,"Samples in the bin (pre-binned rows)")],Gs=[w("region","string",!0,"Region name or code, matched to a tile of options.map"),oe],Hs=[pe,oe,w("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],Ws=[w("source","string",!0,"Source node"),w("target","string",!0,"Target node"),w("value","number",!1,"Link weight. Without it every row counts 1")],Vs=[w("label","string",!0,"Row name. Items with the same name share a row"),w("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),w("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),w("group","string",!1,"Group field (one color per group, and the legend)"),w("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],Ks=[w("label","string",!0,"Node name field"),w("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),w("group","string",!1,"Parent group field (flat rows, as in the treemap)"),w("id","string",!1,"Row id for id/parent rows. Defaults to the label"),w("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],Xs=[w("region","string",!0,"Region name or code, matched to a region of options.map"),oe],Ys=[w("lon","number",!1,"Longitude (degrees)"),w("lat","number",!1,"Latitude (degrees)"),w("size","number",!1,"Value (circle area). Without it all circles match"),w("label","string",!1,"Place name"),w("region","string",!1,"Region of options.map, for rows without lon and lat"),w("group","string",!1,"Group field (one color per group)")],Us=[w("source","string",!0,"Start: a name in options.places or a region"),w("target","string",!0,"End"),w("value","number",!1,"Amount. Without it each row counts 1")],Js=[w("x","number",!0,"x value"),w("y","number",!0,"y value"),w("series","string",!1,"Series field (one color per series)"),w("label","string",!1,"Name")],ao={pie:ss,donut:ls,funnel:cs,waffle:us,treemap:ms,sunburst:ds,waterfall:fs,pareto:hs,marimekko:gs,heatmap:ps,radar:bs,bubble:ys,line:xs,area:ks,stream:ws,bar:$s,radialBar:vs,gauge:Ms,bullet:Ss,sparkline:Ts,slope:Cs,dumbbell:Ns,lollipop:As,beeswarm:Fs,ridgeline:Rs,sankey:Ps,chord:Ls,calendar:_s,bump:Ds,box:Es,parallel:Is,candlestick:Os,segmented:zs,skyline:js,histogram:Bs,scatter:Js,tileMap:Gs,barRace:Hs,network:Ws,timeline:Vs,tree:Ks,choropleth:Xs,symbolMap:Ys,flowMap:Us},nt={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"},tileMap:{component:"TileMap",name:"Tile grid map",nameKo:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"}};function so(e,t){return t==="ko"?e.nameKo:e.name}function lo(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var co=["line","area","bar","scatter"],uo=24,Bn=["line","area","bar","scatter","timeline"];function Gn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function mo(e,t,n){return Bn.includes(e)&&!Gn(e,t,n).length&&!(e==="scatter"&&Ut(n))}function Ut(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function fo(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var qs={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap"};function Jt(e){let t=ao[e]?e:qs[e]??Object.keys(nt).find(n=>n.toLowerCase()===e.toLowerCase()||nt[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!nt[t]))return{type:t,component:nt[t].component,name:nt[t].name,nameKo:nt[t].nameKo,encoding:ao[t]}}function ho(e){let t=new Set,n=a=>{Array.isArray(a)?a.forEach(n):typeof a=="string"&&a&&t.add(a)},r=e.encoding??{};for(let a of Jt(e.type)?.encoding.map(i=>i.name)??Object.keys(r))n(r[a]);let o=e.options??{};for(let a of["dimensions","start","end","ranges"])n(o[a]);return[...t]}function qt(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Zs(e,t){if(e==null||typeof e!="object")return;let n=e;if(qt(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!qt(r,o))return;r=r[o]}return r}}function Fe(e){if(typeof e=="number")return Number.isFinite(e)?e:NaN;if(typeof e=="bigint")return Number(e);if(typeof e=="string"){let t=e.trim(),n=/^\(.*\)$/.test(t),r=t.replace(/[()\s%₩$€£¥원명건개회]/g,"").replace(/^\+/,"");if(!r||r.includes(",")&&!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(r))return NaN;let o=Number(r.replace(/,/g,""));return Number.isFinite(o)?n?-o:o:NaN}return e instanceof Date?e.getTime():typeof e=="boolean"?e?1:0:NaN}function je(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Zs(r,n)}function rt(e,t){let n=je(e,t);return(r,o)=>Fe(n(r,o))}function be(e,t){let n=je(e,t);return(r,o)=>{let a=n(r,o);return a==null?"":a instanceof Date?new Date(a.getTime()-a.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(a)}}function ve(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Qs(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
|
|
23
23
|
`||c==="\r"))break;t.push(n?"":c)}let r=t.join(""),o=l=>r.split(l).length-1,a=[","," ",";","|"],i=",",s=0;for(let l of a){let c=o(l);c>s&&(s=c,i=l)}return i}var el=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function go(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(el.test(t)||/^[-+]?\.\d+$/.test(t)){let n=Fe(t);if(Number.isFinite(n))return n}return t}function Be(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??Qs(o),i=[],s=[],l="",c=!1;for(let h=0;h<o.length;h++){let g=o[h];c?g==='"'?o[h+1]==='"'?(l+='"',h++):c=!1:l+=g:g==='"'&&!l.trim()?(c=!0,l=""):g===a?(s.push(l),l=""):g===`
|
|
24
24
|
`||g==="\r"?(g==="\r"&&o[h+1]===`
|
|
25
|
-
`&&h++,s.push(l),i.push(s),s=[],l=""):l+=g}(l!==""||s.length)&&(s.push(l),i.push(s));let m=i.filter(h=>!(h.length===1&&h[0].trim()===""));if(!m.length)return[];let u=h=>n?go(h):h;if(!r)return m.map(h=>Object.fromEntries(h.map((g,y)=>[String(y),u(g)])));let d=[],f=new Set;return m[0].forEach((h,g)=>{let y=h.trim()||`col${g+1}`,p=y;for(let $=2;f.has(p);$++)p=`${y}_${$}`;f.add(p),d.push(p)}),m.slice(1).map(h=>Object.fromEntries(d.map((g,y)=>[g,u(h[y]??"")])))}function Hn(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((i,s)=>String(i??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(i=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof i[l]=="string"?go(i[l]):i[l]??null])))}function tl(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,l)=>Object.fromEntries(a.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function po(e,t){let n=e;for(let r of t.split(".").filter(Boolean)){if(n===null||typeof n!="object")return;n=n[r]}return n}function Ee(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Ee(JSON.parse(t))}catch{}return Be(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Hn(e):typeof e[0]=="number"?e.map((t,n)=>({label:String(n+1),value:t})):e.filter(t=>t&&typeof t=="object"):[];if(typeof e=="object"){let t=e;return Array.isArray(t.data)?Ee(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Hn(t.rows,t.columns.map(n=>typeof n=="object"&&n&&"name"in n?String(n.name):String(n))):Array.isArray(t.rows)&&Array.isArray(t.fields)||Array.isArray(t.rows)?Ee(t.rows):Array.isArray(t.values)?Hn(t.values):Array.isArray(t.items)?Ee(t.items):Array.isArray(t.results)?Ee(t.results):tl(t)}return[]}function qt(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=a=>{try{return JSON.stringify(a)}catch{return String(a)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let a=0;a<t;a+=r)o.push(e[a]);return o.push(e[t-1]),`${t}:${n(o)}`}function Wn(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(l,c)=>{let m=e[l][c];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let m=0,u=0;for(let d=0;d<n;d++){let f=i(d,c),h=f-i(d,c-1),g=0;for(let y=0;y<d;y++)g+=i(y,c)-i(y,c-1);m+=f,u+=(h/2+g)*f}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,d=0;for(let f=0;f<n;f++){let h=e[f][l],g=Number.isFinite(h)?h:0;g>=0?(o[f][l]=u,u+=g,a[f][l]=u):(o[f][l]=d,d+=g,a[f][l]=d)}continue}let c=0;for(let u=0;u<n;u++)c+=i(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let d=i(u,l);t==="expand"&&(d=c?d/c*100:0),o[u][l]=m,m+=d,a[u][l]=m}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,a[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let d=0;d<r;d++)o[u][d]-=m,a[u][d]-=m}return{y0:o,y1:a}}function bo(e,t,n=-1){if(!t.some(r=>r>=0))return-1;for(let r=e-1;r>=0;r--)if(r!==n&&!t.includes(r))return r;return-1}function yo(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((d,f)=>{d>u&&(u=d,m=f)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),a=[],i=[],s=0,l=0;for(let c of o)s<l?(a.push(c),s+=r[c]):(i.push(c),l+=r[c]);return[...i.reverse(),...a]}var nl=Math.PI*2;function Re(e,t,n){return e<t?t:e>n?n:e}function xo(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function ko(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function $o(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function wo(e){return e>=44032&&e<=55203?.87:e>=4352&&e<=4607||e>=12592&&e<=12687?.8:e>=19968&&e<=40959?.94:e>=48&&e<=57?.585:e===32||e===44||e===46||e===58||e===59||e===39?.26:e===37?.84:e===8722?.73:e===45?.42:e===43||e===61?.6:e===40||e===41||e===91||e===93?.34:e===47?.38:e===8361||e===36?.62:e===8230?.82:e>=65&&e<=90?e===73?.28:e===77||e===87?.86:.66:e>=97&&e<=122?e===105||e===108||e===106?.24:e===109||e===119?.84:e===102||e===116||e===114?.36:.55:.6}var Zt=new Map;function Me(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=Zt.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);$o(c)?i+=wo(c):s+=wo(c)}a=i+s*(n>=600?1.07:1),Zt.size>5e3&&Zt.clear(),Zt.set(o,a)}return a*t}function bt(e,t,n,r=400){if(e=e.trim(),Me(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let l=a+i+1>>1;Me(e.slice(0,l)+o,n,r)<=t?a=l:i=l-1}a>0&&(e.charCodeAt(a-1)&64512)===55296&&a--;let s=e.slice(0,a).trimEnd();return s.length<($o(s.charCodeAt(0))?2:3)?"":s+o}var Mo=A(B(),1),rl=e=>Array.isArray(e)&&e.length===2;function vo(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&rl(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var To=A(B(),1),Vn=10.5;function ol(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let i=1;i<e.length;i++)o=Math.min(o,Math.abs(e[i]-e[i-1]));let a=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(i=>tt(i,{locale:n,maximumFractionDigits:a}))}function So(e,t,n){let r=18;for(let o of ol(e,t,n))r=Math.max(r,Me(o,Vn));return Math.ceil(r+8)}function Kn(e,t){if(!(e>0)||!Number.isFinite(e))return 1;let n=e/Math.max(1,t),r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r;return(o>=7.071?10:o>=3.162?5:o>=1.414?2:1)*r}function ot(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,l=Kn(i,n),c=[o,a];for(let m=0;m<4;m++){let u=Math.ceil(a/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-d<=l*.3?d:o-i*s,a===0?0:u-a<=l*.3?u:a+i*s];let f=Kn(c[1]-c[0],n);if(f===l)break;l=f}return c}function Co(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=Kn(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let l=s,c=0;l<=o+a*1e-9&&c<200;l+=a,c++)i.push(Number((Math.round(l/a)*a).toPrecision(12)));return i}function Xn(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(l=>o+(l-n)*i);return s.domain=e,s.range=t,s.invert=l=>i===0?n:n+(l-o)/i,s.ticks=(l=4)=>Co(n,r,l),s}function Yn(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[a,i]=ot(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function al(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(c,m=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let f of c){let h=Number((f*10**d).toPrecision(12));h>=e*(1-1e-9)&&h<=t*(1+1e-9)&&u.push(h)}return u},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let l=i([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:Co(e,t,3)}function No(e,t){let n=Xn([Math.log10(e[0]),Math.log10(e[1])],t),r=(o=>o>0?n(Math.log10(o)):Number.NaN);return r.domain=e,r.range=t,r.invert=o=>10**n.invert(o),r.ticks=()=>al(e[0],e[1],Math.abs(t[1]-t[0])),r}function yt(e){let t=1/0,n=-1/0;for(let r of e)Number.isFinite(r)&&(r<t&&(t=r),r>n&&(n=r));return t===1/0?[0,1]:[t,n]}var il=864e5;function Ao(e,t,n,r=ue){let o=t-e;if(!(o>0))return[{t:e,label:gt(e,{locale:r,month:"short",day:"numeric"})}];let a=o/il,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,d,f=!1)=>{let h=new Date(m),g=-1,y=0;for(;h.getTime()<=t&&y++<500;){if(h.getTime()>=e){let p=h.getFullYear(),$=f&&!l&&p!==g;i.push({t:h.getTime(),label:gt(h,{locale:r,...d,...$?{year:"numeric"}:{}})}),g=p}u(h)}};if(a<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(f=>f>=m)??12,d=new Date(s);d.setMinutes(0,0,0),c(d,f=>f.setHours(f.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=a/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(f=>f>=u)??120;if(d>=12){let f=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(f,h=>h.setFullYear(h.getFullYear()+d/12),{year:"numeric"})}else{let f=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),h=f.getMonth()%d;h&&f.setMonth(f.getMonth()+(d-h)),c(f,g=>g.setMonth(g.getMonth()+d),{month:"short"},!0)}}return i}function Fo(e,t){let n=new Array(e),r=new Uint8Array(e),o=a=>{if(typeof a!="string"||a.length===0||a.length>9)return-1;let i=Number(a);return Number.isInteger(i)&&i>=0&&i<e&&String(i)===a?i:-1};return new Proxy(n,{get(a,i,s){let l=o(i);return l>=0?(r[l]||(a[l]=t(l),r[l]=1),a[l]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var sl=(e,t,n)=>e==="date"?Bt(t,n)?.getTime()??NaN:Fe(t);function ll(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&qr(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function xt(e,t,n,r,o={}){let a=je(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:je(n,"y"),c=!i&&r!==void 0?je(r,"series"):null,m=e.map((T,v)=>a(T,v)),u=o.xType??ll(m),d=o.locale??ue,f,h,g;if(u==="band"){let T=m.map(S=>String(S??""));f=ve(T);let v=new Map(f.map((S,O)=>[S,O]));h=f.map((S,O)=>O),g=Int32Array.from(T,S=>v.get(S)??-1)}else{let T=u==="date"?o.dayFirst??Zr(m):void 0,v=m.map(E=>sl(u,E,T)),S=Array.from(new Set(v.filter(E=>Number.isFinite(E)))).sort((E,ne)=>E-ne),O=new Map(S.map((E,ne)=>[E,ne]));h=S,f=S.map(String),g=Int32Array.from(v,E=>O.get(E)??-1)}let y=o.dateFormat,p=T=>typeof T=="string"?jt(T.trim())?.[3]:void 0,$=u==="date"&&m.length<5e3?p(m[0]):void 0,x=($===2||$===3)&&m.every(T=>p(T)===$),M=x&&$===3;if(u==="date"&&!y){let T=h.length>1?h[h.length-1]-h[0]:0;y=x&&$===2||T>864e5*120?{month:"short"}:T<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},T>864e5*800&&(y={year:"numeric",month:"short"})}let k;if(u==="band")k=f;else if(M&&!o.dateFormat){let T=Q(d)==="ko";k=h.map(v=>{let S=new Date(v),O=Math.floor(S.getMonth()/3)+1;return T?`${S.getFullYear()}년 ${O}분기`:`Q${O} ${S.getFullYear()}`})}else{let T=h.every(Dn),v=u==="date"?new Intl.DateTimeFormat(d,y):new Intl.NumberFormat(d,T?{useGrouping:!1}:{maximumFractionDigits:6});k=h.length>1e3?Fo(h.length,S=>v.format(h[S])):h.map(S=>v.format(S))}let R=s?[...s]:c?ve(e.map((T,v)=>String(c(T,v)??""))):[""],N=new Map(R.map((T,v)=>[T,v])),j=R.map(()=>new Array(f.length).fill(NaN)),G=R.map(()=>new Array(f.length).fill(null)),D=o.aggregate??"sum",_=D==="mean"?R.map(()=>new Uint32Array(f.length)):null,F=(T,v,S,O)=>{let E=j[T][v];D==="last"?j[T][v]=S:D==="count"?j[T][v]=(Number.isFinite(E)?E:0)+1:D==="mean"?Number.isFinite(S)&&(j[T][v]=(Number.isFinite(E)?E:0)+S,_[T][v]++):j[T][v]=Number.isFinite(E)?E+(Number.isFinite(S)?S:0):S,G[T][v]=O};for(let T=0;T<e.length;T++){let v=g[T];if(v<0)continue;let S=e[T];if(s)for(let O=0;O<s.length;O++)F(O,v,Fe(S[s[O]]),S);else{let O=c?N.get(String(c(S,T)??""))??0:0;F(O,v,Fe(l(S,T)),S)}}if(_)for(let T=0;T<j.length;T++)for(let v=0;v<f.length;v++)_[T][v]>1&&(j[T][v]/=_[T][v]);return{type:u,keys:f,xnum:h,labels:k,series:R,values:j,rows:G}}var cl=140,wt=12,Ro=14,Un=20,Po=12.5;function ul(e,t,n=uo){let r=be(t,t),o=new Map;e.forEach((i,s)=>{let l=r(i,s),c=o.get(l);c?c.push(i):o.set(l,[i])});let a=[...o.keys()].slice(0,n);return{values:a,groups:a.map(i=>o.get(i)),dropped:Math.max(0,o.size-n)}}function ml(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+wt)/(cl+wt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function dl(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*wt)/t));return{pw:r,ph:typeof n=="number"&&Number.isFinite(n)&&n>0?n:Math.max(120,Math.min(180,Math.round(r*.62)))}}var kt=e=>e.filter(Number.isFinite);function Qt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=rt(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return kt(n)}function Lo(e,t,n,r,o,a){return xt(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function fl(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let k=t.flat(),R=r.refLines??{},[N,j]=yt([...Qt(k,r.x??"x"),...kt([Number(R.x)])]),[G,D]=yt([...Qt(k,r.y??"y"),...kt([Number(R.y)])].filter(F=>!s||F>0)),_=r.zero??!1;return{y:c??(s?Yn(G,D,i):ot(G,D,i,{zero:_,pad:.08})),x:r.xDomain??ot(N,j,Math.max(2,Math.round(o/110)),{zero:_,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",d=n[0]?.keys.join(""),f=n.every(k=>k.keys.join("")===d),h=n.length>0&&n.every(k=>k.type!=="band"&&k.type===n[0].type),g=r.xDomain??(!m&&h?yt(n.flatMap(k=>kt(k.xnum))):void 0),y=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(y==="percent")return{x:g,sameKeys:f};if(c)return{y:c,x:g,sameKeys:f};let p=[];t.forEach((k,R)=>{let N=n[R];if(y==="stacked"||y==="auto"&&N.series.length>1){let G=Wn(N.values,"zero");G.y0.forEach(D=>p.push(...D)),G.y1.forEach(D=>p.push(...D))}else N.values.forEach(G=>p.push(...G));m&&!u&&r.line!==void 0&&Lo(e,k,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(G=>p.push(...G)),m||p.push(...Qt(k,r.lower),...Qt(k,r.upper))}),m&&p.push(0),u||p.push(...vo(r.annotations));for(let k of r.referenceLines??[])p.push(k.y);r.signColors&&p.push(Number(r.baseline??0));let[$,x]=yt(kt(p).filter(k=>!s||k>0));return{y:s?Yn($,x,i):m?ot($,x,u?Math.max(2,Math.round(o/120)):i):ot($,x,i,{zero:r.zero??e==="area"}),x:g,sameKeys:f}}function hl(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=xt(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?No:Xn)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),m=So(c,Xr(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(k=>k.series),d=r.endLabels??n.some(k=>k.series.length>1),f=m+6,h=a-(d?Math.min(a*.28,Math.max(...u.map(k=>Me(k,11,700)),20)+14):10),g=l.keys.length,[y,p]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,$=l.type==="number"?g>12:g>Ao(y,p,Math.max(2,Math.floor((h-f)/64)),s).length;if(l.type==="band"||!g||$)return;let x=k=>f+(l.xnum[k]-y)/(p-y)*(h-f),M=k=>Me(l.labels[k],Vn);for(let k=1;;k++){let R=Array.from({length:Math.ceil(g/k)},(N,j)=>j*k);if(k>=g||R.every((N,j)=>!j||x(N)-x(R[j-1])>=(M(N)+M(R[j-1]))/2+8))return R.map(N=>({value:l.xnum[N],label:l.labels[N]}))}}function gl(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")}function pl(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${gl(`${e}|${t}|${o}|${qt(r)}`)}`}function bl(e,t){return typeof e=="string"?t.includes(e):Array.isArray(e)&&e.length>0&&e.every(n=>typeof n=="string"&&t.includes(n))}var yl={en:{intro:(e,t)=>`${Ae(e,"panel")} by ${t}.`,endHigh:(e,t)=>` ${e} ends highest at ${t}.`,falling:e=>` Lower at the end than at the start: ${e}.`,noneFalling:" None is lower at the end than at the start.",total:(e,t)=>` ${e} has the largest total at ${t}.`,points:(e,t)=>` ${e} has the most points (${t}).`,dropped:(e,t)=>` Only the first ${e} of ${t} values are shown.`,more:", …",blank:"(blank)"},ko:{intro:(e,t)=>`${t}별 패널 ${e}개.`,endHigh:(e,t)=>` 마지막 값이 가장 큰 곳: ${e}(${t}).`,falling:e=>` 처음보다 끝이 낮은 곳: ${e}.`,noneFalling:" 처음보다 끝이 낮은 곳은 없어요.",total:(e,t)=>` 합계가 가장 큰 곳: ${e}(${t}).`,points:(e,t)=>` 점이 가장 많은 곳: ${e}(${t}개).`,dropped:(e,t)=>` ${t}개 중 앞의 ${e}개만 보여요.`,more:" 등",blank:"(빈 값)"}},Jn=18;function _o(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=ul(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=ml(s,i,e.columns),{pw:c,ph:m}=dl(s,l,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(_=>Lo(t,_,n,n.y,n.series,n.aggregate)),f=u?fl(t,o,d,n,c,m):{sameKeys:!1},h=u?hl(t,o,d,n,f,c,m,e.locale):void 0,g=t==="bar"&&n.orientation==="horizontal",y=u&&(!g||f.sameKeys),p=u&&(g||f.x!==void 0||f.sameKeys),$=new Set(bl(e.highlight,r)?[e.highlight].flat():[]),x=$.size>0,M=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,k=e.syncId??pl(t,e.by,n,e.data),R=zt(ze(n.format,e.locale),n.unit),N=yl[e.lang],j=[],G=r.map(_=>_===""?N.blank:_);return{panels:r.map((_,F)=>{let T=o[F],v=G[F],S=F%l,O;if(t!=="scatter"){let ne=d[F],ae=se=>ne.values.reduce((ge,Ke)=>ge+(Number.isFinite(Ke[se])?Ke[se]:0),0),K=ne.keys.map((se,ge)=>ge).filter(se=>ne.values.some(ge=>Number.isFinite(ge[se]))),ie=K[K.length-1];j.push({first:K.length?ae(K[0]):NaN,last:K.length?ae(ie):NaN,total:K.reduce((se,ge)=>se+ae(ge),0)}),t!=="bar"&&ne.series.length===1&&ie!==void 0&&(O=R(ne.values[0][ie]))}else j.push({first:NaN,last:NaN,total:T.length});let E={data:T,width:c,height:m,ariaLabel:e.title?`${e.title}, ${v}`:v,syncId:k,highlight:x?$.has(_)?M?()=>!0:void 0:"none":e.highlight,showYAxis:!y||S===0,showXAxis:!p||F+l>=i};return f.y&&(E.yDomain=f.y),f.x&&(E.xDomain=f.x),h&&(E.xTicks=h),{value:_,label:v,props:E,last:O,isPicked:$.has(_)}}),cols:l,pw:c,ph:m,isPanelPick:x,description:xl(t,e.by,G,j,a,R,N)}}function xl(e,t,n,r,o,a,i){let s=i.intro(n.length,t),l=c=>ko(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=i.endHigh(n[c],a(r[c].last)));let m=n.filter((u,d)=>r[d].last<r[d].first);s+=m.length?i.falling(`${m.slice(0,5).join(", ")}${m.length>5?i.more:""}`):i.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?i.total(n[c],a(r[c].total)):i.points(n[c],r[c].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var fe=A(Z(),1);function kl(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function wl(e,t,n=1/0){let r=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=Math.min(r*.5,n))}var en={threshold:.25,enoughPx:96,rootMargin:"0px"};function Io(e,t=!0){let[n,r]=(0,fe.useState)({visible:!t,near:!t});return(0,fe.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(i=>{let s=wl(i[i.length-1],en.threshold,en.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:kl(en.threshold),rootMargin:en.rootMargin}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),a.observe(e),()=>{o.disconnect(),a.disconnect()}},[e,t]),n}function Do(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function tn(e){let[t,n]=(0,fe.useState)(null),[r,o]=(0,fe.useState)(e??null),a=(0,fe.useCallback)(i=>{n(i),i&&e===void 0&&o(Do(i))},[e]);return Ne(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>i(Do(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?i(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var $l=()=>()=>{};function at(){return(0,fe.useSyncExternalStore)($l,()=>!0,()=>!1)}var Eo="(prefers-reduced-motion: reduce)";function nn(e="auto"){let[t,n]=(0,fe.useState)(()=>xe&&typeof window.matchMedia=="function"?window.matchMedia(Eo).matches:!1);return(0,fe.useEffect)(()=>{if(e!=="auto"||!xe||typeof window.matchMedia!="function")return;let r=window.matchMedia(Eo),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Se=A(B(),1),vl=60,Ml=420;function Oo(e){let t=$e(),n=e.chartProps??{},[,r,o]=tn(e.width),a=e.width??(o||480),i=me(e.locale??n.locale),s=Q(i),l=(0,it.useContext)(qe),c=e.title??l,m=e.chart.facetPlan,u=(0,it.useMemo)(()=>{let p=_o({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:a,height:e.height,title:c,locale:i,lang:s});return m?m(p,n,i):p},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(p,$)=>typeof $=="function"?String($):$),e.highlight,e.syncId,a,e.height,c,i,s,m]),d=`${(0,it.useId)().replace(/:/g,"")}fd`,f=nn(n.reducedMotion??"auto"),h=at(),g=_t({motion:{enabled:n.animate!==!1&&!f&&xe},hydrated:h},{waiting:!1,generation:0}),y=e.chart;return(0,Se.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Se.jsx)("p",{id:d,style:Xt,children:e.description??u.description}),(0,Se.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:wt,rowGap:Ro,...u.legend?{marginTop:Jn}:null},children:u.panels.map((p,$)=>{let x=t.paint(p.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,Se.jsxs)("div",{"data-facet":p.value,style:{minWidth:0,...Lt(g,!1,"fade",$*vl,Ml)},children:[(0,Se.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Un,fontSize:Po,fontWeight:700,lineHeight:`${Un}px`,color:x},children:[(0,Se.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.label}),p.last!==void 0?(0,Se.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:p.last}):null]}),(0,Se.jsx)(y,{...n,...p.props})]},p.value)})}),u.legend?(0,Se.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Jn},children:u.legend}):null]})}var rn=["max","min","first","last","none"];function Te(e,t,n,r,o="max"){let a=new Set,i=n.length,s=c=>{if(i&&c!=="none"){if(c==="first")a.add(0);else if(c==="last")a.add(i-1);else if(c==="max"||c==="min"){let m=-1,u=c==="max"?-1/0:1/0;r.forEach((d,f)=>{Number.isFinite(d)&&(c==="max"?d>u:d<u)&&(u=d,m=f)}),m>=0&&a.add(m)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((c,m)=>{m<i&&c!==null&&c!==void 0&&e(c,m)&&a.add(m)}),a;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<i&&a.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&a.add(u)});return a}var ye=A(Z(),1);async function Sl(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",a=await e.text();if(t==="text")return a;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(a))throw new Error(Q(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Be(a);if(t==="json"||o.includes("json"))return JSON.parse(a);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return Be(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):Be(a)}async function Tl(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),a=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!a.ok)throw new Error(`HTTP ${a.status}${a.statusText?` ${a.statusText}`:""}`);r=await Sl(a,t.parse,o,t.locale)}return t.select&&(r=po(r,t.select)),t.transform?t.transform(r):Ee(r)}function zo(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,ye.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,ye.useState)(0),c=me(t.locale),m=(0,ye.useRef)(t);m.current={...t,locale:c};let u=(0,ye.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",f=t.deps??[],h=JSON.stringify(f.map(p=>typeof p=="object"?JSON.stringify(p):String(p))),g=(0,ye.useRef)(!1);(0,ye.useEffect)(()=>{let p=u.current;if(!p||!r){i(M=>M.status==="loading"?{...M,status:"idle"}:M);return}let $=new AbortController,x=!0;return g.current=!0,i(M=>({...M,data:o?M.data:[],status:"loading",error:null})),Tl(p,{...m.current,signal:$.signal}).then(M=>{x&&i({data:M,status:"success",error:null,updatedAt:Date.now()})}).catch(M=>{!x||$.signal.aborted||i(k=>({...k,status:"error",error:M instanceof Error?M:new Error(String(M))}))}).finally(()=>{x&&(g.current=!1)}),()=>{x=!1,g.current=!1,$.abort()}},[d,r,s,h,o]),(0,ye.useEffect)(()=>{if(!n||!r)return;let p=setInterval(()=>{g.current||l($=>$+1)},n);return()=>clearInterval(p)},[n,r]);let y=(0,ye.useCallback)(()=>l(p=>p+1),[]);return{data:a.data,status:a.status,loading:a.status==="loading",error:a.error,empty:a.status==="success"&&a.data.length===0,updatedAt:a.updatedAt,reload:y}}var Zn=A(B(),1),Cl=["csv","svg","png"],Nl=/^[=+\-@\t\r\n=+-@]/,Al=/var\(|color-mix\(/;function jo(e){if(typeof e=="number")return Number.isFinite(e)?String(e):"";if(e==null||e instanceof Date&&Number.isNaN(e.getTime()))return"";let t=e instanceof Date?Yr(e.getTime()):String(e);return`"${(Nl.test(t)&&!Number.isFinite(Fe(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Fl(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Rl(e,t){return`\uFEFF${[t.map(jo),...e.map(r=>t.map(o=>jo(r[o])))].map(r=>r.join(",")).join(`\r
|
|
25
|
+
`&&h++,s.push(l),i.push(s),s=[],l=""):l+=g}(l!==""||s.length)&&(s.push(l),i.push(s));let m=i.filter(h=>!(h.length===1&&h[0].trim()===""));if(!m.length)return[];let u=h=>n?go(h):h;if(!r)return m.map(h=>Object.fromEntries(h.map((g,y)=>[String(y),u(g)])));let d=[],f=new Set;return m[0].forEach((h,g)=>{let y=h.trim()||`col${g+1}`,p=y;for(let $=2;f.has(p);$++)p=`${y}_${$}`;f.add(p),d.push(p)}),m.slice(1).map(h=>Object.fromEntries(d.map((g,y)=>[g,u(h[y]??"")])))}function Hn(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((i,s)=>String(i??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(i=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof i[l]=="string"?go(i[l]):i[l]??null])))}function tl(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,l)=>Object.fromEntries(a.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function po(e,t){let n=e;for(let r of t.split(".").filter(Boolean)){if(n===null||typeof n!="object")return;n=n[r]}return n}function Ee(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Ee(JSON.parse(t))}catch{}return Be(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Hn(e):typeof e[0]=="number"?e.map((t,n)=>({label:String(n+1),value:t})):e.filter(t=>t&&typeof t=="object"):[];if(typeof e=="object"){let t=e;return Array.isArray(t.data)?Ee(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Hn(t.rows,t.columns.map(n=>typeof n=="object"&&n&&"name"in n?String(n.name):String(n))):Array.isArray(t.rows)&&Array.isArray(t.fields)||Array.isArray(t.rows)?Ee(t.rows):Array.isArray(t.values)?Hn(t.values):Array.isArray(t.items)?Ee(t.items):Array.isArray(t.results)?Ee(t.results):tl(t)}return[]}function Zt(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=a=>{try{return JSON.stringify(a)}catch{return String(a)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let a=0;a<t;a+=r)o.push(e[a]);return o.push(e[t-1]),`${t}:${n(o)}`}function Wn(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(l,c)=>{let m=e[l][c];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let m=0,u=0;for(let d=0;d<n;d++){let f=i(d,c),h=f-i(d,c-1),g=0;for(let y=0;y<d;y++)g+=i(y,c)-i(y,c-1);m+=f,u+=(h/2+g)*f}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,d=0;for(let f=0;f<n;f++){let h=e[f][l],g=Number.isFinite(h)?h:0;g>=0?(o[f][l]=u,u+=g,a[f][l]=u):(o[f][l]=d,d+=g,a[f][l]=d)}continue}let c=0;for(let u=0;u<n;u++)c+=i(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let d=i(u,l);t==="expand"&&(d=c?d/c*100:0),o[u][l]=m,m+=d,a[u][l]=m}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,a[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let d=0;d<r;d++)o[u][d]-=m,a[u][d]-=m}return{y0:o,y1:a}}function bo(e,t,n=-1){if(!t.some(r=>r>=0))return-1;for(let r=e-1;r>=0;r--)if(r!==n&&!t.includes(r))return r;return-1}function yo(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((d,f)=>{d>u&&(u=d,m=f)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),a=[],i=[],s=0,l=0;for(let c of o)s<l?(a.push(c),s+=r[c]):(i.push(c),l+=r[c]);return[...i.reverse(),...a]}var nl=Math.PI*2;function Re(e,t,n){return e<t?t:e>n?n:e}function xo(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function ko(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function $o(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function wo(e){return e>=44032&&e<=55203?.87:e>=4352&&e<=4607||e>=12592&&e<=12687?.8:e>=19968&&e<=40959?.94:e>=48&&e<=57?.585:e===32||e===44||e===46||e===58||e===59||e===39?.26:e===37?.84:e===8722?.73:e===45?.42:e===43||e===61?.6:e===40||e===41||e===91||e===93?.34:e===47?.38:e===8361||e===36?.62:e===8230?.82:e>=65&&e<=90?e===73?.28:e===77||e===87?.86:.66:e>=97&&e<=122?e===105||e===108||e===106?.24:e===109||e===119?.84:e===102||e===116||e===114?.36:.55:.6}var Qt=new Map;function Me(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=Qt.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);$o(c)?i+=wo(c):s+=wo(c)}a=i+s*(n>=600?1.07:1),Qt.size>5e3&&Qt.clear(),Qt.set(o,a)}return a*t}function bt(e,t,n,r=400){if(e=e.trim(),Me(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let l=a+i+1>>1;Me(e.slice(0,l)+o,n,r)<=t?a=l:i=l-1}a>0&&(e.charCodeAt(a-1)&64512)===55296&&a--;let s=e.slice(0,a).trimEnd();return s.length<($o(s.charCodeAt(0))?2:3)?"":s+o}var Mo=N(B(),1),rl=e=>Array.isArray(e)&&e.length===2;function vo(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&rl(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var To=N(B(),1),Vn=10.5;function ol(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let i=1;i<e.length;i++)o=Math.min(o,Math.abs(e[i]-e[i-1]));let a=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(i=>tt(i,{locale:n,maximumFractionDigits:a}))}function So(e,t,n){let r=18;for(let o of ol(e,t,n))r=Math.max(r,Me(o,Vn));return Math.ceil(r+8)}function Kn(e,t){if(!(e>0)||!Number.isFinite(e))return 1;let n=e/Math.max(1,t),r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r;return(o>=7.071?10:o>=3.162?5:o>=1.414?2:1)*r}function ot(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,l=Kn(i,n),c=[o,a];for(let m=0;m<4;m++){let u=Math.ceil(a/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-d<=l*.3?d:o-i*s,a===0?0:u-a<=l*.3?u:a+i*s];let f=Kn(c[1]-c[0],n);if(f===l)break;l=f}return c}function Co(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=Kn(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let l=s,c=0;l<=o+a*1e-9&&c<200;l+=a,c++)i.push(Number((Math.round(l/a)*a).toPrecision(12)));return i}function Xn(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(l=>o+(l-n)*i);return s.domain=e,s.range=t,s.invert=l=>i===0?n:n+(l-o)/i,s.ticks=(l=4)=>Co(n,r,l),s}function Yn(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[a,i]=ot(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function al(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(c,m=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let f of c){let h=Number((f*10**d).toPrecision(12));h>=e*(1-1e-9)&&h<=t*(1+1e-9)&&u.push(h)}return u},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let l=i([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:Co(e,t,3)}function No(e,t){let n=Xn([Math.log10(e[0]),Math.log10(e[1])],t),r=(o=>o>0?n(Math.log10(o)):Number.NaN);return r.domain=e,r.range=t,r.invert=o=>10**n.invert(o),r.ticks=()=>al(e[0],e[1],Math.abs(t[1]-t[0])),r}function yt(e){let t=1/0,n=-1/0;for(let r of e)Number.isFinite(r)&&(r<t&&(t=r),r>n&&(n=r));return t===1/0?[0,1]:[t,n]}var il=864e5;function Ao(e,t,n,r=ue){let o=t-e;if(!(o>0))return[{t:e,label:gt(e,{locale:r,month:"short",day:"numeric"})}];let a=o/il,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,d,f=!1)=>{let h=new Date(m),g=-1,y=0;for(;h.getTime()<=t&&y++<500;){if(h.getTime()>=e){let p=h.getFullYear(),$=f&&!l&&p!==g;i.push({t:h.getTime(),label:gt(h,{locale:r,...d,...$?{year:"numeric"}:{}})}),g=p}u(h)}};if(a<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(f=>f>=m)??12,d=new Date(s);d.setMinutes(0,0,0),c(d,f=>f.setHours(f.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=a/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(f=>f>=u)??120;if(d>=12){let f=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(f,h=>h.setFullYear(h.getFullYear()+d/12),{year:"numeric"})}else{let f=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),h=f.getMonth()%d;h&&f.setMonth(f.getMonth()+(d-h)),c(f,g=>g.setMonth(g.getMonth()+d),{month:"short"},!0)}}return i}function Fo(e,t){let n=new Array(e),r=new Uint8Array(e),o=a=>{if(typeof a!="string"||a.length===0||a.length>9)return-1;let i=Number(a);return Number.isInteger(i)&&i>=0&&i<e&&String(i)===a?i:-1};return new Proxy(n,{get(a,i,s){let l=o(i);return l>=0?(r[l]||(a[l]=t(l),r[l]=1),a[l]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var sl=(e,t,n)=>e==="date"?Gt(t,n)?.getTime()??NaN:Fe(t);function ll(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&qr(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function xt(e,t,n,r,o={}){let a=je(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:je(n,"y"),c=!i&&r!==void 0?je(r,"series"):null,m=e.map((T,v)=>a(T,v)),u=o.xType??ll(m),d=o.locale??ue,f,h,g;if(u==="band"){let T=m.map(S=>String(S??""));f=ve(T);let v=new Map(f.map((S,z)=>[S,z]));h=f.map((S,z)=>z),g=Int32Array.from(T,S=>v.get(S)??-1)}else{let T=u==="date"?o.dayFirst??Zr(m):void 0,v=m.map(E=>sl(u,E,T)),S=Array.from(new Set(v.filter(E=>Number.isFinite(E)))).sort((E,ne)=>E-ne),z=new Map(S.map((E,ne)=>[E,ne]));h=S,f=S.map(String),g=Int32Array.from(v,E=>z.get(E)??-1)}let y=o.dateFormat,p=T=>typeof T=="string"?Bt(T.trim())?.[3]:void 0,$=u==="date"&&m.length<5e3?p(m[0]):void 0,x=($===2||$===3)&&m.every(T=>p(T)===$),M=x&&$===3;if(u==="date"&&!y){let T=h.length>1?h[h.length-1]-h[0]:0;y=x&&$===2||T>864e5*120?{month:"short"}:T<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},T>864e5*800&&(y={year:"numeric",month:"short"})}let k;if(u==="band")k=f;else if(M&&!o.dateFormat){let T=Q(d)==="ko";k=h.map(v=>{let S=new Date(v),z=Math.floor(S.getMonth()/3)+1;return T?`${S.getFullYear()}년 ${z}분기`:`Q${z} ${S.getFullYear()}`})}else{let T=h.every(Dn),v=u==="date"?new Intl.DateTimeFormat(d,y):new Intl.NumberFormat(d,T?{useGrouping:!1}:{maximumFractionDigits:6});k=h.length>1e3?Fo(h.length,S=>v.format(h[S])):h.map(S=>v.format(S))}let R=s?[...s]:c?ve(e.map((T,v)=>String(c(T,v)??""))):[""],A=new Map(R.map((T,v)=>[T,v])),O=R.map(()=>new Array(f.length).fill(NaN)),G=R.map(()=>new Array(f.length).fill(null)),D=o.aggregate??"sum",_=D==="mean"?R.map(()=>new Uint32Array(f.length)):null,F=(T,v,S,z)=>{let E=O[T][v];D==="last"?O[T][v]=S:D==="count"?O[T][v]=(Number.isFinite(E)?E:0)+1:D==="mean"?Number.isFinite(S)&&(O[T][v]=(Number.isFinite(E)?E:0)+S,_[T][v]++):O[T][v]=Number.isFinite(E)?E+(Number.isFinite(S)?S:0):S,G[T][v]=z};for(let T=0;T<e.length;T++){let v=g[T];if(v<0)continue;let S=e[T];if(s)for(let z=0;z<s.length;z++)F(z,v,Fe(S[s[z]]),S);else{let z=c?A.get(String(c(S,T)??""))??0:0;F(z,v,Fe(l(S,T)),S)}}if(_)for(let T=0;T<O.length;T++)for(let v=0;v<f.length;v++)_[T][v]>1&&(O[T][v]/=_[T][v]);return{type:u,keys:f,xnum:h,labels:k,series:R,values:O,rows:G}}var cl=140,wt=12,Ro=14,Un=20,Po=12.5;function ul(e,t,n=uo){let r=be(t,t),o=new Map;e.forEach((i,s)=>{let l=r(i,s),c=o.get(l);c?c.push(i):o.set(l,[i])});let a=[...o.keys()].slice(0,n);return{values:a,groups:a.map(i=>o.get(i)),dropped:Math.max(0,o.size-n)}}function ml(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+wt)/(cl+wt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function dl(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*wt)/t));return{pw:r,ph:typeof n=="number"&&Number.isFinite(n)&&n>0?n:Math.max(120,Math.min(180,Math.round(r*.62)))}}var kt=e=>e.filter(Number.isFinite);function en(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=rt(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return kt(n)}function Lo(e,t,n,r,o,a){return xt(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function fl(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let k=t.flat(),R=r.refLines??{},[A,O]=yt([...en(k,r.x??"x"),...kt([Number(R.x)])]),[G,D]=yt([...en(k,r.y??"y"),...kt([Number(R.y)])].filter(F=>!s||F>0)),_=r.zero??!1;return{y:c??(s?Yn(G,D,i):ot(G,D,i,{zero:_,pad:.08})),x:r.xDomain??ot(A,O,Math.max(2,Math.round(o/110)),{zero:_,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",d=n[0]?.keys.join(""),f=n.every(k=>k.keys.join("")===d),h=n.length>0&&n.every(k=>k.type!=="band"&&k.type===n[0].type),g=r.xDomain??(!m&&h?yt(n.flatMap(k=>kt(k.xnum))):void 0),y=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(y==="percent")return{x:g,sameKeys:f};if(c)return{y:c,x:g,sameKeys:f};let p=[];t.forEach((k,R)=>{let A=n[R];if(y==="stacked"||y==="auto"&&A.series.length>1){let G=Wn(A.values,"zero");G.y0.forEach(D=>p.push(...D)),G.y1.forEach(D=>p.push(...D))}else A.values.forEach(G=>p.push(...G));m&&!u&&r.line!==void 0&&Lo(e,k,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(G=>p.push(...G)),m||p.push(...en(k,r.lower),...en(k,r.upper))}),m&&p.push(0),u||p.push(...vo(r.annotations));for(let k of r.referenceLines??[])p.push(k.y);r.signColors&&p.push(Number(r.baseline??0));let[$,x]=yt(kt(p).filter(k=>!s||k>0));return{y:s?Yn($,x,i):m?ot($,x,u?Math.max(2,Math.round(o/120)):i):ot($,x,i,{zero:r.zero??e==="area"}),x:g,sameKeys:f}}function hl(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=xt(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?No:Xn)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),m=So(c,Xr(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(k=>k.series),d=r.endLabels??n.some(k=>k.series.length>1),f=m+6,h=a-(d?Math.min(a*.28,Math.max(...u.map(k=>Me(k,11,700)),20)+14):10),g=l.keys.length,[y,p]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,$=l.type==="number"?g>12:g>Ao(y,p,Math.max(2,Math.floor((h-f)/64)),s).length;if(l.type==="band"||!g||$)return;let x=k=>f+(l.xnum[k]-y)/(p-y)*(h-f),M=k=>Me(l.labels[k],Vn);for(let k=1;;k++){let R=Array.from({length:Math.ceil(g/k)},(A,O)=>O*k);if(k>=g||R.every((A,O)=>!O||x(A)-x(R[O-1])>=(M(A)+M(R[O-1]))/2+8))return R.map(A=>({value:l.xnum[A],label:l.labels[A]}))}}function gl(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")}function pl(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${gl(`${e}|${t}|${o}|${Zt(r)}`)}`}function bl(e,t){return typeof e=="string"?t.includes(e):Array.isArray(e)&&e.length>0&&e.every(n=>typeof n=="string"&&t.includes(n))}var yl={en:{intro:(e,t)=>`${Ae(e,"panel")} by ${t}.`,endHigh:(e,t)=>` ${e} ends highest at ${t}.`,falling:e=>` Lower at the end than at the start: ${e}.`,noneFalling:" None is lower at the end than at the start.",total:(e,t)=>` ${e} has the largest total at ${t}.`,points:(e,t)=>` ${e} has the most points (${t}).`,dropped:(e,t)=>` Only the first ${e} of ${t} values are shown.`,more:", …",blank:"(blank)"},ko:{intro:(e,t)=>`${t}별 패널 ${e}개.`,endHigh:(e,t)=>` 마지막 값이 가장 큰 곳: ${e}(${t}).`,falling:e=>` 처음보다 끝이 낮은 곳: ${e}.`,noneFalling:" 처음보다 끝이 낮은 곳은 없어요.",total:(e,t)=>` 합계가 가장 큰 곳: ${e}(${t}).`,points:(e,t)=>` 점이 가장 많은 곳: ${e}(${t}개).`,dropped:(e,t)=>` ${t}개 중 앞의 ${e}개만 보여요.`,more:" 등",blank:"(빈 값)"}},Jn=18;function _o(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=ul(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=ml(s,i,e.columns),{pw:c,ph:m}=dl(s,l,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(_=>Lo(t,_,n,n.y,n.series,n.aggregate)),f=u?fl(t,o,d,n,c,m):{sameKeys:!1},h=u?hl(t,o,d,n,f,c,m,e.locale):void 0,g=t==="bar"&&n.orientation==="horizontal",y=u&&(!g||f.sameKeys),p=u&&(g||f.x!==void 0||f.sameKeys),$=new Set(bl(e.highlight,r)?[e.highlight].flat():[]),x=$.size>0,M=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,k=e.syncId??pl(t,e.by,n,e.data),R=jt(ze(n.format,e.locale),n.unit),A=yl[e.lang],O=[],G=r.map(_=>_===""?A.blank:_);return{panels:r.map((_,F)=>{let T=o[F],v=G[F],S=F%l,z;if(t!=="scatter"){let ne=d[F],ae=se=>ne.values.reduce((ge,Ke)=>ge+(Number.isFinite(Ke[se])?Ke[se]:0),0),K=ne.keys.map((se,ge)=>ge).filter(se=>ne.values.some(ge=>Number.isFinite(ge[se]))),ie=K[K.length-1];O.push({first:K.length?ae(K[0]):NaN,last:K.length?ae(ie):NaN,total:K.reduce((se,ge)=>se+ae(ge),0)}),t!=="bar"&&ne.series.length===1&&ie!==void 0&&(z=R(ne.values[0][ie]))}else O.push({first:NaN,last:NaN,total:T.length});let E={data:T,width:c,height:m,ariaLabel:e.title?`${e.title}, ${v}`:v,syncId:k,highlight:x?$.has(_)?M?()=>!0:void 0:"none":e.highlight,showYAxis:!y||S===0,showXAxis:!p||F+l>=i};return f.y&&(E.yDomain=f.y),f.x&&(E.xDomain=f.x),h&&(E.xTicks=h),{value:_,label:v,props:E,last:z,isPicked:$.has(_)}}),cols:l,pw:c,ph:m,isPanelPick:x,description:xl(t,e.by,G,O,a,R,A)}}function xl(e,t,n,r,o,a,i){let s=i.intro(n.length,t),l=c=>ko(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=i.endHigh(n[c],a(r[c].last)));let m=n.filter((u,d)=>r[d].last<r[d].first);s+=m.length?i.falling(`${m.slice(0,5).join(", ")}${m.length>5?i.more:""}`):i.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?i.total(n[c],a(r[c].total)):i.points(n[c],r[c].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var fe=N(Z(),1);function kl(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function wl(e,t,n=1/0){let r=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=Math.min(r*.5,n))}var tn={threshold:.25,enoughPx:96,rootMargin:"0px"};function Io(e,t=!0){let[n,r]=(0,fe.useState)({visible:!t,near:!t});return(0,fe.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(i=>{let s=wl(i[i.length-1],tn.threshold,tn.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:kl(tn.threshold),rootMargin:tn.rootMargin}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),a.observe(e),()=>{o.disconnect(),a.disconnect()}},[e,t]),n}function Do(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function nn(e){let[t,n]=(0,fe.useState)(null),[r,o]=(0,fe.useState)(e??null),a=(0,fe.useCallback)(i=>{n(i),i&&e===void 0&&o(Do(i))},[e]);return Ne(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>i(Do(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?i(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var $l=()=>()=>{};function at(){return(0,fe.useSyncExternalStore)($l,()=>!0,()=>!1)}var Eo="(prefers-reduced-motion: reduce)";function rn(e="auto"){let[t,n]=(0,fe.useState)(()=>xe&&typeof window.matchMedia=="function"?window.matchMedia(Eo).matches:!1);return(0,fe.useEffect)(()=>{if(e!=="auto"||!xe||typeof window.matchMedia!="function")return;let r=window.matchMedia(Eo),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Se=N(B(),1),vl=60,Ml=420;function Oo(e){let t=$e(),n=e.chartProps??{},[,r,o]=nn(e.width),a=e.width??(o||480),i=me(e.locale??n.locale),s=Q(i),l=(0,it.useContext)(qe),c=e.title??l,m=e.chart.facetPlan,u=(0,it.useMemo)(()=>{let p=_o({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:a,height:e.height,title:c,locale:i,lang:s});return m?m(p,n,i):p},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(p,$)=>typeof $=="function"?String($):$),e.highlight,e.syncId,a,e.height,c,i,s,m]),d=`${(0,it.useId)().replace(/:/g,"")}fd`,f=rn(n.reducedMotion??"auto"),h=at(),g=Dt({motion:{enabled:n.animate!==!1&&!f&&xe},hydrated:h},{waiting:!1,generation:0}),y=e.chart;return(0,Se.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Se.jsx)("p",{id:d,style:Yt,children:e.description??u.description}),(0,Se.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:wt,rowGap:Ro,...u.legend?{marginTop:Jn}:null},children:u.panels.map((p,$)=>{let x=t.paint(p.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,Se.jsxs)("div",{"data-facet":p.value,style:{minWidth:0,..._t(g,!1,"fade",$*vl,Ml)},children:[(0,Se.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Un,fontSize:Po,fontWeight:700,lineHeight:`${Un}px`,color:x},children:[(0,Se.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.label}),p.last!==void 0?(0,Se.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:p.last}):null]}),(0,Se.jsx)(y,{...n,...p.props})]},p.value)})}),u.legend?(0,Se.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Jn},children:u.legend}):null]})}var on=["max","min","first","last","none"];function Te(e,t,n,r,o="max"){let a=new Set,i=n.length,s=c=>{if(i&&c!=="none"){if(c==="first")a.add(0);else if(c==="last")a.add(i-1);else if(c==="max"||c==="min"){let m=-1,u=c==="max"?-1/0:1/0;r.forEach((d,f)=>{Number.isFinite(d)&&(c==="max"?d>u:d<u)&&(u=d,m=f)}),m>=0&&a.add(m)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((c,m)=>{m<i&&c!==null&&c!==void 0&&e(c,m)&&a.add(m)}),a;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<i&&a.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&a.add(u)});return a}var ye=N(Z(),1);async function Sl(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",a=await e.text();if(t==="text")return a;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(a))throw new Error(Q(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Be(a);if(t==="json"||o.includes("json"))return JSON.parse(a);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return Be(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):Be(a)}async function Tl(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),a=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!a.ok)throw new Error(`HTTP ${a.status}${a.statusText?` ${a.statusText}`:""}`);r=await Sl(a,t.parse,o,t.locale)}return t.select&&(r=po(r,t.select)),t.transform?t.transform(r):Ee(r)}function zo(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,ye.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,ye.useState)(0),c=me(t.locale),m=(0,ye.useRef)(t);m.current={...t,locale:c};let u=(0,ye.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",f=t.deps??[],h=JSON.stringify(f.map(p=>typeof p=="object"?JSON.stringify(p):String(p))),g=(0,ye.useRef)(!1);(0,ye.useEffect)(()=>{let p=u.current;if(!p||!r){i(M=>M.status==="loading"?{...M,status:"idle"}:M);return}let $=new AbortController,x=!0;return g.current=!0,i(M=>({...M,data:o?M.data:[],status:"loading",error:null})),Tl(p,{...m.current,signal:$.signal}).then(M=>{x&&i({data:M,status:"success",error:null,updatedAt:Date.now()})}).catch(M=>{!x||$.signal.aborted||i(k=>({...k,status:"error",error:M instanceof Error?M:new Error(String(M))}))}).finally(()=>{x&&(g.current=!1)}),()=>{x=!1,g.current=!1,$.abort()}},[d,r,s,h,o]),(0,ye.useEffect)(()=>{if(!n||!r)return;let p=setInterval(()=>{g.current||l($=>$+1)},n);return()=>clearInterval(p)},[n,r]);let y=(0,ye.useCallback)(()=>l(p=>p+1),[]);return{data:a.data,status:a.status,loading:a.status==="loading",error:a.error,empty:a.status==="success"&&a.data.length===0,updatedAt:a.updatedAt,reload:y}}var Zn=N(B(),1),Cl=["csv","svg","png"],Nl=/^[=+\-@\t\r\n=+-@]/,Al=/var\(|color-mix\(/;function jo(e){if(typeof e=="number")return Number.isFinite(e)?String(e):"";if(e==null||e instanceof Date&&Number.isNaN(e.getTime()))return"";let t=e instanceof Date?Yr(e.getTime()):String(e);return`"${(Nl.test(t)&&!Number.isFinite(Fe(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Fl(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Rl(e,t){return`\uFEFF${[t.map(jo),...e.map(r=>t.map(o=>jo(r[o])))].map(r=>r.join(",")).join(`\r
|
|
26
26
|
`)}\r
|
|
27
|
-
`}function Pl(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function qn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Bo=2,Ie=16;function Go(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,a,i,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${a}, ${i})`:`rgba(${o}, ${a}, ${i}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function Ho(e,t){let n=document.createElementNS("http://www.w3.org/2000/svg",e);for(let[r,o]of Object.entries(t))n.setAttribute(r,String(o));return n}function Wo(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:a,height:i}=o.viewBox.baseVal,[s,l]=[a+Ie*2,i+Ie*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((h,g)=>{let y;for(let p of Array.from(h.attributes)){if(!Al.test(p.value))continue;let $=(y??(y=getComputedStyle(h))).getPropertyValue(p.name);$&&m[g].setAttribute(p.name,Go($,u))}}),c.removeAttribute("style");for(let[h,g]of Object.entries({viewBox:`${-Ie} ${-Ie} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(h,String(g));let d=Go(getComputedStyle(r).backgroundColor,u),f=o.parentElement?.querySelector("canvas")??null;if(n){let h=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(Ho("rect",{x:-Ie,y:-Ie,width:s,height:l,fill:d}),h),f&&c.insertBefore(Ho("image",{href:f.toDataURL(),width:a,height:i}),h)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:a,vh:i,bg:d,canvas:f}}function Ll(e,t){let n=Wo(e,Bo,!1);if(!n)return;let r=Bo,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let a=o.getContext("2d");if(!a)return;a.fillStyle=n.bg,a.fillRect(0,0,o.width,o.height),n.canvas&&a.drawImage(n.canvas,Ie*r,Ie*r,n.vw*r,n.vh*r);let i=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{a.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(i),o.toBlob(l=>l&&qn(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Vo(e){let t=$e(e.theme),n=Q(me(e.locale))==="ko",r=Pl(e.filename),o=(a,i)=>{if(a==="csv")return qn(new Blob([Rl(e.data,e.columns?.length?e.columns:Fl(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return Ll(i,r);let s=Wo(i,1,!0);s&&qn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,Zn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:Cl.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,Zn.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(a,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:i},a)})})}var Xo=
|
|
28
|
-
`),o=(a,i)=>{if(i==="label")return a.label;if(i==="value")return a.formatted??(a.value===null?null:n(a.value));if(i==="series")return a.series??null;let s=a.datum&&typeof a.datum=="object"?a.datum[i]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?gt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,c=s.replace(Jr,(m,u)=>o(a,u.trim())??(l=!0,""));l||i.push(c)}return i.length?i.map((s,l)=>(0,Xo.jsx)("div",{children:s},l)):null}}function $t(e){let t=String(e??"").normalize("NFC").trim().replace(/\s+/g," ").toLowerCase();return/^\d+$/.test(t)?t.replace(/^0+(?=\d)/,""):t}function st(e){let t=new Map;return e.forEach((n,r)=>{for(let o of n){let a=$t(o);a&&!t.has(a)&&t.set(a,r)}}),n=>t.get($t(n))??-1}function Yo(e,t){let n=[...new Set([...new Set(e)].map($t))].filter(Boolean),r=-1,o=0;return t.forEach((a,i)=>{let s=n.filter(l=>a(l)>=0).length;s>o&&(o=s,r=i)}),r}function Uo(e,t,n=!1){let r=be(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),a=ve(o);if(!n)return a;let i=new Map;for(let s of o)i.set(s,(i.get(s)??0)+1);return a.map((s,l)=>[s,l]).sort((s,l)=>i.get(s[0])-i.get(l[0])||s[1]-l[1]).map(([s])=>s)}var _l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function Jo(e){if(typeof e!="string")return[];let t=new Int8Array(128).fill(-1);for(let i=0;i<64;i++)t[_l.charCodeAt(i)]=i;let n=[],r=0,o=1,a=0;for(let i=0;i<e.length;i++){let s=t[e.charCodeAt(i)]??-1;s<0||(r+=(s&31)*o,a++,s&32&&a<7?o*=32:(s&32||n.push(r%2?-(r+1)/2:r/2),r=0,o=1,a=0))}return n}var qo=new WeakMap,on=(e,t)=>typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=t?e:-1;function an(e){let t=qo.get(e);if(t)return t;let n=Array.isArray(e.topo?.t)?e.topo.t:[],[r,o,a]=n.every(g=>Number.isFinite(g))&&n.length>=3?n:[NaN,NaN,NaN],i=Number.isFinite(r)&&r>0,s=i?Jo(e.topo.arcs):[],l=[],c=0;for(let g=0;g<s.length;){let y=on(s[g++],(s.length-g)/2);if(y<0)break;let p=[],$=0,x=0;for(let M=0;M<y;M++)$+=s[g++],x+=s[g++],p.push([$*r+o,x*r+a]);c+=y,l.push(p)}let m=i?Jo(e.topo.shapes):[],u=0,d=c*4,h=(Array.isArray(e.regions)?e.regions:[]).map(g=>{let y=Array.isArray(g)?g.filter(M=>typeof M=="string"):[],p=[];for(let M=on(m[u++],m.length-u);M>0;M--){let k=[];for(let R=on(m[u++],m.length-u);R>0;R--){let N=[];for(let j=on(m[u++],m.length-u),G=0;G<j;G++){let D=m[u++],_=(D>=0?l[D]:l[~D]?.slice().reverse())??[];if(d-=_.length,d<0)break;for(let F=G?1:0;F<_.length;F++)N.push(_[F])}if(N.length>1&&N[0][0]===N[N.length-1][0]&&N[0][1]===N[N.length-1][1]&&N.pop(),N.length>=3&&k.push(N),d<0||u>m.length)break}if(k.length&&p.push(k),d<0||u>m.length)break}let $=y[0]??"",x=e.namesKo?.[$];return{id:$,name:y[1]??$,nameKo:typeof x=="string"?x:void 0,keys:typeof x=="string"?[...y,x]:y,polygons:p}});return qo.set(e,h),h}var Oe=e=>typeof e=="string"&&e.trim()!==""?e:typeof e=="number"&&Number.isFinite(e)?String(e):void 0;function Zo(e,t){if(!Array.isArray(e))return null;let n=[];for(let r of e){if(!Array.isArray(r)||typeof r[0]!="number"||typeof r[1]!="number"||!Number.isFinite(r[0])||!Number.isFinite(r[1]))continue;let[o,a]=r;a>90||a<-90||o>540||o<-540?(t.n++,a=Math.max(-90,Math.min(90,a)),o=((o+180)%360+360)%360-180):(o>180||o<-180)&&t.n++;let i=n[n.length-1];(!i||i[0]!==o||i[1]!==a)&&n.push([o,a])}return n.length>1&&n[0][0]===n[n.length-1][0]&&n[0][1]===n[n.length-1][1]&&n.pop(),n.length>=3?n:null}function sn(e,t,n){let r=`${t??""}${n??""}`,o=Qo.get(e),a=o?.get(r);if(a)return a;let i=Dl(e,t,n);return o||Qo.set(e,o=new Map),o.set(r,i),i}var Qo=new WeakMap;function Dl(e,t,n){let r=[],o=[],a={n:0};return(Array.isArray(e.features)?e.features:[]).forEach((i,s)=>{let l=i&&typeof i.properties=="object"&&i.properties||{},c=i?.geometry,m=c&&Array.isArray(c.coordinates)?c.type==="Polygon"?[c.coordinates]:c.type==="MultiPolygon"?c.coordinates:[]:[],u=[];for(let h of m){if(!Array.isArray(h))continue;let g=Zo(h[0],a);g&&u.push([g,...h.slice(1).map(y=>Zo(y,a)).filter(y=>y!==null)])}if(!u.length)return void o.push(s);let d=(t?Oe(l[t]):void 0)??Oe(i?.id)??Oe(l.id)??Oe(l.code)??String(s+1),f=(n?Oe(l[n]):void 0)??Oe(l.name)??Oe(l.NAME)??d;r.push({id:d,name:f,keys:[...new Set([d,f,Oe(i?.id)].filter(h=>!!h))],polygons:u})}),{shapes:r,skipped:o,outOfRange:a.n}}var vt=["world","us-states","kr-sido"];function ta(){var t;let e=globalThis;return e[t=Symbol.for("ztd-charts.geo.maps")]??(e[t]=new Map)}function Ge(e){let t=e;return!!t&&typeof t=="object"&&typeof t.name=="string"&&Array.isArray(t.regions)&&!!t.topo&&typeof t.topo.arcs=="string"}function El(e){let t=e;return!!t&&typeof t=="object"&&t.type==="FeatureCollection"&&Array.isArray(t.features)}function lt(e){return ta().get(e)}function Qn(){return[...ta().keys()]}function Il(e){return e.regions.map(t=>{let n=Array.isArray(t)?t.filter(o=>typeof o=="string"):[],r=n[0]!==void 0?e.namesKo?.[n[0]]:void 0;return typeof r=="string"?[...n,r]:n})}var ea=new WeakMap;function Mt(e){let t=ea.get(e);return t||ea.set(e,t=st(Il(e))),t}function na(e,t){if(e===void 0||e==="auto"){let n=Qn();if(!n.length)return{missing:"auto"};let r=Yo(t(),n.map(a=>Mt(lt(a)))),o=n[Math.max(0,r)];return{map:lt(o),name:o}}if(typeof e=="string"){let n=lt(e);return n?{map:n,name:e}:{missing:e}}return Ge(e)?{map:e,name:e.name}:El(e)?{map:e}:null}var ut=.017453292519943295,he=e=>((e+180)%360+360)%360-180,ra=1.340264,oa=-.081106,aa=893e-6,ia=.003796,sa=.8660254037844386,Ol=(e,t)=>{let n=Math.asin(sa*Math.sin(t)),r=n*n,o=r*r*r;return[e*Math.cos(n)/(sa*(ra+3*oa*r+o*(7*aa+9*ia*r))),n*(ra+oa*r+o*(aa+ia*r))]};function ln(e,t){let n=Math.sin(e*ut),r=(n+Math.sin(t*ut))/2;if(Math.abs(r)<.001)return(i,s)=>[i,Math.sin(s)];let o=1+n*(2*r-n),a=Math.sqrt(o)/r;return(i,s)=>{let l=Math.sqrt(Math.max(0,o-2*r*Math.sin(s)))/r;return[l*Math.sin(i*r),a-l*Math.cos(i*r)]}}function St(e,t,n=[0,0],r=1,o=[0,0]){let[a,i]=t(n[0]*ut,n[1]*ut);return{lon0:e,raw:(s,l)=>{let[c,m]=t(s*ut,Math.max(-90,Math.min(90,l))*ut);return[r*(c-a)+o[0],-r*(m-i)+o[1]]}}}var ca=["AK","HI"];function Tt(e,t,n,r){let o=e.pick(t,n,r);return o.raw(he(t-o.lon0),n)}function er(e,t=0,n){if(e==="albersUsa"){let o=St(-96,ln(29.5,45.5),[-.6,38.7]),a=St(-154,ln(55,65),[-2,58.5],.35,[-.307,.201]),i=St(-157,ln(8,18),[-3,19.9],1,[-.205,.212]);return{name:e,pick:(s,l,c)=>c!==void 0?c==="AK"?a:c==="HI"?i:o:l>=50&&(s<=-129||s>=170)?a:l>=18&&l<=23&&s>=-161&&s<=-154?i:o}}if(e==="conic"&&n){let[,o,,a]=n,i=St(t,ln(o+(a-o)/6,o+(a-o)*5/6),[0,(o+a)/2]);return{name:e,pick:()=>i}}let r=St(t,Ol);return{name:"equalEarth",pick:()=>r}}function cn(e){let t=[],n=1/0,r=-1/0;for(let i of e)for(let s of i.polygons)for(let[l,c]of s[0])t.push(he(l)),c<n&&(n=c),c>r&&(r=c);if(!t.length)return null;t.sort((i,s)=>i-s);let o=t[0]+360-t[t.length-1],a=t[0];for(let i=1;i<t.length;i++)t[i]-t[i-1]>o&&(o=t[i]-t[i-1],a=t[i]);return[a,n,a+360-o,r]}function un(e){return e[2]-e[0]>150||e[3]-e[1]>70?"equalEarth":"conic"}function la(e,t,n){let r=[];for(let o=0;o<e.length;o++){let a=e[o],i=e[(o+1)%e.length],s=(a[0]-t)*n>=0,l=(i[0]-t)*n>=0;s&&r.push(a),s!==l&&r.push([t,a[1]+(i[1]-a[1])*(t-a[0])/(i[0]-a[0])])}return r}function zl(e){let t=0,n=-1;for(let a=0;a<e.length;a++)Math.abs(e[a][0]-e[(a+e.length-1)%e.length][0])>180&&(t++,n<0&&(n=a));if(!t)return[e];if(t%2){let a=e[(n+e.length-1)%e.length],i=e[n],s=a[0]>0?180:-180,l=360-Math.abs(a[0]-i[0]),c=a[1]+(i[1]-a[1])*(Math.abs(s-a[0])||0)/(l||1),m=e.reduce((u,d)=>u+d[1],0)<0?-90:90;return[[...e.slice(0,n),[s,c],[s,m],[-s,m],[-s,c],...e.slice(n)]]}let r=[e[0]];for(let a=1;a<e.length;a++){let i=e[a][0],s=r[a-1][0];for(;i-s>180;)i-=360;for(;i-s<-180;)i+=360;r.push([i,e[a][1]])}let o=[];for(let a of[-1,0,1]){let i=la(la(r,a*360-180,1),a*360+180,-1),s=0;for(let l=0,c=i.length-1;l<i.length;c=l++)s+=(i[c][0]-i[l][0])*(i[c][1]+i[l][1]);i.length>=3&&Math.abs(s)>1e-9&&o.push(a?i.map(([l,c])=>[l-a*360,c]):i)}return o}function ua(e,t){let n=[],r=[],o=[],a=[1/0,1/0,-1/0,-1/0];return t.polygons.forEach((i,s)=>i.forEach((l,c)=>{let m=e.pick(l[0][0],l[0][1],e.name==="albersUsa"?t.id:void 0);for(let u of zl(l.map(([d,f])=>[he(d-m.lon0),f]))){let d=new Float64Array(u.length*2);u.forEach(([f,h],g)=>{let[y,p]=m.raw(f,h);d[g*2]=y,d[g*2+1]=p,y<a[0]&&(a[0]=y),p<a[1]&&(a[1]=p),y>a[2]&&(a[2]=y),p>a[3]&&(a[3]=p)}),n.push(d),r.push(s),o.push(c===0)}})),{rings:n,poly:r,outer:o,box:a}}function ma(e,t){let n=[1/0,1/0,-1/0,-1/0],[r,o,a,i]=t;for(let s=0;s<=24;s++){let l=s/24;for(let[c,m]of[[r+(a-r)*l,o],[r+(a-r)*l,i],[r,o+(i-o)*l],[a,o+(i-o)*l]]){let[u,d]=Tt(e,c,m);n[0]=Math.min(n[0],u),n[1]=Math.min(n[1],d),n[2]=Math.max(n[2],u),n[3]=Math.max(n[3],d)}}return n}function da(e,t,n){let r=e[2]-e[0],o=e[3]-e[1],a=r>0&&o>0?Math.min(t/r,n/o):1;return{k:a,tx:(t-r*a)/2-e[0]*a,ty:(n-o*a)/2-e[1]*a}}var ct=e=>Math.round(e*10)/10||0;function fa(e,t,n,r=0){let o="";for(let a of e){let i="",s=NaN,l=NaN,c=0,m=1/0,u=-1/0,d=1/0,f=-1/0;for(let g=0;g<a.length;g+=2){let y=ct(a[g]*t.k+t.tx),p=ct(a[g+1]*t.k+t.ty);Math.abs(y-s)<.35&&Math.abs(p-l)<.35||(i+=c?`${c===1?"l":" "}${ct(y-s)} ${ct(p-l)}`:`M${y} ${p}`,s=y,l=p,c++,y<m&&(m=y),y>u&&(u=y),p<d&&(d=p),p>f&&(f=p))}n!==void 0&&(u<0||f<0||m>n[0]||d>n[1])||Math.min(u-m,f-d)<r||(c>=3&&(u-m>=1||f-d>=1)?o+=`${i}Z`:r||(o+=`M${ct((m+u)/2-.8)} ${ct((d+f)/2-.8)}h1.6v1.6h-1.6Z`))}return o}function jl(e){let t=0,n=0,r=0,o=e.length/2;for(let a=0,i=o-1;a<o;i=a++){let s=e[i*2]*e[a*2+1]-e[a*2]*e[i*2+1];t+=s,n+=(e[i*2]+e[a*2])*s,r+=(e[i*2+1]+e[a*2+1])*s}return[t/2,t?n/(3*t):NaN,t?r/(3*t):NaN]}function ha(e){let t=new Map,n=e.rings.map(jl);e.rings.forEach((d,f)=>t.set(e.poly[f],(t.get(e.poly[f])??0)+(e.outer[f]?1:-1)*Math.abs(n[f][0])));let r=-1,o=0;for(let[d,f]of t)f>o&&(o=f,r=d);if(r<0)return[NaN,NaN];let a=e.rings.map((d,f)=>f).filter(d=>e.poly[d]===r),i=0,s=0;for(let d of a)e.outer[d]&&(i+=n[d][2]*Math.abs(n[d][0]),s+=Math.abs(n[d][0]));let l=i/s,c=[];for(let d of a){let f=e.rings[d],h=f.length/2;for(let g=0,y=h-1;g<h;y=g++){let p=f[g*2+1],$=f[y*2+1];p>l!=$>l&&c.push(f[g*2]+(f[y*2]-f[g*2])*(l-p)/($-p))}}c.sort((d,f)=>d-f);let m=NaN,u=-1;for(let d=0;d+1<c.length;d+=2)c[d+1]-c[d]>u&&(u=c[d+1]-c[d],m=(c[d]+c[d+1])/2);return[m,l]}var ga=new WeakMap;function Bl(e){let t=Math.max(.5,(e[2]-e[0])*.05),n=Math.max(.5,(e[3]-e[1])*.05);return[e[0]-t,Math.max(-90,e[1]-n),e[2]+t,Math.min(90,e[3]+n)]}function mn(e,t={}){let n=`${t.focus??""}${t.featureId??""}${t.featureName??""}`,r=ga.get(e),o=r?.get(n);if(o)return o;let a=Ge(e)?e:null,i=a?an(a):sn(e,t.featureId,t.featureName).shapes,s=new Set(a?.hidden??[]),l=t.focus!==void 0&&a?.focus&&Object.hasOwn(a.focus,t.focus)?a.focus[t.focus]:void 0,c=l?new Set(l.ids.split(" ")):null,m=new Set;i.forEach((f,h)=>{f.polygons.length&&!s.has(f.id)&&(!c||c.has(f.id))&&m.add(h)});let u=[];if(l)u.push({box:[...l.box]});else{let f=new Map;for(let h of m){let g=a?.projection==="albersUsa"&&ca.includes(i[h].id)?i[h].id:"",y=f.get(g);y?y.push(i[h]):f.set(g,[i[h]])}for(let[h,g]of f){let y=cn(g);if(!y)continue;let p=(a?a.projection:un(y))==="equalEarth",$=Bl(y);u.push({box:p?[-180,$[1],180,$[3]]:$,...h&&{id:h}})}}let d={boxes:u,shown:m,shapes:i,match:a?Mt(a):st(i.map(f=>f.keys))};return r||ga.set(e,r=new Map),r.set(n,d),d}function Gl(e,t){return Number.isFinite(e)&&Number.isFinite(t)&&e>=-180&&e<=180&&t>=-90&&t<=90}function Hl(e,t,n){for(let r of e.boxes){let[o,a,i,s]=r.box;if(!(n<a||n>s)){for(let l of[t,t+360,t-360])if(l>=o&&l<=i)return r}}return null}function tr(e,t){if("name"in t){let r=e.match(t.name);return r<0?{miss:"unmatched"}:e.shown.has(r)?{region:r}:{miss:"outside"}}if(!Gl(t.lon,t.lat))return{miss:"invalid"};let n=Hl(e,t.lon,t.lat);return n?{lon:t.lon,lat:t.lat,...n.id&&{id:n.id}}:{miss:"outside"}}var Wl=e=>e.boxes.reduce((t,n)=>t+(n.box[2]-n.box[0])*(n.box[3]-n.box[1]),0);function pa(e,t){if(e!==void 0&&e!=="auto")return na(e,()=>[]);let n=Qn();if(!n.length)return{missing:"auto"};let r=t(),o=new Set,a=r.filter(m=>{if(!("name"in m))return!0;let u=$t(m.name);return!u||o.has(u)?!1:(o.add(u),!0)}),i=-1,s=0,l=1/0;n.forEach((m,u)=>{let d=mn(lt(m)),f=0;for(let g of a)"miss"in tr(d,g)||f++;let h=Wl(d);(f>s||f===s&&f>0&&h<l)&&(i=u,s=f,l=h)});let c=i>=0?n[i]:n.includes("world")?"world":n[0];return{map:lt(c),name:c}}var ba=1e3;function Vl(e,t){if(!e||typeof e!="object"||Array.isArray(e)||!Object.hasOwn(e,t))return null;let n=e[t];if(!Array.isArray(n)||n.length!==2)return{lon:NaN,lat:NaN};let r=o=>typeof o=="number"?o:typeof o=="string"&&o.trim()!==""?Number(o):NaN;return{lon:r(n[0]),lat:r(n[1])}}function ya(e,t,n){return!!e&&!!t&&e!==t&&n>0&&Number.isFinite(n)}function nr(e,t){return Vl(e,t)??{name:t}}function xa(e){if(Array.isArray(e))return e;if(e&&typeof e=="object"){let t=e;if(Array.isArray(t.values))return t.values;if(typeof t.csv=="string")return Be(t.csv)}return null}var Ta=A(Z(),1);var te=A(Z(),1);function ka(e,t){let n=$e(e.theme),[r,o,a]=tn(e.width),i=at(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=nn(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&xe,d=Io(r,e.animateOnView!==!1&&u),f=me(e.locale),h=Q(f),g=(0,te.useMemo)(()=>ze(e.format,f,t.format),[e.format,f,t.format]),y=(0,te.useCallback)(K=>et(K,{locale:f}),[f]),p=(0,te.useMemo)(()=>zt(g,e.unit),[g,e.unit]),$=(0,te.useMemo)(()=>qt(e.data),[e.data]),[x,M]=(0,te.useState)(null),[k,R]=(0,te.useState)(null),N=(0,te.useRef)([]),j=(0,te.useRef)(e.onHover);j.current=e.onHover;let G=(0,te.useRef)(e.onClick);G.current=e.onClick;let D=(0,te.useRef)(null),_=(0,te.useRef)(null),F=(0,te.useRef)(null),T=(0,te.useCallback)((K,ie="pointer")=>{if(F.current!==K){F.current=K;let se=K===null?null:N.current[K]??null;queueMicrotask(()=>j.current?.(se)),_.current?.(K)}D.current=K===null?null:ie,M(K),R(D.current)},[]),v=(0,te.useCallback)(K=>{D.current!=="keyboard"&&(D.current=K===null?null:"sync",M(K),R(D.current))},[]),S=(0,te.useCallback)(K=>{let ie=N.current[K];ie&&G.current?.(ie)},[]),O=no(e.replayKey),E=e.width!==void 0||(a??0)>0,ne={enabled:u,active:d.visible&&E,near:d.near,replayKey:O,dataKey:$,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},ae=(0,te.useCallback)((K,ie=1)=>x===null||x===K?ie:ie*.38,[x]);return{p:n,width:s,height:c,measured:E,responsive:e.width===void 0,pending:xe&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:ne,fv:p,fmt:g,pct:y,locale:f,lang:h,t:h==="ko"?Lr:Pr,active:x,via:k,setActive:T,click:S,events:N,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:ae,sig:$,description:e.description,reduced:m,publish:_,applySync:v}}var ee=A(Z(),1);function Kl(e){return 1-Math.pow(1-e,3)}function Xl(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Yl(e){return e==="easeInOut"?Xl:e==="linear"?t=>t:Kl}function Ul(e,t){return e==="linear"?1:e==="easeInOut"?t<.5?12*t*t:3*Math.pow(-2*t+2,2):3*Math.pow(1-t,2)}function mt(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),a=Math.floor(o),i=Math.min(e.length-1,a+1);n[r]=e[a]+(e[i]-e[a])*(o-a)}return n}function dn(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],o=t[n];if(Number.isNaN(r)!==Number.isNaN(o)||Math.abs(r-o)>1e-6)return!1}return!0}function wa(e,t,n){for(let r=0;r<n.length;r++)(!Number.isFinite(e[r])||!Number.isFinite(n[r]))&&(e[r]=n[r],t[r]=0)}function $a(e,t,n,r){if(!t||!n||t.length!==n.length)return mt(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let l of mt(s,n[i]))o.push(l)}return o.length===r?o:mt(e,r)}var fn=class{constructor(){this.tracks=new Map;this.seq=0;this.easing="spring";this.duration=900;this.omega=8.2;this.animating=!1;this.entranceStart=-1;this.maxDelay=0}configure(t,n){this.easing=t,this.duration=Math.max(1,n),this.omega=7.4/(this.duration/1e3)}sameTargets(t){let n=0;for(let r of this.tracks.values())r.exiting||n++;if(n!==t.length)return!1;for(let r of t){let o=this.tracks.get(r.key);if(!o||o.exiting||!dn(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let a=t.from??t.to,i=t.enter??a;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:a.slice(),enter:i.slice(),exit:(t.exit??i).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),a=this.make(r,r.to,0,0);o&&(a.order=o.order),a.done=!0,a.progress=1,n.set(r.key,a)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let a=this.tracks.get(o.key),i=this.make(o,o.from??o.to,1/0,o.delay??0);a&&(i.order=a.order),r=Math.max(r,o.delay??0),n.set(o.key,i)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),wa(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=dn(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),l=r>0?Math.min(a*r,240):0;if(s){let c=i.to.length;s.from=$a(s.cur,s.parts,i.parts,c),s.vel=$a(s.curVel,s.parts,i.parts,c),s.parts=i.parts,s.to=i.to.slice(),wa(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=dn(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(i,i.enter??i.from??i.to,n+l,0);c.done=dn(c.from,c.to),this.tracks.set(i.key,c)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=mt(i.exit,i.cur.length),i.t0=n,i.exiting=!0,i.done=!1,i.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=Yl(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=mt(s.from,c)),s.vel.length!==c&&(s.vel=mt(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-a*l),d=a*l>=8&&a*l<20,f=0;for(let h=0;h<c;h++){let g=s.from[h]-s.to[h],y=s.vel[h]+a*g;s.cur[h]=s.to[h]+(g+y*l)*u,s.curVel[h]=(s.vel[h]-a*y*l)*u,d&&f<.15&&(f=Math.max(f,Math.abs(s.cur[h]-s.to[h]),Math.abs(s.curVel[h]/a)))}m=a*l>=20||d&&f<.15,s.progress=Math.min(1,1-(1+a*l)*u)}else{let u=Math.min(1,l/o),d=r(u),f=Ul(this.easing,u)/o;for(let h=0;h<c;h++)s.cur[h]=s.from[h]+(s.to[h]-s.from[h])*d,s.curVel[h]=(s.to[h]-s.from[h])*f;m=u>=1,s.progress=d}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&i.push(s.key)}else n=!0}for(let s of i)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Ct=new Set,hn=0;function va(e){hn=0;let t=Array.from(Ct);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Ct.delete(n)}Ct.size&&typeof requestAnimationFrame<"u"&&(hn=requestAnimationFrame(va))}function Ma(e){return Ct.add(e),!hn&&typeof requestAnimationFrame<"u"&&(hn=requestAnimationFrame(va)),()=>{Ct.delete(e)}}function Jl(e){let t=new Map,n=!1;for(let r of e){let o=(t.get(r.key)??0)+1;t.set(r.key,o),o>1&&(n=!0)}return n?(t.clear(),e.map(r=>{let o=(t.get(r.key)??0)+1;return t.set(r.key,o),o>1?{...r,key:`${r.key}#${o}`}:r})):e}function Sa(e,t){let n=(0,ee.useMemo)(()=>Jl(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,ee.useRef)(null),d=(0,ee.useRef)("init"),f=(0,ee.useRef)(null),h=(0,ee.useRef)(s),g=(0,ee.useRef)(i),y=(0,ee.useRef)(!1),p=(0,ee.useRef)(0),[,$]=(0,ee.useState)(0),x=(0,ee.useRef)(null),M=(0,ee.useRef)(!0);u.current||(u.current=new fn,u.current.configure(l,c),u.current.snap(n),f.current=n);let k=u.current;if(k.configure(l,c),f.current!==n){let _=d.current,F=!Object.is(h.current,s);k.sameTargets(n)?k.refreshData(n):!r||_==="init"?k.snap(n):_==="idle"?k.hold(n):_==="running"||F?k.update(n,Et(),m):k.snap(n),f.current=n,h.current=s}let R=(0,ee.useRef)(()=>!1);R.current=_=>{if(!M.current)return!1;let F=k.step(_);return!F&&d.current==="running"&&(d.current="done"),$(T=>(T+1)%1e9),F||(x.current=null),F};let N=(0,ee.useCallback)(()=>{if(!xe||x.current||!k.animating)return;let _=F=>R.current(F);x.current=Ma(_)},[k]);Ne(()=>{let _=!Object.is(g.current,i);if(g.current=i,!r){(d.current!=="done"||k.animating)&&(k.snap(f.current??n),d.current="done",$(F=>F+1));return}d.current==="init"||_&&a?(k.hold(f.current??n),d.current="idle",y.current=!1,$(F=>F+1)):_&&(y.current=!0)},[r,i]),Ne(()=>{!r||!a||!y.current||(y.current=!1,k.hold(f.current??n),d.current="idle",$(_=>_+1))},[a,r]),(0,ee.useEffect)(()=>{r&&o&&d.current==="idle"&&(k.start(Et()),p.current+=1,d.current="running",N(),$(_=>_+1))},[r,o,i,k,N]),(0,ee.useEffect)(()=>{k.animating&&N()}),(0,ee.useEffect)(()=>(M.current=!0,()=>{M.current=!1,x.current?.(),x.current=null}),[]);let j=Et(),G=k.elapsed(j),D=r&&d.current==="idle";return{items:k.items(),get:_=>k.get(_),elapsed:D?0:G,fade:(_,F=320)=>D?0:Number.isFinite(G)?Math.max(0,Math.min(1,(G-_)/F)):1,waiting:D,animating:k.animating,generation:p.current}}var rr=A(B(),1);function Ca(e,t,n,r,o){if(r)return o==="categorical"?ke(e,t,n):Br(e,t,n);if(o==="categorical")return ke(e,t,n);let a=re(e,"strong"),i=re(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?i:a)}var ql=A(Z(),1);var or=A(B(),1);var Na=e=>e?"neutralStrong":"accent";var ar=A(B(),1);function Aa(e,t,n,r){if(typeof e!="function")return Te(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let l=o.get(r(i,s));l!==void 0&&e(i,s)&&a.add(l)}),a}var Zl=A(Z(),1);var sr=A(B(),1),Ql={name:"Candlestick chart",open:"Open",high:"High",low:"Low",close:"Close",change:"Change",volume:"Volume",empty:"No data.",ohlc:(e,t,n,r)=>`open ${e}, high ${t}, low ${n}, close ${r}`,span:(e,t,n)=>`${e} to ${t}: ${n}`,desc:(e,t,n,r,o)=>`${e} to ${t}, ${Ae(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Fa={en:Ql,ko:{name:"캔들스틱",open:"시가",high:"고가",low:"저가",close:"종가",change:"등락률",volume:"거래량",empty:"데이터가 없어요.",ohlc:(e,t,n,r)=>`시가 ${e}, 고가 ${t}, 저가 ${n}, 종가 ${r}`,span:(e,t,n)=>`${e}부터 ${t}까지 ${n}`,desc:(e,t,n,r,o)=>`${e}부터 ${t}까지 ${n}개 봉. 첫 시가 ${r}, 마지막 종가 ${o}`,ma:e=>`${e}일선`,up:"상승",down:"하락",maLegend:e=>`${e}일 이동평균`}},ir=["ink","muted","dim"];function Ra(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,ir.length)}var Pa=A(Z(),1),La=A(B(),1);function lr({p:e,frame:t,regions:n,opacity:r}){let o=(0,Pa.useMemo)(()=>n.map(a=>t.paths[a]).join(""),[t,n]);return o?(0,La.jsx)("path",{d:o,fill:e.paint("neutralSoft"),fillOpacity:r,stroke:e.paint("panel"),strokeWidth:.6,strokeLinejoin:"round",fillRule:"evenodd",pointerEvents:"none"}):null}var ec=(e,t)=>e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1],_a=new WeakMap;function Da(e,t={}){let n=Number.isFinite(t.lon0)?((t.lon0+180)%360+360)%360-180:0,r=`${t.focus??""}${t.featureId??""}${t.featureName??""}${n?`${n}`:""}`,o=_a.get(e),a=o?.get(r);if(a)return a;let i=Ge(e)?e:null,s=i?an(i):sn(e,t.featureId,t.featureName).shapes,l=new Set(i?.hidden??[]),c=t.focus!==void 0&&i?.focus&&Object.hasOwn(i.focus,t.focus)?i.focus[t.focus]:void 0,m=s.map((p,$)=>$).filter(p=>!l.has(s[p].id)&&s[p].polygons.length),u;if(c)u=er("equalEarth",c.lon0);else{let p=cn(m.map(x=>s[x]))??[-180,-60,180,85],$=i?i.projection:un(p);u=er($,$==="conic"||!i?(p[0]+p[2])/2:$==="equalEarth"?n:0,p)}let d=s.map(p=>ua(u,p)),f=[1/0,1/0,-1/0,-1/0];if(c)f=ma(u,c.box);else for(let p of m){let $=d[p].box;f=[Math.min(f[0],$[0]),Math.min(f[1],$[1]),Math.max(f[2],$[2]),Math.max(f[3],$[3])]}Number.isFinite(f[0])||(f=[0,0,1,1]);let h=m.filter(p=>ec(d[p].box,f)),g=c?new Set(c.ids.split(" ")):null,y={shapes:s,projected:d,projection:u,box:f,regions:g?h.filter(p=>g.has(s[p].id)):h,context:g?h.filter(p=>!g.has(s[p].id)):[],clip:!!c,centers:d.map(ha),match:i?Mt(i):st(s.map(p=>p.keys))};return o||_a.set(e,o=new Map),o.set(r,y),y}function Ea(e){let t=e.box[2]-e.box[0],n=e.box[3]-e.box[1];return t>0&&n>0?t/n:2}function Ia(e,t,n,r=2,o=e.box){let a=da(o,Math.max(1,t-r*2),Math.max(1,n-r*2));a.tx+=r,a.ty+=r;let i=new Set([...e.regions,...e.context]);return{fit:a,paths:e.projected.map((s,l)=>i.has(l)?fa(s.rings,a,[t,n]):""),centers:e.centers.map(([s,l])=>[s*a.k+a.tx,l*a.k+a.ty]),project:(s,l,c)=>{let[m,u]=Tt(e.projection,s,l,c);return[m*a.k+a.tx,u*a.k+a.ty]}}}var Y=A(Z(),1);var za=A(B(),1);function Oa({p:e,l:t,dim:n}){return(0,za.jsx)("text",{x:Math.round(t.x*10)/10,y:Math.round(t.y*10)/10,dy:"0.35em",fontSize:11,fontWeight:t.weight,textAnchor:t.anchor,fill:e.paint("ink"),stroke:e.paint("panel"),strokeWidth:3,strokeLinejoin:"round",paintOrder:"stroke",opacity:n?.45:void 0,className:"ztd-mark",style:{pointerEvents:"none"},children:t.text})}var ja=new WeakMap;function cr(e){let t=ja.get(e);if(t)return t;let n=[NaN,NaN],r=-1;for(let o of e.polygons){let a=o[0];if(!a||a.length<3)continue;let i=a[0][0],s=0,l=0,c=0;for(let m=0,u=a.length-1;m<a.length;u=m++){let d=i+he(a[m][0]-i),f=i+he(a[u][0]-i),h=f*a[m][1]-d*a[u][1];s+=h,l+=(f+d)*h,c+=(a[u][1]+a[m][1])*h}Math.abs(s)>r&&s!==0&&(r=Math.abs(s),n=[he(l/(3*s)),c/(3*s)])}return r<0&&(n=e.polygons[0]?.[0]?.[0]?[e.polygons[0][0][0][0],e.polygons[0][0][0][1]]:[NaN,NaN]),ja.set(e,n),n}var Nt={atlantic:0,pacific:150};function Ga(e,t){let n=Ge(e)?e:null;return!!n&&n.projection==="equalEarth"&&!(t!==void 0&&n.focus&&Object.hasOwn(n.focus,t))}function Ha(e,t,n){if(e==="atlantic"||e==="pacific")return Nt[e];let r=o=>{let a=0;for(let i of t)Math.abs(he(i.b-o)-he(i.a-o))>180&&(a=Ce(a+i.w));for(let i of n)Math.abs(he(i-o))>160&&(a+=1);return a};return r(Nt.pacific)<r(Nt.atlantic)?Nt.pacific:Nt.atlantic}var U=e=>Math.round(e*10)/10||0,Ce=e=>Math.min(Number.MAX_VALUE,e);function Wa(e,t){if("miss"in t)return null;let n=e.projection.name==="albersUsa";if("region"in t){let[i,s]=e.centers[t.region]??[NaN,NaN],l=e.shapes[t.region],[c,m]=cr(l);return!Number.isFinite(i)||!Number.isFinite(s)||!Number.isFinite(c)?null:{x:i,y:s,lon:c,lat:m,sub:e.projection.pick(c,m,n?l.id:void 0)}}let r=n?t.id??"":void 0,[o,a]=Tt(e.projection,t.lon,t.lat,r);return Number.isFinite(o)&&Number.isFinite(a)?{x:o,y:a,lon:t.lon,lat:t.lat,sub:e.projection.pick(t.lon,t.lat,r)}:null}function Va(e,t){let n=[e.box[0],e.box[1],e.box[2],e.box[3]];if(e.clip)return n;for(let r of t)r.x<n[0]&&(n[0]=r.x),r.y<n[1]&&(n[1]=r.y),r.x>n[2]&&(n[2]=r.x),r.y>n[3]&&(n[3]=r.y);return n}var Ba=(e,t)=>e[0]<t[2]&&e[2]>t[0]&&e[1]<t[3]&&e[3]>t[1];function Ka(e,t,n,r,o=[],a=[]){let i=[...o],s=[],l=r*.62,c=new Set;return e.forEach((m,u)=>{let d=`${Math.round(m.x)} ${Math.round(m.y)}`;if(c.has(d))return;c.add(d);let f=m.weight??600,h=Me(m.text,r,f),g=m.r+3,y=[[m.x+g,m.y,"start",[m.x+g,m.y-l,m.x+g+h,m.y+l]],[m.x-g,m.y,"end",[m.x-g-h,m.y-l,m.x-g,m.y+l]],[m.x,m.y-g-l,"middle",[m.x-h/2,m.y-g-2*l,m.x+h/2,m.y-g]],[m.x,m.y+g+l,"middle",[m.x-h/2,m.y+g,m.x+h/2,m.y+g+2*l]]];for(let[p,$,x,M]of y)if(!(M[0]<1||M[1]<0||M[2]>t-1||M[3]>n)&&!(i.some(k=>Ba(k,M))||a.some(k=>Ba(k,M)))){i.push(M),s.push({x:p,y:$,anchor:x,text:m.text,weight:f,k:u});return}}),s}function Xa(e,t){return et(e,{locale:t,maximumFractionDigits:Math.abs(e)<10?1:0})}function gn(e,t){return t==="ko"?e==="auto"?"등록한 지도가 없어요. ztd-charts/geo의 지도를 registerMap에 넘겨 주세요":vt.includes(e)?`"${e}" 지도를 등록하지 않았어요. ztd-charts/geo/${e}에서 불러와 registerMap에 넘겨 주세요`:`"${e}" 지도를 등록하지 않았어요. 지도를 registerMap에 넘기거나 ${vt.join(", ")}, GeoJSON을 써 주세요`:e==="auto"?"No map is registered. Import one from ztd-charts/geo and pass it to registerMap":vt.includes(e)?`Map "${e}" is not registered. Import it from ztd-charts/geo/${e} and pass it to registerMap`:`Map "${e}" is not registered. Pass a map to registerMap, or use ${vt.join(", ")} or a GeoJSON`}var W=A(B(),1),tc={kind:"Flow map",to:(e,t)=>`${e} to ${t}`,share:e=>`${e} of the total`,shareLabel:"Share",out:"Outgoing",in:"Incoming",largest:"Largest flows",desc:(e,t,n,r)=>`${Ae(e,"flow")} between ${Ae(t,"place")}, ${n} in total. Largest: ${r}`,skipped:e=>`${Ae(e,"flow")} could not be placed on the map`,capped:(e,t)=>`The ${e} largest of ${t} flows are drawn`},nc={en:tc,ko:{kind:"흐름 지도",to:(e,t)=>`${e}에서 ${t}`,share:e=>`전체의 ${e}`,shareLabel:"비율",out:"나감",in:"들어옴",largest:"큰 흐름",desc:(e,t,n,r)=>`지점 ${t}곳 사이 흐름 ${e}개, 합계 ${n}. 가장 큰 흐름: ${r}`,skipped:e=>`지도에 놓지 못한 흐름 ${e}개`,capped:(e,t)=>`흐름 ${t}개 중 큰 ${e}개를 그려요`}},ur=(e,t)=>`${e} → ${t}`,He=172,We=17,Ya=16,rc=600,Ua=400,Ja=.22,pn=(e,t,n)=>[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n],Ve=(e,t,n,r)=>pn(pn(e,t,r),pn(t,n,r),r);function mr(e,t,n,r){let o=0,a=1;for(let i=0;i<24;i++){let s=(o+a)/2,l=Ve(e,t,n,s);Math.hypot(l[0]-n[0],l[1]-n[1])>r?o=s:a=s}return o}function oc(e,t,n,r,o){let a=n.fit.k,i=c=>[c.x*a+n.fit.tx,c.y*a+n.fit.ty],s=i(e),l=i(t);if(e.sub===t.sub){let c=he(e.lon-e.sub.lon0),m=he(t.lon-t.sub.lon0);if(Math.abs(m-c)>180){let u=Math.sign(m-c),d=(y,p,$)=>{let[x,M]=y.sub.raw(p,y.lat),[k,R]=y.sub.raw(p+$,y.lat),N=i(y);return[N[0]+(k-x)*a,N[1]+(R-M)*a]},f=dr(s,d(t,m,-360*u),0,0,e.sub),h=dr(d(e,c,360*u),l,r,o,e.sub),g=ti(e.sub,n);return f.arrow=qa(s,d(t,m,-360*u),g,o,!1),h.arrow=`${qa(d(e,c,360*u),l,g,o,!0)}${h.arrow}`,[f,h]}}return[dr(s,l,r,o,null)]}var Za=(e,t)=>[(e[0]+t[0])/2-(t[1]-e[1])*Ja,(e[1]+t[1])/2+(t[0]-e[0])*Ja],Qa=e=>[Re(e*1.4+4,6,20),Re(e*.8+2.5,3.5,13)];function ei(e,t,n){let r=e[0]-t[0],o=e[1]-t[1],a=Math.hypot(r,o)||1,i=-o/a*n,s=r/a*n;return`M${U(e[0])} ${U(e[1])}L${U(t[0]+i)} ${U(t[1]+s)}L${U(t[0]-i)} ${U(t[1]-s)}Z`}function ac(e,t){let n=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){let[a,i]=t[r],[s,l]=t[o];i>e[1]!=l>e[1]&&e[0]<(s-a)*(e[1]-i)/(l-i)+a&&(n=!n)}return n}function qa(e,t,n,r,o){let a=Za(e,t),[i,s]=Qa(r),l=-1;for(let p=0;p<=48;p++){let $=o?p/48:1-p/48;if(ac(Ve(e,a,t,$),n)){l=$;break}}if(l<0)return"";let c=Ve(e,a,t,l),m=o?Math.min(1,l+.01):Math.max(0,l-.01),u=Ve(e,a,t,m),d=o?u[0]-c[0]:c[0]-u[0],f=o?u[1]-c[1]:c[1]-u[1],h=Math.hypot(d,f)||1,g=o?[c[0]+d/h*i,c[1]+f/h*i]:c,y=[g[0]-d/h*i,g[1]-f/h*i];return ei(g,y,s)}function dr(e,t,n,r,o){let a=Math.hypot(t[0]-e[0],t[1]-e[1]);if(a<1)return{d:"",arrow:"",cut:o};let i=Za(e,t),[s,l]=Qa(r);if(!(n>0)||a<n*2+s+6)return{d:`M${U(e[0])} ${U(e[1])}Q${U(i[0])} ${U(i[1])} ${U(t[0])} ${U(t[1])}`,arrow:"",cut:o};let c=mr(e,i,t,n+1.5),m=mr(e,i,t,n+1.5+s),u=mr(e,i,t,n+1.5+s*.6),d=Ve(e,i,t,u),f=pn(e,i,u),h=Ve(e,i,t,c),g=Ve(e,i,t,m);return{d:`M${U(e[0])} ${U(e[1])}Q${U(f[0])} ${U(f[1])} ${U(d[0])} ${U(d[1])}`,arrow:ei(h,g,l),cut:o}}function ti(e,t){let n=([o,a])=>[o*t.fit.k+t.fit.tx,a*t.fit.k+t.fit.ty],r=[];for(let o=-90;o<=90;o+=3)r.push(n(e.raw(180,o)));for(let o=90;o>=-90;o-=3)r.push(n(e.raw(-180,o)));return r}var ic=(e,t)=>`M${ti(e,t).map(([n,r])=>`${U(n)} ${U(r)}`).join("L")}Z`;function fr(e){let t=(0,Y.useMemo)(()=>{let b=I=>e.data.some(z=>z!==null&&typeof z=="object"&&Jt(z,I)),C=be(e.source??(b("source")?"source":"from"),"source"),L=be(e.target??(b("target")?"target":"to"),"target"),V=e.value!==void 0||b("value"),J=rt(e.value,"value"),H=new Map;return e.data.forEach((I,z)=>{let q=C(I,z).trim(),ce=L(I,z).trim(),Pe=V?J(I,z):1;if(!ya(q,ce,Pe))return;let Je=`${q}${ce}`,kn=H.get(Je);kn?kn.value=Ce(kn.value+Pe):H.set(Je,{s:q,t:ce,value:Pe,datum:I,row:z})}),[...H.values()]},[e.data,e.source,e.target,e.value]),n=(0,Y.useMemo)(()=>{let b=new Set;for(let C of t)b.add(C.s).add(C.t);return[...b]},[t]),r=(0,Y.useMemo)(()=>pa(e.map,()=>n.map(b=>nr(e.places,b))),[e.map,e.places,n]),o=r&&"map"in r?r.map:null,a=(0,Y.useMemo)(()=>({focus:e.focus,featureId:e.featureId,featureName:e.featureName}),[e.focus,e.featureId,e.featureName]),i=(0,Y.useMemo)(()=>{let b=new Map;if(!o)return b;let C=mn(o,a);for(let L of n)b.set(L,tr(C,nr(e.places,L)));return b},[o,a,n,e.places]),s=(0,Y.useMemo)(()=>{if(!o||!Ga(o,e.focus))return;let b=mn(o,a),C=V=>{let J=i.get(V);return!J||"miss"in J?NaN:"lon"in J?J.lon:cr(b.shapes[J.region])[0]},L=t.flatMap(V=>{let J=C(V.s),H=C(V.t);return Number.isFinite(J)&&Number.isFinite(H)?[{a:J,b:H,w:V.value}]:[]});return Ha(e.center,L,[])},[o,a,i,t,e.focus,e.center]),l=(0,Y.useMemo)(()=>o?Da(o,{...a,lon0:s}):null,[o,a,s]),c=l?Ea(l):2,m=b=>e.ranking===!0||e.ranking!==!1&&b>=rc,u=ka(e,{height:b=>Math.round(Math.max(120,Math.min((m(b)?b-He-Ya:b)/c,b*.85))),duration:1100}),{p:d,width:f,height:h,fv:g}=u,y=nc[u.lang],p=(0,Y.useId)().replace(/:/g,""),$=(0,Y.useMemo)(()=>{if(!l)return{places:[],flows:[],all:0,total:0,skipped:t.length};let b=new Map,C=new Map,L=[];for(let I of n){let z=i.get(I),q="region"in z?C.get(z.region):void 0;if(q!==void 0){b.set(I,q);continue}let ce=Wa(l,z);ce&&("region"in z&&C.set(z.region,L.length),b.set(I,L.length),L.push({name:I,at:ce,out:0,in:0}))}let V=[],J=new Map;for(let I of t){let z=b.get(I.s),q=b.get(I.t);if(z===void 0||q===void 0||z===q)continue;let ce=J.get(z*L.length+q);if(ce)ce.value=Ce(ce.value+I.value);else{let Pe={a:z,b:q,value:I.value,datum:I.datum,row:I.row};J.set(z*L.length+q,Pe),V.push(Pe)}L[z].out=Ce(L[z].out+I.value),L[q].in=Ce(L[q].in+I.value)}V.sort((I,z)=>z.value-I.value||I.row-z.row);let H=0;for(let I of V)H=Ce(H+I.value);return{places:L,flows:V.slice(0,ba),all:V.length,total:H,skipped:t.filter(I=>b.get(I.s)===void 0||b.get(I.t)===void 0).length}},[l,i,n,t]),{places:x,flows:M,all:k,total:R}=$,N=M.length,j=N?M[0].value:0,G=m(f)&&N>=2,D=G?f-He-Ya:f,_=Re(D/70,3,12),F=b=>Re(_*(b/(j||1)),1,_),T=(0,Y.useMemo)(()=>x.reduce((b,C)=>Math.max(b,Ce(C.out+C.in)),0),[x]),v=b=>T>0?2.5+4*Math.sqrt(Ce(b.out+b.in)/T):3,S=(0,Y.useMemo)(()=>{let b=new Set;for(let C of M)b.add(C.a).add(C.b);return b},[M]),O=(0,Y.useMemo)(()=>l?Va(l,[...S].map(b=>x[b].at)):null,[l,x,S]),E=(0,Y.useMemo)(()=>l&&O?Ia(l,D,h,9,O):null,[l,O,D,h]),ne=b=>E?[b.at.x*E.fit.k+E.fit.tx,b.at.y*E.fit.k+E.fit.ty]:[0,0],ae=(0,Y.useMemo)(()=>{let b=e.highlight,C=typeof b=="string"&&!rn.includes(b)?x.findIndex(L=>L.name===b):-1;return C>=0?new Set(M.flatMap((L,V)=>L.a===C||L.b===C?[V]:[])):Te(b,M.map(L=>L.datum),M.map(L=>ur(x[L.a].name,x[L.b].name)),M.map(L=>L.value),"max")},[e.highlight,M,x]),K=(0,Y.useMemo)(()=>E?M.map(b=>oc(x[b.a].at,x[b.b].at,E,v(x[b.b]),F(b.value))):[],[E,M,x,T,_,j]),ie=(0,Y.useMemo)(()=>{let b=[];for(let C of K)for(let L of C)L.cut&&!b.includes(L.cut)&&b.push(L.cut);return b},[K]),se=(0,Y.useMemo)(()=>M.map(b=>R>0?Xa(b.value/R*100,u.locale):""),[M,R,u.locale]),ge=(0,Y.useMemo)(()=>M.map((b,C)=>({datum:b.datum,index:C,key:`${x[b.a].name}${x[b.b].name}`,label:y.to(x[b.a].name,x[b.b].name),value:b.value,formatted:[g(b.value),se[C]&&y.share(se[C])].filter(Boolean).join(", ")})),[M,x,se,g,y]),[Ke,gr]=(0,Y.useState)(null),le=u.active!==null&&u.active<N?u.active:null,Xe=Ke!==null&&x[Ke]?Ke:null,pr=le!==null?[le]:Xe!==null?M.flatMap((b,C)=>b.a===Xe||b.b===Xe?[C]:[]):null,br=b=>Xe===b||le!==null&&(M[le].a===b||M[le].b===b),Ft=(b,C)=>u.setActive(b,C==="touch"?"touch":"pointer"),yr=(0,Y.useRef)(()=>{});yr.current=b=>{u.via!=="keyboard"&&(u.setActive(null),gr(b))};let xi=(0,Y.useMemo)(()=>[{key:"__g",to:[1],from:[0],data:null}],[]),Rt=Sa(xi,u.motion),ki=_t(u,Rt),bn=Rt.get("__g")?.[0]??1,Ye=bn<.999,wi=u.motion.duration??1100,xr=(b,C,L,V)=>{let J=U(F(M[b].value)),H=ae.has(b)?d.paint("accent"):d.paint("neutralStrong"),I=ae.has(b)?.95:.8;K[b].forEach((z,q)=>{if(!z.d)return;let ce=z.cut?`url(#${p}s${ie.indexOf(z.cut)})`:void 0,Pe=V===null&&N>Ua;C.push((0,W.jsx)("path",{d:z.d,fill:"none",stroke:H,strokeWidth:J,strokeLinecap:"round",opacity:I,clipPath:ce,className:"ztd-mark",pathLength:Ye?1:void 0,strokeDasharray:Ye?"1 1":void 0,style:Ye?{strokeDashoffset:"var(--ztd-grow)"}:void 0,pointerEvents:Pe?"stroke":"none",onPointerEnter:Pe?Je=>Ft(b,Je.pointerType):void 0},`${b}:${q}`)),z.arrow&&L.push((0,W.jsx)("path",{d:z.arrow,fill:H,opacity:I,clipPath:ce,className:"ztd-mark",pointerEvents:"none"},`${b}:${q}`)),V&&V.push((0,W.jsx)("path",{d:z.d,fill:"none",stroke:"transparent",strokeWidth:Math.max(J+6,10),clipPath:ce,onPointerEnter:Je=>Ft(b,Je.pointerType),onClick:()=>u.click(b)},`${b}:${q}`))})},yn=(0,Y.useMemo)(()=>{let b=[],C=[],L=[];return K.forEach((V,J)=>xr(J,b,C,N<=Ua?L:null)),{lines:b,heads:C,hits:L}},[K,M,ae,d,Ye,ie,p,N]),kr=(()=>{let b=[],C=[];for(let L of pr??[])xr(L,b,C,[]);return{lines:b,heads:C}})(),$i=(0,Y.useMemo)(()=>{if(!u.showLabels||!E||!N)return[];let b=D>=560?8:D>=390?5:0,C=[...new Set(M.flatMap((H,I)=>ae.has(I)?[H.a,H.b]:[]))].slice(0,40),L=[...S].filter(H=>!C.includes(H)).sort((H,I)=>Ce(x[I].out+x[I].in)-Ce(x[H].out+x[H].in)||H-I),V=[...C,...L].slice(0,Math.max(b,C.length)),J=[...S].map(H=>{let[I,z]=ne(x[H]),q=v(x[H]);return[I-q,z-q,I+q,z+q]});return Ka(V.map(H=>{let[I,z]=ne(x[H]);return{x:I,y:z,r:v(x[H]),text:bt(x[H].name,Math.min(130,D*.3),11,600)}}),D,h,11,[],J).map(H=>({...H,k:V[H.k]}))},[u.showLabels,E,N,M,ae,S,x,D,h]),xn=null;if(E&&le!==null){let b=M[le],[C,L]=ne(x[b.a]),[V,J]=ne(x[b.b]),H=se[le];xn={x:Re((C+V)/2,0,D),y:Re((L+J)/2,0,h),title:ur(x[b.a].name,x[b.b].name),rows:[{label:u.t.value,value:g(b.value),color:ae.has(le)?d.paint("accent"):d.paint("neutralStrong")},...H?[{label:y.shareLabel,value:H,strong:!1}]:[]]}}else if(E&&Xe!==null){let b=x[Xe],[C,L]=ne(b);xn={x:Re(C,0,D),y:Re(L,0,h),title:b.name,rows:[{label:y.out,value:g(b.out)},{label:y.in,value:g(b.in)}]}}let Ue=r&&"missing"in r?r.missing:null,wr=[$.skipped?y.skipped($.skipped):"",k>N?y.capped(N,k):""].filter(Boolean),vi=N?`${y.to(x[M[0].a].name,x[M[0].b].name)}, ${g(j)}`:"",Mi=e.description??(N?`${y.kind}. ${y.desc(k,S.size,g(R),vi)}${wr.length?`. ${wr.join(". ")}`:""}.`:Ue?gn(Ue,u.lang):""),Si=u.via==="keyboard"&&le!==null&&ge[le]?`${ge[le].label}, ${ge[le].formatted}`:"",Ti=Math.max(0,Math.floor((h-8)/We)-1),Ci=G?M.slice(0,Ti):[],Ni=f-He,Ai=b=>{u.via!=="keyboard"&&(gr(null),Ft(null,b))},$r=(b,C=0)=>{let[L,V]=ne(x[b]);return(0,W.jsx)("circle",{cx:U(L),cy:U(V),r:U(v(x[b])+C),fill:d.paint("ink"),stroke:d.paint("panel"),strokeWidth:1.2,className:"ztd-mark",onPointerEnter:()=>yr.current(b)},x[b].name)},Fi=(0,Y.useMemo)(()=>[...S].map(b=>$r(b)),[S,x,E,d,T]),dt=pr!==null;return(0,W.jsxs)(oo,{c:u,kind:y.kind,ariaLabel:e.ariaLabel,description:Mi,emptyText:Ue?gn(Ue,u.lang):void 0,events:ge,tip:xn,renderTip:e.tooltip,announce:Si,className:e.className,style:e.style,theme:e.theme,defs:E&&(l?.clip||ie.length)?(0,W.jsxs)(W.Fragment,{children:[l?.clip?(0,W.jsx)("clipPath",{id:`${p}c`,children:(0,W.jsx)("rect",{width:D,height:h})}):null,ie.map((b,C)=>(0,W.jsx)("clipPath",{id:`${p}s${C}`,children:(0,W.jsx)("path",{d:ic(b,E)})},C))]}):void 0,children:[Ue?(0,W.jsx)(pt,{x:f/2,y:h/2,anchor:"middle",size:12,fill:d.paint("muted"),children:bt(gn(Ue,u.lang),f-16,12)}):null,E&&l?(0,W.jsxs)("g",{children:[(0,W.jsx)("rect",{width:D,height:h,fill:"transparent",onPointerEnter:b=>Ai(b.pointerType)}),(0,W.jsxs)("g",{clipPath:l.clip?`url(#${p}c)`:void 0,children:[l.context.length?(0,W.jsx)(lr,{p:d,frame:E,regions:l.context,opacity:.6}):null,(0,W.jsx)(lr,{p:d,frame:E,regions:l.regions}),(0,W.jsxs)("g",{opacity:dt?.15:void 0,children:[(0,W.jsx)("g",{style:Ye?{"--ztd-grow":U(1-bn)}:void 0,children:yn.lines}),(0,W.jsx)("g",{opacity:Ye?Re((bn-.85)/.15,0,1):void 0,children:yn.heads})]}),dt?(0,W.jsxs)("g",{pointerEvents:"none",children:[kr.lines,kr.heads]}):null,yn.hits,(0,W.jsxs)("g",{style:Lt(ki,Rt.waiting,"fade",0,Math.min(400,wi)),children:[(0,W.jsx)("g",{opacity:dt?.35:void 0,children:Fi}),dt?[...S].filter(br).map(b=>$r(b,1)):null]})]}),$i.map(b=>(0,W.jsx)(Oa,{p:d,l:b,dim:dt&&!br(b.k)},x[b.k].name))]},Rt.generation):null,G?(0,W.jsxs)("g",{transform:`translate(${Ni} 0)`,children:[(0,W.jsx)(pt,{x:0,y:We/2,size:10,weight:600,fill:d.paint("muted"),children:y.largest}),Ci.map((b,C)=>{let L=(C+1)*We,V=g(b.value),J=Me(V,11,600),H=Math.max(4,(He-J-6)*(b.value/(j||1))),I=le===C;return(0,W.jsxs)("g",{onPointerEnter:z=>Ft(C,z.pointerType),children:[(0,W.jsx)("rect",{x:-4,y:L,width:He+4,height:We,rx:4,fill:I?d.paint("lift"):"transparent"}),(0,W.jsx)("rect",{x:-2,y:L+1.5,width:U(H),height:We-3,rx:3,fill:ae.has(C)?d.paint("accent"):d.paint("neutralSoft"),opacity:ae.has(C)?.2:1}),(0,W.jsx)(pt,{x:2,y:L+We/2,size:11,weight:ae.has(C)?700:500,fill:d.paint("ink"),children:bt(ur(x[b.a].name,x[b.b].name),He-J-10,11,ae.has(C)?700:500)}),(0,W.jsx)(pt,{x:He-2,y:L+We/2,anchor:"end",size:11,weight:600,fill:d.paint("ink"),children:V})]},C)})]}):null]})}var sc=A(Z(),1);var ii=A(B(),1),lc={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ae(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},cc={en:lc,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},ni=(e,t)=>cc[e].other(t);function ri(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((a,i)=>({v:a.value,i})).sort((a,i)=>i.v-a.v).slice(0,Math.floor(t)).map(a=>a.i)),o=e.filter((a,i)=>!r.has(i));return{kept:e.filter((a,i)=>r.has(i)),other:n(o.length,xo(o.map(a=>a.value)))}}var oi=e=>Number.isFinite(e)&&e>0?e:0;function ai(e,t,n,r){return r==="emphasis"?jr(e,t,n):ke(e,t,n)}var uc=A(Z(),1);var ui=A(B(),1);function si(e,t){return t===!1?e.map((n,r)=>r):yo(e)}function li(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return Te(e,t,t,r,"max")}function ci(e,t,n){let r=new Array(t.length),o=t.filter(a=>!n.has(a));for(let a of t)n.has(a)&&(r[a]=re(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?re(e,"neutral"):Ot(e,1-i/Math.max(1,o.length-1))),r}function mi(e){return!e||typeof e!="object"||Array.isArray(e)?[]:ve(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function di(e,t){return ht(e,t+1,new Set)}var mc=A(Z(),1);var hi=A(B(),1);var dc=26;var $d=dc*.62;function fi(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!rn.includes(o)&&t.forEach((a,i)=>a===o&&r.add(i));return r}var Le=A(B(),1);function gi(e,t,n){let r=Ut(e);return r?.type==="scatter"&&t?.size!==void 0&&!Yt(n)?Ut("bubble"):r}function fc(e,t={}){let n={};for(let r of e.encoding){let o=t[r.name];o!==void 0&&(n[r.prop??r.name]=o)}return n}function hc(e,t,n,r=!1){let o=gi(e.type,e.encoding,e.options);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&Bn.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(m.includes(o.type)){let u=be(a.label,"label"),d=rt(a.value,"value"),f=o.type==="waffle",h=t.map((k,R)=>({r:k,label:u(k,R),value:f?d(k,R):oi(d(k,R))})),{kept:g,other:y}=f?{kept:h,other:null}:ri(h,i.other,(k,R)=>({r:{},label:ni(Q(n),k),value:R})),p=Te(s,g.map(k=>k.r),g.map(k=>k.label),g.map(k=>k.value),f?"first":"max"),$=y?[...g,y]:g,x=De(k=>f?ke(k,$.length,p):ai(k,$.length,p,i.colorMode)),M=f&&i.shape==="arc";return $.map((k,R)=>({label:k.label,color:x[R],...M&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Ra(Array.isArray(i.ma)?i.ma:void 0,t.length),d=Fa[Q(n)];return[{label:d.up,color:i.upColor??"accent"},{label:d.down,color:i.downColor??"neutralStrong"},...u.map((f,h)=>({label:d.maLegend(f),color:ir[h],shape:"line"}))]}if(o.type==="network"){let u=mi(i.groups);if(u.length<2)return[];let d=De(f=>di(f,u.length));return u.map((f,h)=>({label:f,color:d[h],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof a.group!="string")return[];let u=be(a.group,"group"),d=ve(t.map((h,g)=>u(h,g)).filter(Boolean));if(d.length<2)return[];let f=De(h=>ht(h,d.length,new Set));return d.map((h,g)=>({label:h,color:f[g],shape:"circle"}))}if(o.type==="scatter"){if(typeof a.series!="string"||Yt(i))return[];let u=be(a.series,"series"),d=ve(t.map((g,y)=>u(g,y)));if(d.length<2)return[];let f=Aa(s,t,d,u),h=De(g=>ht(g,d.length,f));return c(d.map((g,y)=>({label:g,color:h[y],shape:"circle"})))}if(o.type==="timeline"){let u=typeof a.group!="string",d=u?a.status:a.group;if(typeof d!="string")return[];let f=Uo(t,d,u),h=De(g=>ke(g,f.length,fi(s,f)));return c(f.map((g,y)=>({label:g,color:h[y],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(a.y))u=a.y;else if(typeof a.series=="string"){let x=be(a.series,"series");u=ve(t.map((M,k)=>x(M,k)))}let d=Gn(o.type,a,i);if(d.length){let x=Te(s,u,u,u.map(()=>0),"none"),M=De(R=>ke(R,u.length,x)),k=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((R,N)=>({label:R,color:M[N]}));return[...c(k),...d.map((R,N)=>({label:R,color:Na(N),shape:"line"}))]}if(u.length<2)return[];let h=o.type==="bar"&&i.layout==="diverging"&&s===void 0?bo(u.length,Array.isArray(i.negative)?i.negative.map(x=>u.indexOf(String(x))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,g=h>=0?new Set([h]):Te(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((x,M)=>({label:x,color:g.has(M)?"accent":"neutralStrong",shape:"square"})));let y=i.colorMode,p=x=>ke(x,u.length,g);if((o.type==="line"||o.type==="area")&&(p=x=>Ca(x,u.length,g,o.type==="area",y)),o.type==="stream"){let x=xt(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),M=si(x.values,i.reorder),k=li(s,x.series,x.values);p=R=>ci(R,M,k)}let $=De(p);return c(u.map((x,M)=>({label:x,color:$[M],...o.type==="line"&&{shape:"line"}})))}return[]}function gc(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&co.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function pc(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:a,highlight:i,syncId:s,title:l,description:c}}function pi(e,t){let{spec:n}=e,r=gi(n.type,n.encoding,n.options),o=(0,At.useMemo)(()=>xa(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=lo(n,e.locale),s=me(i),l=Q(s),c=zo(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),m=fo(n),u=(0,At.useMemo)(()=>m?Ko(m,s):void 0,[m,s]),d=n.options?.hidden,f=Array.isArray(d)?d.map(String):[],h=f.join(""),[g,y]=(0,At.useState)(null);if(!r)return(0,Le.jsx)(jn,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let p=o??c.data,$=t[r.type],x={...n.options??{}},M={...fc(r,n.encoding),...x,...u?{tooltip:u}:{},data:p,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:i},k=n.card?.legend==="toggle"&&mo(r.type,n.encoding??{},x),R=g&&g.base===h?g.hidden:f;k&&(M.hidden=R);let N=F=>y(T=>{let v=T&&T.base===h?T.hidden:f;return{base:h,hidden:v.includes(F)?v.filter(S=>S!==F):[...v,F]}}),j=M.height??220,G=gc(n,r.type),D=a&&!p.length&&(c.loading||c.error||c.empty)?(0,Le.jsx)(jn,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:j,locale:i}):G?(0,Le.jsx)(Oo,{chart:$,...pc(r.type,G,M)}):(0,Le.jsx)($,{...M});if(n.card){let F=n.card,T=F.legend==="auto"||F.legend==="toggle"?hc(n,p,s,k):F.legend,v=T?.length?k?(0,Le.jsx)(zn,{items:T,hidden:R,onToggle:N,locale:i}):T:void 0,S=F.download?(0,Le.jsx)(Vo,{data:p,columns:ho(n),filename:F.title??r.type,formats:Array.isArray(F.download)?F.download:void 0,locale:i}):void 0;D=(0,Le.jsx)(ro,{number:F.number,title:F.title??so(r,l),subtitle:F.subtitle,legend:v,actions:S,source:F.source||void 0,note:F.note||void 0,accent:F.accent,takeaway:F.takeaway,level:F.level,sample:F.sample,replay:F.replay!==!1,className:e.className,locale:i,children:D})}let _=e.theme??n.theme;return _&&(D=(0,Le.jsx)(Ht,{theme:_,children:D})),D}function bc({cfg:e,components:t}){let n=at();return pi({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function yi(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,bi.hydrateRoot)(r,(0,hr.createElement)(Ht,{theme:o.theme,cssVars:!0},(0,hr.createElement)(bc,{cfg:o,components:{[e]:t}})))}yi("flowMap",fr);})();
|
|
27
|
+
`}function Pl(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function qn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Bo=2,Ie=16;function Go(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,a,i,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${a}, ${i})`:`rgba(${o}, ${a}, ${i}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function Ho(e,t){let n=document.createElementNS("http://www.w3.org/2000/svg",e);for(let[r,o]of Object.entries(t))n.setAttribute(r,String(o));return n}function Wo(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:a,height:i}=o.viewBox.baseVal,[s,l]=[a+Ie*2,i+Ie*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((h,g)=>{let y;for(let p of Array.from(h.attributes)){if(!Al.test(p.value))continue;let $=(y??(y=getComputedStyle(h))).getPropertyValue(p.name);$&&m[g].setAttribute(p.name,Go($,u))}}),c.removeAttribute("style");for(let[h,g]of Object.entries({viewBox:`${-Ie} ${-Ie} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(h,String(g));let d=Go(getComputedStyle(r).backgroundColor,u),f=o.parentElement?.querySelector("canvas")??null;if(n){let h=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(Ho("rect",{x:-Ie,y:-Ie,width:s,height:l,fill:d}),h),f&&c.insertBefore(Ho("image",{href:f.toDataURL(),width:a,height:i}),h)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:a,vh:i,bg:d,canvas:f}}function Ll(e,t){let n=Wo(e,Bo,!1);if(!n)return;let r=Bo,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let a=o.getContext("2d");if(!a)return;a.fillStyle=n.bg,a.fillRect(0,0,o.width,o.height),n.canvas&&a.drawImage(n.canvas,Ie*r,Ie*r,n.vw*r,n.vh*r);let i=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{a.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(i),o.toBlob(l=>l&&qn(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Vo(e){let t=$e(e.theme),n=Q(me(e.locale))==="ko",r=Pl(e.filename),o=(a,i)=>{if(a==="csv")return qn(new Blob([Rl(e.data,e.columns?.length?e.columns:Fl(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return Ll(i,r);let s=Wo(i,1,!0);s&&qn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,Zn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:Cl.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,Zn.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(a,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:i},a)})})}var Xo=N(B(),1);function Ko(e,t=ue){let n=ze(void 0,t),r=e.split(`
|
|
28
|
+
`),o=(a,i)=>{if(i==="label")return a.label;if(i==="value")return a.formatted??(a.value===null?null:n(a.value));if(i==="series")return a.series??null;let s=a.datum&&typeof a.datum=="object"?a.datum[i]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?gt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,c=s.replace(Jr,(m,u)=>o(a,u.trim())??(l=!0,""));l||i.push(c)}return i.length?i.map((s,l)=>(0,Xo.jsx)("div",{children:s},l)):null}}function $t(e){let t=String(e??"").normalize("NFC").trim().replace(/\s+/g," ").toLowerCase();return/^\d+$/.test(t)?t.replace(/^0+(?=\d)/,""):t}function st(e){let t=new Map;return e.forEach((n,r)=>{for(let o of n){let a=$t(o);a&&!t.has(a)&&t.set(a,r)}}),n=>t.get($t(n))??-1}function Yo(e,t){let n=[...new Set([...new Set(e)].map($t))].filter(Boolean),r=-1,o=0;return t.forEach((a,i)=>{let s=n.filter(l=>a(l)>=0).length;s>o&&(o=s,r=i)}),r}function Uo(e,t,n=!1){let r=be(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),a=ve(o);if(!n)return a;let i=new Map;for(let s of o)i.set(s,(i.get(s)??0)+1);return a.map((s,l)=>[s,l]).sort((s,l)=>i.get(s[0])-i.get(l[0])||s[1]-l[1]).map(([s])=>s)}var _l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function Jo(e){if(typeof e!="string")return[];let t=new Int8Array(128).fill(-1);for(let i=0;i<64;i++)t[_l.charCodeAt(i)]=i;let n=[],r=0,o=1,a=0;for(let i=0;i<e.length;i++){let s=t[e.charCodeAt(i)]??-1;s<0||(r+=(s&31)*o,a++,s&32&&a<7?o*=32:(s&32||n.push(r%2?-(r+1)/2:r/2),r=0,o=1,a=0))}return n}var qo=new WeakMap,an=(e,t)=>typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=t?e:-1;function sn(e){let t=qo.get(e);if(t)return t;let n=Array.isArray(e.topo?.t)?e.topo.t:[],[r,o,a]=n.every(g=>Number.isFinite(g))&&n.length>=3?n:[NaN,NaN,NaN],i=Number.isFinite(r)&&r>0,s=i?Jo(e.topo.arcs):[],l=[],c=0;for(let g=0;g<s.length;){let y=an(s[g++],(s.length-g)/2);if(y<0)break;let p=[],$=0,x=0;for(let M=0;M<y;M++)$+=s[g++],x+=s[g++],p.push([$*r+o,x*r+a]);c+=y,l.push(p)}let m=i?Jo(e.topo.shapes):[],u=0,d=c*4,h=(Array.isArray(e.regions)?e.regions:[]).map(g=>{let y=Array.isArray(g)?g.filter(M=>typeof M=="string"):[],p=[];for(let M=an(m[u++],m.length-u);M>0;M--){let k=[];for(let R=an(m[u++],m.length-u);R>0;R--){let A=[];for(let O=an(m[u++],m.length-u),G=0;G<O;G++){let D=m[u++],_=(D>=0?l[D]:l[~D]?.slice().reverse())??[];if(d-=_.length,d<0)break;for(let F=G?1:0;F<_.length;F++)A.push(_[F])}if(A.length>1&&A[0][0]===A[A.length-1][0]&&A[0][1]===A[A.length-1][1]&&A.pop(),A.length>=3&&k.push(A),d<0||u>m.length)break}if(k.length&&p.push(k),d<0||u>m.length)break}let $=y[0]??"",x=e.namesKo?.[$];return{id:$,name:y[1]??$,nameKo:typeof x=="string"?x:void 0,keys:typeof x=="string"?[...y,x]:y,polygons:p}});return qo.set(e,h),h}var Oe=e=>typeof e=="string"&&e.trim()!==""?e:typeof e=="number"&&Number.isFinite(e)?String(e):void 0;function Zo(e,t){if(!Array.isArray(e))return null;let n=[];for(let r of e){if(!Array.isArray(r)||typeof r[0]!="number"||typeof r[1]!="number"||!Number.isFinite(r[0])||!Number.isFinite(r[1]))continue;let[o,a]=r;a>90||a<-90||o>540||o<-540?(t.n++,a=Math.max(-90,Math.min(90,a)),o=((o+180)%360+360)%360-180):(o>180||o<-180)&&t.n++;let i=n[n.length-1];(!i||i[0]!==o||i[1]!==a)&&n.push([o,a])}return n.length>1&&n[0][0]===n[n.length-1][0]&&n[0][1]===n[n.length-1][1]&&n.pop(),n.length>=3?n:null}function ln(e,t,n){let r=`${t??""}${n??""}`,o=Qo.get(e),a=o?.get(r);if(a)return a;let i=Dl(e,t,n);return o||Qo.set(e,o=new Map),o.set(r,i),i}var Qo=new WeakMap;function Dl(e,t,n){let r=[],o=[],a={n:0};return(Array.isArray(e.features)?e.features:[]).forEach((i,s)=>{let l=i&&typeof i.properties=="object"&&i.properties||{},c=i?.geometry,m=c&&Array.isArray(c.coordinates)?c.type==="Polygon"?[c.coordinates]:c.type==="MultiPolygon"?c.coordinates:[]:[],u=[];for(let h of m){if(!Array.isArray(h))continue;let g=Zo(h[0],a);g&&u.push([g,...h.slice(1).map(y=>Zo(y,a)).filter(y=>y!==null)])}if(!u.length)return void o.push(s);let d=(t?Oe(l[t]):void 0)??Oe(i?.id)??Oe(l.id)??Oe(l.code)??String(s+1),f=(n?Oe(l[n]):void 0)??Oe(l.name)??Oe(l.NAME)??d;r.push({id:d,name:f,keys:[...new Set([d,f,Oe(i?.id)].filter(h=>!!h))],polygons:u})}),{shapes:r,skipped:o,outOfRange:a.n}}var vt=["world","us-states","kr-sido"];function ta(){var t;let e=globalThis;return e[t=Symbol.for("ztd-charts.geo.maps")]??(e[t]=new Map)}function Ge(e){let t=e;return!!t&&typeof t=="object"&&typeof t.name=="string"&&Array.isArray(t.regions)&&!!t.topo&&typeof t.topo.arcs=="string"}function El(e){let t=e;return!!t&&typeof t=="object"&&t.type==="FeatureCollection"&&Array.isArray(t.features)}function lt(e){return ta().get(e)}function Qn(){return[...ta().keys()]}function Il(e){return e.regions.map(t=>{let n=Array.isArray(t)?t.filter(o=>typeof o=="string"):[],r=n[0]!==void 0?e.namesKo?.[n[0]]:void 0;return typeof r=="string"?[...n,r]:n})}var ea=new WeakMap;function Mt(e){let t=ea.get(e);return t||ea.set(e,t=st(Il(e))),t}function na(e,t){if(e===void 0||e==="auto"){let n=Qn();if(!n.length)return{missing:"auto"};let r=Yo(t(),n.map(a=>Mt(lt(a)))),o=n[Math.max(0,r)];return{map:lt(o),name:o}}if(typeof e=="string"){let n=lt(e);return n?{map:n,name:e}:{missing:e}}return Ge(e)?{map:e,name:e.name}:El(e)?{map:e}:null}var ut=.017453292519943295,he=e=>((e+180)%360+360)%360-180,ra=1.340264,oa=-.081106,aa=893e-6,ia=.003796,sa=.8660254037844386,Ol=(e,t)=>{let n=Math.asin(sa*Math.sin(t)),r=n*n,o=r*r*r;return[e*Math.cos(n)/(sa*(ra+3*oa*r+o*(7*aa+9*ia*r))),n*(ra+oa*r+o*(aa+ia*r))]};function cn(e,t){let n=Math.sin(e*ut),r=(n+Math.sin(t*ut))/2;if(Math.abs(r)<.001)return(i,s)=>[i,Math.sin(s)];let o=1+n*(2*r-n),a=Math.sqrt(o)/r;return(i,s)=>{let l=Math.sqrt(Math.max(0,o-2*r*Math.sin(s)))/r;return[l*Math.sin(i*r),a-l*Math.cos(i*r)]}}function St(e,t,n=[0,0],r=1,o=[0,0]){let[a,i]=t(n[0]*ut,n[1]*ut);return{lon0:e,raw:(s,l)=>{let[c,m]=t(s*ut,Math.max(-90,Math.min(90,l))*ut);return[r*(c-a)+o[0],-r*(m-i)+o[1]]}}}var ca=["AK","HI"];function Tt(e,t,n,r){let o=e.pick(t,n,r);return o.raw(he(t-o.lon0),n)}function er(e,t=0,n){if(e==="albersUsa"){let o=St(-96,cn(29.5,45.5),[-.6,38.7]),a=St(-154,cn(55,65),[-2,58.5],.35,[-.307,.201]),i=St(-157,cn(8,18),[-3,19.9],1,[-.205,.212]);return{name:e,pick:(s,l,c)=>c!==void 0?c==="AK"?a:c==="HI"?i:o:l>=50&&(s<=-129||s>=170)?a:l>=18&&l<=23&&s>=-161&&s<=-154?i:o}}if(e==="conic"&&n){let[,o,,a]=n,i=St(t,cn(o+(a-o)/6,o+(a-o)*5/6),[0,(o+a)/2]);return{name:e,pick:()=>i}}let r=St(t,Ol);return{name:"equalEarth",pick:()=>r}}function un(e){let t=[],n=1/0,r=-1/0;for(let i of e)for(let s of i.polygons)for(let[l,c]of s[0])t.push(he(l)),c<n&&(n=c),c>r&&(r=c);if(!t.length)return null;t.sort((i,s)=>i-s);let o=t[0]+360-t[t.length-1],a=t[0];for(let i=1;i<t.length;i++)t[i]-t[i-1]>o&&(o=t[i]-t[i-1],a=t[i]);return[a,n,a+360-o,r]}function mn(e){return e[2]-e[0]>150||e[3]-e[1]>70?"equalEarth":"conic"}function la(e,t,n){let r=[];for(let o=0;o<e.length;o++){let a=e[o],i=e[(o+1)%e.length],s=(a[0]-t)*n>=0,l=(i[0]-t)*n>=0;s&&r.push(a),s!==l&&r.push([t,a[1]+(i[1]-a[1])*(t-a[0])/(i[0]-a[0])])}return r}function zl(e){let t=0,n=-1;for(let a=0;a<e.length;a++)Math.abs(e[a][0]-e[(a+e.length-1)%e.length][0])>180&&(t++,n<0&&(n=a));if(!t)return[e];if(t%2){let a=e[(n+e.length-1)%e.length],i=e[n],s=a[0]>0?180:-180,l=360-Math.abs(a[0]-i[0]),c=a[1]+(i[1]-a[1])*(Math.abs(s-a[0])||0)/(l||1),m=e.reduce((u,d)=>u+d[1],0)<0?-90:90;return[[...e.slice(0,n),[s,c],[s,m],[-s,m],[-s,c],...e.slice(n)]]}let r=[e[0]];for(let a=1;a<e.length;a++){let i=e[a][0],s=r[a-1][0];for(;i-s>180;)i-=360;for(;i-s<-180;)i+=360;r.push([i,e[a][1]])}let o=[];for(let a of[-1,0,1]){let i=la(la(r,a*360-180,1),a*360+180,-1),s=0;for(let l=0,c=i.length-1;l<i.length;c=l++)s+=(i[c][0]-i[l][0])*(i[c][1]+i[l][1]);i.length>=3&&Math.abs(s)>1e-9&&o.push(a?i.map(([l,c])=>[l-a*360,c]):i)}return o}function ua(e,t){let n=[],r=[],o=[],a=[1/0,1/0,-1/0,-1/0];return t.polygons.forEach((i,s)=>i.forEach((l,c)=>{let m=e.pick(l[0][0],l[0][1],e.name==="albersUsa"?t.id:void 0);for(let u of zl(l.map(([d,f])=>[he(d-m.lon0),f]))){let d=new Float64Array(u.length*2);u.forEach(([f,h],g)=>{let[y,p]=m.raw(f,h);d[g*2]=y,d[g*2+1]=p,y<a[0]&&(a[0]=y),p<a[1]&&(a[1]=p),y>a[2]&&(a[2]=y),p>a[3]&&(a[3]=p)}),n.push(d),r.push(s),o.push(c===0)}})),{rings:n,poly:r,outer:o,box:a}}function ma(e,t){let n=[1/0,1/0,-1/0,-1/0],[r,o,a,i]=t;for(let s=0;s<=24;s++){let l=s/24;for(let[c,m]of[[r+(a-r)*l,o],[r+(a-r)*l,i],[r,o+(i-o)*l],[a,o+(i-o)*l]]){let[u,d]=Tt(e,c,m);n[0]=Math.min(n[0],u),n[1]=Math.min(n[1],d),n[2]=Math.max(n[2],u),n[3]=Math.max(n[3],d)}}return n}function da(e,t,n){let r=e[2]-e[0],o=e[3]-e[1],a=r>0&&o>0?Math.min(t/r,n/o):1;return{k:a,tx:(t-r*a)/2-e[0]*a,ty:(n-o*a)/2-e[1]*a}}var ct=e=>Math.round(e*10)/10||0;function fa(e,t,n,r=0){let o="";for(let a of e){let i="",s=NaN,l=NaN,c=0,m=1/0,u=-1/0,d=1/0,f=-1/0;for(let g=0;g<a.length;g+=2){let y=ct(a[g]*t.k+t.tx),p=ct(a[g+1]*t.k+t.ty);Math.abs(y-s)<.35&&Math.abs(p-l)<.35||(i+=c?`${c===1?"l":" "}${ct(y-s)} ${ct(p-l)}`:`M${y} ${p}`,s=y,l=p,c++,y<m&&(m=y),y>u&&(u=y),p<d&&(d=p),p>f&&(f=p))}n!==void 0&&(u<0||f<0||m>n[0]||d>n[1])||Math.min(u-m,f-d)<r||(c>=3&&(u-m>=1||f-d>=1)?o+=`${i}Z`:r||(o+=`M${ct((m+u)/2-.8)} ${ct((d+f)/2-.8)}h1.6v1.6h-1.6Z`))}return o}function jl(e){let t=0,n=0,r=0,o=e.length/2;for(let a=0,i=o-1;a<o;i=a++){let s=e[i*2]*e[a*2+1]-e[a*2]*e[i*2+1];t+=s,n+=(e[i*2]+e[a*2])*s,r+=(e[i*2+1]+e[a*2+1])*s}return[t/2,t?n/(3*t):NaN,t?r/(3*t):NaN]}function ha(e){let t=new Map,n=e.rings.map(jl);e.rings.forEach((d,f)=>t.set(e.poly[f],(t.get(e.poly[f])??0)+(e.outer[f]?1:-1)*Math.abs(n[f][0])));let r=-1,o=0;for(let[d,f]of t)f>o&&(o=f,r=d);if(r<0)return[NaN,NaN];let a=e.rings.map((d,f)=>f).filter(d=>e.poly[d]===r),i=0,s=0;for(let d of a)e.outer[d]&&(i+=n[d][2]*Math.abs(n[d][0]),s+=Math.abs(n[d][0]));let l=i/s,c=[];for(let d of a){let f=e.rings[d],h=f.length/2;for(let g=0,y=h-1;g<h;y=g++){let p=f[g*2+1],$=f[y*2+1];p>l!=$>l&&c.push(f[g*2]+(f[y*2]-f[g*2])*(l-p)/($-p))}}c.sort((d,f)=>d-f);let m=NaN,u=-1;for(let d=0;d+1<c.length;d+=2)c[d+1]-c[d]>u&&(u=c[d+1]-c[d],m=(c[d]+c[d+1])/2);return[m,l]}var ga=new WeakMap;function Bl(e){let t=Math.max(.5,(e[2]-e[0])*.05),n=Math.max(.5,(e[3]-e[1])*.05);return[e[0]-t,Math.max(-90,e[1]-n),e[2]+t,Math.min(90,e[3]+n)]}function dn(e,t={}){let n=`${t.focus??""}${t.featureId??""}${t.featureName??""}`,r=ga.get(e),o=r?.get(n);if(o)return o;let a=Ge(e)?e:null,i=a?sn(a):ln(e,t.featureId,t.featureName).shapes,s=new Set(a?.hidden??[]),l=t.focus!==void 0&&a?.focus&&Object.hasOwn(a.focus,t.focus)?a.focus[t.focus]:void 0,c=l?new Set(l.ids.split(" ")):null,m=new Set;i.forEach((f,h)=>{f.polygons.length&&!s.has(f.id)&&(!c||c.has(f.id))&&m.add(h)});let u=[];if(l)u.push({box:[...l.box]});else{let f=new Map;for(let h of m){let g=a?.projection==="albersUsa"&&ca.includes(i[h].id)?i[h].id:"",y=f.get(g);y?y.push(i[h]):f.set(g,[i[h]])}for(let[h,g]of f){let y=un(g);if(!y)continue;let p=(a?a.projection:mn(y))==="equalEarth",$=Bl(y);u.push({box:p?[-180,$[1],180,$[3]]:$,...h&&{id:h}})}}let d={boxes:u,shown:m,shapes:i,match:a?Mt(a):st(i.map(f=>f.keys))};return r||ga.set(e,r=new Map),r.set(n,d),d}function Gl(e,t){return Number.isFinite(e)&&Number.isFinite(t)&&e>=-180&&e<=180&&t>=-90&&t<=90}function Hl(e,t,n){for(let r of e.boxes){let[o,a,i,s]=r.box;if(!(n<a||n>s)){for(let l of[t,t+360,t-360])if(l>=o&&l<=i)return r}}return null}function tr(e,t){if("name"in t){let r=e.match(t.name);return r<0?{miss:"unmatched"}:e.shown.has(r)?{region:r}:{miss:"outside"}}if(!Gl(t.lon,t.lat))return{miss:"invalid"};let n=Hl(e,t.lon,t.lat);return n?{lon:t.lon,lat:t.lat,...n.id&&{id:n.id}}:{miss:"outside"}}var Wl=e=>e.boxes.reduce((t,n)=>t+(n.box[2]-n.box[0])*(n.box[3]-n.box[1]),0);function pa(e,t){if(e!==void 0&&e!=="auto")return na(e,()=>[]);let n=Qn();if(!n.length)return{missing:"auto"};let r=t(),o=new Set,a=r.filter(m=>{if(!("name"in m))return!0;let u=$t(m.name);return!u||o.has(u)?!1:(o.add(u),!0)}),i=-1,s=0,l=1/0;n.forEach((m,u)=>{let d=dn(lt(m)),f=0;for(let g of a)"miss"in tr(d,g)||f++;let h=Wl(d);(f>s||f===s&&f>0&&h<l)&&(i=u,s=f,l=h)});let c=i>=0?n[i]:n.includes("world")?"world":n[0];return{map:lt(c),name:c}}var ba=1e3;function Vl(e,t){if(!e||typeof e!="object"||Array.isArray(e)||!Object.hasOwn(e,t))return null;let n=e[t];if(!Array.isArray(n)||n.length!==2)return{lon:NaN,lat:NaN};let r=o=>typeof o=="number"?o:typeof o=="string"&&o.trim()!==""?Number(o):NaN;return{lon:r(n[0]),lat:r(n[1])}}function ya(e,t,n){return!!e&&!!t&&e!==t&&n>0&&Number.isFinite(n)}function nr(e,t){return Vl(e,t)??{name:t}}function xa(e){if(Array.isArray(e))return e;if(e&&typeof e=="object"){let t=e;if(Array.isArray(t.values))return t.values;if(typeof t.csv=="string")return Be(t.csv)}return null}var Ta=N(Z(),1);var te=N(Z(),1);function ka(e,t){let n=$e(e.theme),[r,o,a]=nn(e.width),i=at(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=rn(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&xe,d=Io(r,e.animateOnView!==!1&&u),f=me(e.locale),h=Q(f),g=(0,te.useMemo)(()=>ze(e.format,f,t.format),[e.format,f,t.format]),y=(0,te.useCallback)(K=>et(K,{locale:f}),[f]),p=(0,te.useMemo)(()=>jt(g,e.unit),[g,e.unit]),$=(0,te.useMemo)(()=>Zt(e.data),[e.data]),[x,M]=(0,te.useState)(null),[k,R]=(0,te.useState)(null),A=(0,te.useRef)([]),O=(0,te.useRef)(e.onHover);O.current=e.onHover;let G=(0,te.useRef)(e.onClick);G.current=e.onClick;let D=(0,te.useRef)(null),_=(0,te.useRef)(null),F=(0,te.useRef)(null),T=(0,te.useCallback)((K,ie="pointer")=>{if(F.current!==K){F.current=K;let se=K===null?null:A.current[K]??null;queueMicrotask(()=>O.current?.(se)),_.current?.(K)}D.current=K===null?null:ie,M(K),R(D.current)},[]),v=(0,te.useCallback)(K=>{D.current!=="keyboard"&&(D.current=K===null?null:"sync",M(K),R(D.current))},[]),S=(0,te.useCallback)(K=>{let ie=A.current[K];ie&&G.current?.(ie)},[]),z=no(e.replayKey),E=e.width!==void 0||(a??0)>0,ne={enabled:u,active:d.visible&&E,near:d.near,replayKey:z,dataKey:$,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},ae=(0,te.useCallback)((K,ie=1)=>x===null||x===K?ie:ie*.38,[x]);return{p:n,width:s,height:c,measured:E,responsive:e.width===void 0,pending:xe&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:ne,fv:p,fmt:g,pct:y,locale:f,lang:h,t:h==="ko"?Lr:Pr,active:x,via:k,setActive:T,click:S,events:A,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:ae,sig:$,description:e.description,reduced:m,publish:_,applySync:v}}var ee=N(Z(),1);function Kl(e){return 1-Math.pow(1-e,3)}function Xl(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Yl(e){return e==="easeInOut"?Xl:e==="linear"?t=>t:Kl}function Ul(e,t){return e==="linear"?1:e==="easeInOut"?t<.5?12*t*t:3*Math.pow(-2*t+2,2):3*Math.pow(1-t,2)}function mt(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),a=Math.floor(o),i=Math.min(e.length-1,a+1);n[r]=e[a]+(e[i]-e[a])*(o-a)}return n}function fn(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],o=t[n];if(Number.isNaN(r)!==Number.isNaN(o)||Math.abs(r-o)>1e-6)return!1}return!0}function wa(e,t,n){for(let r=0;r<n.length;r++)(!Number.isFinite(e[r])||!Number.isFinite(n[r]))&&(e[r]=n[r],t[r]=0)}function $a(e,t,n,r){if(!t||!n||t.length!==n.length)return mt(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let l of mt(s,n[i]))o.push(l)}return o.length===r?o:mt(e,r)}var hn=class{constructor(){this.tracks=new Map;this.seq=0;this.easing="spring";this.duration=900;this.omega=8.2;this.animating=!1;this.entranceStart=-1;this.maxDelay=0}configure(t,n){this.easing=t,this.duration=Math.max(1,n),this.omega=7.4/(this.duration/1e3)}sameTargets(t){let n=0;for(let r of this.tracks.values())r.exiting||n++;if(n!==t.length)return!1;for(let r of t){let o=this.tracks.get(r.key);if(!o||o.exiting||!fn(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let a=t.from??t.to,i=t.enter??a;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:a.slice(),enter:i.slice(),exit:(t.exit??i).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),a=this.make(r,r.to,0,0);o&&(a.order=o.order),a.done=!0,a.progress=1,n.set(r.key,a)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let a=this.tracks.get(o.key),i=this.make(o,o.from??o.to,1/0,o.delay??0);a&&(i.order=a.order),r=Math.max(r,o.delay??0),n.set(o.key,i)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),wa(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=fn(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),l=r>0?Math.min(a*r,240):0;if(s){let c=i.to.length;s.from=$a(s.cur,s.parts,i.parts,c),s.vel=$a(s.curVel,s.parts,i.parts,c),s.parts=i.parts,s.to=i.to.slice(),wa(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=fn(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(i,i.enter??i.from??i.to,n+l,0);c.done=fn(c.from,c.to),this.tracks.set(i.key,c)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=mt(i.exit,i.cur.length),i.t0=n,i.exiting=!0,i.done=!1,i.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=Yl(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=mt(s.from,c)),s.vel.length!==c&&(s.vel=mt(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-a*l),d=a*l>=8&&a*l<20,f=0;for(let h=0;h<c;h++){let g=s.from[h]-s.to[h],y=s.vel[h]+a*g;s.cur[h]=s.to[h]+(g+y*l)*u,s.curVel[h]=(s.vel[h]-a*y*l)*u,d&&f<.15&&(f=Math.max(f,Math.abs(s.cur[h]-s.to[h]),Math.abs(s.curVel[h]/a)))}m=a*l>=20||d&&f<.15,s.progress=Math.min(1,1-(1+a*l)*u)}else{let u=Math.min(1,l/o),d=r(u),f=Ul(this.easing,u)/o;for(let h=0;h<c;h++)s.cur[h]=s.from[h]+(s.to[h]-s.from[h])*d,s.curVel[h]=(s.to[h]-s.from[h])*f;m=u>=1,s.progress=d}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&i.push(s.key)}else n=!0}for(let s of i)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Ct=new Set,gn=0;function va(e){gn=0;let t=Array.from(Ct);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Ct.delete(n)}Ct.size&&typeof requestAnimationFrame<"u"&&(gn=requestAnimationFrame(va))}function Ma(e){return Ct.add(e),!gn&&typeof requestAnimationFrame<"u"&&(gn=requestAnimationFrame(va)),()=>{Ct.delete(e)}}function Jl(e){let t=new Map,n=!1;for(let r of e){let o=(t.get(r.key)??0)+1;t.set(r.key,o),o>1&&(n=!0)}return n?(t.clear(),e.map(r=>{let o=(t.get(r.key)??0)+1;return t.set(r.key,o),o>1?{...r,key:`${r.key}#${o}`}:r})):e}function Sa(e,t){let n=(0,ee.useMemo)(()=>Jl(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,ee.useRef)(null),d=(0,ee.useRef)("init"),f=(0,ee.useRef)(null),h=(0,ee.useRef)(s),g=(0,ee.useRef)(i),y=(0,ee.useRef)(!1),p=(0,ee.useRef)(0),[,$]=(0,ee.useState)(0),x=(0,ee.useRef)(null),M=(0,ee.useRef)(!0);u.current||(u.current=new hn,u.current.configure(l,c),u.current.snap(n),f.current=n);let k=u.current;if(k.configure(l,c),f.current!==n){let _=d.current,F=!Object.is(h.current,s);k.sameTargets(n)?k.refreshData(n):!r||_==="init"?k.snap(n):_==="idle"?k.hold(n):_==="running"||F?k.update(n,It(),m):k.snap(n),f.current=n,h.current=s}let R=(0,ee.useRef)(()=>!1);R.current=_=>{if(!M.current)return!1;let F=k.step(_);return!F&&d.current==="running"&&(d.current="done"),$(T=>(T+1)%1e9),F||(x.current=null),F};let A=(0,ee.useCallback)(()=>{if(!xe||x.current||!k.animating)return;let _=F=>R.current(F);x.current=Ma(_)},[k]);Ne(()=>{let _=!Object.is(g.current,i);if(g.current=i,!r){(d.current!=="done"||k.animating)&&(k.snap(f.current??n),d.current="done",$(F=>F+1));return}d.current==="init"||_&&a?(k.hold(f.current??n),d.current="idle",y.current=!1,$(F=>F+1)):_&&(y.current=!0)},[r,i]),Ne(()=>{!r||!a||!y.current||(y.current=!1,k.hold(f.current??n),d.current="idle",$(_=>_+1))},[a,r]),(0,ee.useEffect)(()=>{r&&o&&d.current==="idle"&&(k.start(It()),p.current+=1,d.current="running",A(),$(_=>_+1))},[r,o,i,k,A]),(0,ee.useEffect)(()=>{k.animating&&A()}),(0,ee.useEffect)(()=>(M.current=!0,()=>{M.current=!1,x.current?.(),x.current=null}),[]);let O=It(),G=k.elapsed(O),D=r&&d.current==="idle";return{items:k.items(),get:_=>k.get(_),elapsed:D?0:G,fade:(_,F=320)=>D?0:Number.isFinite(G)?Math.max(0,Math.min(1,(G-_)/F)):1,waiting:D,animating:k.animating,generation:p.current}}var rr=N(B(),1);function Ca(e,t,n,r,o){if(r)return o==="categorical"?ke(e,t,n):Br(e,t,n);if(o==="categorical")return ke(e,t,n);let a=re(e,"strong"),i=re(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?i:a)}var ql=N(Z(),1);var or=N(B(),1);var Na=e=>e?"neutralStrong":"accent";var ar=N(B(),1);function Aa(e,t,n,r){if(typeof e!="function")return Te(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let l=o.get(r(i,s));l!==void 0&&e(i,s)&&a.add(l)}),a}var Zl=N(Z(),1);var sr=N(B(),1),Ql={name:"Candlestick chart",open:"Open",high:"High",low:"Low",close:"Close",change:"Change",volume:"Volume",empty:"No data.",ohlc:(e,t,n,r)=>`open ${e}, high ${t}, low ${n}, close ${r}`,span:(e,t,n)=>`${e} to ${t}: ${n}`,desc:(e,t,n,r,o)=>`${e} to ${t}, ${Ae(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Fa={en:Ql,ko:{name:"캔들스틱",open:"시가",high:"고가",low:"저가",close:"종가",change:"등락률",volume:"거래량",empty:"데이터가 없어요.",ohlc:(e,t,n,r)=>`시가 ${e}, 고가 ${t}, 저가 ${n}, 종가 ${r}`,span:(e,t,n)=>`${e}부터 ${t}까지 ${n}`,desc:(e,t,n,r,o)=>`${e}부터 ${t}까지 ${n}개 봉. 첫 시가 ${r}, 마지막 종가 ${o}`,ma:e=>`${e}일선`,up:"상승",down:"하락",maLegend:e=>`${e}일 이동평균`}},ir=["ink","muted","dim"];function Ra(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,ir.length)}var Pa=N(Z(),1),La=N(B(),1);function lr({p:e,frame:t,regions:n,opacity:r}){let o=(0,Pa.useMemo)(()=>n.map(a=>t.paths[a]).join(""),[t,n]);return o?(0,La.jsx)("path",{d:o,fill:e.paint("neutralSoft"),fillOpacity:r,stroke:e.paint("panel"),strokeWidth:.6,strokeLinejoin:"round",fillRule:"evenodd",pointerEvents:"none"}):null}var ec=(e,t)=>e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1],_a=new WeakMap;function Da(e,t={}){let n=Number.isFinite(t.lon0)?((t.lon0+180)%360+360)%360-180:0,r=`${t.focus??""}${t.featureId??""}${t.featureName??""}${n?`${n}`:""}`,o=_a.get(e),a=o?.get(r);if(a)return a;let i=Ge(e)?e:null,s=i?sn(i):ln(e,t.featureId,t.featureName).shapes,l=new Set(i?.hidden??[]),c=t.focus!==void 0&&i?.focus&&Object.hasOwn(i.focus,t.focus)?i.focus[t.focus]:void 0,m=s.map((p,$)=>$).filter(p=>!l.has(s[p].id)&&s[p].polygons.length),u;if(c)u=er("equalEarth",c.lon0);else{let p=un(m.map(x=>s[x]))??[-180,-60,180,85],$=i?i.projection:mn(p);u=er($,$==="conic"||!i?(p[0]+p[2])/2:$==="equalEarth"?n:0,p)}let d=s.map(p=>ua(u,p)),f=[1/0,1/0,-1/0,-1/0];if(c)f=ma(u,c.box);else for(let p of m){let $=d[p].box;f=[Math.min(f[0],$[0]),Math.min(f[1],$[1]),Math.max(f[2],$[2]),Math.max(f[3],$[3])]}Number.isFinite(f[0])||(f=[0,0,1,1]);let h=m.filter(p=>ec(d[p].box,f)),g=c?new Set(c.ids.split(" ")):null,y={shapes:s,projected:d,projection:u,box:f,regions:g?h.filter(p=>g.has(s[p].id)):h,context:g?h.filter(p=>!g.has(s[p].id)):[],clip:!!c,centers:d.map(ha),match:i?Mt(i):st(s.map(p=>p.keys))};return o||_a.set(e,o=new Map),o.set(r,y),y}function Ea(e){let t=e.box[2]-e.box[0],n=e.box[3]-e.box[1];return t>0&&n>0?t/n:2}function Ia(e,t,n,r=2,o=e.box){let a=da(o,Math.max(1,t-r*2),Math.max(1,n-r*2));a.tx+=r,a.ty+=r;let i=new Set([...e.regions,...e.context]);return{fit:a,paths:e.projected.map((s,l)=>i.has(l)?fa(s.rings,a,[t,n]):""),centers:e.centers.map(([s,l])=>[s*a.k+a.tx,l*a.k+a.ty]),project:(s,l,c)=>{let[m,u]=Tt(e.projection,s,l,c);return[m*a.k+a.tx,u*a.k+a.ty]}}}var Y=N(Z(),1);var za=N(B(),1);function Oa({p:e,l:t,dim:n}){return(0,za.jsx)("text",{x:Math.round(t.x*10)/10,y:Math.round(t.y*10)/10,dy:"0.35em",fontSize:11,fontWeight:t.weight,textAnchor:t.anchor,fill:e.paint("ink"),stroke:e.paint("panel"),strokeWidth:3,strokeLinejoin:"round",paintOrder:"stroke",opacity:n?.45:void 0,className:"ztd-mark",style:{pointerEvents:"none"},children:t.text})}var ja=new WeakMap;function cr(e){let t=ja.get(e);if(t)return t;let n=[NaN,NaN],r=-1;for(let o of e.polygons){let a=o[0];if(!a||a.length<3)continue;let i=a[0][0],s=0,l=0,c=0;for(let m=0,u=a.length-1;m<a.length;u=m++){let d=i+he(a[m][0]-i),f=i+he(a[u][0]-i),h=f*a[m][1]-d*a[u][1];s+=h,l+=(f+d)*h,c+=(a[u][1]+a[m][1])*h}Math.abs(s)>r&&s!==0&&(r=Math.abs(s),n=[he(l/(3*s)),c/(3*s)])}return r<0&&(n=e.polygons[0]?.[0]?.[0]?[e.polygons[0][0][0][0],e.polygons[0][0][0][1]]:[NaN,NaN]),ja.set(e,n),n}var Nt={atlantic:0,pacific:150};function Ga(e,t){let n=Ge(e)?e:null;return!!n&&n.projection==="equalEarth"&&!(t!==void 0&&n.focus&&Object.hasOwn(n.focus,t))}function Ha(e,t,n){if(e==="atlantic"||e==="pacific")return Nt[e];let r=o=>{let a=0;for(let i of t)Math.abs(he(i.b-o)-he(i.a-o))>180&&(a=Ce(a+i.w));for(let i of n)Math.abs(he(i-o))>160&&(a+=1);return a};return r(Nt.pacific)<r(Nt.atlantic)?Nt.pacific:Nt.atlantic}var U=e=>Math.round(e*10)/10||0,Ce=e=>Math.min(Number.MAX_VALUE,e);function Wa(e,t){if("miss"in t)return null;let n=e.projection.name==="albersUsa";if("region"in t){let[i,s]=e.centers[t.region]??[NaN,NaN],l=e.shapes[t.region],[c,m]=cr(l);return!Number.isFinite(i)||!Number.isFinite(s)||!Number.isFinite(c)?null:{x:i,y:s,lon:c,lat:m,sub:e.projection.pick(c,m,n?l.id:void 0)}}let r=n?t.id??"":void 0,[o,a]=Tt(e.projection,t.lon,t.lat,r);return Number.isFinite(o)&&Number.isFinite(a)?{x:o,y:a,lon:t.lon,lat:t.lat,sub:e.projection.pick(t.lon,t.lat,r)}:null}function Va(e,t){let n=[e.box[0],e.box[1],e.box[2],e.box[3]];if(e.clip)return n;for(let r of t)r.x<n[0]&&(n[0]=r.x),r.y<n[1]&&(n[1]=r.y),r.x>n[2]&&(n[2]=r.x),r.y>n[3]&&(n[3]=r.y);return n}var Ba=(e,t)=>e[0]<t[2]&&e[2]>t[0]&&e[1]<t[3]&&e[3]>t[1];function Ka(e,t,n,r,o=[],a=[]){let i=[...o],s=[],l=r*.62,c=new Set;return e.forEach((m,u)=>{let d=`${Math.round(m.x)} ${Math.round(m.y)}`;if(c.has(d))return;c.add(d);let f=m.weight??600,h=Me(m.text,r,f),g=m.r+3,y=[[m.x+g,m.y,"start",[m.x+g,m.y-l,m.x+g+h,m.y+l]],[m.x-g,m.y,"end",[m.x-g-h,m.y-l,m.x-g,m.y+l]],[m.x,m.y-g-l,"middle",[m.x-h/2,m.y-g-2*l,m.x+h/2,m.y-g]],[m.x,m.y+g+l,"middle",[m.x-h/2,m.y+g,m.x+h/2,m.y+g+2*l]]];for(let[p,$,x,M]of y)if(!(M[0]<1||M[1]<0||M[2]>t-1||M[3]>n)&&!(i.some(k=>Ba(k,M))||a.some(k=>Ba(k,M)))){i.push(M),s.push({x:p,y:$,anchor:x,text:m.text,weight:f,k:u});return}}),s}function Xa(e,t){return et(e,{locale:t,maximumFractionDigits:Math.abs(e)<10?1:0})}function pn(e,t){return t==="ko"?e==="auto"?"등록한 지도가 없어요. ztd-charts/geo의 지도를 registerMap에 넘겨 주세요":vt.includes(e)?`"${e}" 지도를 등록하지 않았어요. ztd-charts/geo/${e}에서 불러와 registerMap에 넘겨 주세요`:`"${e}" 지도를 등록하지 않았어요. 지도를 registerMap에 넘기거나 ${vt.join(", ")}, GeoJSON을 써 주세요`:e==="auto"?"No map is registered. Import one from ztd-charts/geo and pass it to registerMap":vt.includes(e)?`Map "${e}" is not registered. Import it from ztd-charts/geo/${e} and pass it to registerMap`:`Map "${e}" is not registered. Pass a map to registerMap, or use ${vt.join(", ")} or a GeoJSON`}var W=N(B(),1),tc={kind:"Flow map",to:(e,t)=>`${e} to ${t}`,share:e=>`${e} of the total`,shareLabel:"Share",out:"Outgoing",in:"Incoming",largest:"Largest flows",desc:(e,t,n,r)=>`${Ae(e,"flow")} between ${Ae(t,"place")}, ${n} in total. Largest: ${r}`,skipped:e=>`${Ae(e,"flow")} could not be placed on the map`,capped:(e,t)=>`The ${e} largest of ${t} flows are drawn`},nc={en:tc,ko:{kind:"흐름 지도",to:(e,t)=>`${e}에서 ${t}`,share:e=>`전체의 ${e}`,shareLabel:"비율",out:"나감",in:"들어옴",largest:"큰 흐름",desc:(e,t,n,r)=>`지점 ${t}곳 사이 흐름 ${e}개, 합계 ${n}. 가장 큰 흐름: ${r}`,skipped:e=>`지도에 놓지 못한 흐름 ${e}개`,capped:(e,t)=>`흐름 ${t}개 중 큰 ${e}개를 그려요`}},ur=(e,t)=>`${e} → ${t}`,He=172,We=17,Ya=16,rc=600,Ua=400,Ja=.22,At=(e,t,n)=>[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n],Ve=(e,t,n,r)=>At(At(e,t,r),At(t,n,r),r);function mr(e,t,n,r){let o=0,a=1;for(let i=0;i<24;i++){let s=(o+a)/2,l=Ve(e,t,n,s);Math.hypot(l[0]-n[0],l[1]-n[1])>r?o=s:a=s}return o}function oc(e,t,n,r,o,a){let i=n.fit.k,s=m=>[m.x*i+n.fit.tx,m.y*i+n.fit.ty],l=s(e),c=s(t);if(e.sub===t.sub){let m=he(e.lon-e.sub.lon0),u=he(t.lon-t.sub.lon0);if(Math.abs(u-m)>180){let d=Math.sign(u-m),f=(p,$,x)=>{let[M,k]=p.sub.raw($,p.lat),[R,A]=p.sub.raw($+x,p.lat),O=s(p);return[O[0]+(R-M)*i,O[1]+(A-k)*i]},h=dr(l,f(t,u,-360*d),0,0,e.sub),g=dr(f(e,m,360*d),c,o,a,e.sub),y=ti(e.sub,n,r);return h.arrow=qa(l,f(t,u,-360*d),y,a,!1),g.arrow=`${qa(f(e,m,360*d),c,y,a,!0)}${g.arrow}`,[h,g]}}return[dr(l,c,o,a,null)]}var Za=(e,t)=>[(e[0]+t[0])/2-(t[1]-e[1])*Ja,(e[1]+t[1])/2+(t[0]-e[0])*Ja],Qa=e=>[Re(e*1.4+4,6,20),Re(e*.8+2.5,3.5,13)];function ei(e,t,n){let r=e[0]-t[0],o=e[1]-t[1],a=Math.hypot(r,o)||1,i=-o/a*n,s=r/a*n;return`M${U(e[0])} ${U(e[1])}L${U(t[0]+i)} ${U(t[1]+s)}L${U(t[0]-i)} ${U(t[1]-s)}Z`}function ac(e,t){let n=!1;for(let r=0,o=t.length-1;r<t.length;o=r++){let[a,i]=t[r],[s,l]=t[o];i>e[1]!=l>e[1]&&e[0]<(s-a)*(e[1]-i)/(l-i)+a&&(n=!n)}return n}function qa(e,t,n,r,o){let a=Za(e,t),[i,s]=Qa(r),l=-1;for(let p=0;p<=48;p++){let $=o?p/48:1-p/48;if(ac(Ve(e,a,t,$),n)){l=$;break}}if(l<0)return"";let c=Ve(e,a,t,l),m=o?Math.min(1,l+.01):Math.max(0,l-.01),u=Ve(e,a,t,m),d=o?u[0]-c[0]:c[0]-u[0],f=o?u[1]-c[1]:c[1]-u[1],h=Math.hypot(d,f)||1,g=o?[c[0]+d/h*i,c[1]+f/h*i]:c,y=[g[0]-d/h*i,g[1]-f/h*i];return ei(g,y,s)}function dr(e,t,n,r,o){let a=Math.hypot(t[0]-e[0],t[1]-e[1]);if(a<1)return{d:"",arrow:"",cut:o};let i=Za(e,t),[s,l]=Qa(r);if(!(n>0)||a<n*2+s+6)return{d:`M${U(e[0])} ${U(e[1])}Q${U(i[0])} ${U(i[1])} ${U(t[0])} ${U(t[1])}`,arrow:"",cut:o};let c=mr(e,i,t,n+1.5),m=mr(e,i,t,n+1.5+s),u=mr(e,i,t,n+1.5+s*.6),d=Ve(e,i,t,u),f=At(e,i,u),h=Ve(e,i,t,c),g=Ve(e,i,t,m);return{d:`M${U(e[0])} ${U(e[1])}Q${U(f[0])} ${U(f[1])} ${U(d[0])} ${U(d[1])}`,arrow:ei(h,g,l),cut:o}}function ti(e,t,[n,r]){let o=([i,s])=>[i*t.fit.k+t.fit.tx,s*t.fit.k+t.fit.ty],a=[];for(let i=-90;i<=90;i+=3)a.push(o(e.raw(180,i)));for(let i=90;i>=-90;i-=3)a.push(o(e.raw(-180,i)));for(let i of[s=>s[0],s=>n-s[0],s=>s[1],s=>r-s[1]]){let s=a;a=[],s.forEach((l,c)=>{let m=s[(c+s.length-1)%s.length],u=i(l),d=i(m);u>=0!=d>=0&&a.push(At(m,l,d/(d-u))),u>=0&&a.push(l)})}return a}var ic=(e,t,n)=>`M${ti(e,t,n).map(([r,o])=>`${U(r)} ${U(o)}`).join("L")}Z`;function fr(e){let t=(0,Y.useMemo)(()=>{let b=I=>e.data.some(j=>j!==null&&typeof j=="object"&&qt(j,I)),C=be(e.source??(b("source")?"source":"from"),"source"),L=be(e.target??(b("target")?"target":"to"),"target"),V=e.value!==void 0||b("value"),J=rt(e.value,"value"),H=new Map;return e.data.forEach((I,j)=>{let q=C(I,j).trim(),ce=L(I,j).trim(),Pe=V?J(I,j):1;if(!ya(q,ce,Pe))return;let Je=`${q}${ce}`,kn=H.get(Je);kn?kn.value=Ce(kn.value+Pe):H.set(Je,{s:q,t:ce,value:Pe,datum:I,row:j})}),[...H.values()]},[e.data,e.source,e.target,e.value]),n=(0,Y.useMemo)(()=>{let b=new Set;for(let C of t)b.add(C.s).add(C.t);return[...b]},[t]),r=(0,Y.useMemo)(()=>pa(e.map,()=>n.map(b=>nr(e.places,b))),[e.map,e.places,n]),o=r&&"map"in r?r.map:null,a=(0,Y.useMemo)(()=>({focus:e.focus,featureId:e.featureId,featureName:e.featureName}),[e.focus,e.featureId,e.featureName]),i=(0,Y.useMemo)(()=>{let b=new Map;if(!o)return b;let C=dn(o,a);for(let L of n)b.set(L,tr(C,nr(e.places,L)));return b},[o,a,n,e.places]),s=(0,Y.useMemo)(()=>{if(!o||!Ga(o,e.focus))return;let b=dn(o,a),C=V=>{let J=i.get(V);return!J||"miss"in J?NaN:"lon"in J?J.lon:cr(b.shapes[J.region])[0]},L=t.flatMap(V=>{let J=C(V.s),H=C(V.t);return Number.isFinite(J)&&Number.isFinite(H)?[{a:J,b:H,w:V.value}]:[]});return Ha(e.center,L,[])},[o,a,i,t,e.focus,e.center]),l=(0,Y.useMemo)(()=>o?Da(o,{...a,lon0:s}):null,[o,a,s]),c=l?Ea(l):2,m=b=>e.ranking===!0||e.ranking!==!1&&b>=rc,u=ka(e,{height:b=>Math.round(Math.max(120,Math.min((m(b)?b-He-Ya:b)/c,b*.85))),duration:1100}),{p:d,width:f,height:h,fv:g}=u,y=nc[u.lang],p=(0,Y.useId)().replace(/:/g,""),$=(0,Y.useMemo)(()=>{if(!l)return{places:[],flows:[],all:0,total:0,skipped:t.length};let b=new Map,C=new Map,L=[];for(let I of n){let j=i.get(I),q="region"in j?C.get(j.region):void 0;if(q!==void 0){b.set(I,q);continue}let ce=Wa(l,j);ce&&("region"in j&&C.set(j.region,L.length),b.set(I,L.length),L.push({name:I,at:ce,out:0,in:0}))}let V=[],J=new Map;for(let I of t){let j=b.get(I.s),q=b.get(I.t);if(j===void 0||q===void 0||j===q)continue;let ce=J.get(j*L.length+q);if(ce)ce.value=Ce(ce.value+I.value);else{let Pe={a:j,b:q,value:I.value,datum:I.datum,row:I.row};J.set(j*L.length+q,Pe),V.push(Pe)}L[j].out=Ce(L[j].out+I.value),L[q].in=Ce(L[q].in+I.value)}V.sort((I,j)=>j.value-I.value||I.row-j.row);let H=0;for(let I of V)H=Ce(H+I.value);return{places:L,flows:V.slice(0,ba),all:V.length,total:H,skipped:t.filter(I=>b.get(I.s)===void 0||b.get(I.t)===void 0).length}},[l,i,n,t]),{places:x,flows:M,all:k,total:R}=$,A=M.length,O=A?M[0].value:0,G=m(f)&&A>=2,D=G?f-He-Ya:f,_=Re(D/70,3,12),F=b=>Re(_*(b/(O||1)),1,_),T=(0,Y.useMemo)(()=>x.reduce((b,C)=>Math.max(b,Ce(C.out+C.in)),0),[x]),v=b=>T>0?2.5+4*Math.sqrt(Ce(b.out+b.in)/T):3,S=(0,Y.useMemo)(()=>{let b=new Set;for(let C of M)b.add(C.a).add(C.b);return b},[M]),z=(0,Y.useMemo)(()=>l?Va(l,[...S].map(b=>x[b].at)):null,[l,x,S]),E=(0,Y.useMemo)(()=>l&&z?Ia(l,D,h,9,z):null,[l,z,D,h]),ne=b=>E?[b.at.x*E.fit.k+E.fit.tx,b.at.y*E.fit.k+E.fit.ty]:[0,0],ae=(0,Y.useMemo)(()=>{let b=e.highlight,C=typeof b=="string"&&!on.includes(b)?x.findIndex(L=>L.name===b):-1;return C>=0?new Set(M.flatMap((L,V)=>L.a===C||L.b===C?[V]:[])):Te(b,M.map(L=>L.datum),M.map(L=>ur(x[L.a].name,x[L.b].name)),M.map(L=>L.value),"max")},[e.highlight,M,x]),K=(0,Y.useMemo)(()=>E?M.map(b=>oc(x[b.a].at,x[b.b].at,E,[D,h],v(x[b.b]),F(b.value))):[],[E,M,x,T,_,O]),ie=(0,Y.useMemo)(()=>{let b=[];for(let C of K)for(let L of C)L.cut&&!b.includes(L.cut)&&b.push(L.cut);return b},[K]),se=(0,Y.useMemo)(()=>M.map(b=>R>0?Xa(b.value/R*100,u.locale):""),[M,R,u.locale]),ge=(0,Y.useMemo)(()=>M.map((b,C)=>({datum:b.datum,index:C,key:`${x[b.a].name}${x[b.b].name}`,label:y.to(x[b.a].name,x[b.b].name),value:b.value,formatted:[g(b.value),se[C]&&y.share(se[C])].filter(Boolean).join(", ")})),[M,x,se,g,y]),[Ke,gr]=(0,Y.useState)(null),le=u.active!==null&&u.active<A?u.active:null,Xe=Ke!==null&&x[Ke]?Ke:null,pr=le!==null?[le]:Xe!==null?M.flatMap((b,C)=>b.a===Xe||b.b===Xe?[C]:[]):null,br=b=>Xe===b||le!==null&&(M[le].a===b||M[le].b===b),Rt=(b,C)=>u.setActive(b,C==="touch"?"touch":"pointer"),yr=(0,Y.useRef)(()=>{});yr.current=b=>{u.via!=="keyboard"&&(u.setActive(null),gr(b))};let xi=(0,Y.useMemo)(()=>[{key:"__g",to:[1],from:[0],data:null}],[]),Pt=Sa(xi,u.motion),ki=Dt(u,Pt),bn=Pt.get("__g")?.[0]??1,Ye=bn<.999,wi=u.motion.duration??1100,xr=(b,C,L,V)=>{let J=U(F(M[b].value)),H=ae.has(b)?d.paint("accent"):d.paint("neutralStrong"),I=ae.has(b)?.95:.8;K[b].forEach((j,q)=>{if(!j.d)return;let ce=j.cut?`url(#${p}s${ie.indexOf(j.cut)})`:void 0,Pe=V===null&&A>Ua;C.push((0,W.jsx)("path",{d:j.d,fill:"none",stroke:H,strokeWidth:J,strokeLinecap:"round",opacity:I,clipPath:ce,className:"ztd-mark",pathLength:Ye?1:void 0,strokeDasharray:Ye?"1 1":void 0,style:Ye?{strokeDashoffset:"var(--ztd-grow)"}:void 0,pointerEvents:Pe?"stroke":"none",onPointerEnter:Pe?Je=>Rt(b,Je.pointerType):void 0},`${b}:${q}`)),j.arrow&&L.push((0,W.jsx)("path",{d:j.arrow,fill:H,opacity:I,clipPath:ce,className:"ztd-mark",pointerEvents:"none"},`${b}:${q}`)),V&&V.push((0,W.jsx)("path",{d:j.d,fill:"none",stroke:"transparent",strokeWidth:Math.max(J+6,10),clipPath:ce,onPointerEnter:Je=>Rt(b,Je.pointerType),onClick:()=>u.click(b)},`${b}:${q}`))})},yn=(0,Y.useMemo)(()=>{let b=[],C=[],L=[];return K.forEach((V,J)=>xr(J,b,C,A<=Ua?L:null)),{lines:b,heads:C,hits:L}},[K,M,ae,d,Ye,ie,p,A]),kr=(()=>{let b=[],C=[];for(let L of pr??[])xr(L,b,C,[]);return{lines:b,heads:C}})(),$i=(0,Y.useMemo)(()=>{if(!u.showLabels||!E||!A)return[];let b=D>=560?8:D>=390?5:0,C=[...new Set(M.flatMap((H,I)=>ae.has(I)?[H.a,H.b]:[]))].slice(0,40),L=[...S].filter(H=>!C.includes(H)).sort((H,I)=>Ce(x[I].out+x[I].in)-Ce(x[H].out+x[H].in)||H-I),V=[...C,...L].slice(0,Math.max(b,C.length)),J=[...S].map(H=>{let[I,j]=ne(x[H]),q=v(x[H]);return[I-q,j-q,I+q,j+q]});return Ka(V.map(H=>{let[I,j]=ne(x[H]);return{x:I,y:j,r:v(x[H]),text:bt(x[H].name,Math.min(130,D*.3),11,600)}}),D,h,11,[],J).map(H=>({...H,k:V[H.k]}))},[u.showLabels,E,A,M,ae,S,x,D,h]),xn=null;if(E&&le!==null){let b=M[le],[C,L]=ne(x[b.a]),[V,J]=ne(x[b.b]),H=se[le];xn={x:Re((C+V)/2,0,D),y:Re((L+J)/2,0,h),title:ur(x[b.a].name,x[b.b].name),rows:[{label:u.t.value,value:g(b.value),color:ae.has(le)?d.paint("accent"):d.paint("neutralStrong")},...H?[{label:y.shareLabel,value:H,strong:!1}]:[]]}}else if(E&&Xe!==null){let b=x[Xe],[C,L]=ne(b);xn={x:Re(C,0,D),y:Re(L,0,h),title:b.name,rows:[{label:y.out,value:g(b.out)},{label:y.in,value:g(b.in)}]}}let Ue=r&&"missing"in r?r.missing:null,wr=[$.skipped?y.skipped($.skipped):"",k>A?y.capped(A,k):""].filter(Boolean),vi=A?`${y.to(x[M[0].a].name,x[M[0].b].name)}, ${g(O)}`:"",Mi=e.description??(A?`${y.kind}. ${y.desc(k,S.size,g(R),vi)}${wr.length?`. ${wr.join(". ")}`:""}.`:Ue?pn(Ue,u.lang):""),Si=u.via==="keyboard"&&le!==null&&ge[le]?`${ge[le].label}, ${ge[le].formatted}`:"",Ti=Math.max(0,Math.floor((h-8)/We)-1),Ci=G?M.slice(0,Ti):[],Ni=f-He,Ai=b=>{u.via!=="keyboard"&&(gr(null),Rt(null,b))},$r=(b,C=0)=>{let[L,V]=ne(x[b]);return(0,W.jsx)("circle",{cx:U(L),cy:U(V),r:U(v(x[b])+C),fill:d.paint("ink"),stroke:d.paint("panel"),strokeWidth:1.2,className:"ztd-mark",onPointerEnter:()=>yr.current(b)},x[b].name)},Fi=(0,Y.useMemo)(()=>[...S].map(b=>$r(b)),[S,x,E,d,T]),dt=pr!==null;return(0,W.jsxs)(oo,{c:u,kind:y.kind,ariaLabel:e.ariaLabel,description:Mi,emptyText:Ue?pn(Ue,u.lang):void 0,events:ge,tip:xn,renderTip:e.tooltip,announce:Si,className:e.className,style:e.style,theme:e.theme,defs:E&&(l?.clip||ie.length)?(0,W.jsxs)(W.Fragment,{children:[l?.clip?(0,W.jsx)("clipPath",{id:`${p}c`,children:(0,W.jsx)("rect",{width:D,height:h})}):null,ie.map((b,C)=>(0,W.jsx)("clipPath",{id:`${p}s${C}`,children:(0,W.jsx)("path",{d:ic(b,E,[D,h])})},C))]}):void 0,children:[Ue?(0,W.jsx)(pt,{x:f/2,y:h/2,anchor:"middle",size:12,fill:d.paint("muted"),children:bt(pn(Ue,u.lang),f-16,12)}):null,E&&l?(0,W.jsxs)("g",{children:[(0,W.jsx)("rect",{width:D,height:h,fill:"transparent",onPointerEnter:b=>Ai(b.pointerType)}),(0,W.jsxs)("g",{clipPath:l.clip?`url(#${p}c)`:void 0,children:[l.context.length?(0,W.jsx)(lr,{p:d,frame:E,regions:l.context,opacity:.6}):null,(0,W.jsx)(lr,{p:d,frame:E,regions:l.regions}),(0,W.jsxs)("g",{opacity:dt?.15:void 0,children:[(0,W.jsx)("g",{style:Ye?{"--ztd-grow":U(1-bn)}:void 0,children:yn.lines}),(0,W.jsx)("g",{opacity:Ye?Re((bn-.85)/.15,0,1):void 0,children:yn.heads})]}),dt?(0,W.jsxs)("g",{pointerEvents:"none",children:[kr.lines,kr.heads]}):null,yn.hits,(0,W.jsxs)("g",{style:_t(ki,Pt.waiting,"fade",0,Math.min(400,wi)),children:[(0,W.jsx)("g",{opacity:dt?.35:void 0,children:Fi}),dt?[...S].filter(br).map(b=>$r(b,1)):null]})]}),$i.map(b=>(0,W.jsx)(Oa,{p:d,l:b,dim:dt&&!br(b.k)},x[b.k].name))]},Pt.generation):null,G?(0,W.jsxs)("g",{transform:`translate(${Ni} 0)`,children:[(0,W.jsx)(pt,{x:0,y:We/2,size:10,weight:600,fill:d.paint("muted"),children:y.largest}),Ci.map((b,C)=>{let L=(C+1)*We,V=g(b.value),J=Me(V,11,600),H=Math.max(4,(He-J-6)*(b.value/(O||1))),I=le===C;return(0,W.jsxs)("g",{onPointerEnter:j=>Rt(C,j.pointerType),children:[(0,W.jsx)("rect",{x:-4,y:L,width:He+4,height:We,rx:4,fill:I?d.paint("lift"):"transparent"}),(0,W.jsx)("rect",{x:-2,y:L+1.5,width:U(H),height:We-3,rx:3,fill:ae.has(C)?d.paint("accent"):d.paint("neutralSoft"),opacity:ae.has(C)?.2:1}),(0,W.jsx)(pt,{x:2,y:L+We/2,size:11,weight:ae.has(C)?700:500,fill:d.paint("ink"),children:bt(ur(x[b.a].name,x[b.b].name),He-J-10,11,ae.has(C)?700:500)}),(0,W.jsx)(pt,{x:He-2,y:L+We/2,anchor:"end",size:11,weight:600,fill:d.paint("ink"),children:V})]},C)})]}):null]})}var sc=N(Z(),1);var ii=N(B(),1),lc={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ae(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},cc={en:lc,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},ni=(e,t)=>cc[e].other(t);function ri(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((a,i)=>({v:a.value,i})).sort((a,i)=>i.v-a.v).slice(0,Math.floor(t)).map(a=>a.i)),o=e.filter((a,i)=>!r.has(i));return{kept:e.filter((a,i)=>r.has(i)),other:n(o.length,xo(o.map(a=>a.value)))}}var oi=e=>Number.isFinite(e)&&e>0?e:0;function ai(e,t,n,r){return r==="emphasis"?jr(e,t,n):ke(e,t,n)}var uc=N(Z(),1);var ui=N(B(),1);function si(e,t){return t===!1?e.map((n,r)=>r):yo(e)}function li(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return Te(e,t,t,r,"max")}function ci(e,t,n){let r=new Array(t.length),o=t.filter(a=>!n.has(a));for(let a of t)n.has(a)&&(r[a]=re(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?re(e,"neutral"):zt(e,1-i/Math.max(1,o.length-1))),r}function mi(e){return!e||typeof e!="object"||Array.isArray(e)?[]:ve(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function di(e,t){return ht(e,t+1,new Set)}var mc=N(Z(),1);var hi=N(B(),1);var dc=26;var $d=dc*.62;function fi(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!on.includes(o)&&t.forEach((a,i)=>a===o&&r.add(i));return r}var Le=N(B(),1);function gi(e,t,n){let r=Jt(e);return r?.type==="scatter"&&t?.size!==void 0&&!Ut(n)?Jt("bubble"):r}function fc(e,t={}){let n={};for(let r of e.encoding){let o=t[r.name];o!==void 0&&(n[r.prop??r.name]=o)}return n}function hc(e,t,n,r=!1){let o=gi(e.type,e.encoding,e.options);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&Bn.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(m.includes(o.type)){let u=be(a.label,"label"),d=rt(a.value,"value"),f=o.type==="waffle",h=t.map((k,R)=>({r:k,label:u(k,R),value:f?d(k,R):oi(d(k,R))})),{kept:g,other:y}=f?{kept:h,other:null}:ri(h,i.other,(k,R)=>({r:{},label:ni(Q(n),k),value:R})),p=Te(s,g.map(k=>k.r),g.map(k=>k.label),g.map(k=>k.value),f?"first":"max"),$=y?[...g,y]:g,x=De(k=>f?ke(k,$.length,p):ai(k,$.length,p,i.colorMode)),M=f&&i.shape==="arc";return $.map((k,R)=>({label:k.label,color:x[R],...M&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Ra(Array.isArray(i.ma)?i.ma:void 0,t.length),d=Fa[Q(n)];return[{label:d.up,color:i.upColor??"accent"},{label:d.down,color:i.downColor??"neutralStrong"},...u.map((f,h)=>({label:d.maLegend(f),color:ir[h],shape:"line"}))]}if(o.type==="network"){let u=mi(i.groups);if(u.length<2)return[];let d=De(f=>di(f,u.length));return u.map((f,h)=>({label:f,color:d[h],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof a.group!="string")return[];let u=be(a.group,"group"),d=ve(t.map((h,g)=>u(h,g)).filter(Boolean));if(d.length<2)return[];let f=De(h=>ht(h,d.length,new Set));return d.map((h,g)=>({label:h,color:f[g],shape:"circle"}))}if(o.type==="scatter"){if(typeof a.series!="string"||Ut(i))return[];let u=be(a.series,"series"),d=ve(t.map((g,y)=>u(g,y)));if(d.length<2)return[];let f=Aa(s,t,d,u),h=De(g=>ht(g,d.length,f));return c(d.map((g,y)=>({label:g,color:h[y],shape:"circle"})))}if(o.type==="timeline"){let u=typeof a.group!="string",d=u?a.status:a.group;if(typeof d!="string")return[];let f=Uo(t,d,u),h=De(g=>ke(g,f.length,fi(s,f)));return c(f.map((g,y)=>({label:g,color:h[y],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(a.y))u=a.y;else if(typeof a.series=="string"){let x=be(a.series,"series");u=ve(t.map((M,k)=>x(M,k)))}let d=Gn(o.type,a,i);if(d.length){let x=Te(s,u,u,u.map(()=>0),"none"),M=De(R=>ke(R,u.length,x)),k=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((R,A)=>({label:R,color:M[A]}));return[...c(k),...d.map((R,A)=>({label:R,color:Na(A),shape:"line"}))]}if(u.length<2)return[];let h=o.type==="bar"&&i.layout==="diverging"&&s===void 0?bo(u.length,Array.isArray(i.negative)?i.negative.map(x=>u.indexOf(String(x))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,g=h>=0?new Set([h]):Te(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((x,M)=>({label:x,color:g.has(M)?"accent":"neutralStrong",shape:"square"})));let y=i.colorMode,p=x=>ke(x,u.length,g);if((o.type==="line"||o.type==="area")&&(p=x=>Ca(x,u.length,g,o.type==="area",y)),o.type==="stream"){let x=xt(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),M=si(x.values,i.reorder),k=li(s,x.series,x.values);p=R=>ci(R,M,k)}let $=De(p);return c(u.map((x,M)=>({label:x,color:$[M],...o.type==="line"&&{shape:"line"}})))}return[]}function gc(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&co.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function pc(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:a,highlight:i,syncId:s,title:l,description:c}}function pi(e,t){let{spec:n}=e,r=gi(n.type,n.encoding,n.options),o=(0,Ft.useMemo)(()=>xa(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=lo(n,e.locale),s=me(i),l=Q(s),c=zo(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),m=fo(n),u=(0,Ft.useMemo)(()=>m?Ko(m,s):void 0,[m,s]),d=n.options?.hidden,f=Array.isArray(d)?d.map(String):[],h=f.join(""),[g,y]=(0,Ft.useState)(null);if(!r)return(0,Le.jsx)(jn,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let p=o??c.data,$=t[r.type],x={...n.options??{}},M={...fc(r,n.encoding),...x,...u?{tooltip:u}:{},data:p,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:i},k=n.card?.legend==="toggle"&&mo(r.type,n.encoding??{},x),R=g&&g.base===h?g.hidden:f;k&&(M.hidden=R);let A=F=>y(T=>{let v=T&&T.base===h?T.hidden:f;return{base:h,hidden:v.includes(F)?v.filter(S=>S!==F):[...v,F]}}),O=M.height??220,G=gc(n,r.type),D=a&&!p.length&&(c.loading||c.error||c.empty)?(0,Le.jsx)(jn,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:O,locale:i}):G?(0,Le.jsx)(Oo,{chart:$,...pc(r.type,G,M)}):(0,Le.jsx)($,{...M});if(n.card){let F=n.card,T=F.legend==="auto"||F.legend==="toggle"?hc(n,p,s,k):F.legend,v=T?.length?k?(0,Le.jsx)(zn,{items:T,hidden:R,onToggle:A,locale:i}):T:void 0,S=F.download?(0,Le.jsx)(Vo,{data:p,columns:ho(n),filename:F.title??r.type,formats:Array.isArray(F.download)?F.download:void 0,locale:i}):void 0;D=(0,Le.jsx)(ro,{number:F.number,title:F.title??so(r,l),subtitle:F.subtitle,legend:v,actions:S,source:F.source||void 0,note:F.note||void 0,accent:F.accent,takeaway:F.takeaway,level:F.level,sample:F.sample,replay:F.replay!==!1,className:e.className,locale:i,children:D})}let _=e.theme??n.theme;return _&&(D=(0,Le.jsx)(Wt,{theme:_,children:D})),D}function bc({cfg:e,components:t}){let n=at();return pi({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function yi(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,bi.hydrateRoot)(r,(0,hr.createElement)(Wt,{theme:o.theme,cssVars:!0},(0,hr.createElement)(bc,{cfg:o,components:{[e]:t}})))}yi("flowMap",fr);})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ztd-charts-cli",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.3",
|
|
4
4
|
"description": "ztd-charts CLI: list charts, get JSON Schemas, validate specs, render SVG/PNG/HTML, start a project, and get chart suggestions from data",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Junhan2",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@resvg/resvg-js": "^2.6.2",
|
|
36
36
|
"react": "^19.3.1",
|
|
37
37
|
"react-dom": "^19.3.1",
|
|
38
|
-
"ztd-charts": "0.11.
|
|
38
|
+
"ztd-charts": "0.11.3"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/react": "^19.2.0",
|