ztd-charts-cli 0.5.0 → 0.6.0

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.
Files changed (42) hide show
  1. package/dist/api.d.ts +23 -1
  2. package/dist/api.js +5 -1
  3. package/dist/{chunk-LVCEIXBR.js → chunk-4K4P2AWW.js} +50 -19
  4. package/dist/cli.js +2 -1
  5. package/dist/client/area.js +28 -0
  6. package/dist/client/bar.js +28 -0
  7. package/dist/client/beeswarm.js +28 -0
  8. package/dist/client/box.js +28 -0
  9. package/dist/client/bubble.js +28 -0
  10. package/dist/client/bullet.js +28 -0
  11. package/dist/client/bump.js +28 -0
  12. package/dist/client/calendar.js +28 -0
  13. package/dist/client/candlestick.js +28 -0
  14. package/dist/client/chord.js +28 -0
  15. package/dist/client/donut.js +28 -0
  16. package/dist/client/dumbbell.js +28 -0
  17. package/dist/client/funnel.js +28 -0
  18. package/dist/client/gauge.js +28 -0
  19. package/dist/client/heatmap.js +28 -0
  20. package/dist/client/histogram.js +28 -0
  21. package/dist/client/line.js +28 -0
  22. package/dist/client/lollipop.js +28 -0
  23. package/dist/client/marimekko.js +28 -0
  24. package/dist/client/parallel.js +28 -0
  25. package/dist/client/pareto.js +28 -0
  26. package/dist/client/pie.js +28 -0
  27. package/dist/client/radar.js +28 -0
  28. package/dist/client/radialBar.js +28 -0
  29. package/dist/client/react.js +66 -0
  30. package/dist/client/ridgeline.js +28 -0
  31. package/dist/client/sankey.js +28 -0
  32. package/dist/client/scatter.js +28 -0
  33. package/dist/client/segmented.js +28 -0
  34. package/dist/client/skyline.js +28 -0
  35. package/dist/client/slope.js +28 -0
  36. package/dist/client/sparkline.js +28 -0
  37. package/dist/client/stream.js +28 -0
  38. package/dist/client/sunburst.js +28 -0
  39. package/dist/client/treemap.js +28 -0
  40. package/dist/client/waffle.js +28 -0
  41. package/dist/client/waterfall.js +28 -0
  42. package/package.json +3 -3
package/dist/api.d.ts CHANGED
@@ -100,7 +100,17 @@ interface RenderResult {
100
100
  html?: string;
101
101
  width?: number;
102
102
  height?: number;
103
+ /** 그리면서 바꾼 것 (PNG에서 뺀 이모지 등). 경고처럼 보여 줘요 */
104
+ notes?: string[];
103
105
  }
106
+ /**
107
+ * PNG로 바꾸기 전에 SVG 글자에서 이모지를 빼요. resvg는 컬러 이모지 글꼴을 못 그려서, 이모지가 든 글자 덩어리 전체가 네모로 나와요.
108
+ * 이모지를 뺀 자리의 겹친 공백은 하나로 줄이고 앞뒤 공백은 지워요. 뺀 개수를 돌려줘요
109
+ */
110
+ declare function stripEmoji(svg: string): {
111
+ svg: string;
112
+ removed: number;
113
+ };
104
114
  /** 데이터 주소를 가져올 때 기다리는 시간과 받는 크기의 한도 */
105
115
  declare const FETCH_TIMEOUT_MS = 15000;
106
116
  declare const MAX_FETCH_BYTES: number;
@@ -115,6 +125,18 @@ declare function fetchUrl(url: string, locale?: string, opts?: FetchOptions): Pr
115
125
  * 가져오기, 검사, 그리기가 같은 로캘(locale, 그다음 스펙 options.locale)을 써요
116
126
  */
117
127
  declare function render(input: ChartSpec, opts?: RenderOptions): Promise<RenderResult>;
128
+ /**
129
+ * SVG를 PNG로 (resvg). 이모지는 빼고, 뺀 수를 locale 언어로 notes에 알려요.
130
+ * MCP는 SVG가 너무 커서 글자로 못 보낼 때 이미 그린 SVG를 이걸로 바꿔 보내요
131
+ */
132
+ declare function svgToPng(svg: string, opts?: {
133
+ scale?: number;
134
+ fonts?: string[];
135
+ locale?: string;
136
+ }): Promise<{
137
+ png: Buffer;
138
+ notes?: string[];
139
+ }>;
118
140
  /** http(s) 주소인지. loadRows, CLI suggest, MCP suggest_chart가 같은 규칙(대소문자 무시)을 써요 */
119
141
  declare function isHttpUrl(source: string): boolean;
120
142
  /** 파일 경로나 URL, CSV/JSON 문자열을 행 배열로 */
@@ -128,5 +150,5 @@ declare function suggest(rows: Record<string, unknown>[], opts?: {
128
150
  suggestions: Suggestion[];
129
151
  };
130
152
 
131
- export { FETCH_TIMEOUT_MS, MAX_FETCH_BYTES, fetchUrl, findFonts, getChartInfo, getChartSchema, isHttpUrl, listCharts, loadRows, reactSnippet, render, resolveType, specSnippet, suggest, summarize, validate };
153
+ export { FETCH_TIMEOUT_MS, MAX_FETCH_BYTES, fetchUrl, findFonts, getChartInfo, getChartSchema, isHttpUrl, listCharts, loadRows, reactSnippet, render, resolveType, specSnippet, stripEmoji, suggest, summarize, svgToPng, validate };
132
154
  export type { ChartSummary, FetchOptions, RenderOptions, RenderResult };
package/dist/api.js CHANGED
@@ -13,10 +13,12 @@ import {
13
13
  render,
14
14
  resolveType,
15
15
  specSnippet,
16
+ stripEmoji,
16
17
  suggest,
17
18
  summarize,
19
+ svgToPng,
18
20
  validate
19
- } from "./chunk-LVCEIXBR.js";
21
+ } from "./chunk-4K4P2AWW.js";
20
22
  export {
21
23
  CHARTS,
22
24
  FETCH_TIMEOUT_MS,
@@ -32,7 +34,9 @@ export {
32
34
  render,
33
35
  resolveType,
34
36
  specSnippet,
37
+ stripEmoji,
35
38
  suggest,
36
39
  summarize,
40
+ svgToPng,
37
41
  validate
38
42
  };
@@ -3,13 +3,13 @@ import { existsSync, readFileSync, readdirSync } from "fs";
3
3
  import { createRequire } from "module";
4
4
  import { dirname, join, resolve } from "path";
5
5
  import { fileURLToPath } from "url";
6
- import { CHARTS, commonOptionsIn, findGroup, findLevel, getChartDef, localizeDef, schemaForIn, specLocale, specSchemaIn, suggestCharts, validateSpec, variantsIn, TYPE_ALIASES } from "ztd-charts/spec";
6
+ import { CHARTS, commonOptionsIn, downloadFields, findGroup, findLevel, getChartDef, localizeDef, schemaForIn, specLocale, specSchemaIn, specTemplate, suggestCharts, validateSpec, variantsIn, TYPE_ALIASES } from "ztd-charts/spec";
7
7
  import { inlineRows, normalizeData, parseCSV } from "ztd-charts/spec";
8
- import { langOf, renderSpecToHTML, renderSpecToSVG, resolveSpecData } from "ztd-charts/server";
8
+ import { langOf, renderSpecToHTML, renderSpecToSVG, resolveDef, resolveSpecData } from "ztd-charts/server";
9
9
 
10
10
  // src/messages.ts
11
11
  import { plural } from "ztd-charts/server";
12
- var VERSION = "0.5.0";
12
+ var VERSION = "0.6.0";
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 36 React chart types
@@ -65,6 +65,7 @@ ${n} charts. Details: ztd-charts info <type>`,
65
65
  variants: "Variants",
66
66
  noVariants: (type) => `${type} has no named variants`,
67
67
  saved: (p) => `Saved: ${p}`,
68
+ emojiRemoved: (n) => `Removed ${n} emoji from the PNG text because PNG has no emoji font. SVG and HTML keep them`,
68
69
  valid: (file, type, warnings) => `\u2713 ${file}: valid ${type} spec${warnings ? ` (${plural(warnings, "warning")})` : ""}`,
69
70
  skipped: (p) => `Skipped (already exists): ${p}`,
70
71
  created: (p) => `Created: ${p}`,
@@ -153,6 +154,7 @@ ${n}\uC885. \uC790\uC138\uD788: ztd-charts info <type>`,
153
154
  variants: "\uBCC0\uD615",
154
155
  noVariants: (type) => `${type}\uC5D0\uB294 \uC774\uB984 \uBD99\uC740 \uBCC0\uD615\uC774 \uC5C6\uC5B4\uC694`,
155
156
  saved: (p) => `\uC800\uC7A5: ${p}`,
157
+ emojiRemoved: (n) => `PNG\uC5D0\uB294 \uC774\uBAA8\uC9C0 \uAE00\uAF34\uC774 \uC5C6\uC5B4\uC11C \uAE00\uC790\uC5D0\uC11C \uC774\uBAA8\uC9C0 ${n}\uAC1C\uB97C \uBE90\uC5B4\uC694. SVG\uC640 HTML\uC5D0\uB294 \uADF8\uB300\uB85C \uC788\uC5B4\uC694`,
156
158
  valid: (file, type, warnings) => `\u2713 ${file}: \uC62C\uBC14\uB978 ${type} \uC2A4\uD399${warnings ? `(\uACBD\uACE0 ${warnings}\uAC1C)` : ""}`,
157
159
  skipped: (p) => `\uAC74\uB108\uB700(\uC774\uBBF8 \uC788\uC74C): ${p}`,
158
160
  created: (p) => `\uB9CC\uB4E6: ${p}`,
@@ -283,10 +285,16 @@ function reactSnippet(spec, opts = {}) {
283
285
  const v = spec.encoding?.[c.name];
284
286
  if (v !== void 0) props.push(`${c.prop ?? c.name}=${jsxValue(v)}`);
285
287
  }
286
- for (const [k, v] of Object.entries(spec.options ?? {})) if (JSX_NAME.test(k)) props.push(`${k}=${jsxValue(v)}`);
288
+ const template = specTemplate(spec);
289
+ const tipLocale = specLocale(spec);
290
+ for (const [k, v] of Object.entries(spec.options ?? {})) {
291
+ if (!JSX_NAME.test(k)) continue;
292
+ if (k === "tooltip" && template) props.push(`tooltip={templateTooltip(${JSON.stringify(template)}${tipLocale ? `, ${JSON.stringify(tipLocale)}` : ""})}`);
293
+ else props.push(`${k}=${jsxValue(v)}`);
294
+ }
287
295
  const chartEl = `<${def.component} ${props.join(" ")} />`;
288
296
  const card = spec.card;
289
- const imports = card ? `ChartCard, ${def.component}` : def.component;
297
+ const imports = [card && "ChartCard", card?.download && "DownloadButtons", def.component, template && "templateTooltip"].filter(Boolean).join(", ");
290
298
  const more = rows && rows.length > 12 ? ko2 ? ` // \uC678 ${rows.length - 12}\uD589` : ` // and ${rows.length - 12} more rows` : "";
291
299
  const dataLine = rows && opts.inlineData !== false ? `const ${dataVar} = ${JSON.stringify(rows.slice(0, 12), null, 2)}${more};
292
300
 
@@ -295,8 +303,13 @@ function reactSnippet(spec, opts = {}) {
295
303
  let body = chartEl;
296
304
  if (card) {
297
305
  const cp = [];
298
- for (const k of ["number", "title", "subtitle", "takeaway", "level"]) if (card[k]) cp.push(`${k}=${jsxValue(card[k])}`);
306
+ for (const k of ["number", "title", "subtitle", "takeaway", "level", "source", "note", "accent"]) if (card[k]) cp.push(`${k}=${jsxValue(card[k])}`);
299
307
  if (Array.isArray(card.legend)) cp.push(`legend=${jsxValue(card.legend)}`);
308
+ if (card.download) {
309
+ const cols = downloadFields(spec);
310
+ const dp = [`data={${dataVar}}`, cols.length ? `columns=${jsxValue(cols)}` : "", card.title ? `filename=${jsxValue(card.title)}` : "", Array.isArray(card.download) ? `formats=${jsxValue(card.download)}` : ""];
311
+ cp.push(`actions={<DownloadButtons ${dp.filter(Boolean).join(" ")} />}`);
312
+ }
300
313
  cp.push("replay");
301
314
  body = `<ChartCard ${cp.join(" ")}>
302
315
  ${chartEl}
@@ -338,15 +351,27 @@ function findFonts(extra = []) {
338
351
  }
339
352
  return out;
340
353
  }
341
- function standaloneUrl() {
342
- try {
343
- const p = require2.resolve("ztd-charts/package.json");
344
- const f = join(dirname(p), "dist/standalone.js");
345
- if (!existsSync(f)) return null;
346
- return `data:text/javascript;base64,${readFileSync(f).toString("base64")}`;
347
- } catch {
348
- return null;
354
+ var EMOJI = new RegExp("\\p{Regional_Indicator}{2}|[#*0-9]\\p{Variation_Selector}?\\p{Me}|(?:\\p{Emoji_Presentation}|\\p{Extended_Pictographic}\\p{Variation_Selector})\\p{Emoji_Modifier}?(?:\\p{Join_Control}(?:\\p{Emoji_Presentation}|\\p{Extended_Pictographic}\\p{Variation_Selector}?)\\p{Emoji_Modifier}?)*", "gu");
355
+ function stripEmoji(svg) {
356
+ let removed = 0;
357
+ const out = svg.replace(/(<(?:text|tspan)\b[^>]*>)([^<]+)</g, (whole, open, text) => {
358
+ const t = text.replace(EMOJI, () => {
359
+ removed++;
360
+ return "";
361
+ });
362
+ return t === text ? whole : `${open}${t.replace(/ {2,}/g, " ").trim()}<`;
363
+ });
364
+ return { svg: out, removed };
365
+ }
366
+ function clientScript(type) {
367
+ const here = dirname(fileURLToPath(import.meta.url));
368
+ for (const dir of [join(here, "client"), join(here, "../dist/client")]) {
369
+ const react = join(dir, "react.js");
370
+ const chart = join(dir, `${type}.js`);
371
+ if (existsSync(react) && existsSync(chart)) return `${readFileSync(react, "utf8")}
372
+ ${readFileSync(chart, "utf8")}`;
349
373
  }
374
+ return null;
350
375
  }
351
376
  var FETCH_TIMEOUT_MS = 15e3;
352
377
  var MAX_FETCH_BYTES = 20 * 1024 * 1024;
@@ -407,8 +432,9 @@ async function render(input, opts = {}) {
407
432
  }
408
433
  const format = opts.format ?? "svg";
409
434
  if (format === "html") {
410
- const lib = opts.interactive ? standaloneUrl() : null;
411
- const html = renderSpecToHTML(spec, { width: opts.width, height: opts.height, theme: opts.theme, frame: opts.frame, interactive: lib ? { libraryUrl: lib } : false, locale });
435
+ const type = opts.interactive ? resolveDef(spec.type, spec.encoding)?.type : void 0;
436
+ const script = type ? clientScript(type) : null;
437
+ const html = renderSpecToHTML(spec, { width: opts.width, height: opts.height, theme: opts.theme, frame: opts.frame, interactive: script ? { script } : false, locale });
412
438
  return { format, html };
413
439
  }
414
440
  const svg = renderSpecToSVG(spec, { width: opts.width, height: opts.height, theme: opts.theme, frame: opts.frame, locale });
@@ -416,11 +442,14 @@ async function render(input, opts = {}) {
416
442
  const width = m ? Number(m[1]) : void 0;
417
443
  const height = m ? Number(m[2]) : void 0;
418
444
  if (format === "svg") return { format, svg, width, height };
445
+ return { format, svg, width, height, ...await svgToPng(svg, { scale: opts.scale, fonts: opts.fonts, locale }) };
446
+ }
447
+ async function svgToPng(svg, opts = {}) {
419
448
  const { Resvg } = await import("@resvg/resvg-js");
420
449
  const fontFiles = findFonts(opts.fonts);
421
- const r = new Resvg(svg, { fitTo: { mode: "zoom", value: opts.scale ?? 2 }, font: { fontFiles, loadSystemFonts: true, defaultFontFamily: fontFiles.length ? "Pretendard" : "sans-serif" } });
422
- const png = r.render().asPng();
423
- return { format, svg, png: Buffer.from(png), width, height };
450
+ const plain = stripEmoji(svg);
451
+ const r = new Resvg(plain.svg, { fitTo: { mode: "zoom", value: opts.scale ?? 2 }, font: { fontFiles, loadSystemFonts: true, defaultFontFamily: fontFiles.length ? "Pretendard" : "sans-serif" } });
452
+ return { png: Buffer.from(r.render().asPng()), ...plain.removed ? { notes: [CLI_TEXT[langOf(opts.locale)].emojiRemoved(plain.removed)] } : {} };
424
453
  }
425
454
  function isHttpUrl(source) {
426
455
  return /^https?:\/\//i.test(source);
@@ -452,10 +481,12 @@ export {
452
481
  reactSnippet,
453
482
  specSnippet,
454
483
  findFonts,
484
+ stripEmoji,
455
485
  FETCH_TIMEOUT_MS,
456
486
  MAX_FETCH_BYTES,
457
487
  fetchUrl,
458
488
  render,
489
+ svgToPng,
459
490
  isHttpUrl,
460
491
  loadRows,
461
492
  suggest
package/dist/cli.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  resolveType,
14
14
  suggest,
15
15
  validate
16
- } from "./chunk-LVCEIXBR.js";
16
+ } from "./chunk-4K4P2AWW.js";
17
17
 
18
18
  // src/cli.ts
19
19
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -202,6 +202,7 @@ ${info.react}`);
202
202
  if (format === "png") writeFileSync(target, res.png);
203
203
  else writeFileSync(target, format === "html" ? res.html : res.svg);
204
204
  out(t.saved(`${target}${res.width ? ` (${res.width}\xD7${res.height}${format === "png" ? ` @${scale ?? 2}x` : ""})` : ""}`));
205
+ for (const n of res.notes ?? []) out(`! ${n}`);
205
206
  return;
206
207
  }
207
208
  case "init": {
@@ -0,0 +1,28 @@
1
+ (()=>{var Qa=Object.create;var wr=Object.defineProperty;var ei=Object.getOwnPropertyDescriptor;var ti=Object.getOwnPropertyNames;var ni=Object.getPrototypeOf,ri=Object.prototype.hasOwnProperty;var bn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var oi=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ti(t))!ri.call(e,o)&&o!==n&&wr(e,o,{get:()=>t[o],enumerable:!(r=ei(t,o))||r.enumerable});return e};var D=(e,t,n)=>(n=e!=null?Qa(ni(e)):{},oi(t||!e||!e.__esModule?wr(n,"default",{value:e,enumerable:!0}):n,e));var re=bn((yl,vr)=>{vr.exports=globalThis.__ztdReact.react});var $r=bn((xl,Cr)=>{Cr.exports=globalThis.__ztdReact["react-dom/client"]});var V=bn((Fl,Yr)=>{Yr.exports=globalThis.__ztdReact["react/jsx-runtime"]});var nr=D(re(),1),_a=D($r(),1);var Nt=D(re(),1);var Wt=D(re(),1);var Mr=D(re(),1),Pt=(0,Mr.createContext)(void 0);var si=D(re(),1);var ai=["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],Tr='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',Sr='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',Xe={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:Tr,monoFamily:Sr,radius:18,radiusCode:14,radiusMark:4},ii={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:Tr,monoFamily:Sr,radius:18,radiusCode:14,radiusMark:4},yn={dark:Xe,light:ii};function xn(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function kn(e){let t={};for(let n of ai){let r=e[n];typeof r=="string"&&(t[xn(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 wn(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 li=`
2
+ .ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
3
+ .ztd-root:focus{outline:none}
4
+ .ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${Xe.accent});outline-offset:3px;border-radius:6px}
5
+ .ztd-svg{display:block;overflow:visible;user-select:none;-webkit-user-select:none}
6
+ .ztd-mark{transition:opacity .18s ease,fill .18s ease,stroke .18s ease,stroke-width .18s ease}
7
+ .ztd-tip{animation:ztd-fade .14s ease-out;transition:left .2s cubic-bezier(.22,1,.36,1),top .2s cubic-bezier(.22,1,.36,1)}
8
+ .ztd-guide{transition:transform .2s cubic-bezier(.22,1,.36,1)}
9
+ .ztd-still .ztd-tip,.ztd-still .ztd-guide{transition:none;animation:none}
10
+ .ztd-btn{appearance:none;font:inherit;cursor:pointer;transition:background .14s,color .14s,border-color .14s}
11
+ .ztd-btn:focus{outline:none}
12
+ .ztd-btn:focus-visible{outline:2px solid var(--ztd-accent,${Xe.accent});outline-offset:2px}
13
+ .ztd-card{transition:border-color .16s ease}
14
+ .ztd-card:hover{border-color:var(--ztd-dim,${Xe.dim})}
15
+ @media (prefers-reduced-motion: reduce){.ztd-mark,.ztd-tip,.ztd-guide,.ztd-btn,.ztd-card{transition:none;animation:none}}
16
+ @keyframes ztd-pop{from{opacity:0;transform:scale(.45)}to{opacity:1;transform:none}}
17
+ @keyframes ztd-fade{from{opacity:0}to{opacity:1}}
18
+ .ztd-pop{transform-box:fill-box;transform-origin:center}
19
+ @keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
20
+ .ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
21
+ @media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
22
+ `;var Ar=!1;function kt(){if(Ar||typeof document>"u"||(Ar=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=li,document.head.appendChild(e)}var Dt=D(re(),1),ze=typeof window<"u"&&typeof document<"u",De=ze?Dt.useLayoutEffect:Dt.useEffect;function Lt(){return typeof performance<"u"?performance.now():Date.now()}var Le=D(re(),1),ui=(0,Le.createContext)(void 0),Et=new Map;function ci(e,t){let n=Et.get(e);return n||Et.set(e,n=new Set),n.add(t),()=>{n.delete(t),n.size||Et.delete(e)}}function mi(e,t,n){Et.get(e)?.forEach(r=>r(t,n))}function di(e,t,n){let r=e.indexOf(n.key);return r>=0||t.length>1e3?r:t.indexOf(n.label)}function Nr(e,t,n,r){let o=(0,Le.useContext)(ui),a=t??o,[i]=(0,Le.useState)(()=>({})),s=(0,Le.useRef)({keys:n,labels:r});s.current={keys:n,labels:r},e.publish.current=a?u=>mi(a,u===null||s.current.keys[u]===void 0?null:{key:s.current.keys[u],label:s.current.labels[u]},i):null;let l=e.applySync;(0,Le.useEffect)(()=>{if(a)return ci(a,(u,d)=>{if(d===i)return;let c=u?di(s.current.keys,s.current.labels,u):-1;l(c<0?null:c)})},[a,i,l])}function le(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function He(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var Rr={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},Fr={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var fi=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],hi={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function gi(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function pi(e){return gi(fi,e)}function Pr(e,t){let n=pi(e);return{text:n?n[t]:e,...hi[n?.id??"basic"]}}var Ae=D(re(),1);var Br=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),ce="en-US",Dr=new Map;function vn(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=Dr.get(r);return o||(o=new Intl.NumberFormat(e,n),Dr.set(r,o)),o}function Cn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function qe(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ce,...r}=t;return Cn(vn(n,r).format(e))}var $n=e=>e!==0&&Math.abs(e)<.05,Mn=(e,t,n="")=>`${qe(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function _t(e,t={}){if(!Number.isFinite(e))return"-";if($n(e)&&t.maximumFractionDigits===void 0)return Mn(e,t.locale??ce,"%");let n=Math.abs(e);return`${qe(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Or(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ce,...r}=t;if(le(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],u=o/s,d=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||u<100?1:0)),c=Math.round(u*10**d)/10**d;if(i>0&&c>=a[i-1][0]/s){i--;continue}return(e<0&&c!==0?"-":"")+qe(c,{locale:n,...r,maximumFractionDigits:d})+l}}return Cn(vn(n,{notation:"compact",...r}).format(e))}var bi=(e,t=le(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function wt(e,t=ce,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=vn(t,o);return l=>Number.isFinite(l)?`${i}${Cn(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=>_t(o,{locale:t});case"ratio":return o=>_t(o*100,{locale:t});case"compact":return o=>Or(o,{locale:t});case"currency":return r(bi(t));default:{let o=r({maximumFractionDigits:1});return a=>$n(a)?Mn(a,t):o(a)}}}function Tn(e,t=ce,n=0){return e!==void 0?wt(e,t):n>=1e5?r=>$n(r)?Mn(r,t):Or(r,{locale:t}):r=>qe(r,{locale:t})}function yi(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Sn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,xi=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,ki=["january","february","march","april","may","june","july","august","september","october","november","december"],Lr=e=>{let t=e.toLowerCase();return t.length<3?0:ki.findIndex(n=>n.startsWith(t))+1},Er=e=>+e+(+e<30?2e3:1900);function Ir(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var wi=[/^(\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})일)?$/],zr=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Hr=/\{([^{}]+)\}/g;function Bt(e,t){let n;for(let r of wi)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?[Er(n[3]),+n[2],+n[1],1]:[Er(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=zr.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=Lr(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=Lr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Vr=e=>xi.test(e)||Bt(e)!==null;function jr(e){let t;for(let n of e){let r=typeof n=="string"?zr.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function Ot(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(Sn(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return Ot(`${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 yi(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 _r=new Map;function vt(e,t={month:"short",day:"numeric"}){let n=Ot(e);if(!n)return"-";let{locale:r=ce,...o}=t,a=r+JSON.stringify(o),i=_r.get(a);return i||(i=new Intl.DateTimeFormat(r,o),_r.set(a,i)),i.format(n)}var Wr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function mt(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Wr[t.toLowerCase()]&&(t=Wr[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 Ur(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 Nn(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 dt(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Kr(e){return .2126*dt(e[0])+.7152*dt(e[1])+.0722*dt(e[2])}function Rn(e,t,n){let r=typeof e=="string"?mt(e):e,o=typeof t=="string"?mt(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?mt(n):n:null;o[3]<1&&a&&(o=Nn(o,a));let i=r[3]<1?Nn(r,o):r,s=Kr(i),l=Kr(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function vi(e){return[dt(e[0]),dt(e[1]),dt(e[2])]}function An(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 Gr(e){let[t,n,r]=vi(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 Ci([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[An(4.0767416621*o-3.3077115913*a+.2309699292*i),An(-1.2684380046*o+2.6097574011*a-.3413193965*i),An(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function It(e,t,n){let r=mt(e),o=mt(t);if(!r||!o)return e;let a=Gr(r),i=Gr(o),s=Math.max(0,Math.min(1,n));return Ur(Ci([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 Fn(e,t,n){let r=t[0],o=-1;for(let a of t){let i=Rn(a,e,n);i>o&&(o=i,r=a)}return r}var Pn=D(V(),1),zt=(0,Ae.createContext)({theme:Xe,cssVars:!0});function $i(e,t=Xe){return e?typeof e=="string"?yn[e]??t:wn(t,e):t}function Vt(e){let t=(0,Ae.useContext)(zt),n=e.base?yn[e.base]:t.theme,r=(0,Ae.useMemo)(()=>$i(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,Ae.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,Ae.useMemo)(()=>kn(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Pn.jsx)(zt.Provider,{value:i,children:(0,Pn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Mi=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Ht(e){return Mi.has(e)}function Ti(e,t){let n=r=>t?`var(${xn(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Ht(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Ht(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 Ve(e){let t=(0,Ae.useContext)(zt);return(0,Ae.useMemo)(()=>{let n=wn(t.theme,e);return Ti(n,t.cssVars)},[t.theme,t.cssVars,e])}function Ne(e){let t=(0,Ae.useContext)(zt);return e??t.locale??ce}function Xr(e){return e?kn(e):{}}var jt=D(re(),1),Dn=(0,jt.createContext)(void 0);function qr(e){let t=(0,jt.useContext)(Dn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var N=D(V(),1),Si={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`},Ai={en:Si,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Ni={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Ln=e=>Ai[le(Ne(e))];function En(e){let t=Ve(e.theme),n=Ln(e.locale),[r,o]=(0,Wt.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(d=>!s.has(d.label)).length,u=(0,N.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((d,c)=>{let m=!s.has(d.label),h=m&&l===1,f=(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(Ri,{p:t,item:d,off:!m}),(0,N.jsx)("span",{style:m?void 0:{textDecoration:"line-through"},children:d.label})]});return(0,N.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,N.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":m,"aria-disabled":h||void 0,onClick:()=>{h||(i(d.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:h?"default":void 0},children:f}):f},c)})});return i?(0,N.jsxs)(N.Fragment,{children:[u,(0,N.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Ni,children:r?n.shown(l,e.items.length):""})]}):u}function Ri({p:e,item:t,off:n}){let r=t.color?Ht(t.color)?e.paint(t.color):t.color:e.paint("neutral"),o=t.shape??"square";return o==="line"||o==="dash"?(0,N.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,N.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,N.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,N.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 Fi(e){let t=Ve(e.theme),n=Pr(e.level,le(Ne(e.locale)));return(0,N.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 Pi(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,N.jsxs)(N.Fragment,{children:[e.slice(0,r),(0,N.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function Zr(e){let t=Ve(e.theme),n=Ln(e.locale),[r,o]=(0,Wt.useState)(0);De(()=>kt(),[]);let a=()=>{o(m=>m+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,N.jsx)(En,{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,u=e.replay||e.onReplay,d=e.source!==void 0||e.note!==void 0?(0,N.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,c=e.takeaway!==void 0||e.level||e.sample?(0,N.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,N.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,N.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,N.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,N.jsx)(Fi,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,N.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,N.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,N.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,N.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:Pi(e.title,e.accent,t.paint("accentText"))}),e.actions,u?(0,N.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,N.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,N.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,N.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,N.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,N.jsx)("span",{}),i]}):null]}),(0,N.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,N.jsx)(Dn.Provider,{value:r,children:(0,N.jsx)(Pt.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),d?(0,N.jsxs)(N.Fragment,{children:[d,c]}):c]})}function _n(e){let t=Ve(e.theme),n=Ln(e.locale),r=e.height??220;if(De(()=>kt(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,N.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,N.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,N.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,N.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,N.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,N.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,N.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,N.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,N.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,N.jsx)(N.Fragment,{children:e.children})}function Ze(e,t,n,r,o="max"){let a=new Set,i=n.length,s=u=>{if(i&&u!=="none"){if(u==="first")a.add(0);else if(u==="last")a.add(i-1);else if(u==="max"||u==="min"){let d=-1,c=u==="max"?-1/0:1/0;r.forEach((m,h)=>{Number.isFinite(m)&&(u==="max"?m>c:m<c)&&(c=m,d=h)}),d>=0&&a.add(d)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((u,d)=>{d<i&&u!==null&&u!==void 0&&e(u,d)&&a.add(d)}),a;let l=Array.isArray(e)?e:[e];for(let u of l)typeof u=="number"?u>=0&&u<i&&a.add(u):u==="max"||u==="min"||u==="first"||u==="last"||u==="none"?s(u):n.forEach((d,c)=>{d===u&&a.add(c)});return a}function ye(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 Di(e,t){let n=Fn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Rn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):Fn(t,["#FFFFFF","#000000"])}function Jr(e,t){let n=It(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Di(e,n),raw:n}}function Bn(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=ye(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=ye(e,"neutral");else if(s===0)r[i]=ye(e,"ink");else if(s===a-1)r[i]=ye(e,"neutral");else if(a===3)r[i]=ye(e,"strong");else{let l=(s-1)/Math.max(1,a-2);r[i]=l<=.001?ye(e,"strong"):Jr(e,1-l)}}),r}function Ct(e,t){let n=new Array(e),r=[];for(let a=0;a<e;a++)t.has(a)?n[a]="accent":r.push(a);let o=r.length;return r.forEach((a,i)=>{o===1?n[a]="neutral":i===0?n[a]="ink":i===o-1?n[a]="neutral":n[a]="neutralStrong"}),n}function Qr(e,t){return Ct(e+1,t).slice(0,e)}function eo(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=ye(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=ye(e,"neutral"):s===0?r[i]=ye(e,"strong"):s===a-1?r[i]=ye(e,"neutral"):r[i]=Jr(e,1-s/(a-1))}),r}function to(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Li(e,t){if(e==null||typeof e!="object")return;let n=e;if(to(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!to(r,o))return;r=r[o]}return r}}function je(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 ft(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Li(r,n)}function $t(e,t){let n=ft(e,t);return(r,o)=>je(n(r,o))}function Kt(e,t){let n=ft(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 Je(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}var Ce=D(re(),1);function Ei(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let u=e[l];if(u==='"')n=!n;else if(!n&&(u===`
23
+ `||u==="\r"))break;t.push(n?"":u)}let r=t.join(""),o=l=>r.split(l).length-1,a=[","," ",";","|"],i=",",s=0;for(let l of a){let u=o(l);u>s&&(s=u,i=l)}return i}var _i=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function no(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(_i.test(t)||/^[-+]?\.\d+$/.test(t)){let n=je(t);if(Number.isFinite(n))return n}return t}function it(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??Ei(o),i=[],s=[],l="",u=!1;for(let f=0;f<o.length;f++){let p=o[f];u?p==='"'?o[f+1]==='"'?(l+='"',f++):u=!1:l+=p:p==='"'&&!l.trim()?(u=!0,l=""):p===a?(s.push(l),l=""):p===`
24
+ `||p==="\r"?(p==="\r"&&o[f+1]===`
25
+ `&&f++,s.push(l),i.push(s),s=[],l=""):l+=p}(l!==""||s.length)&&(s.push(l),i.push(s));let d=i.filter(f=>!(f.length===1&&f[0].trim()===""));if(!d.length)return[];let c=f=>n?no(f):f;if(!r)return d.map(f=>Object.fromEntries(f.map((p,k)=>[String(k),c(p)])));let m=[],h=new Set;return d[0].forEach((f,p)=>{let k=f.trim()||`col${p+1}`,C=k;for(let $=2;h.has(C);$++)C=`${k}_${$}`;h.add(C),m.push(C)}),d.slice(1).map(f=>Object.fromEntries(m.map((p,k)=>[p,c(f[k]??"")])))}function On(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"?no(i[l]):i[l]??null])))}function Bi(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(u=>[u,e[u][l]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function ro(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 Qe(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Qe(JSON.parse(t))}catch{}return it(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?On(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)?Qe(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?On(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)?Qe(t.rows):Array.isArray(t.values)?On(t.values):Array.isArray(t.items)?Qe(t.items):Array.isArray(t.results)?Qe(t.results):Bi(t)}return[]}function oo(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 ao(e,t){let n=e.length;if(t>=n||t<3)return e.slice();let r=[e[0]],o=(n-2)/(t-2),a=0;for(let i=0;i<t-2;i++){let s=Math.floor((i+1)*o)+1,l=Math.min(Math.floor((i+2)*o)+1,n),u=0,d=0;for(let k=s;k<l;k++)u+=e[k].x,d+=e[k].y;let c=Math.max(1,l-s);u/=c,d/=c;let m=Math.floor(i*o)+1,h=Math.floor((i+1)*o)+1,f=m,p=-1;for(let k=m;k<h;k++){let C=Math.abs((e[a].x-u)*(e[k].y-e[a].y)-(e[a].x-e[k].x)*(d-e[a].y));C>p&&(p=C,f=k)}r.push(e[f]),a=f}return r.push(e[n-1]),r}async function Oi(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(le(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return it(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 it(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):it(a)}async function Ii(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 Oi(a,t.parse,o,t.locale)}return t.select&&(r=ro(r,t.select)),t.transform?t.transform(r):Qe(r)}function io(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,Ce.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,Ce.useState)(0),u=Ne(t.locale),d=(0,Ce.useRef)(t);d.current={...t,locale:u};let c=(0,Ce.useRef)(e);c.current=e;let m=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],f=JSON.stringify(h.map(C=>typeof C=="object"?JSON.stringify(C):String(C))),p=(0,Ce.useRef)(!1);(0,Ce.useEffect)(()=>{let C=c.current;if(!C||!r){i(b=>b.status==="loading"?{...b,status:"idle"}:b);return}let $=new AbortController,B=!0;return p.current=!0,i(b=>({...b,data:o?b.data:[],status:"loading",error:null})),Ii(C,{...d.current,signal:$.signal}).then(b=>{B&&i({data:b,status:"success",error:null,updatedAt:Date.now()})}).catch(b=>{!B||$.signal.aborted||i(R=>({...R,status:"error",error:b instanceof Error?b:new Error(String(b))}))}).finally(()=>{B&&(p.current=!1)}),()=>{B=!1,p.current=!1,$.abort()}},[m,r,s,f,o]),(0,Ce.useEffect)(()=>{if(!n||!r)return;let C=setInterval(()=>{p.current||l($=>$+1)},n);return()=>clearInterval(C)},[n,r]);let k=(0,Ce.useCallback)(()=>l(C=>C+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:k}}var zn=D(V(),1),zi=["csv","svg","png"],Hi=/^[=+\-@\t\r\n=+-@]/,Vi=/var\(|color-mix\(/;function so(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?Ir(e.getTime()):String(e);return`"${(Hi.test(t)&&!Number.isFinite(je(t))?`'${t}`:t).replace(/"/g,'""')}"`}function ji(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Wi(e,t){return`\uFEFF${[t.map(so),...e.map(r=>t.map(o=>so(r[o])))].map(r=>r.join(",")).join(`\r
26
+ `)}\r
27
+ `}function Ki(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function In(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var lo=2,et=16;function uo(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 co(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 mo(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+et*2,i+et*2],u=o.cloneNode(!0),d=u.querySelectorAll("*"),c=new Map;o.querySelectorAll("*").forEach((f,p)=>{let k;for(let C of Array.from(f.attributes)){if(!Vi.test(C.value))continue;let $=(k??(k=getComputedStyle(f))).getPropertyValue(C.name);$&&d[p].setAttribute(C.name,uo($,c))}}),u.removeAttribute("style");for(let[f,p]of Object.entries({viewBox:`${-et} ${-et} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))u.setAttribute(f,String(p));let m=uo(getComputedStyle(r).backgroundColor,c),h=o.parentElement?.querySelector("canvas")??null;if(n){let f=u.querySelector("desc")?.nextSibling??u.firstChild;u.insertBefore(co("rect",{x:-et,y:-et,width:s,height:l,fill:m}),f),h&&u.insertBefore(co("image",{href:h.toDataURL(),width:a,height:i}),f)}return{svg:new XMLSerializer().serializeToString(u),w:s,h:l,vw:a,vh:i,bg:m,canvas:h}}function Gi(e,t){let n=mo(e,lo,!1);if(!n)return;let r=lo,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,et*r,et*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&&In(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function fo(e){let t=Ve(e.theme),n=le(Ne(e.locale))==="ko",r=Ki(e.filename),o=(a,i)=>{if(a==="csv")return In(new Blob([Wi(e.data,e.columns?.length?e.columns:ji(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return Gi(i,r);let s=mo(i,1,!0);s&&In(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,zn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:zi.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 go=D(V(),1);function ho(e,t=ce){let n=wt(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?vt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,u=s.replace(Hr,(d,c)=>o(a,c.trim())??(l=!0,""));l||i.push(u)}return i.length?i.map((s,l)=>(0,go.jsx)("div",{children:s},l)):null}}var v=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),Re=v("label","string",!0,"Item name field"),fe=v("value","number",!0,"Value field"),Ui=[Re,fe],Yi=[Re,fe],Xi=[v("label","string",!0,"Stage name"),v("value","number",!0,"Users at the stage")],qi=[Re,fe],Zi=[v("label","string",!0,"Leaf (lowest level) name"),fe,v("group","string",!1,"Parent group field")],Ji=[v("label","string",!0,"Leaf name"),fe,v("group","string",!1,"Parent group field")],Qi=[Re,v("value","number",!0,"Change (total rows may omit it)"),v("type","string",!1,'"total" makes a total bar')],es=[Re,fe],ts=[v("x","string",!0,"Column field"),v("series","string",!0,"Stacked series field"),fe],ns=[v("x","string",!0,"Column field"),v("y","string",!0,"Row field"),fe],rs=[v("axis","string",!0,"Metric (axis) field"),v("value","number",!0,"Value field",{multi:!0}),v("series","string",!1,"Series field")],os=[v("x","number",!0,"x value"),v("y","number",!0,"y value"),v("size","number",!1,"Circle size"),v("label","string",!1,"Name")],bo=v("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),as=[v("x","any",!0,"x field (date, number or category)"),v("y","number",!0,"y field. An array for wide tables",{multi:!0}),v("series","string",!1,"Series field (long tables)"),v("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),bo],is=[v("x","any",!0,"x field"),v("y","number",!0,"y field. An array for wide tables",{multi:!0}),v("series","string",!1,"Series field"),v("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}),bo],ss=[v("x","any",!0,"x field"),v("y","number",!0,"y field",{multi:!0}),v("series","string",!1,"Series field")],ls=[v("x","string",!0,"Category field"),v("y","number",!0,"Value field. An array for wide tables",{multi:!0}),v("series","string",!1,"Series field"),v("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})],us=[Re,fe],cs=[v("value","number",!0,"Value field",{prop:"valueKey"}),v("target","number",!1,"Target field",{prop:"targetKey"})],ms=[Re,v("value","number",!0,"Actual value field"),v("target","number",!1,"Target field")],ds=[v("x","any",!1,"x field"),v("y","number",!0,"y field")],fs=[Re,v("x","string",!1,"Period field (long tables)"),v("value","number",!1,"Value field (long tables)")],hs=[Re,v("start","number",!0,"Before value"),v("end","number",!0,"After value")],gs=[Re,fe],ps=[v("value","number",!0,"Value field"),v("group","string",!1,"Group (row) field"),v("label","string",!1,"Dot name")],bs=[v("group","string",!0,"Group field"),v("value","number",!0,"Value field")],ys=[v("source","string",!0,"Source node"),v("target","string",!0,"Target node"),fe],xs=[v("source","string",!0,"Sending group"),v("target","string",!0,"Receiving group"),fe],ks=[v("date","date",!0,"Date field"),fe],ws=[v("x","any",!0,"Period field"),v("series","string",!0,"Item field"),v("rank","number",!1,"Rank field (1 is first)"),v("value","number",!1,"Value field (instead of rank, largest is first)")],vs=[v("group","string",!0,"Group field"),v("value","number",!0,"Value field")],Cs=[v("label","string",!1,"Row name field")],$s=[v("x","date",!0,"Date (period) field"),v("open","number",!0,"Open price field"),v("high","number",!0,"High price field"),v("low","number",!0,"Low price field"),v("close","number",!0,"Close price field"),v("volume","number",!1,"Volume field")],Ms=[Re,fe],Ts=[v("x","any",!0,"Period field (date or category)"),v("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),v("series","string",!1,"Series field (long tables, back row only)"),v("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Ss=[v("value","number",!1,"Sample value field (raw rows)"),v("group","string",!1,"Group field. Up to 2 groups overlap"),v("x0","number",!1,"Bin start (pre-binned rows)"),v("x1","number",!1,"Bin end (pre-binned rows)"),v("count","number",!1,"Samples in the bin (pre-binned rows)")],As=[v("x","number",!0,"x value"),v("y","number",!0,"y value"),v("series","string",!1,"Series field (one color per series)"),v("label","string",!1,"Name")],po={pie:Ui,donut:Yi,funnel:Xi,waffle:qi,treemap:Zi,sunburst:Ji,waterfall:Qi,pareto:es,marimekko:ts,heatmap:ns,radar:rs,bubble:os,line:as,area:is,stream:ss,bar:ls,radialBar:us,gauge:cs,bullet:ms,sparkline:ds,slope:fs,dumbbell:hs,lollipop:gs,beeswarm:ps,ridgeline:bs,sankey:ys,chord:xs,calendar:ks,bump:ws,box:vs,parallel:Cs,candlestick:$s,segmented:Ms,skyline:Ts,histogram:Ss,scatter:As},ht={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:"산점도"}};function yo(e,t){return t==="ko"?e.nameKo:e.name}function xo(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Hn=["line","area","bar","scatter"];function Vn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"?[].concat(t.line??[]).map(String):[]}function ko(e,t,n){return Hn.includes(e)&&!Vn(e,t,n).length}function wo(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Ns={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"};function Gt(e){let t=po[e]?e:Ns[e]??Object.keys(ht).find(n=>n.toLowerCase()===e.toLowerCase()||ht[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!ht[t]))return{type:t,component:ht[t].component,name:ht[t].name,nameKo:ht[t].nameKo,encoding:po[t]}}function vo(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 Gt(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]}var Rs=Math.PI*2;function Co(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function I(e){return Math.round(e*100)/100}function $o(e,t=!0){let n=e.length;if(!n)return"";let r=l=>`${t?"M":"L"}${I(l[0])},${I(l[1])}`;if(n<3)return r(e[0])+e.slice(1).map(l=>`L${I(l[0])},${I(l[1])}`).join("");let o=[],a=[];for(let l=0;l<n-1;l++){let u=e[l+1][0]-e[l][0];o.push(u),a.push(u===0?0:(e[l+1][1]-e[l][1])/u)}let i=[a[0]];for(let l=1;l<n-1;l++)if(a[l-1]*a[l]<=0)i.push(0);else{let u=2*o[l]+o[l-1],d=o[l]+2*o[l-1];i.push((u+d)/(u/a[l-1]+d/a[l]))}i.push(a[n-2]);let s=r(e[0]);for(let l=0;l<n-1;l++){let u=o[l]/3;s+=`C${I(e[l][0]+u)},${I(e[l][1]+i[l]*u)} ${I(e[l+1][0]-u)},${I(e[l+1][1]-i[l+1]*u)} ${I(e[l+1][0])},${I(e[l+1][1])}`}return s}function Ut(e,t="smooth"){if(!e.length)return"";if(t==="smooth")return $o(e);if(t==="step"){let n=`M${I(e[0][0])},${I(e[0][1])}`;for(let r=1;r<e.length;r++){let o=(e[r-1][0]+e[r][0])/2;n+=`H${I(o)}V${I(e[r][1])}H${I(e[r][0])}`}return n}return Fs(e)}function Fs(e){if(!e.length)return"";let t=`M${I(e[0][0])},${I(e[0][1])}`;for(let n=1;n<e.length;n++)t+=`L${I(e[n][0])},${I(e[n][1])}`;return t}function Yt(e,t,n="smooth"){if(!e.length)return"";let r=[...t].reverse(),o=Ut(e,n),a;return n==="smooth"?a=$o(r.map(i=>[i[0],i[1]]),!1):n==="step"?a=Ut(r,"step").replace(/^M/,"L"):a=r.map(i=>`L${I(i[0])},${I(i[1])}`).join(""),`${o}${a}Z`}function Xt(e,t){let n=0,r=e.length-1;if(r<0)return-1;for(;r-n>1;){let o=n+r>>1;e[o]<t?n=o:r=o}return Math.abs(e[n]-t)<=Math.abs(e[r]-t)?n:r}function Mo(e){let t=e.length,n=e.reduce((l,u)=>l+u.x,0)/t,r=e.reduce((l,u)=>l+u.y,0)/t,o=0,a=0,i=0;for(let l of e)o+=(l.x-n)*(l.y-r),a+=(l.x-n)**2,i+=(l.y-r)**2;let s=a?o/a:0;return{slope:s,r2:a&&i?o*o/(a*i):0,at:l=>r+s*(l-n)}}function To(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 it(t.csv)}return null}var te=D(re(),1);var xe=D(re(),1);var j=D(V(),1),qt=60,jn=8;function So(e,t){return e.length>jn?[...e.slice(0,jn),{label:t(e.length-jn),value:""}]:e}var Ao={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function No(e){let{c:t,events:n}=e,r=(0,xe.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,De(()=>{kt()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,xe.useContext)(Pt),u=e.ariaLabel??l??e.kind,d=(0,xe.useMemo)(()=>s?`${n.length}${n.slice(0,qt).map(x=>`${x.label}${x.series??""}${x.formatted??x.value??""}`).join("")}`:"",[n,s]),c=(0,xe.useMemo)(()=>(0,j.jsx)(Ps,{label:u,events:n,t:t.t}),[u,d,t.t]),m=(0,xe.useRef)(null);(0,xe.useEffect)(()=>{let x=()=>{m.current=null};return window.addEventListener("scroll",x,{capture:!0,passive:!0}),window.addEventListener("resize",x,{passive:!0}),()=>{window.removeEventListener("scroll",x,{capture:!0}),window.removeEventListener("resize",x)}},[]),(0,xe.useEffect)(()=>{m.current=null},[t.width,t.height]);let h=x=>{if(x.target!==x.currentTarget)return;if(e.onKey?.(x)){x.preventDefault();return}let A=t.active,L;switch(x.key){case"ArrowRight":case"ArrowDown":L=A===null?0:(A+1)%i;break;case"ArrowLeft":case"ArrowUp":L=A===null?i-1:(A-1+i)%i;break;case"Home":L=0;break;case"End":L=i-1;break;case"Escape":if(A===null)return;L=null;break;case"Enter":case" ":A!==null&&(x.preventDefault(),t.click(A));return;default:return}x.preventDefault(),t.setActive(L,"keyboard")},{via:f,node:p,setActive:k}=t;(0,xe.useEffect)(()=>{if(f!=="touch"||!p)return;let x=A=>{p.contains(A.target)||k(null)};return document.addEventListener("pointerdown",x),()=>document.removeEventListener("pointerdown",x)},[f,p,k]);let C=t.active!==null?n[t.active]:null,$=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,B=$&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,b=typeof e.renderTip=="function"&&C?e.renderTip(C):null,R=e.announce??(t.via==="keyboard"&&C?`${C.label}${C.series?` ${C.series}`:""}: ${C.formatted??C.value??""} (${(t.active??0)+1}/${i})`:""),X;if($){let x=$.x*B,A=t.width*B,L=`clamp(${(4-x).toFixed(1)}px, -50%, calc(${(A-x-4).toFixed(1)}px - 100%))`,Y=$.y<64;X={position:"absolute",left:x,top:$.y*B,transform:`translate(${L}, ${Y?"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*B-8)}}let z=x=>{m.current=null,x.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},Z=x=>x?A=>{let L=m.current??(m.current=A.currentTarget.getBoundingClientRect());L.width&&x((A.clientX-L.left)/L.width*t.width,(A.clientY-L.top)/L.height*t.height,A)}:void 0,U=Z(e.onPointerMove),G=Z(e.onPointerDown),P=U||G?x=>{x.pointerType==="touch"&&U?.(x),G?.(x)}:void 0,E=Z(e.onPointerUp),S=Xr(e.theme);return(0,j.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":u,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?h:void 0,onBlur:x=>{t.via==="keyboard"&&!x.currentTarget.contains(x.relatedTarget)&&t.setActive(null)},onPointerLeave:z,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"),...S,...e.style},children:[t.pending?null:e.underlay,(0,j.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:U,onPointerDown:P,onPointerUp:E,onPointerCancel:E,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,j.jsx)("title",{id:o,children:u}),(0,j.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,j.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,$?(0,j.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:X,children:b??(0,j.jsxs)(j.Fragment,{children:[(0,j.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((x,A)=>(0,j.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,j.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(x.strong?"ink":"muted")},children:[x.color?(0,j.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:x.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,x.label]}),(0,j.jsx)("span",{style:{fontWeight:x.strong===!1?500:700},children:x.value})]},A))]})}):null,(0,j.jsx)("span",{className:"ztd-sr",style:Ao,"aria-live":"polite","aria-atomic":"true",children:R}),s&&!t.pending?c:null]})}function Ps({label:e,events:t,t:n}){return(0,j.jsx)("div",{className:"ztd-sr",style:Ao,children:(0,j.jsxs)("table",{children:[(0,j.jsx)("caption",{children:n.table(e)}),(0,j.jsxs)("tbody",{children:[t.slice(0,qt).map((r,o)=>(0,j.jsxs)("tr",{children:[(0,j.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,j.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>qt?(0,j.jsx)("tr",{children:(0,j.jsx)("td",{colSpan:2,children:n.more(t.length-qt)})}):null]})]})})}function he(e){let t=e.baseline??"central";return(0,j.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})}function Fo(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function Ro(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 ue(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 u=r.charCodeAt(l);Fo(u)?i+=Ro(u):s+=Ro(u)}a=i+s*(n>=600?1.07:1),Zt.size>5e3&&Zt.clear(),Zt.set(o,a)}return a*t}function Ee(e,t,n,r=400){if(e=e.trim(),ue(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let l=a+i+1>>1;ue(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<(Fo(s.charCodeAt(0))?2:3)?"":s+o}function Po(e,t,n=-1/0,r=1/0){let o=e.map((s,l)=>({y:s,i:l})).sort((s,l)=>s.y-l.y),a=new Array(e.length),i=o.map(s=>Math.max(n,Math.min(r,s.y)));for(let s=0;s<30;s++){let l=!1;for(let u=1;u<i.length;u++){let d=i[u]-i[u-1];if(d<t){let c=(t-d)/2;i[u-1]-=c,i[u]+=c,l=!0}}for(let u=0;u<i.length;u++)i[u]=Math.max(n,Math.min(r,i[u]));if(!l)break}for(let s=1;s<i.length;s++)i[s]-i[s-1]<t&&(i[s]=i[s-1]+t);if(i.length&&i[i.length-1]>r){let s=i[i.length-1]-r;for(let l=0;l<i.length;l++)i[l]-=s}return o.forEach((s,l)=>{a[s.i]=i[l]}),a}var ge=D(V(),1),We=10.5;function Do(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=>qe(i,{locale:n,maximumFractionDigits:a}))}function Lo(e,t,n){let r=18;for(let o of Do(e,t,n))r=Math.max(r,ue(o,We));return Math.ceil(r+8)}function Eo(e){let{p:t,ticks:n,y:r,x0:o,x1:a,fmt:i}=e,s=e.side==="right",l=e.labels===!1?null:Do(n,i,e.locale);return(0,ge.jsx)("g",{"aria-hidden":"true",opacity:e.opacity,children:n.map((u,d)=>{let c=Math.round(r(u))+.5,m=u===0&&e.zero!==!1;return(0,ge.jsxs)("g",{children:[(0,ge.jsx)("line",{x1:o,x2:a,y1:c,y2:c,stroke:t.paint(m?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:m?.7:1}),l?(0,ge.jsx)(he,{x:s?a+6:o-6,y:c,anchor:s?"start":"end",size:We,fill:t.paint("muted"),children:l[d]}):null]},u)})})}function _o(e,t,n){let r=[],o=-1/0;for(let a of e){let i=ue(a.label,We),s=Math.max(a.x-i/2,0);s<o+8||a.x-i/2<t||a.x+i/2>n||(r.push(a),o=s+i)}return r}function Wn(e,t,n=We,r=8,o=400,a){let i=t.length;if(i<=1)return t.map((c,m)=>m);let s=t.map(c=>ue(c,n,o)),l=(c,m)=>Math.abs(e[m]-e[c])<(s[c]+s[m])/2+r,u=[];for(let c of a??[])u.some(m=>l(m,c))||u.push(c);let d=c=>!u.some(m=>l(m,c));for(let c=1;c<=i;c++){let m=u.slice();for(let h=0;h<i;h+=c)d(h)&&m.push(h);if(c>1&&(i-1)%c>c/2&&d(i-1)&&m.push(i-1),m.sort((h,f)=>h-f),m.every((h,f)=>!f||!l(m[f-1],h)))return m}return[0,i-1]}var Jt=e=>Math.round(e*10)/10;function Bo(e){let{p:t}=e;return(0,ge.jsxs)("g",{className:"ztd-guide","aria-hidden":"true",pointerEvents:"none",style:{transform:`translate(${Jt(e.x)}px,0px)`},children:[(0,ge.jsx)("line",{x1:0,x2:0,y1:e.top,y2:e.bottom,stroke:t.paint("dim"),strokeWidth:1}),e.dots?.map(n=>(0,ge.jsxs)("g",{className:"ztd-guide",style:{transform:`translate(0px,${Jt(n.y)}px)`},children:[(0,ge.jsx)("circle",{r:n.strong?9:7,fill:n.color,opacity:.2}),(0,ge.jsx)("circle",{r:n.strong?4.2:3.2,fill:n.color,stroke:t.paint("panel"),strokeWidth:2})]},n.k))]})}function Oo(e){let{p:t}=e,n=Ee(e.label,160,We,700),r=ue(n,We,700)+14,o=Math.max(r/2+1,Math.min(e.width-r/2-1,e.x));return(0,ge.jsxs)("g",{className:"ztd-guide","aria-hidden":"true",pointerEvents:"none",style:{transform:`translate(${Jt(o)}px,${Jt(e.y)}px)`},children:[(0,ge.jsx)("rect",{x:-r/2,y:-9,width:r,height:18,rx:9,fill:t.paint("ink"),stroke:t.paint("panel"),strokeWidth:3,paintOrder:"stroke"}),(0,ge.jsx)(he,{x:0,y:0,anchor:"middle",size:We,weight:700,fill:t.paint("onInk"),children:n})]})}var st=D(re(),1);var oe=D(V(),1),Ds={zoomHint:" Press Enter to zoom in.",pickHint:" Press Enter to select.",high:"High",low:"Low",resetLabel:"Show all (reset zoom)",reset:"Show all",extremes:(e,t)=>`, high ${e}, low ${t}`,range:(e,t)=>`${e} to ${t}`},zo={en:Ds,ko:{zoomHint:" Enter를 누르면 확대해요.",pickHint:" Enter를 누르면 이 구간을 골라요.",high:"최고",low:"최저",resetLabel:"전체 보기(확대 풀기)",reset:"전체 보기",extremes:(e,t)=>`, 최고 ${e}, 최저 ${t}`,range:(e,t)=>`${e}~${t}`}},Ls=4;function Es(e){let[t,n]=(0,st.useState)(null),[r,o]=(0,st.useState)(!1),a=(0,st.useRef)(null),i=(0,st.useRef)(null),s=()=>{a.current=null,i.current=null,o(!1),n(null)},l=(m,h,f)=>!e.enabled||e.count<2||f.pointerType==="touch"||f.button!==0||!e.inPlot(m,h)?!1:(a.current={i:e.indexAt(m),x:m,moved:!1},f.currentTarget.setPointerCapture?.(f.pointerId),!0),u=m=>{let h=a.current;if(!h)return!1;if(!h.moved&&Math.abs(m-h.x)<Ls)return!0;h.moved=!0;let f=e.indexAt(m),p=Math.min(h.i,f),k=Math.max(h.i,f);return o(!0),n(C=>C?.from===p&&C.to===k?C:{from:p,to:k}),!0},d=(m,h,f)=>{let p=a.current;if(a.current=null,f.currentTarget.hasPointerCapture?.(f.pointerId)&&f.currentTarget.releasePointerCapture(f.pointerId),!p)return;if(o(!1),!p.moved||f.type==="pointercancel"){t&&(n(null),e.onCommit(null));return}let k=e.indexAt(m),C={from:Math.min(p.i,k),to:Math.max(p.i,k)},$=C.to>C.from;n($&&e.keep!==!1?C:null),e.onCommit($?C:null)},c=(m,h)=>{if(!e.enabled)return!1;if(m.key==="Escape"&&t)return s(),e.onCommit(null),!0;if(m.key==="Enter"&&t&&i.current!==null)return i.current=null,e.keep===!1&&n(null),e.onCommit(t),!0;if(!m.shiftKey||m.key!=="ArrowLeft"&&m.key!=="ArrowRight"||e.count<2)return!1;let f=m.key==="ArrowRight"?1:-1,p=i.current??h??(f>0?0:e.count-1),k=t&&i.current!==null?t.from===p?t.to:t.from:p,C=Math.max(0,Math.min(e.count-1,k+f));return i.current=p,n(C===p?null:{from:Math.min(p,C),to:Math.max(p,C)}),!0};return{range:t,dragging:r,keyboard:t!==null&&i.current!==null,down:l,move:u,up:d,key:c}}function Ho(e){let[t,n]=(0,st.useState)(null);return t&&t.sig!==e&&n(null),{view:t&&t.sig===e?t.range:null,zoomTo:r=>n({sig:e,range:r}),reset:()=>n(null)}}function Vo(e,t,n){let r=zo[n.lang],o=e.brush==="zoom"?"zoom":e.brush?"select":null,a=Es({enabled:o!==null,count:n.count,indexAt:n.indexAt,inPlot:n.inPlot,keep:o!=="zoom",onCommit:l=>{let u=l?n.toXRange(l):null;e.onBrush?.(u),o==="zoom"&&u&&u.to>u.from&&t.zoomTo([u.from,u.to])}}),i={onPointerDown:o?a.down:void 0,onPointerUp:o?a.up:void 0,onKey:o?l=>l.key==="Escape"&&t.view&&!a.range?(t.reset(),!0):a.key(l,n.active):void 0,overlay:t.view?(0,oe.jsx)(_s,{p:n.p,onReset:t.reset,text:r}):null},s=a.keyboard?o==="zoom"?r.zoomHint:r.pickHint:"";return{brush:a,frame:i,hint:s,text:r}}function jo(e,t){return!Number.isFinite(e)||!Number.isFinite(t)||e===0?null:(t-e)/Math.abs(e)}function Wo(e,t=ce){let n=Math.round(e*1e3)/10;return`${n>0?"+":""}${qe(n,{locale:t,maximumFractionDigits:1})}%`}function Ko(e){let{p:t,top:n,bottom:r}=e,o=Math.min(e.x0,e.x1),a=Math.max(e.x0,e.x1),i=ue(e.main,11.5,800),s=ue(e.sub,10.5,500)+6,l=i+s+16,u=Math.max(2,Math.min(e.width-l-2,(o+a)/2-l/2)),d=n+4;return(0,oe.jsxs)("g",{pointerEvents:"none","aria-hidden":"true",children:[(0,oe.jsx)("rect",{x:o,y:n,width:Math.max(1,a-o),height:Math.max(0,r-n),fill:t.paint("accent"),opacity:e.dragging?.1:.14}),(0,oe.jsx)("line",{x1:o,x2:o,y1:n,y2:r,stroke:t.paint("accent"),strokeWidth:1,opacity:.7}),(0,oe.jsx)("line",{x1:a,x2:a,y1:n,y2:r,stroke:t.paint("accent"),strokeWidth:1,opacity:.7}),(0,oe.jsx)("rect",{x:u,y:d,width:l,height:22,rx:8,fill:t.paint("panel"),stroke:t.paint("line")}),(0,oe.jsx)(he,{x:u+8,y:d+11,size:11.5,weight:800,fill:t.paint("ink"),children:e.main}),(0,oe.jsx)(he,{x:u+8+i+6,y:d+11,size:10.5,weight:500,fill:t.paint("muted"),children:e.sub})]})}function Go(e){let{p:t,width:n,top:r,bottom:o,max:a,min:i}=e,s=zo[e.lang];return(0,oe.jsxs)(oe.Fragment,{children:[(0,oe.jsx)(Io,{p:t,x:a.x,y:a.y,text:`${s.high} ${a.text}`,below:a.y-26<r+30,width:n}),(0,oe.jsx)(Io,{p:t,x:i.x,y:i.y,text:`${s.low} ${i.text}`,below:i.y+26<o,width:n})]})}function Io(e){let{p:t}=e,n=ue(e.text,10.5,700)+12,r=18,o=Math.max(2,Math.min(e.width-n-2,e.x-n/2)),a=e.below?e.y+8:e.y-r-8;return(0,oe.jsxs)("g",{pointerEvents:"none","aria-hidden":"true",children:[(0,oe.jsx)("circle",{cx:e.x,cy:e.y,r:3.5,fill:t.paint("ink"),stroke:t.paint("panel"),strokeWidth:2}),(0,oe.jsx)("rect",{x:o,y:a,width:n,height:r,rx:9,fill:t.paint("ink")}),(0,oe.jsx)(he,{x:o+n/2,y:a+r/2,anchor:"middle",size:10.5,weight:700,fill:t.paint("onInk"),children:e.text})]})}function _s(e){let{p:t}=e;return(0,oe.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onReset,"aria-label":e.text.resetLabel,style:{position:"absolute",top:0,right:0,height:24,padding:"0 10px",borderRadius:12,border:`1px solid ${t.paint("line")}`,background:t.paint("panel"),color:t.paint("muted"),fontSize:11.5,fontWeight:600,zIndex:4},children:e.text.reset})}var K=D(V(),1),lt=e=>Array.isArray(e)&&e.length===2;function Uo(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&lt(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var Yo=e=>e?.find(t=>t.type==="forecast")?.from,Bs=(e,t)=>Math.max(0,Math.min(e.x+e.w,t.x+t.w)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.h,t.y+t.h)-Math.max(e.y,t.y));function Kn(e,t,n){let r=t[0],o=1/0;for(let a of t){let i=Un(e,a.x,a.y,a.anchor),s=n.reduce((l,u)=>l+Bs(i,u),0);if(s<o&&(r=a,o=s),s===0)break}return n.push(Un(e,r.x,r.y,r.anchor)),r}var Gn=(e,t)=>Math.max(e.x0,Math.min(e.x1,t)),Os=(e,t)=>t!==null&&t>=e.x0-1&&t<=e.x1+1;function Xo(e,t){let n=e.xAt(t[0]),r=e.xAt(t[1]);return n===null||r===null?null:[Math.min(n,r)-e.half,Math.max(n,r)+e.half]}function qo(e,t){let n=e.y(Number(t[0])),r=e.y(Number(t[1]));return Number.isFinite(n)&&Number.isFinite(r)?[Math.max(e.top,Math.min(n,r)),Math.min(e.bottom,Math.max(n,r))]:null}function Qt(e,t){let n=t===void 0?null:e.xAt(t);return n===null||n>e.x1?null:Math.max(e.x0,n-(e.edge?e.half:0))}var Zo={en:{forecast:"Forecast",trend:"Trend",period:"period",weekends:"weekends shaded",lead:"Annotations"},ko:{forecast:"예측",trend:"추세",period:"기간",weekends:"주말 음영",lead:"주석"}};function Jo({list:e,g:t}){if(!e?.length)return null;let{p:n}=t,r=Math.max(0,t.bottom-t.top),o=[];return e.forEach((a,i)=>{if(a.type==="band"&&lt(a.y)){let s=qo(t,a.y);if(!s)return;let[l,u]=s;o.push((0,K.jsxs)("g",{children:[(0,K.jsx)("rect",{x:t.x0,y:l,width:Math.max(0,t.x1-t.x0),height:Math.max(0,u-l),fill:n.paint("accent"),opacity:.1}),(0,K.jsx)("line",{x1:t.x0,x2:t.x1,y1:l,y2:l,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"}),(0,K.jsx)("line",{x1:t.x0,x2:t.x1,y1:u,y2:u,stroke:n.paint("accent"),strokeOpacity:.45,strokeDasharray:"3 3"})]},i))}else if(a.type==="band"&&lt(a.x)||a.type==="forecast"){let s;if(a.type==="forecast"){let d=Qt(t,a.from);s=d===null?null:[d,t.x1]}else s=Xo(t,a.x);if(!s)return;let l=Gn(t,s[0]),u=Gn(t,s[1]);if(u-l<.5)return;o.push((0,K.jsx)("rect",{x:l,y:t.top,width:u-l,height:r,fill:n.paint("ink"),opacity:.05},i))}else if(a.type==="weekends"&&t.time&&t.time.t1-t.time.t0<=864e5*400){let s=Math.min(432e5,(t.time.t1-t.time.t0)/Math.max(1,t.time.n-1)/2),l=new Date(t.time.t0);l.setHours(0,0,0,0),l.setDate(l.getDate()-(l.getDay()+1)%7);for(let u=0;l.getTime()-s<=t.time.t1&&u<60;u++){let d=l.getTime();l.setDate(l.getDate()+2);let c=Math.max(t.x0,t.time.xt(d-s)),m=Math.min(t.x1,t.time.xt(l.getTime()-s));m>c&&o.push((0,K.jsx)("rect",{x:c,y:t.top,width:m-c,height:r,fill:n.paint("ink"),opacity:.045},`${i}w${u}`)),l.setDate(l.getDate()+5)}}}),(0,K.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}var Qo=(e,t)=>ue(e,10.5,t?700:500)+8;function Un(e,t,n,r="start",o){let a=Qo(e,o);return{x:r==="end"?t-a:t,y:n-8,w:a,h:16}}function Mt({p:e,x:t,y:n,text:r,anchor:o="start",strong:a}){let i=Un(r,t,n,o,a);return(0,K.jsxs)("g",{children:[(0,K.jsx)("rect",{x:i.x,y:i.y,width:i.w,height:i.h,rx:5,fill:e.paint("panel"),opacity:.94}),(0,K.jsx)(he,{x:i.x+4,y:n,size:10.5,weight:a?700:500,fill:e.paint(a?"ink":"muted"),children:r})]})}function ea({list:e,g:t}){if(!e?.length)return null;let{p:n}=t,r=Zo[t.lang],o=[],a=[],i=[...t.avoid??[]];return e.forEach((s,l)=>{if(s.type==="line"&&typeof s.y=="number"){let u=t.y(s.y);if(!Number.isFinite(u))return;let d=s.label?Ee(s.label,160,10.5):"",c=d?Kn(d,[{x:t.x1-2,y:u-10,anchor:"end"},{x:t.x0+2,y:u-10,anchor:"start"},{x:t.x1-2,y:u+10,anchor:"end"},{x:t.x0+2,y:u+10,anchor:"start"}],i):null;o.push((0,K.jsxs)("g",{children:[(0,K.jsx)("line",{x1:t.x0,x2:t.x1,y1:u,y2:u,stroke:n.paint("dim"),strokeDasharray:"4 3"}),c?(0,K.jsx)(Mt,{p:n,x:c.x,y:c.y,text:d,anchor:c.anchor}):null]},l))}else if(s.type==="band"&&s.label){let u=lt(s.y)?qo(t,s.y):[t.top,t.bottom],d=lt(s.x)?Xo(t,s.x):[t.x0,t.x1];if(!d||!u)return;let[c,m]=u,h=Ee(s.label,160,10.5),f=Math.min(Gn(t,d[0]),t.x1-40)+4,p=Kn(h,[{x:f,y:c+11,anchor:"start"},{x:f,y:m-11,anchor:"start"}],i);o.push((0,K.jsx)(Mt,{p:n,x:p.x,y:p.y,text:h},l))}else if(s.type==="forecast"){let u=Qt(t,s.from);if(u===null)return;let d=Ee(s.label??r.forecast,120,10.5),c=Math.min(u+4,t.x1-50),m=Kn(d,[{x:c,y:t.top+9,anchor:"start"},{x:c,y:t.bottom-9,anchor:"start"}],i);o.push((0,K.jsxs)("g",{children:[(0,K.jsx)("line",{x1:u,x2:u,y1:t.top,y2:t.bottom,stroke:n.paint("dim"),strokeDasharray:"2 3"}),(0,K.jsx)(Mt,{p:n,x:m.x,y:m.y,text:d})]},l))}else if(s.type==="event"&&s.label){let u=t.xAt(s.x);if(!Os(t,u))return;let d=Ee(s.label,140,10.5,700),c=Qo(d,!0),m=Math.max(t.x0,Math.min(u-c/2,t.x1-c)),h=a.findIndex(p=>p<m-4);h<0&&(h=a.length),a[h]=m+c;let f=t.top+9+h*18;o.push((0,K.jsxs)("g",{children:[(0,K.jsx)("line",{x1:u,x2:u,y1:f+8,y2:t.bottom,stroke:n.paint("ink"),strokeOpacity:.45,strokeDasharray:"2 3"}),(0,K.jsx)("circle",{cx:u,cy:t.bottom,r:2.5,fill:n.paint("ink"),opacity:.6}),(0,K.jsx)(Mt,{p:n,x:m,y:f,text:d,strong:!0})]},l))}else if(s.type==="trend"&&t.points){let u=t.points().filter(h=>Number.isFinite(h.x)&&Number.isFinite(h.y));if(u.length<2)return;let{at:d}=Mo(u),c=u[0].x,m=u[u.length-1].x;o.push((0,K.jsxs)("g",{children:[(0,K.jsx)("line",{x1:c,x2:m,y1:d(c),y2:d(m),stroke:n.paint("muted"),strokeWidth:1.5,strokeDasharray:"6 4",strokeLinecap:"round"}),(0,K.jsx)(Mt,{p:n,x:m-2,y:d(m)-11,text:Ee(s.label??r.trend,120,10.5),anchor:"end"})]},l))}}),(0,K.jsx)("g",{"aria-hidden":"true",pointerEvents:"none",children:o})}function ta(e,t,n,r){if(!e?.length)return"";let o=Zo[t],a=t==="ko",i=r??(l=>String(l??"")),s=e.map(l=>{let u=l.label?a?`(${l.label})`:` (${l.label})`:"";return l.type==="band"&&lt(l.y)?a?`구간 ${n(Number(l.y[0]))}~${n(Number(l.y[1]))}${u}`:`band ${n(Number(l.y[0]))} to ${n(Number(l.y[1]))}${u}`:l.type==="band"&&lt(l.x)?a?`${l.label??o.period} ${i(l.x[0])}~${i(l.x[1])}`:`${l.label??o.period} from ${i(l.x[0])} to ${i(l.x[1])}`:l.type==="line"&&typeof l.y=="number"?a?`기준선 ${n(l.y)}${u}`:`reference line at ${n(l.y)}${u}`:l.type==="event"?a?`${i(l.x)} ${l.label??""}`.trim():`${l.label??"event"} at ${i(l.x)}`:l.type==="forecast"?a?`${i(l.from)}부터 ${l.label??o.forecast}`:`${l.label??o.forecast.toLowerCase()} from ${i(l.from)}`:l.type==="trend"?a?l.label??"추세선":l.label??"trend line":l.type==="weekends"?o.weekends:""}).filter(Boolean);return s.length?` ${o.lead}: ${s.join(a?", ":"; ")}.`:""}var Is=e=>Array.isArray(e);function en(e,t,n){let r=Is(e)?e:[e];return n?t<r.length?r[t]:null:r[0]}function ra(e,t,n,r,o,a){let i=typeof t=="function"||typeof n=="function"?new Map(o.map((s,l)=>[s,l])):null;return e.map((s,l)=>{let u=new Array(s.length).fill(NaN),d=new Array(s.length).fill(NaN),c=en(t,l,r),m=en(n,l,r);if(c===null||m===null)return{lo:u,hi:d};let h=$t(c,""),f=$t(m,"");for(let p=Math.max(0,a);p<s.length;p++){let k=s[p];if(k===null)continue;let C=i?.get(k)??-1,$=h(k,C),B=f(k,C);!Number.isFinite($)||!Number.isFinite(B)||(u[p]=Math.min($,B),d[p]=Math.max($,B))}return{lo:u,hi:d}})}var Yn=(e,t,n)=>Number.isFinite(e)&&Number.isFinite(t)&&(e<t||e>n);function zs(e,t){let n=[],r=-1;for(let o=0;o<=e.length;o++){let a=o<e.length&&Number.isFinite(e[o])&&Number.isFinite(t[o]);a&&r<0?r=o:!a&&r>=0&&(o-1>r&&n.push([r,o-1]),r=-1)}return n}function Hs(e,t,n,r,o,a,i){let s=t(a),l=t(i);if(!(l>=s))return;let u=Math.floor(s),d=Math.floor(l)-u+1,c=new Array(d).fill(1/0),m=new Array(d).fill(-1/0),h=0;for(let f=a;f<i;f++){let p=Math.min(n[f],n[f+1]),k=Math.max(r[f],r[f+1]),C=Math.floor(t(f+1))-u;for(let $=h;$<=C;$++)p<c[$]&&(c[$]=p),k>m[$]&&(m[$]=k);h=C}for(let f=0;f<d;f++){let p=Math.max(s,u+f),k=Math.min(l,u+f+1);k<=p&&f>0||(e.xl.push(p),e.xr.push(k),e.top.push(o(m[f])),e.bottom.push(o(c[f])))}}function oa(e,t,n,r,o){let a=zs(t,n);if(!a.length)return null;let i=a.reduce((u,[d,c])=>u+c-d+1,0),s={runs:[],xl:[],xr:[],top:[],bottom:[]},l=i>o;for(let[u,d]of a)if(s.runs.push(s.top.length),l)Hs(s,e,t,n,r,u,d);else for(let c=u;c<=d;c++)s.xl.push(e(c)),s.top.push(r(n[c])),s.bottom.push(r(t[c]));return s.runs.push(s.top.length),s}function Vs(e,t,n,r,o,a){let i=I(n[o]),s=`M${I(e[o])},${i}`;for(let l=o+1;l<a;l++){let u=I(n[l]);u!==i&&(s+=`H${I(e[l])}V${i=u}`)}i=I(r[a-1]),s+=`H${I(t[a-1])}V${i}`;for(let l=a-2;l>=o;l--){let u=I(r[l]);u!==i&&(s+=`H${I(t[l])}V${i=u}`)}return`${s}H${I(e[o])}Z`}var na=(e,t,n,r)=>e.slice(n,r).map((o,a)=>[o,t[n+a]]);function aa(e,t,n,r){let o="";for(let a=0;a+1<e.runs.length;a++){let i=e.runs[a],s=e.runs[a+1];s-i<1||(o+=e.xr.length?Vs(e.xl,e.xr,t,n,i,s):Yt(na(e.xl,t,i,s),na(e.xl,n,i,s),r))}return o}function Xn(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 qn(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=Xn(i,n),u=[o,a];for(let d=0;d<4;d++){let c=Math.ceil(a/l-1e-9)*l,m=Math.floor(o/l+1e-9)*l;u=[o===0?0:o-m<=l*.3?m:o-i*s,a===0?0:c-a<=l*.3?c:a+i*s];let h=Xn(u[1]-u[0],n);if(h===l)break;l=h}return u}function ia(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=Xn(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let l=s,u=0;l<=o+a*1e-9&&u<200;l+=a,u++)i.push(Number((Math.round(l/a)*a).toPrecision(12)));return i}function gt(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)=>ia(n,r,l),s}function sa(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]=qn(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function js(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(u,d=1)=>{let c=[];for(let m=Math.floor(r);m<=Math.ceil(o);m++)if(!(m%d))for(let h of u){let f=Number((h*10**m).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&c.push(f)}return c},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:ia(e,t,3)}function la(e,t){let n=gt([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=()=>js(e[0],e[1],Math.abs(t[1]-t[0])),r}function Tt(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 Ws=864e5;function ua(e,t,n,r=ce){let o=t-e;if(!(o>0))return[{t:e,label:vt(e,{locale:r,month:"short",day:"numeric"})}];let a=o/Ws,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),u=(d,c,m,h=!1)=>{let f=new Date(d),p=-1,k=0;for(;f.getTime()<=t&&k++<500;){if(f.getTime()>=e){let C=f.getFullYear(),$=h&&!l&&C!==p;i.push({t:f.getTime(),label:vt(f,{locale:r,...m,...$?{year:"numeric"}:{}})}),p=C}c(f)}};if(a<=1.5){let d=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),c=[1,2,3,4,6,12].find(h=>h>=d)??12,m=new Date(s);m.setMinutes(0,0,0),u(m,h=>h.setHours(h.getHours()+c),{hour:"numeric"})}else if(a<=n*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());u(d,c=>c.setDate(c.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());d.setDate(d.getDate()+(8-d.getDay())%7),u(d,c=>c.setDate(c.getDate()+7),{month:"numeric",day:"numeric"})}else{let d=a/30.44,c=Math.max(1,Math.ceil(d/Math.max(1,n))),m=[1,2,3,6,12,24,60].find(h=>h>=c)??120;if(m>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);u(h,f=>f.setFullYear(f.getFullYear()+m/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%m;f&&h.setMonth(h.getMonth()+(m-f)),u(h,p=>p.setMonth(p.getMonth()+m),{month:"short"},!0)}}return i}function St(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 tn=(e,t,n)=>e==="date"?Ot(t,n)?.getTime()??NaN:je(t);function ca(e,t){let n=new Set(t?t.split(""):[]),r=e.series.flatMap((a,i)=>n.has(a)?[]:[i]);if(r.length===e.series.length)return[e,r];let o=a=>r.map(i=>a[i]);return[{...e,series:o(e.series),values:o(e.values),rows:o(e.rows),...e.rowValues&&{rowValues:o(e.rowValues)}},r]}function Ks(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Vr(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function ma(e,t,n,r,o={}){let a=ft(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:ft(n,"y"),u=!i&&r!==void 0?ft(r,"series"):null,d=e.map((S,x)=>a(S,x)),c=o.xType??Ks(d),m=o.locale??ce,h,f,p;if(c==="band"){let S=d.map(A=>String(A??""));h=Je(S);let x=new Map(h.map((A,L)=>[A,L]));f=h.map((A,L)=>L),p=Int32Array.from(S,A=>x.get(A)??-1)}else{let S=c==="date"?o.dayFirst??jr(d):void 0,x=d.map(Y=>tn(c,Y,S)),A=Array.from(new Set(x.filter(Y=>Number.isFinite(Y)))).sort((Y,pe)=>Y-pe),L=new Map(A.map((Y,pe)=>[Y,pe]));f=A,h=A.map(String),p=Int32Array.from(x,Y=>L.get(Y)??-1)}let k=o.dateFormat,C=S=>typeof S=="string"?Bt(S.trim())?.[3]:void 0,$=c==="date"&&d.length<5e3?C(d[0]):void 0,B=($===2||$===3)&&d.every(S=>C(S)===$),b=B&&$===3;if(c==="date"&&!k){let S=f.length>1?f[f.length-1]-f[0]:0;k=B&&$===2||S>864e5*120?{month:"short"}:S<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},S>864e5*800&&(k={year:"numeric",month:"short"})}let R;if(c==="band")R=h;else if(b&&!o.dateFormat){let S=le(m)==="ko";R=f.map(x=>{let A=new Date(x),L=Math.floor(A.getMonth()/3)+1;return S?`${A.getFullYear()}년 ${L}분기`:`Q${L} ${A.getFullYear()}`})}else{let S=f.every(Sn),x=c==="date"?new Intl.DateTimeFormat(m,k):new Intl.NumberFormat(m,S?{useGrouping:!1}:{maximumFractionDigits:6});R=f.length>1e3?St(f.length,A=>x.format(f[A])):f.map(A=>x.format(A))}let X=s?[...s]:u?Je(e.map((S,x)=>String(u(S,x)??""))):[""],z=new Map(X.map((S,x)=>[S,x])),Z=X.map(()=>new Array(h.length).fill(NaN)),U=X.map(()=>new Array(h.length).fill(null)),G=o.aggregate??"sum",P=G==="mean"?X.map(()=>new Uint32Array(h.length)):null,E=(S,x,A,L)=>{let Y=Z[S][x];G==="last"?Z[S][x]=A:G==="count"?Z[S][x]=(Number.isFinite(Y)?Y:0)+1:G==="mean"?Number.isFinite(A)&&(Z[S][x]=(Number.isFinite(Y)?Y:0)+A,P[S][x]++):Z[S][x]=Number.isFinite(Y)?Y+(Number.isFinite(A)?A:0):A,U[S][x]=L};for(let S=0;S<e.length;S++){let x=p[S];if(x<0)continue;let A=e[S];if(s)for(let L=0;L<s.length;L++)E(L,x,je(A[s[L]]),A);else{let L=u?z.get(String(u(A,S)??""))??0:0;E(L,x,je(l(A,S)),A)}}if(P)for(let S=0;S<Z.length;S++)for(let x=0;x<h.length;x++)P[S][x]>1&&(Z[S][x]/=P[S][x]);return{type:c,keys:h,xnum:f,labels:R,series:X,values:Z,rows:U}}function da(e,t){let n=e.keys.length;if(n<=t||t<2)return e;let r=n/t,o=[],a=[];for(let s=0;s<t;s++){let l=Math.floor(s*r),u=Math.min(n,Math.floor((s+1)*r));u<=l||(a.push([l,u]),o.push(s===0?0:s===t-1?n-1:Math.floor((l+u-1)/2)))}let i=e.values.map(s=>a.map(([l,u])=>{let d=0,c=0;for(let m=l;m<u;m++)Number.isFinite(s[m])&&(d+=s[m],c++);return c?d/c:NaN}));return{type:e.type,keys:o.map(s=>e.keys[s]),xnum:e.type==="band"?o.map((s,l)=>l):o.map(s=>e.xnum[s]),labels:St(o.length,s=>e.labels[o[s]]),series:e.series,values:i,rows:e.rows.map(s=>o.map(l=>s[l])),rowValues:e.values.map(s=>o.map(l=>s[l]))}}var ae=D(re(),1);var ke=D(re(),1);function Gs(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Us(e,t){let n=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=n*.5)}function ga(e,t=!0){let[n,r]=(0,ke.useState)({visible:!t,near:!t});return(0,ke.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=Us(i[i.length-1],.25);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:Gs(.25),rootMargin:"0px 0px -8% 0px"}),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 fa(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function pa(e){let[t,n]=(0,ke.useState)(null),[r,o]=(0,ke.useState)(e??null),a=(0,ke.useCallback)(i=>{n(i),i&&e===void 0&&o(fa(i))},[e]);return De(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=u=>o(d=>d!==null&&Math.abs(d-u)<.5?d:u),s=()=>i(fa(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(u=>{let d=u[u.length-1]?.contentRect;d?i(d.width>0?Math.round(d.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var Ys=()=>()=>{};function nn(){return(0,ke.useSyncExternalStore)(Ys,()=>!0,()=>!1)}var ha="(prefers-reduced-motion: reduce)";function ba(e="auto"){let[t,n]=(0,ke.useState)(()=>ze&&typeof window.matchMedia=="function"?window.matchMedia(ha).matches:!1);return(0,ke.useEffect)(()=>{if(e!=="auto"||!ze||typeof window.matchMedia!="function")return;let r=window.matchMedia(ha),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}function ya(e,t){let n=Ve(e.theme),[r,o,a]=pa(e.width),i=nn(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,u=e.height??l,d=ba(e.reducedMotion??"auto"),c=e.animate!==!1&&!d&&ze,m=ga(r,e.animateOnView!==!1&&c),h=Ne(e.locale),f=le(h),p=(0,ae.useMemo)(()=>wt(e.format,h,t.format),[e.format,h,t.format]),k=(0,ae.useCallback)(Q=>_t(Q,{locale:h}),[h]),C=(0,ae.useMemo)(()=>Br(p,e.unit),[p,e.unit]),$=(0,ae.useMemo)(()=>oo(e.data),[e.data]),[B,b]=(0,ae.useState)(null),[R,X]=(0,ae.useState)(null),z=(0,ae.useRef)([]),Z=(0,ae.useRef)(e.onHover);Z.current=e.onHover;let U=(0,ae.useRef)(e.onClick);U.current=e.onClick;let G=(0,ae.useRef)(null),P=(0,ae.useRef)(null),E=(0,ae.useRef)(null),S=(0,ae.useCallback)((Q,me="pointer")=>{if(E.current!==Q){E.current=Q;let Rt=Q===null?null:z.current[Q]??null;queueMicrotask(()=>Z.current?.(Rt)),P.current?.(Q)}G.current=Q===null?null:me,b(Q),X(G.current)},[]),x=(0,ae.useCallback)(Q=>{G.current!=="keyboard"&&(G.current=Q===null?null:"sync",b(Q),X(G.current))},[]),A=(0,ae.useCallback)(Q=>{let me=z.current[Q];me&&U.current?.(me)},[]),L=qr(e.replayKey),Y=e.width!==void 0||(a??0)>0,pe={enabled:c,active:m.visible&&Y,near:m.near,replayKey:L,dataKey:$,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},bt=(0,ae.useCallback)((Q,me=1)=>B===null||B===Q?me:me*.38,[B]);return{p:n,width:s,height:u,measured:Y,responsive:e.width===void 0,pending:ze&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:pe,fv:C,fmt:p,pct:k,locale:h,lang:f,t:f==="ko"?Fr:Rr,active:B,via:R,setActive:S,click:A,events:z,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:bt,sig:$,description:e.description,reduced:d,publish:P,applySync:x}}var ee=D(re(),1);function Xs(e){return 1-Math.pow(1-e,3)}function qs(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Zs(e){return e==="easeInOut"?qs:e==="linear"?t=>t:Xs}function Js(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 pt(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 rn(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 xa(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 ka(e,t,n,r){if(!t||!n||t.length!==n.length)return pt(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 pt(s,n[i]))o.push(l)}return o.length===r?o:pt(e,r)}var on=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||!rn(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),xa(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=rn(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 u=i.to.length;s.from=ka(s.cur,s.parts,i.parts,u),s.vel=ka(s.curVel,s.parts,i.parts,u),s.parts=i.parts,s.to=i.to.slice(),xa(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=rn(s.from,s.to)&&s.vel.every(d=>Math.abs(d)<1e-6),s.progress=s.done?1:0}else{let u=this.make(i,i.enter??i.from??i.to,n+l,0);u.done=rn(u.from,u.to),this.tracks.set(i.key,u)}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=pt(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=Zs(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,u=s.to.length;if(s.from.length!==u&&(s.from=pt(s.from,u)),s.vel.length!==u&&(s.vel=pt(s.vel,u)),s.cur.length!==u&&(s.cur=new Array(u).fill(0),s.curVel=new Array(u).fill(0)),!(l>0)){for(let c=0;c<u;c++)s.cur[c]=s.from[c],s.curVel[c]=0;s.progress=0,n=!0;continue}let d;if(this.easing==="spring"){let c=Math.exp(-a*l),m=a*l>=8&&a*l<20,h=0;for(let f=0;f<u;f++){let p=s.from[f]-s.to[f],k=s.vel[f]+a*p;s.cur[f]=s.to[f]+(p+k*l)*c,s.curVel[f]=(s.vel[f]-a*k*l)*c,m&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/a)))}d=a*l>=20||m&&h<.15,s.progress=Math.min(1,1-(1+a*l)*c)}else{let c=Math.min(1,l/o),m=r(c),h=Js(this.easing,c)/o;for(let f=0;f<u;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*m,s.curVel[f]=(s.to[f]-s.from[f])*h;d=c>=1,s.progress=m}if(d){for(let c=0;c<u;c++)s.cur[c]=s.to[c],s.curVel[c]=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}},At=new Set,an=0;function wa(e){an=0;let t=Array.from(At);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||At.delete(n)}At.size&&typeof requestAnimationFrame<"u"&&(an=requestAnimationFrame(wa))}function va(e){return At.add(e),!an&&typeof requestAnimationFrame<"u"&&(an=requestAnimationFrame(wa)),()=>{At.delete(e)}}function Qs(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 Ca(e,t){let n=(0,ee.useMemo)(()=>Qs(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:u=900,stagger:d=0}=t,c=(0,ee.useRef)(null),m=(0,ee.useRef)("init"),h=(0,ee.useRef)(null),f=(0,ee.useRef)(s),p=(0,ee.useRef)(i),k=(0,ee.useRef)(!1),C=(0,ee.useRef)(0),[,$]=(0,ee.useState)(0),B=(0,ee.useRef)(null),b=(0,ee.useRef)(!0);c.current||(c.current=new on,c.current.configure(l,u),c.current.snap(n),h.current=n);let R=c.current;if(R.configure(l,u),h.current!==n){let P=m.current,E=!Object.is(f.current,s);R.sameTargets(n)?R.refreshData(n):!r||P==="init"?R.snap(n):P==="idle"?R.hold(n):P==="running"||E?R.update(n,Lt(),d):R.snap(n),h.current=n,f.current=s}let X=(0,ee.useRef)(()=>!1);X.current=P=>{if(!b.current)return!1;let E=R.step(P);return!E&&m.current==="running"&&(m.current="done"),$(S=>(S+1)%1e9),E||(B.current=null),E};let z=(0,ee.useCallback)(()=>{if(!ze||B.current||!R.animating)return;let P=E=>X.current(E);B.current=va(P)},[R]);De(()=>{let P=!Object.is(p.current,i);if(p.current=i,!r){(m.current!=="done"||R.animating)&&(R.snap(h.current??n),m.current="done",$(E=>E+1));return}m.current==="init"||P&&a?(R.hold(h.current??n),m.current="idle",k.current=!1,$(E=>E+1)):P&&(k.current=!0)},[r,i]),De(()=>{!r||!a||!k.current||(k.current=!1,R.hold(h.current??n),m.current="idle",$(P=>P+1))},[a,r]),(0,ee.useEffect)(()=>{r&&o&&m.current==="idle"&&(R.start(Lt()),C.current+=1,m.current="running",z(),$(P=>P+1))},[r,o,i,R,z]),(0,ee.useEffect)(()=>{R.animating&&z()}),(0,ee.useEffect)(()=>(b.current=!0,()=>{b.current=!1,B.current?.(),B.current=null}),[]);let Z=Lt(),U=R.elapsed(Z),G=r&&m.current==="idle";return{items:R.items(),get:P=>R.get(P),elapsed:G?0:U,fade:(P,E=320)=>G?0:Number.isFinite(U)?Math.max(0,Math.min(1,(U-P)/E)):1,waiting:G,animating:R.animating,generation:C.current}}function Zn(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,u)=>{let d=e[l][u];return Number.isFinite(d)&&d>0?d:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let u=1;u<r;u++){let d=0,c=0;for(let m=0;m<n;m++){let h=i(m,u),f=h-i(m,u-1),p=0;for(let k=0;k<m;k++)p+=i(k,u)-i(k,u-1);d+=h,c+=(f/2+p)*h}d&&(l-=c/d),s[u]=l}}for(let l=0;l<r;l++){if(t==="zero"){let c=0,m=0;for(let h=0;h<n;h++){let f=e[h][l],p=Number.isFinite(f)?f:0;p>=0?(o[h][l]=c,c+=p,a[h][l]=c):(o[h][l]=m,m+=p,a[h][l]=m)}continue}let u=0;for(let c=0;c<n;c++)u+=i(c,l);let d=t==="silhouette"?-u/2:s[l];for(let c=0;c<n;c++){let m=i(c,l);t==="expand"&&(m=u?m/u*100:0),o[c][l]=d,d+=m,a[c][l]=d}}if(t==="wiggle"&&r){let l=1/0,u=-1/0;for(let c=0;c<r;c++)l=Math.min(l,o[0]?.[c]??0),u=Math.max(u,a[n-1]?.[c]??0);let d=0;for(let c=0;c<r;c++)d+=((o[0]?.[c]??0)+(a[n-1]?.[c]??0))/2;d/=r;for(let c=0;c<n;c++)for(let m=0;m<r;m++)o[c][m]-=d,a[c][m]-=d}return{y0:o,y1:a}}var T=D(V(),1),el={line:"Line chart",area:"Area chart",span:(e,t)=>`${e}: ${t}`,desc:(e,t,n,r,o)=>`${He(e,"series","series")} (${t}), x from ${n} to ${r}, ${He(o,"point")}`,lower:"low",upper:"high",band:e=>` Range ${e}.`,range:(e,t)=>`${e} to ${t}`,outside:(e,t)=>e?` ${He(e,"point")} outside the range: ${t}.`:" No points outside the range.",where:(e,t)=>`${e} (${t})`,logDropped:e=>` ${He(e,"value")} at or below 0 ${e===1?"is":"are"} not shown on the log scale.`},tl={en:el,ko:{line:"라인 차트",area:"영역 차트",span:(e,t)=>`${e} 구간 ${t}`,desc:(e,t,n,r,o)=>`계열 ${e}개(${t}), x ${n}부터 ${r}까지 ${o}개 지점`,lower:"하한",upper:"상한",band:e=>` 범위 ${e}.`,range:(e,t)=>`${e}~${t}`,outside:(e,t)=>e?` 범위 밖 ${e}개 지점: ${t}.`:" 범위 밖 지점 없음.",where:(e,t)=>`${e}(${t})`,logDropped:e=>` 로그 눈금이라 0 이하 값 ${e}개는 뺐어요.`}};function nl(e,t,n){let r=Math.max(0,Math.min(t,n)),o=Math.min(e.keys.length-1,Math.max(t,n)),a=e.keys.slice(r,o+1);return{type:e.type,keys:a,xnum:e.type==="band"?a.map((i,s)=>s):e.xnum.slice(r,o+1),labels:e.labels.slice(r,o+1),series:e.series,values:e.values.map(i=>i.slice(r,o+1)),rows:e.rows.map(i=>i.slice(r,o+1))}}function rl(e,t,n){if(t!=="forecast")return 0;let r=e.keys.length;if(n===void 0)return r;if(e.type==="band"){let i=e.keys.indexOf(String(n));return i<0?r:i}let o=tn(e.type,n);if(!Number.isFinite(o))return r;let a=e.xnum.findIndex(i=>i>=o);return a<0?r:a}function ol(e,t,n,r,o){let a=(d,c)=>e.series.length>1&&e.series[d]?o.where(c,e.series[d]):c,i=Je(t.flatMap((d,c)=>d.lo.some(Number.isFinite)?[a(c,o.range(...n[c]))]:[]));if(!i.length)return"";let s=o.band(i.join(", "));if(!r)return s;let l=0,u=[];return t.forEach((d,c)=>{for(let m=0;m<d.lo.length;m++)Yn(e.values[c][m],d.lo[m],d.hi[m])&&(l++,u.length<5&&u.push(a(c,e.labels[m])))}),s+o.outside(l,`${u.join(", ")}${l>u.length?", …":""}`)}function $a(e,t,n,r){let o=en(e,t,n);return typeof o=="string"&&o?o:r}function al(e,t,n){let r=e.keys.length;if(e.type==="band"){let s=r>1?(n-t)/(r-1):0;return l=>r>1?t+l*s:(t+n)/2}let[o,a]=Tt(e.xnum),i=gt([o,a===o?o+1:a],[t,n]);return Object.assign(s=>i(e.xnum[s]),{v:i})}function il(e){let{c:t,model:n,xs:r,x0:o,x1:a,y:i}=e,s=t.p,l;if(n.type==="date"&&n.keys.length>1){let d=n.xnum[0],c=n.xnum[n.xnum.length-1],m=Math.max(2,Math.floor((a-o)/64)),h=gt([d,c],[o,a]),f=ua(d,c,m,t.locale);if(f.length>=2&&n.keys.length>f.length)l=f.map(p=>({x:h(p.t),label:p.label}));else{let p=n.keys.map((k,C)=>r(C));l=Wn(p,n.labels).map(k=>({x:p[k],label:n.labels[k]}))}}else if(n.type==="number"&&n.keys.length>12){let[d,c]=Tt(n.xnum),m=gt([d,c],[o,a]),h=d>=1e3&&c<=9999?String:Tn(void 0,t.locale,Math.max(-d,c));l=m.ticks(Math.max(2,Math.floor((a-o)/70))).map(f=>({x:m(f),label:h(f)}))}else{let d=n.keys.map((c,m)=>r(m));l=Wn(d,n.labels).map(c=>({x:d[c],label:n.labels[c]}))}let u=_o(l,-2,t.width+2);return(0,T.jsx)("g",{"aria-hidden":"true",children:u.map((d,c)=>(0,T.jsx)(he,{x:d.x,y:i,anchor:"middle",size:We,fill:s.paint("muted"),children:d.label},c))})}function sl(e){let t=e.kind==="area",n=!t&&e.yScale==="log",r=ya(e,{height:g=>Math.max(200,Math.min(300,g*.5)),duration:1100,stagger:120}),{p:o,width:a,height:i}=r,s=tl[r.lang],l=(0,te.useId)().replace(/:/g,""),u=(0,te.useMemo)(()=>ma(e.data,e.x,e.y,e.series,{xType:e.xType,locale:r.locale,aggregate:e.aggregate,dayFirst:e.dayFirst}),[e.data,e.x,e.y,e.series,e.xType,r.locale,e.aggregate,e.dayFirst]),[d,c]=(0,te.useMemo)(()=>{if(!n)return[u,0];let g=0,y=u.values.map(M=>M.map(w=>w<=0?(g++,Number.NaN):w));return g?[{...u,values:y},g]:[u,0]},[u,n]),m=d.series.length,h=t?e.stack??(m>1?"stacked":"none"):"none",f=Ho(r.sig),p=f.view,k=(0,te.useMemo)(()=>p?nl(d,p[0],p[1]):d,[d,p]),C=Math.max(40,Math.round(e.maxPoints??a/2)),$=(0,te.useMemo)(()=>h!=="none"?da(k,C):k,[k,h,C]),B=e.hidden?.join("")??"",[b,R]=(0,te.useMemo)(()=>ca($,B),[$,B]),X=b.rowValues??b.values,z=(0,te.useMemo)(()=>h==="none"?null:Zn(b.values,h==="percent"?"expand":"zero"),[b,h]),Z=Yo(e.annotations),{lower:U,upper:G}=e,P=rl(b,e.bandFrom,Z),E=(0,te.useMemo)(()=>{if(U===void 0||G===void 0||h!=="none")return null;let g=ra($.rows,U,G,Array.isArray(e.y),e.data,P),y=b===$?g:R.map(M=>g[M]);if(n)for(let M of y)M.lo.forEach((w,F)=>{w>0&&M.hi[F]>0||(M.lo[F]=M.hi[F]=Number.NaN)});return y.some(M=>M.lo.some(Number.isFinite))?y:null},[$,b,R,U,G,e.y,e.data,h,P,n]),S=(0,te.useMemo)(()=>{let g=[];return E?.forEach(y=>y.lo.forEach((M,w)=>Number.isFinite(M)&&g.push(M,y.hi[w]))),g.length?Tt(g):g},[E]),x=(0,te.useMemo)(()=>{let g=$.values.map(y=>y.reduce((M,w)=>M+(Number.isFinite(w)?w:0),0));return Ze(e.highlight,$.series,$.series,g,"first")},[$,e.highlight]),A=(0,te.useMemo)(()=>{if(t)return e.colorMode==="categorical"?Bn(o,m,x):eo(o,m,x);if(e.colorMode==="categorical")return Bn(o,m,x);let g=ye(o,"strong"),y=ye(o,"accent");return $.series.map((M,w)=>x.has(w)?y:g)},[t,e.colorMode,o,m,x,$.series]),L=(0,te.useMemo)(()=>b===$?x:new Set(R.flatMap((g,y)=>x.has(g)?[y]:[])),[b,$,x,R]),Y=(0,te.useMemo)(()=>b===$?A:R.map(g=>A[g]),[b,$,A,R]),pe=[];z?z.y1.forEach(g=>g.forEach(y=>pe.push(y))):b.values.forEach(g=>g.forEach(y=>Number.isFinite(y)&&pe.push(y))),pe.push(...S);let bt=n?e.referenceLines?.filter(g=>g.y>0):e.referenceLines;bt?.forEach(g=>pe.push(g.y)),pe.push(...Uo(e.annotations).filter(g=>!n||g>0));let Q=e.baseline??0,me=!!e.signColors&&h==="none"&&(!n||Q>0);me&&pe.push(Q);let[Rt,rr]=Tt(pe),Oa=e.yDomain&&(!n||e.yDomain[0]>0&&e.yDomain[1]>0)?e.yDomain:void 0,Fe=e.yLabel?22:10,_e=22,sn=Math.max(2,Math.round(i/70)),nt=Oa??(n?sa(Rt,rr,sn):h==="percent"?[0,100]:qn(Rt,rr,sn,{zero:e.zero??t})),or=h==="percent"?g=>`${g}%`:Tn(e.format,r.locale,Math.max(Math.abs(nt[0]),Math.abs(nt[1]))),J=(n?la:gt)(nt,[i-_e,Fe]),ar=J.ticks(sn),ln=Lo(ar,or,r.locale),ir=e.endLabels??m>1,Ia=g=>{for(let y=b.keys.length-1;y>=0;y--)if(Number.isFinite(b.values[g][y]))return y;return-1},sr=ir?Math.min(a*.28,Math.max(...$.series.map(g=>ue(g,11,700)),20)+14):10,$e=ln+6,de=a-sr,we=al(b,$e,de),Ke=(0,te.useMemo)(()=>b.keys.map((g,y)=>we(y)),[b,$e,de]),yt=e.maxPoints??Math.max(60,Math.round((de-$e)*2)),un=e.curve??"smooth",xt=Math.min(nt[1],Math.max(nt[0],0)),rt=o.color(e.downColor,"neutralStrong"),ot=J(Q),at=we.v,lr=g=>at?tn(b.type,g):b.keys.indexOf(String(g)),za=g=>{let y=lr(g);return at?Number.isFinite(y)?at(y):null:y<0?null:we(y)},Ft=b.xnum.length-1,cn={p:o,lang:r.lang,xAt:za,y:J,x0:$e,x1:de,top:Fe,bottom:i-_e,half:at||Ft<1?0:(we(1)-we(0))/2,time:b.type==="date"&&at&&Ft>0?{t0:b.xnum[0],t1:b.xnum[Ft],n:Ft+1,xt:at}:void 0,points:()=>{let g=[...L][0]??0;return Ke.map((y,M)=>({x:y,y:J(z?z.y1[g][M]:b.values[g][M])}))}},ut=Qt(cn,Z),Ha=g=>{let y=lr(g),M=at?b.xnum.indexOf(y):y;return M>=0?b.labels[M]:String(g??"")},ur=(g,y)=>me&&L.has(g)&&y<Q?rt:Y[g].fill,mn=!e.connectNulls&&!z&&b.keys.length>1,dn=(0,te.useMemo)(()=>b.series.map((g,y)=>{let M=O=>z?z.y1[y][O]:b.values[y][O],w=[];for(let O=0;O<b.keys.length;O++){if(!Number.isFinite(M(O)))continue;let _=w[w.length-1];_&&(!mn||_[_.length-1]===O-1)?_.push(O):w.push([O])}let F=w.reduce((O,_)=>O+_.length,0);F>yt&&(w=w.map(O=>ao(O.map(_=>({x:we(_),y:M(_),k:_})),w.length>1?Math.max(3,Math.round(yt*O.length/F)):yt).map(_=>_.k)));let H=w.flat(),ne=0,se=w.map(O=>[ne,ne+=O.length]),Me=H.map(O=>J(M(O))),Be=z?H.map(O=>J(z.y0[y][O])):t?H.map(()=>J(xt)):void 0,Ue={s:y,name:g,pts:Me,xs:H.map(O=>we(O)),base:Be,sw:Y[y],hi:L.has(y),idx:H,spans:se},ve=E?.[y],Ye=ve?oa(we,ve.lo,ve.hi,J,yt):null;if(!ve||!Ye)return Ue;let be=e.outside?H.flatMap((O,_)=>Yn(b.values[y][O],ve.lo[O],ve.hi[O])?[_]:[]):void 0;return{...Ue,band:Ye,out:be}}),[b,z,Y,L,$e,de,i,nt[0],nt[1],yt,t,E,e.outside,mn,n]),fn=r.motion.stagger??120,cr=(0,te.useMemo)(()=>[...dn].sort((g,y)=>Number(g.hi)-Number(y.hi)),[dn]),Va=(0,te.useMemo)(()=>cr.map((g,y)=>{let M=J(xt),w=g.band?[...g.band.top,...g.band.bottom]:[],F=g.band?[g.band.top.length,g.band.bottom.length]:[];if(t){let H=g.base??g.pts.map(()=>M);return{key:`s:${g.name}`,to:[1,...g.pts,...H,...w],from:[0,...g.pts.map(()=>M),...H.map(()=>M),...w.map(()=>M)],delay:y*fn*.5,parts:[1,g.pts.length,H.length,...F],data:g}}return{key:`s:${g.name}`,to:[1,...g.pts,...w],from:[0,...g.pts,...w],enter:[0,...g.pts,...w],delay:y*fn,parts:[1,g.pts.length,...F],data:g}}),[cr,fn,t,i,xt]),mr=Ca(Va,r.motion),dr=r.fv,hn=r.fmt,ct=(0,te.useMemo)(()=>{if(!E)return null;let g=Array.isArray(e.y),y=b.series.map((w,F)=>[$a(U,R[F],g,s.lower),$a(G,R[F],g,s.upper)]);return{range:(w,F)=>Number.isFinite(E[w].lo[F])?` (${y[w][0]} ${hn(E[w].lo[F])} ~ ${y[w][1]} ${hn(E[w].hi[F])})`:"",unnamed:typeof e.y=="string"?e.y:void 0,desc:ol(b,E,y,e.outside===!0,s)}},[E,e.y,b,R,U,G,s,hn,e.outside]),ja=(0,te.useMemo)(()=>{if(!b.series.length)return[];let g=[...L][0]??0,y=(M,w,F)=>{let H=M||ct?.unnamed;return`${H?`${H} `:""}${dr(X[w][F])}${ct?.range(w,F)??""}`};return St(b.keys.length,M=>{let w=X[g]?.[M];return{datum:b.rows[g]?.[M]??null,index:M,key:b.keys[M],label:b.labels[M],value:Number.isFinite(w)?w:null,formatted:b.series.map((F,H)=>Number.isFinite(X[H][M])?y(F,H,M):null).filter(Boolean).join(", ")}})},[b,X,L,dr,ct]),fr=(g,y)=>{let M=d.keys.indexOf(g);return M<0?y:M},{brush:Ge,frame:Wa,hint:Ka,text:hr}=Vo(e,f,{p:o,active:r.active,lang:r.lang,count:b.keys.length,indexAt:g=>Xt(Ke,g),inPlot:(g,y)=>g>=$e-4&&g<=de+4&&y>=Fe&&y<=i-_e,toXRange:g=>{let y=b.keys[g.from],M=b.keys[g.to];return{from:fr(y,g.from),to:fr(M,g.to),fromKey:y,toKey:M,fromLabel:b.labels[g.from],toLabel:b.labels[g.to]}}}),ie=r.active;Nr(r,e.syncId,b.keys,b.labels);let gr=null;if(ie!==null&&b.keys[ie]!==void 0&&!Ge.dragging){let g=h==="percent"?Zn(X.map(w=>[w[ie]]),"expand"):null,y=b.series.map((w,F)=>({s:w,si:F,v:X[F][ie]})).filter(w=>Number.isFinite(w.v)).sort((w,F)=>F.v-w.v).map(w=>{let F=ct?.range(w.si,ie),H=g?`${Math.round(g.y1[w.si][0]-g.y0[w.si][0])}% · ${r.fv(w.v)}`:r.fv(w.v);return{label:w.s||ct?.unnamed||r.t.value,value:F?(0,T.jsxs)(T.Fragment,{children:[H,(0,T.jsx)("span",{style:{fontWeight:500,color:o.paint("muted")},children:F})]}):H,color:ur(w.si,w.v),strong:L.has(w.si)}}),M=Math.min(...b.series.map((w,F)=>z?J(z.y1[F][ie]):Number.isFinite(b.values[F][ie])?J(b.values[F][ie]):i));gr={x:we(ie),y:Math.max(Fe,M),title:b.labels[ie],rows:So(y,r.t.more)}}let Ga=g=>{if(!b.keys.length)return;let y=Xt(Ke,g);y>=0&&y!==r.active&&r.setActive(y,"pointer")},pr=null,br;if(Ge.range&&Ge.range.to<b.keys.length){let{from:g,to:y}=Ge.range,M=[...L][0]??0,w=b.values[M]??[],F=NaN,H=NaN,ne=-1,se=-1;for(let be=g;be<=y;be++){let O=w[be];Number.isFinite(O)&&(Number.isFinite(F)||(F=O),H=O,(ne<0||O>w[ne])&&(ne=be),(se<0||O<w[se])&&(se=be))}let Me=jo(F,H),Be=Me!==null?Wo(Me,r.locale):Number.isFinite(H-F)?`${H-F>=0?"+":""}${r.fv(H-F)}`:"-",Ue=hr.range(b.labels[g],b.labels[y]),ve=be=>J(z?z.y1[M][be]:w[be]),Ye=i-_e;pr=(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(Ko,{p:o,x0:Ke[g],x1:Ke[y],top:Fe,bottom:Ye,width:a,main:Be,sub:Ue,dragging:Ge.dragging}),ne>=0&&se>=0&&ne!==se?(0,T.jsx)(Go,{p:o,lang:r.lang,width:a,top:Fe,bottom:Ye,max:{x:Ke[ne],y:ve(ne),text:r.fv(w[ne])},min:{x:Ke[se],y:ve(se),text:r.fv(w[se])}}):null]}),Ge.dragging||(br=`${s.span(Ue,Be)}${ne>=0?hr.extremes(r.fv(w[ne]),r.fv(w[se])):""}.${Ka}`)}let Ua=ir?(()=>{let g=dn.map(M=>{let w=Ia(M.s);if(w<0)return null;let F=J(z?(z.y0[M.s][w]+z.y1[M.s][w])/2:b.values[M.s][w]);return{d:M,y:F}}).filter(M=>M!==null),y=Po(g.map(M=>M.y),14,Fe+4,i-_e-2);return g.map((M,w)=>({...M,ly:y[w]}))})():[],Ya=r.motion.duration??1100,yr=e.dots??"auto",Xa=yr===!0||yr==="auto"&&!t&&b.keys.length<=16,xr=t?s.area:s.line,qa=e.description??`${xr}. ${s.desc(b.series.length,b.series.filter(Boolean).join(", ")||r.t.value,b.labels[0]??"",b.labels[b.labels.length-1]??"",b.keys.length)}.${ct?.desc??""}${ta(e.annotations,r.lang,r.fv,Ha)}${c?s.logDropped(c):""}`,gn=[],kr=[];for(let g of mr.items){let y=g.data,M=g.v,w=y.xs.length,F=M[0],H=M.slice(1,1+w),ne=y.xs.map((_,W)=>[_,H[W]??H[H.length-1]??0]),se=me&&y.hi,Me=y.spans,Be=Me.map(([_,W])=>Ut(ne.slice(_,W),un)),Ue=se?Me.map(([_],W)=>`${Be[W]}V${I(ot)}H${I(y.xs[_])}Z`).join(""):"",ve=_=>Me.map(([W,Te])=>Yt(ne.slice(W,Te),_.slice(W,Te),un)).join(""),Ye=mn?Me.filter(([_,W])=>W-_===1).map(([_])=>_):[],be=(_,W)=>{let[Te,Oe]=ne[_],Pe=se&&Oe>ot?rt:y.sw.fill;return(0,T.jsx)("circle",{cx:Te,cy:Oe,r:y.hi?3:2.2,fill:y.hi?Pe:o.paint("panel"),stroke:Pe,strokeWidth:y.hi?0:1.4,opacity:W},_)};if(y.band){let _=1+(t?2*w:w),W=y.band.top.length;kr.push((0,T.jsx)("path",{d:aa(y.band,M.slice(_,_+W),M.slice(_+W,_+2*W),un),fill:y.sw.fill,opacity:.16*F*(g.exiting?.4:1)},g.key))}let O=_=>y.out?.map(W=>{let[Te,Oe]=ne[W];return(0,T.jsx)("circle",{cx:Te,cy:Oe,r:3.6,fill:se&&Oe>ot?rt:y.sw.fill,stroke:o.paint("panel"),strokeWidth:1.5,opacity:_(W)},`o${W}`)});if(t){let _=M.slice(1+w,1+2*w),W=y.xs.map((Se,q)=>[Se,_[q]??J(xt)]),Te=Be.join(""),Oe=se?["up","dn"].map(Se=>(0,T.jsx)("path",{d:Ue,fill:Se==="up"?y.sw.fill:rt,opacity:.5,clipPath:`url(#${l}${Se})`},Se)):(0,T.jsx)("path",{d:ve(W),fill:y.sw.fill,opacity:h==="none"?y.hi?.5:.28:1}),Pe=Se=>(se?["up","dn"]:[null]).map(q=>(0,T.jsx)("path",{d:Te,fill:"none",stroke:q==="dn"?rt:h==="none"?y.sw.fill:o.paint("panel"),strokeWidth:h==="none"?y.hi?2.2:1.4:1.2,strokeLinejoin:"round",strokeDasharray:Se?"5 4":void 0,opacity:Math.min(1,F*1.4),clipPath:q?`url(#${l}${q})`:void 0},q??"s"));gn.push((0,T.jsxs)("g",{opacity:g.exiting?.4:1,children:[Oe,ut!==null?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("g",{clipPath:`url(#${l}pre)`,children:Pe(!1)}),(0,T.jsx)("g",{clipPath:`url(#${l}post)`,children:Pe(!0)})]}):Pe(!1),Ye.map(Se=>be(Se,Math.min(1,F*1.4))),O(()=>Math.min(1,F*1.4))]},g.key))}else{let _=y.hi?2.6:1.7,W=F<.999,Te=q=>Math.max(0,Math.min(1,(F-(w>1?q/(w-1):1))*8+(F>=.999?1:0))),Oe=W&&Me.length>1?Me.flatMap(([q,Ie],pn)=>Ie-q>1?[[Be[pn],Math.max(0,Math.min(1,(F*(w-1)-q)/(Ie-1-q)))]]:[]):[[Be.join(""),F]],Pe=q=>(se?["up","dn"]:[null]).flatMap(Ie=>Oe.map(([pn,Za],Ja)=>(0,T.jsx)("path",{d:pn,fill:"none",stroke:Ie==="dn"?rt:y.sw.fill,strokeWidth:_,strokeLinejoin:"round",strokeLinecap:"round",pathLength:W?1:void 0,strokeDasharray:W?"1 1":q?"5 4":void 0,strokeDashoffset:W?1-Za:void 0,clipPath:Ie?`url(#${l}${Ie})`:void 0},`${Ie??"s"}${Ja}`))),Se=e.area&&y.hi?se?["up","dn"].map(q=>(0,T.jsx)("path",{d:Ue,fill:q==="up"?y.sw.fill:rt,opacity:.16*F,clipPath:`url(#${l}${q})`},q)):(0,T.jsx)("path",{d:ve(ne.map(([q])=>[q,J(xt)])),fill:`url(#${l}g)`,opacity:F}):null;gn.push((0,T.jsxs)("g",{opacity:g.exiting?.4:1,children:[Se,ut!==null?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("g",{clipPath:`url(#${l}pre)`,children:Pe(!1)}),(0,T.jsx)("g",{clipPath:`url(#${l}post)`,children:Pe(!0)})]}):Pe(!1),(Xa?ne.map((q,Ie)=>Ie):Ye).map(q=>be(q,Te(q))),O(Te)]},g.key))}}return(0,T.jsxs)(No,{c:r,kind:xr,ariaLabel:e.ariaLabel,description:qa,events:ja,tip:gr,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,onPointerMove:(g,y,M)=>{Ge.move(g),M.pointerType==="touch"?r.setActive(Xt(Ke,g),"touch"):Ga(g)},...Wa,announce:br,defs:e.area||ut!==null||me?(0,T.jsxs)(T.Fragment,{children:[e.area?(0,T.jsxs)("linearGradient",{id:`${l}g`,x1:"0",x2:"0",y1:"0",y2:"1",children:[(0,T.jsx)("stop",{offset:"0%",stopColor:o.paint("accent"),stopOpacity:.28}),(0,T.jsx)("stop",{offset:"100%",stopColor:o.paint("accent"),stopOpacity:0})]}):null,ut!==null?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("clipPath",{id:`${l}pre`,children:(0,T.jsx)("rect",{x:-a,y:-i,width:a+ut,height:i*3})}),(0,T.jsx)("clipPath",{id:`${l}post`,children:(0,T.jsx)("rect",{x:ut,y:-i,width:a*2,height:i*3})})]}):null,me?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("clipPath",{id:`${l}up`,children:(0,T.jsx)("rect",{x:-a,y:-i,width:a*3,height:i+ot})}),(0,T.jsx)("clipPath",{id:`${l}dn`,children:(0,T.jsx)("rect",{x:-a,y:ot,width:a*3,height:i*2})})]}):null]}):null,children:[e.yLabel?(0,T.jsx)(he,{x:ln,y:6,anchor:"start",size:10.5,fill:o.paint("muted"),children:e.yLabel}):null,(0,T.jsx)(Eo,{p:o,ticks:ar,y:J,x0:ln,x1:de+4,fmt:or,locale:r.locale}),(0,T.jsx)(Jo,{list:e.annotations,g:cn}),me?(0,T.jsx)("line",{x1:$e,x2:de,y1:ot,y2:ot,stroke:o.paint("dim"),pointerEvents:"none"}):null,bt?.map((g,y)=>(0,T.jsx)("line",{x1:$e,x2:de,y1:J(g.y),y2:J(g.y),stroke:o.paint("dim"),strokeDasharray:"3 3"},y)),(0,T.jsx)("rect",{x:$e,y:Fe,width:Math.max(0,de-$e),height:Math.max(0,i-_e-Fe),fill:"transparent"}),kr,gn,(0,T.jsx)(ea,{list:e.annotations,g:cn}),ie!==null&&b.keys[ie]!==void 0?(0,T.jsx)(Bo,{p:o,x:we(ie),top:Fe,bottom:i-_e,dots:b.series.flatMap((g,y)=>{let M=z?z.y1[y][ie]:b.values[y][ie];return Number.isFinite(M)?[{k:y,y:J(M),color:ur(y,M),strong:L.has(y)}]:[]})}):null,bt?.map((g,y)=>g.label?(0,T.jsxs)("g",{pointerEvents:"none",children:[(0,T.jsx)("rect",{x:de-ue(g.label,10.5)-8,y:J(g.y)-17,width:ue(g.label,10.5)+8,height:15,rx:5,fill:o.paint("panel"),opacity:.94}),(0,T.jsx)(he,{x:de-4,y:J(g.y)-9.5,anchor:"end",size:10.5,fill:o.paint("muted"),children:g.label})]},`rl${y}`):null),Ua.map(g=>(0,T.jsx)(he,{x:de+8,y:g.ly,size:11,weight:g.d.hi?800:500,fill:o.paint(g.d.hi?"ink":"muted"),opacity:mr.fade(Ya*.75,300),children:Ee(g.d.name,sr-10,11,g.d.hi?800:500)},g.d.name)),pr,(0,T.jsx)(il,{c:r,model:b,xs:we,x0:$e,x1:de,y:i-_e+13}),ie!==null&&b.keys[ie]!==void 0&&!Ge.dragging?(0,T.jsx)(Oo,{p:o,x:we(ie),y:i-_e+13,label:b.labels[ie],width:a}):null]})}function Jn(e){return(0,T.jsx)(sl,{...e,kind:"area"})}var ll=D(re(),1);var Ta=D(V(),1);var Ma=e=>e?"neutralStrong":"accent";var Qn=D(V(),1);function Sa(e,t,n,r){if(typeof e!="function")return Ze(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 ul=D(re(),1);var tr=D(V(),1),cl={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}, ${He(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Aa={en:cl,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}일 이동평균`}},er=["ink","muted","dim"];function Na(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,er.length)}var ml=D(re(),1);var Da=D(V(),1),dl={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${He(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},fl={en:dl,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Ra=(e,t)=>fl[e].other(t);function Fa(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,Co(o.map(a=>a.value)))}}var Pa=e=>Number.isFinite(e)&&e>0?e:0;var tt=D(V(),1);function La(e,t){let n=Gt(e);return n?.type==="scatter"&&t?.size!==void 0?Gt("bubble"):n}function hl(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 gl(e,t,n,r=!1){let o=La(e.type,e.encoding);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&Hn.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),u=c=>c.filter(m=>!l.has(m.label)),d=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(d.includes(o.type)){let c=Kt(a.label,"label"),m=$t(a.value,"value"),h=o.type==="waffle",f=t.map((b,R)=>({r:b,label:c(b,R),value:h?m(b,R):Pa(m(b,R))})),{kept:p,other:k}=h?{kept:f,other:null}:Fa(f,i.other,(b,R)=>({r:{},label:Ra(le(n),b),value:R})),C=Ze(s,p.map(b=>b.r),p.map(b=>b.label),p.map(b=>b.value),h?"first":"max"),$=k?[...p,k]:p,B=Ct($.length,C);return $.map((b,R)=>({label:b.label,color:B[R]}))}if(o.type==="candlestick"){let c=Na(Array.isArray(i.ma)?i.ma:void 0,t.length),m=Aa[le(n)];return[{label:m.up,color:i.upColor??"accent"},{label:m.down,color:i.downColor??"neutralStrong"},...c.map((h,f)=>({label:m.maLegend(h),color:er[f],shape:"line"}))]}if(o.type==="scatter"){if(typeof a.series!="string")return[];let c=Kt(a.series,"series"),m=Je(t.map((f,p)=>c(f,p)));if(m.length<2)return[];let h=Qr(m.length,Sa(s,t,m,c));return u(m.map((f,p)=>({label:f,color:h[p],shape:"circle"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let c=[];if(Array.isArray(a.y))c=a.y;else if(typeof a.series=="string"){let p=Kt(a.series,"series");c=Je(t.map((k,C)=>p(k,C)))}let m=Vn(o.type,a,i);if(m.length){let p=Ct(c.length,Ze(s,c,c,c.map(()=>0),"none")),k=c.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:c.map((C,$)=>({label:C,color:p[$]}));return[...u(k),...m.map((C,$)=>({label:C,color:Ma($),shape:"line"}))]}if(c.length<2)return[];let h=Ze(s,c,c,c.map(()=>0),"first");if(o.type==="line"||o.type==="radar")return u(c.map((p,k)=>({label:p,color:h.has(k)?"accent":"neutralStrong",shape:o.type==="line"?"line":"square"})));let f=Ct(c.length,h);return u(c.map((p,k)=>({label:p,color:f[k]})))}return[]}function Ea(e,t){let{spec:n}=e,r=La(n.type,n.encoding),o=(0,Nt.useMemo)(()=>To(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=xo(n,e.locale),s=Ne(i),l=le(s),u=io(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),d=wo(n),c=(0,Nt.useMemo)(()=>d?ho(d,s):void 0,[d,s]),m=n.options?.hidden,h=Array.isArray(m)?m.map(String):[],f=h.join(""),[p,k]=(0,Nt.useState)(null);if(!r)return(0,tt.jsx)(_n,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let C=o??u.data,$=t[r.type],B={...n.options??{}},b={...hl(r,n.encoding),...B,...c?{tooltip:c}:{},data:C,...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},R=n.card?.legend==="toggle"&&ko(r.type,n.encoding??{},B),X=p&&p.base===f?p.hidden:h;R&&(b.hidden=X);let z=P=>k(E=>{let S=E&&E.base===f?E.hidden:h;return{base:f,hidden:S.includes(P)?S.filter(x=>x!==P):[...S,P]}}),Z=b.height??220,U=a&&!C.length&&(u.loading||u.error||u.empty)?(0,tt.jsx)(_n,{loading:u.loading,error:u.error,empty:u.empty,onRetry:u.reload,height:Z,locale:i}):(0,tt.jsx)($,{...b});if(n.card){let P=n.card,E=P.legend==="auto"||P.legend==="toggle"?gl(n,C,s,R):P.legend,S=E?.length?R?(0,tt.jsx)(En,{items:E,hidden:X,onToggle:z,locale:i}):E:void 0,x=P.download?(0,tt.jsx)(fo,{data:C,columns:vo(n),filename:P.title??r.type,formats:Array.isArray(P.download)?P.download:void 0,locale:i}):void 0;U=(0,tt.jsx)(Zr,{number:P.number,title:P.title??yo(r,l),subtitle:P.subtitle,legend:S,actions:x,source:P.source||void 0,note:P.note||void 0,accent:P.accent,takeaway:P.takeaway,level:P.level,sample:P.sample,replay:P.replay!==!1,className:e.className,locale:i,children:U})}let G=e.theme??n.theme;return G&&(U=(0,tt.jsx)(Vt,{theme:G,children:U})),U}function pl({cfg:e,components:t}){let n=nn();return Ea({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function Ba(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,_a.hydrateRoot)(r,(0,nr.createElement)(Vt,{theme:o.theme,cssVars:!0},(0,nr.createElement)(pl,{cfg:o,components:{[e]:t}})))}Ba("area",Jn);})();