ztd-charts-cli 0.12.0 → 0.13.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 (52) hide show
  1. package/README.md +1 -1
  2. package/dist/api.js +1 -1
  3. package/dist/{chunk-KNBUVTZ2.js → chunk-LR5X5LI2.js} +3 -3
  4. package/dist/cli.js +1 -1
  5. package/dist/client/area.js +6 -6
  6. package/dist/client/bar.js +6 -6
  7. package/dist/client/barRace.js +6 -6
  8. package/dist/client/beeswarm.js +7 -7
  9. package/dist/client/box.js +6 -6
  10. package/dist/client/bubble.js +6 -6
  11. package/dist/client/bullet.js +6 -6
  12. package/dist/client/bump.js +6 -6
  13. package/dist/client/calendar.js +10 -10
  14. package/dist/client/candlestick.js +6 -6
  15. package/dist/client/chord.js +7 -7
  16. package/dist/client/choropleth.js +9 -9
  17. package/dist/client/cohort.js +28 -0
  18. package/dist/client/donut.js +6 -6
  19. package/dist/client/dumbbell.js +6 -6
  20. package/dist/client/flowMap.js +7 -7
  21. package/dist/client/funnel.js +6 -6
  22. package/dist/client/gauge.js +6 -6
  23. package/dist/client/heatmap.js +9 -9
  24. package/dist/client/histogram.js +6 -6
  25. package/dist/client/horizon.js +28 -0
  26. package/dist/client/line.js +6 -6
  27. package/dist/client/lollipop.js +6 -6
  28. package/dist/client/marimekko.js +6 -6
  29. package/dist/client/network.js +6 -6
  30. package/dist/client/parallel.js +6 -6
  31. package/dist/client/pareto.js +6 -6
  32. package/dist/client/pie.js +6 -6
  33. package/dist/client/radar.js +6 -6
  34. package/dist/client/radialBar.js +6 -6
  35. package/dist/client/ridgeline.js +6 -6
  36. package/dist/client/sankey.js +6 -6
  37. package/dist/client/scatter.js +6 -6
  38. package/dist/client/segmented.js +6 -6
  39. package/dist/client/skyline.js +10 -10
  40. package/dist/client/slope.js +6 -6
  41. package/dist/client/sparkTable.js +28 -0
  42. package/dist/client/sparkline.js +6 -6
  43. package/dist/client/stream.js +7 -7
  44. package/dist/client/sunburst.js +7 -7
  45. package/dist/client/symbolMap.js +7 -7
  46. package/dist/client/tileMap.js +6 -6
  47. package/dist/client/timeline.js +6 -6
  48. package/dist/client/tree.js +6 -6
  49. package/dist/client/treemap.js +7 -7
  50. package/dist/client/waffle.js +7 -7
  51. package/dist/client/waterfall.js +6 -6
  52. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
- (()=>{var Ra=Object.create;var sr=Object.defineProperty;var Fa=Object.getOwnPropertyDescriptor;var _a=Object.getOwnPropertyNames;var Pa=Object.getPrototypeOf,La=Object.prototype.hasOwnProperty;var mn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Da=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _a(t))!La.call(e,o)&&o!==n&&sr(e,o,{get:()=>t[o],enumerable:!(r=Fa(t,o))||r.enumerable});return e};var F=(e,t,n)=>(n=e!=null?Ra(Pa(e)):{},Da(t||!e||!e.__esModule?sr(n,"default",{value:e,enumerable:!0}):n,e));var Y=mn((wl,lr)=>{lr.exports=globalThis.__ztdReact.react});var ur=mn(($l,cr)=>{cr.exports=globalThis.__ztdReact["react-dom/client"]});var V=mn((Ol,Dr)=>{Dr.exports=globalThis.__ztdReact["react/jsx-runtime"]});var Zn=F(Y(),1),ga=F(ur(),1);var wt=F(Y(),1);var Bt=F(Y(),1);var mr=F(Y(),1),Ze=(0,mr.createContext)(void 0);var gr=F(Y(),1);var Ea=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],dr='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',fr='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',De={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",accent2:"#FF8CC1",accent3:"#38C6F6",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:dr,monoFamily:fr,radius:18,radiusCode:14,radiusMark:4},dn={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",accent2:"#D8488C",accent3:"#659815",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:dr,monoFamily:fr,radius:18,radiusCode:14,radiusMark:4},fn={dark:De,light:dn};function Ct(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function hn(e){let t={};for(let n of Ea){let r=e[n];typeof r=="string"&&(t[Ct(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 gn(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 Oa=`
1
+ (()=>{var Na=Object.create;var sr=Object.defineProperty;var Fa=Object.getOwnPropertyDescriptor;var _a=Object.getOwnPropertyNames;var Pa=Object.getPrototypeOf,Da=Object.prototype.hasOwnProperty;var mn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var La=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _a(t))!Da.call(e,o)&&o!==n&&sr(e,o,{get:()=>t[o],enumerable:!(r=Fa(t,o))||r.enumerable});return e};var F=(e,t,n)=>(n=e!=null?Na(Pa(e)):{},La(t||!e||!e.__esModule?sr(n,"default",{value:e,enumerable:!0}):n,e));var Y=mn((Tl,lr)=>{lr.exports=globalThis.__ztdReact.react});var ur=mn((Ml,cr)=>{cr.exports=globalThis.__ztdReact["react-dom/client"]});var V=mn((Bl,Lr)=>{Lr.exports=globalThis.__ztdReact["react/jsx-runtime"]});var Zn=F(Y(),1),ga=F(ur(),1);var wt=F(Y(),1);var Bt=F(Y(),1);var mr=F(Y(),1),Ze=(0,mr.createContext)(void 0);var gr=F(Y(),1);var Ea=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],dr='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',fr='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',Le={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",accent2:"#FF8CC1",accent3:"#38C6F6",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:dr,monoFamily:fr,radius:18,radiusCode:14,radiusMark:4},dn={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",accent2:"#D8488C",accent3:"#659815",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:dr,monoFamily:fr,radius:18,radiusCode:14,radiusMark:4},fn={dark:Le,light:dn};function Ct(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function hn(e){let t={};for(let n of Ea){let r=e[n];typeof r=="string"&&(t[Ct(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 gn(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 Oa=`
2
2
  .ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
3
3
  .ztd-root:focus{outline:none}
4
- .ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${De.accent});outline-offset:3px;border-radius:6px}
4
+ .ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${Le.accent});outline-offset:3px;border-radius:6px}
5
5
  .ztd-svg{display:block;overflow:visible;user-select:none;-webkit-user-select:none}
6
6
  .ztd-mark{transition:opacity .18s ease,fill .18s ease,stroke .18s ease,stroke-width .18s ease}
7
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)}
@@ -9,9 +9,9 @@
9
9
  .ztd-still .ztd-tip,.ztd-still .ztd-guide{transition:none;animation:none}
10
10
  .ztd-btn{appearance:none;font:inherit;cursor:pointer;transition:background .14s,color .14s,border-color .14s}
11
11
  .ztd-btn:focus{outline:none}
12
- .ztd-btn:focus-visible{outline:2px solid var(--ztd-accent,${De.accent});outline-offset:2px}
12
+ .ztd-btn:focus-visible{outline:2px solid var(--ztd-accent,${Le.accent});outline-offset:2px}
13
13
  .ztd-card{transition:border-color .16s ease}
14
- .ztd-card:hover{border-color:var(--ztd-dim,${De.dim})}
14
+ .ztd-card:hover{border-color:var(--ztd-dim,${Le.dim})}
15
15
  @media (prefers-reduced-motion: reduce){.ztd-mark,.ztd-tip,.ztd-guide,.ztd-btn,.ztd-card{transition:none;animation:none}}
16
16
  @keyframes ztd-pop{from{opacity:0;transform:scale(.45)}to{opacity:1;transform:none}}
17
17
  @keyframes ztd-fade{from{opacity:0}to{opacity:1}}
@@ -19,10 +19,10 @@
19
19
  @keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
20
20
  .ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
21
21
  @media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
22
- `;function pr(e,t,n,r,o){if(e)return t?{opacity:0}:{animation:`ztd-${n} ${Math.round(o)}ms cubic-bezier(.22,.9,.3,1) ${Math.round(r)}ms backwards`}}function br(e,t){let[n]=(0,gr.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var hr=!1;function dt(){if(hr||typeof document>"u"||(hr=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=Oa,document.head.appendChild(e)}var At=F(Y(),1),ke=typeof window<"u"&&typeof document<"u",Ae=ke?At.useLayoutEffect:At.useEffect;function Nt(){return typeof performance<"u"?performance.now():Date.now()}var Ne=F(Y(),1),Ia=(0,Ne.createContext)(void 0),Rt=new Map;function za(e,t){let n=Rt.get(e);return n||Rt.set(e,n=new Set),n.add(t),()=>{n.delete(t),n.size||Rt.delete(e)}}function Ba(e,t,n){Rt.get(e)?.forEach(r=>r(t,n))}function Ha(e,t,n){let r=e.indexOf(n.key);return r>=0||t.length>1e3?r:t.indexOf(n.label)}function yr(e,t,n,r){let o=(0,Ne.useContext)(Ia),i=t??o,[a]=(0,Ne.useState)(()=>({})),s=(0,Ne.useRef)({keys:n,labels:r});s.current={keys:n,labels:r},e.publish.current=i?u=>Ba(i,u===null||s.current.keys[u]===void 0?null:{key:s.current.keys[u],label:s.current.labels[u]},a):null;let l=e.applySync;(0,Ne.useEffect)(()=>{if(i)return za(i,(u,m)=>{if(m===a)return;let c=u?Ha(s.current.keys,s.current.labels,u):-1;l(c<0?null:c)})},[i,a,l])}function J(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Ee(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var xr={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},kr={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var ja=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],Ga={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function Va(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function Wa(e){return Va(ja,e)}function wr(e,t){let n=Wa(e);return{text:n?n[t]:e,...Ga[n?.id??"basic"]}}var $r={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Oe(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),$r[t.toLowerCase()]&&(t=$r[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(a=>a+a).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let i=parseInt(o,16);return o.length===6?[i>>16&255,i>>8&255,i&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 i=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),a=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return i.some(s=>Number.isNaN(s))?null:[i[0],i[1],i[2],Number.isNaN(a)?1:a]}return null}function Mr(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 bn(e,t){let n=e[3];return[e[0]*n+t[0]*(1-n),e[1]*n+t[1]*(1-n),e[2]*n+t[2]*(1-n),1]}function qe(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ft(e){return .2126*qe(e[0])+.7152*qe(e[1])+.0722*qe(e[2])}function yn(e,t,n){let r=typeof e=="string"?Oe(e):e,o=typeof t=="string"?Oe(t):t;if(!r||!o)return 0;let i=n?typeof n=="string"?Oe(n):n:null;o[3]<1&&i&&(o=bn(o,i));let a=r[3]<1?bn(r,o):r,s=Ft(a),l=Ft(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function Ka(e){return[qe(e[0]),qe(e[1]),qe(e[2])]}function pn(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 vr(e){let[t,n,r]=Ka(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),a=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*i-.0040720468*a,1.9779984951*o-2.428592205*i+.4505937099*a,.0259040371*o+.7827717662*i-.808675766*a]}function Xa([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,i=(e-.1055613458*t-.0638541728*n)**3,a=(e-.0894841775*t-1.291485548*n)**3;return[pn(4.0767416621*o-3.3077115913*i+.2309699292*a),pn(-1.2684380046*o+2.6097574011*i-.3413193965*a),pn(-.0041960863*o-.7034186147*i+1.707614701*a),r]}function Qe(e,t,n){let r=Oe(e),o=Oe(t);if(!r||!o)return e;let i=vr(r),a=vr(o),s=Math.max(0,Math.min(1,n));return Mr(Xa([i[0]*s+a[0]*(1-s),i[1]*s+a[1]*(1-s),i[2]*s+a[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function xn(e,t,n){let r=t[0],o=-1;for(let i of t){let a=yn(i,e,n);a>o&&(o=a,r=i)}return r}function Q(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 wn(e,t){let n=xn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return yn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):xn(t,["#FFFFFF","#000000"])}function _t(e,t){let n=Qe(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:wn(e,n),raw:n}}function we(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=Q(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{if(i===1)r[a]=Q(e,"neutral");else if(s===0)r[a]=Q(e,"ink");else if(s===i-1)r[a]=Q(e,"neutral");else if(i===3)r[a]=Q(e,"strong");else{let l=(s-1)/Math.max(1,i-2);r[a]=l<=.001?Q(e,"strong"):_t(e,1-l)}}),r}var kn="mix:";function Ie(e){return e({theme:dn,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${kn}${o}`}).map(n=>n.fill)}function Tr(e,t){return t?.startsWith(kn)?e.mix("neutralStrong","neutral",Number(t.slice(kn.length))):e.color(t)}function We(e,t,n){return we(e,t+1,n).slice(0,t)}function Pt(e,t,n,r="neutral"){let o=Q(e,"accent"),i=Q(e,r);return Array.from({length:t},(a,s)=>n.has(s)?o:i)}function ft(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=Q(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{i===1?r[a]=Q(e,"neutral"):s===0?r[a]=Q(e,"strong"):s===i-1?r[a]=Q(e,"neutral"):r[a]=_t(e,1-s/(i-1))}),r}var $e=F(Y(),1);var Lt=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),ie="en-US",Sr=new Map;function $n(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=Sr.get(r);return o||(o=new Intl.NumberFormat(e,n),Sr.set(r,o)),o}function vn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function tt(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ie,...r}=t;return vn($n(n,r).format(e))}var Mn=e=>e!==0&&Math.abs(e)<.05,Tn=(e,t,n="")=>`${tt(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function et(e,t={}){if(!Number.isFinite(e))return"-";if(Mn(e)&&t.maximumFractionDigits===void 0)return Tn(e,t.locale??ie,"%");let n=Math.abs(e);return`${tt(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Rr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ie,...r}=t;if(J(n)==="ko"){let o=Math.abs(e),i=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],a=i.findIndex(([s])=>o>=s);for(a<0&&(a=i.length-1);;){let[s,l]=i[a],u=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||u<100?1:0)),c=Math.round(u*10**m)/10**m;if(a>0&&c>=i[a-1][0]/s){a--;continue}return(e<0&&c!==0?"-":"")+tt(c,{locale:n,...r,maximumFractionDigits:m})+l}}return vn($n(n,{notation:"compact",...r}).format(e))}var Ua=(e,t=J(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Ke(e,t=ie,n){if(typeof e=="function")return e;let r=(o,i="",a="")=>{let s=$n(t,o);return l=>Number.isFinite(l)?`${a}${vn(s.format(l))}${i}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:i="",...a}=e;return r(a,o,i)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>et(o,{locale:t});case"ratio":return o=>et(o*100,{locale:t});case"compact":return o=>Rr(o,{locale:t});case"currency":return r(Ua(t));default:{let o=r({maximumFractionDigits:1});return i=>Mn(i)?Tn(i,t):o(i)}}}function Dt(e,t=ie,n=0){return e!==void 0?Ke(e,t):n>=1e5?r=>Mn(r)?Tn(r,t):Rr(r,{locale:t}):r=>tt(r,{locale:t})}function Ya(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,Ja=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Za=["january","february","march","april","may","june","july","august","september","october","november","december"],Cr=e=>{let t=e.toLowerCase();return t.length<3?0:Za.findIndex(n=>n.startsWith(t))+1},Ar=e=>+e+(+e<30?2e3:1900);function Fr(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var qa=[/^(\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})일)?$/],_r=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Pr=/\{([^{}]+)\}/g;function Et(e,t){let n;for(let r of qa)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?[Ar(n[3]),+n[2],+n[1],1]:[Ar(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=_r.exec(e)){let r=+n[1],o=+n[3],i=r>12||o<=12&&t===!0;return[+n[4],i?o:r,i?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=Cr(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=Cr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Cn=e=>Ja.test(e)||Et(e)!==null;function Lr(e){let t;for(let n of e){let r=typeof n=="string"?_r.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function ht(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 ht(`${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=Et(n,t);if(r)return Ya(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 Nr=new Map;function gt(e,t={month:"short",day:"numeric"}){let n=ht(e);if(!n)return"-";let{locale:r=ie,...o}=t,i=r+JSON.stringify(o),a=Nr.get(i);return a||(a=new Intl.DateTimeFormat(r,o),Nr.set(i,a)),a.format(n)}var An=F(V(),1),Ot=(0,$e.createContext)({theme:De,cssVars:!0});function Qa(e,t=De){return e?typeof e=="string"?fn[e]??t:gn(t,e):t}function It(e){let t=(0,$e.useContext)(Ot),n=e.base?fn[e.base]:t.theme,r=(0,$e.useMemo)(()=>Qa(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,i=e.locale??t.locale,a=(0,$e.useMemo)(()=>({theme:r,cssVars:o,locale:i}),[r,o,i]),s=(0,$e.useMemo)(()=>hn(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,An.jsx)(Ot.Provider,{value:a,children:(0,An.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var ei=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Er(e){return ei.has(e)}function ti(e,t){let n=r=>t?`var(${Ct(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Er(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Er(r)?e[r]:r:e[o],mix:(r,o,i)=>{let a=Math.round(Math.max(0,Math.min(1,i))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${a}%, ${n(o)})`:Qe(e[r],e[o],i)}}}function ve(e){let t=(0,$e.useContext)(Ot);return(0,$e.useMemo)(()=>{let n=gn(t.theme,e);return ti(n,t.cssVars)},[t.theme,t.cssVars,e])}function ue(e){let t=(0,$e.useContext)(Ot);return e??t.locale??ie}function Or(e){return e?hn(e):{}}var zt=F(Y(),1),Nn=(0,zt.createContext)(void 0);function Ir(e){let t=(0,zt.useContext)(Nn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var P=F(V(),1),ni={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`},ri={en:ni,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var oi={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Rn=e=>ri[J(ue(e))];function Fn(e){let t=ve(e.theme),n=Rn(e.locale),[r,o]=(0,Bt.useState)(!1),i=e.size??11.5,a=e.onToggle,s=new Set(a?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.label)).length,u=(0,P.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((m,c)=>{let d=!s.has(m.label),g=d&&l===1,f=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(ai,{p:t,item:m,off:!d}),(0,P.jsx)("span",{style:d?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,P.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:i,color:t.paint("muted"),lineHeight:1.3},children:a?(0,P.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":d,"aria-disabled":g||void 0,onClick:()=>{g||(a(m.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:g?"default":void 0},children:f}):f},c)})});return a?(0,P.jsxs)(P.Fragment,{children:[u,(0,P.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:oi,children:r?n.shown(l,e.items.length):""})]}):u}function ai({p:e,item:t,off:n}){let r=Tr(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,P.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,P.jsx)("line",{x1:1,x2:13,y1:4,y2:4,stroke:r,strokeWidth:2,strokeDasharray:o==="dash"?"3 2":void 0,strokeLinecap:"round"}),o==="line"?(0,P.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,P.jsx)("span",{"aria-hidden":"true",style:{width:9,height:9,flex:"none",borderRadius:o==="circle"?9:2.5,background:r,boxShadow:t.color==="neutral"||t.color==="neutralSoft"||!t.color?`inset 0 0 0 1px ${e.paint("line2")}`:void 0,opacity:n?.35:void 0}})}function ii(e){let t=ve(e.theme),n=wr(e.level,J(ue(e.locale)));return(0,P.jsx)("span",{style:{background:t.paint(n.bg),color:t.paint(n.fg),borderRadius:8,padding:"3px 9px",fontSize:12.5,fontWeight:700,lineHeight:"18px",whiteSpace:"nowrap",flex:"none"},children:n.text})}function si(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,P.jsxs)(P.Fragment,{children:[e.slice(0,r),(0,P.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function zr(e){let t=ve(e.theme),n=Rn(e.locale),[r,o]=(0,Bt.useState)(0);Ae(()=>dt(),[]);let i=()=>{o(d=>d+1),e.onReplay?.()},a=Array.isArray(e.legend)?(0,P.jsx)(Fn,{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,m=e.source!==void 0||e.note!==void 0?(0,P.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,c=e.takeaway!==void 0||e.level||e.sample?(0,P.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,P.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,P.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,P.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,P.jsx)(ii,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,P.jsxs)("section",{id:e.id,className:`ztd-card${e.className?` ${e.className}`:""}`,style:{background:t.paint("panel"),color:t.paint("ink"),border:`1px solid ${t.paint("line")}`,borderRadius:`var(--ztd-radius, ${t.theme.radius}px)`,padding:"20px 20px 16px",display:"flex",flexDirection:"column",gap:12,minWidth:0,boxSizing:"border-box",fontFamily:t.cssVars?`var(--ztd-font, ${t.theme.fontFamily})`:t.theme.fontFamily,wordBreak:"keep-all",textWrap:"balance",...e.style},children:[(0,P.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,P.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,P.jsx)("span",{style:{fontFamily:t.cssVars?`var(--ztd-mono, ${t.theme.monoFamily})`:t.theme.monoFamily,fontSize:17,fontWeight:700,color:t.paint("accentText"),letterSpacing:-.2,flex:"none"},children:l}):null,(0,P.jsx)(s,{style:{margin:0,fontSize:22,fontWeight:800,color:t.paint("ink"),letterSpacing:-.5,lineHeight:1.25,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:si(e.title,e.accent,t.paint("accentText"))}),e.actions,u?(0,P.jsx)("button",{type:"button",className:"ztd-btn",onClick:i,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,P.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,P.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,P.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||a?(0,P.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,P.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,P.jsx)("span",{}),a]}):null]}),(0,P.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,P.jsx)(Nn.Provider,{value:r,children:(0,P.jsx)(Ze.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,P.jsxs)(P.Fragment,{children:[m,c]}):c]})}function _n(e){let t=ve(e.theme),n=Rn(e.locale),r=e.height??220;if(Ae(()=>dt(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,P.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,P.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,P.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,P.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,P.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onRetry,style:{marginTop:4,background:t.paint("ink"),color:t.paint("onInk"),border:"none",borderRadius:14,padding:"5px 14px",fontSize:12.5,fontWeight:700},children:n.retry}):null]})})}return e.loading?(0,P.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,i)=>(0,P.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${i*90}ms`}},i))}):e.empty?(0,P.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,P.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,P.jsx)(P.Fragment,{children:e.children})}var ot=F(Y(),1);var me=F(Y(),1);var X=F(V(),1),Ht=60;var jt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Br(e){let{c:t,events:n}=e,r=(0,me.useId)().replace(/:/g,""),o=`${r}t`,i=`${r}d`;t.events.current=n,Ae(()=>{dt()},[]);let a=n.length,s=!e.noNav&&a>0,l=(0,me.useContext)(Ze),u=e.ariaLabel??l??e.kind,m=(0,me.useMemo)(()=>s?`${n.length}${n.slice(0,Ht).map($=>`${$.label}${$.series??""}${$.formatted??$.value??""}`).join("")}`:"",[n,s]),c=(0,me.useMemo)(()=>(0,X.jsx)(li,{label:u,events:n,t:t.t}),[u,m,t.t]),d=(0,me.useRef)(null);(0,me.useEffect)(()=>{let $=()=>{d.current=null};return window.addEventListener("scroll",$,{capture:!0,passive:!0}),window.addEventListener("resize",$,{passive:!0}),()=>{window.removeEventListener("scroll",$,{capture:!0}),window.removeEventListener("resize",$)}},[]),(0,me.useEffect)(()=>{d.current=null},[t.width,t.height]);let g=$=>{if($.target!==$.currentTarget)return;if(e.onKey?.($)){$.preventDefault();return}let h=t.active,D;switch($.key){case"ArrowRight":case"ArrowDown":D=h===null?0:(h+1)%a;break;case"ArrowLeft":case"ArrowUp":D=h===null?a-1:(h-1+a)%a;break;case"Home":D=0;break;case"End":D=a-1;break;case"Escape":if(h===null)return;D=null;break;case"Enter":case" ":h!==null&&($.preventDefault(),t.click(h));return;default:return}$.preventDefault(),t.setActive(D,"keyboard")},{via:f,node:b,setActive:M}=t;(0,me.useEffect)(()=>{if(f!=="touch"||!b)return;let $=h=>{b.contains(h.target)||M(null)};return document.addEventListener("pointerdown",$),()=>document.removeEventListener("pointerdown",$)},[f,b,M]);let w=t.active!==null?n[t.active]:null,v=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,S=v&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,R=typeof e.renderTip=="function"&&w?e.renderTip(w):null,x=e.announce??(t.via==="keyboard"&&w?`${w.label}${w.series?` ${w.series}`:""}: ${w.formatted??w.value??""} (${(t.active??0)+1}/${a})`:""),_;if(v){let $=v.x*S,h=t.width*S,D=`clamp(${(4-$).toFixed(1)}px, -50%, calc(${(h-$-4).toFixed(1)}px - 100%))`,W=v.y<64;_={position:"absolute",left:$,top:v.y*S,transform:`translate(${D}, ${W?"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*S-8)}}let z=$=>{d.current=null,$.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},O=$=>$?h=>{let D=d.current??(d.current=h.currentTarget.getBoundingClientRect());D.width&&$((h.clientX-D.left)/D.width*t.width,(h.clientY-D.top)/D.height*t.height,h)}:void 0,I=O(e.onPointerMove),B=O(e.onPointerDown),E=I||B?$=>{$.pointerType==="touch"&&I?.($),B?.($)}:void 0,N=O(e.onPointerUp),C=Or(e.theme);return(0,X.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":u,"aria-describedby":i,tabIndex:s?0:void 0,onKeyDown:s?g:void 0,onBlur:$=>{t.via==="keyboard"&&!$.currentTarget.contains($.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"),...C,...e.style},children:[t.pending?null:e.underlay,(0,X.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${i}`,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:I,onPointerDown:E,onPointerUp:N,onPointerCancel:N,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,X.jsx)("title",{id:o,children:u}),(0,X.jsx)("desc",{id:i,children:a||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,X.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,v?(0,X.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:_,children:R??(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:v.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:v.title}),v.rows.map(($,h)=>(0,X.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,X.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint($.strong?"ink":"muted")},children:[$.color?(0,X.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:$.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,$.label]}),(0,X.jsx)("span",{style:{fontWeight:$.strong===!1?500:700},children:$.value})]},h))]})}):null,(0,X.jsx)("span",{className:"ztd-sr",style:jt,"aria-live":"polite","aria-atomic":"true",children:x}),s&&!t.pending?c:null]})}function li({label:e,events:t,t:n}){return(0,X.jsx)("div",{className:"ztd-sr",style:jt,children:(0,X.jsxs)("table",{children:[(0,X.jsx)("caption",{children:n.table(e)}),(0,X.jsxs)("tbody",{children:[t.slice(0,Ht).map((r,o)=>(0,X.jsxs)("tr",{children:[(0,X.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,X.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Ht?(0,X.jsx)("tr",{children:(0,X.jsx)("td",{colSpan:2,children:n.more(t.length-Ht)})}):null]})]})})}function ze(e){let t=e.baseline??"central";return(0,X.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var y=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),ge=y("label","string",!0,"Item name field"),ne=y("value","number",!0,"Value field"),ci=[ge,ne],ui=[ge,ne],mi=[y("label","string",!0,"Stage name"),y("value","number",!0,"Users at the stage")],di=[ge,ne],fi=[y("label","string",!0,"Leaf (lowest level) name"),ne,y("group","string",!1,"Parent group field")],hi=[y("label","string",!0,"Leaf name"),ne,y("group","string",!1,"Parent group field")],gi=[ge,y("value","number",!0,"Change (total rows may omit it)"),y("type","string",!1,'"total" makes a total bar')],pi=[ge,ne],bi=[y("x","string",!0,"Column field"),y("series","string",!0,"Stacked series field"),ne],yi=[y("x","string",!0,"Column field"),y("y","string",!0,"Row field"),ne],xi=[y("axis","string",!0,"Metric (axis) field"),y("value","number",!0,"Value field",{multi:!0}),y("series","string",!1,"Series field")],ki=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("size","number",!1,"Circle size"),y("label","string",!1,"Name")],jr=y("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),wi=[y("x","any",!0,"x field (date, number or category)"),y("y","number",!0,"y field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field (long tables)"),y("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),jr],$i=[y("x","any",!0,"x field"),y("y","number",!0,"y field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field"),y("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}),jr],vi=[y("x","any",!0,"x field"),y("y","number",!0,"y field",{multi:!0}),y("series","string",!1,"Series field")],Mi=[y("x","string",!0,"Category field"),y("y","number",!0,"Value field. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field"),y("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})],Ti=[ge,ne],Si=[y("value","number",!0,"Value field",{prop:"valueKey"}),y("target","number",!1,"Target field",{prop:"targetKey"})],Ci=[ge,y("value","number",!0,"Actual value field"),y("target","number",!1,"Target field")],Ai=[y("x","any",!1,"x field"),y("y","number",!0,"y field")],Ni=[ge,y("x","string",!1,"Period field (long tables)"),y("value","number",!1,"Value field (long tables)")],Ri=[ge,y("start","number",!0,"Before value"),y("end","number",!0,"After value")],Fi=[ge,ne],_i=[y("value","number",!0,"Value field"),y("group","string",!1,"Group (row) field"),y("label","string",!1,"Dot name")],Pi=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],Li=[y("source","string",!1,"Source node"),y("target","string",!1,"Target node"),y("dimensions","string",!1,"Stage columns of a wide table, left to right (2 to 6). Each row is one path, so source and target are not used. Without value, each row counts 1",{multi:!0}),y("value","number",!1,"Value field")],Di=[y("source","string",!0,"Sending group"),y("target","string",!0,"Receiving group"),ne],Ei=[y("date","date",!0,"Date field"),ne],Oi=[y("x","any",!0,"Period field"),y("series","string",!0,"Item field"),y("rank","number",!1,"Rank field (1 is first)"),y("value","number",!1,"Value field (instead of rank, largest is first)")],Ii=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],zi=[y("label","string",!1,"Row name field")],Bi=[y("x","date",!0,"Date (period) field"),y("open","number",!0,"Open price field"),y("high","number",!0,"High price field"),y("low","number",!0,"Low price field"),y("close","number",!0,"Close price field"),y("volume","number",!1,"Volume field")],Hi=[ge,ne],ji=[y("x","any",!0,"Period field (date or category)"),y("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),y("series","string",!1,"Series field (long tables, back row only)"),y("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Gi=[y("value","number",!1,"Sample value field (raw rows)"),y("group","string",!1,"Group field. Up to 2 groups overlap"),y("x0","number",!1,"Bin start (pre-binned rows)"),y("x1","number",!1,"Bin end (pre-binned rows)"),y("count","number",!1,"Samples in the bin (pre-binned rows)")],Vi=[y("region","string",!0,"Region name or code, matched to a tile of options.map"),ne],Wi=[ge,ne,y("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],Ki=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),y("value","number",!1,"Link weight. Without it every row counts 1")],Xi=[y("label","string",!0,"Row name. Items with the same name share a row"),y("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),y("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),y("group","string",!1,"Group field (one color per group, and the legend)"),y("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],Ui=[y("label","string",!0,"Node name field"),y("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),y("group","string",!1,"Parent group field (flat rows, as in the treemap)"),y("id","string",!1,"Row id for id/parent rows. Defaults to the label"),y("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],Yi=[y("region","string",!0,"Region name or code, matched to a region of options.map"),ne],Ji=[y("lon","number",!1,"Longitude (degrees)"),y("lat","number",!1,"Latitude (degrees)"),y("size","number",!1,"Value (circle area). Without it all circles match"),y("label","string",!1,"Place name"),y("region","string",!1,"Region of options.map, for rows without lon and lat"),y("group","string",!1,"Group field (one color per group)")],Zi=[y("source","string",!0,"Start: a name in options.places or a region"),y("target","string",!0,"End"),y("value","number",!1,"Amount. Without it each row counts 1")],qi=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("series","string",!1,"Series field (one color per series)"),y("label","string",!1,"Name")],Hr={pie:ci,donut:ui,funnel:mi,waffle:di,treemap:fi,sunburst:hi,waterfall:gi,pareto:pi,marimekko:bi,heatmap:yi,radar:xi,bubble:ki,line:wi,area:$i,stream:vi,bar:Mi,radialBar:Ti,gauge:Si,bullet:Ci,sparkline:Ai,slope:Ni,dumbbell:Ri,lollipop:Fi,beeswarm:_i,ridgeline:Pi,sankey:Li,chord:Di,calendar:Ei,bump:Oi,box:Ii,parallel:zi,candlestick:Bi,segmented:Hi,skyline:ji,histogram:Gi,scatter:qi,tileMap:Vi,barRace:Wi,network:Ki,timeline:Xi,tree:Ui,choropleth:Yi,symbolMap:Ji,flowMap:Zi},nt={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"},tileMap:{component:"TileMap",name:"Tile grid map",nameKo:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"}};function Gr(e,t){return t==="ko"?e.nameKo:e.name}function Vr(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Wr=["line","area","bar","scatter"],Kr=24,Pn=["line","area","bar","scatter","timeline"];function Ln(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function Xr(e,t,n){return Pn.includes(e)&&!Ln(e,t,n).length&&!(e==="scatter"&&Gt(n))}function Gt(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function Ur(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Qi={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",butterfly:"bar",pyramid:"bar",populationPyramid:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",raincloud:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap",alluvial:"sankey",parallelSets:"sankey"};function Vt(e){let t=Hr[e]?e:Qi[e]??Object.keys(nt).find(n=>n.toLowerCase()===e.toLowerCase()||nt[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!nt[t]))return{type:t,component:nt[t].component,name:nt[t].name,nameKo:nt[t].nameKo,encoding:Hr[t]}}function Yr(e){let t=new Set,n=i=>{Array.isArray(i)?i.forEach(n):typeof i=="string"&&i&&t.add(i)},r=e.encoding??{};for(let i of Vt(e.type)?.encoding.map(a=>a.name)??Object.keys(r))n(r[i]);let o=e.options??{};for(let i of["dimensions","start","end","ranges"])n(o[i]);return[...t]}function Jr(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function es(e,t){if(e==null||typeof e!="object")return;let n=e;if(Jr(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!Jr(r,o))return;r=r[o]}return r}}function Re(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 Xe(e,t){if(typeof e=="function")return e;let n=e??t;return r=>es(r,n)}function Wt(e,t){let n=Xe(e,t);return(r,o)=>Re(n(r,o))}function Fe(e,t){let n=Xe(e,t);return(r,o)=>{let i=n(r,o);return i==null?"":i instanceof Date?new Date(i.getTime()-i.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(i)}}function Me(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function ts(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,i=[","," ",";","|"],a=",",s=0;for(let l of i){let u=o(l);u>s&&(s=u,a=l)}return a}var ns=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function Zr(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(ns.test(t)||/^[-+]?\.\d+$/.test(t)){let n=Re(t);if(Number.isFinite(n))return n}return t}function Ue(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let i=t.delimiter??ts(o),a=[],s=[],l="",u=!1;for(let f=0;f<o.length;f++){let b=o[f];u?b==='"'?o[f+1]==='"'?(l+='"',f++):u=!1:l+=b:b==='"'&&!l.trim()?(u=!0,l=""):b===i?(s.push(l),l=""):b===`
24
- `||b==="\r"?(b==="\r"&&o[f+1]===`
25
- `&&f++,s.push(l),a.push(s),s=[],l=""):l+=b}(l!==""||s.length)&&(s.push(l),a.push(s));let m=a.filter(f=>!(f.length===1&&f[0].trim()===""));if(!m.length)return[];let c=f=>n?Zr(f):f;if(!r)return m.map(f=>Object.fromEntries(f.map((b,M)=>[String(M),c(b)])));let d=[],g=new Set;return m[0].forEach((f,b)=>{let M=f.trim()||`col${b+1}`,w=M;for(let v=2;g.has(w);v++)w=`${M}_${v}`;g.add(w),d.push(w)}),m.slice(1).map(f=>Object.fromEntries(d.map((b,M)=>[b,c(f[M]??"")])))}function Dn(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((a,s)=>String(a??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(a=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof a[l]=="string"?Zr(a[l]):a[l]??null])))}function rs(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(i=>Array.isArray(i))){let i=Object.keys(e),a=Math.max(...o.map(s=>s.length));return Array.from({length:a},(s,l)=>Object.fromEntries(i.map(u=>[u,e[u][l]??null])))}return Object.entries(e).map(([i,a])=>({[n]:i,[r]:a}))}function qr(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 Be(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Be(JSON.parse(t))}catch{}return Ue(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Dn(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)?Be(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Dn(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)?Be(t.rows):Array.isArray(t.values)?Dn(t.values):Array.isArray(t.items)?Be(t.items):Array.isArray(t.results)?Be(t.results):rs(t)}return[]}function Kt(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=i=>{try{return JSON.stringify(i)}catch{return String(i)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let i=0;i<t;i+=r)o.push(e[i]);return o.push(e[t-1]),`${t}:${n(o)}`}function En(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),i=e.map(()=>new Array(r).fill(0)),a=(l,u)=>{let m=e[l][u];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let u=1;u<r;u++){let m=0,c=0;for(let d=0;d<n;d++){let g=a(d,u),f=g-a(d,u-1),b=0;for(let M=0;M<d;M++)b+=a(M,u)-a(M,u-1);m+=g,c+=(f/2+b)*g}m&&(l-=c/m),s[u]=l}}for(let l=0;l<r;l++){if(t==="zero"){let c=0,d=0;for(let g=0;g<n;g++){let f=e[g][l],b=Number.isFinite(f)?f:0;b>=0?(o[g][l]=c,c+=b,i[g][l]=c):(o[g][l]=d,d+=b,i[g][l]=d)}continue}let u=0;for(let c=0;c<n;c++)u+=a(c,l);let m=t==="silhouette"?-u/2:s[l];for(let c=0;c<n;c++){let d=a(c,l);t==="expand"&&(d=u?d/u*100:0),o[c][l]=m,m+=d,i[c][l]=m}}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,i[n-1]?.[c]??0);let m=0;for(let c=0;c<r;c++)m+=((o[0]?.[c]??0)+(i[n-1]?.[c]??0))/2;m/=r;for(let c=0;c<n;c++)for(let d=0;d<r;d++)o[c][d]-=m,i[c][d]-=m}return{y0:o,y1:i}}function Qr(e,t,n=-1){if(!t.some(r=>r>=0))return-1;for(let r=e-1;r>=0;r--)if(r!==n&&!t.includes(r))return r;return-1}function eo(e){let t=e.length,n=e.map(u=>{let m=0,c=-1/0;return u.forEach((d,g)=>{d>c&&(c=d,m=g)}),m}),r=e.map(u=>u.reduce((m,c)=>m+(Number.isFinite(c)?c:0),0)),o=Array.from({length:t},(u,m)=>m).sort((u,m)=>n[u]-n[m]),i=[],a=[],s=0,l=0;for(let u of o)s<l?(i.push(u),s+=r[u]):(a.push(u),l+=r[u]);return[...a.reverse(),...i]}var os=Math.PI*2;function to(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function no(e,t,n,r){return Math.max(0,Math.min(r-1,Math.round((e-t)/(n-t||1)*(r-1))))}function ro(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function as(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function oo(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 Xt=new Map;function se(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=Xt.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let u=r.charCodeAt(l);as(u)?a+=oo(u):s+=oo(u)}i=a+s*(n>=600?1.07:1),Xt.size>5e3&&Xt.clear(),Xt.set(o,i)}return i*t}var io=F(V(),1),is=e=>Array.isArray(e)&&e.length===2;function ao(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&is(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var co=F(V(),1),pe=10.5;function ss(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let a=1;a<e.length;a++)o=Math.min(o,Math.abs(e[a]-e[a-1]));let i=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(a=>tt(a,{locale:n,maximumFractionDigits:i}))}function so(e,t,n){let r=18;for(let o of ss(e,t,n))r=Math.max(r,se(o,pe));return Math.ceil(r+8)}function lo(e,t,n=pe,r=8,o=400,i){let a=t.length;if(a<=1)return t.map((c,d)=>d);let s=t.map(c=>se(c,n,o)),l=(c,d)=>Math.abs(e[d]-e[c])<(s[c]+s[d])/2+r,u=[];for(let c of i??[])u.some(d=>l(d,c))||u.push(c);let m=c=>!u.some(d=>l(d,c));for(let c=1;c<=a;c++){let d=u.slice();for(let g=0;g<a;g+=c)m(g)&&d.push(g);if(c>1&&(a-1)%c>c/2&&m(a-1)&&d.push(a-1),d.sort((g,f)=>g-f),d.every((g,f)=>!f||!l(d[f-1],g)))return d}return[0,a-1]}function Ut(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 He(e,t,n=4,r={}){let o=e,i=t;if(!Number.isFinite(o)||!Number.isFinite(i))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),i<0&&(i=0)),o===i)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let a=i-o,s=r.pad??.07,l=Ut(a,n),u=[o,i];for(let m=0;m<4;m++){let c=Math.ceil(i/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;u=[o===0?0:o-d<=l*.3?d:o-a*s,i===0?0:c-i<=l*.3?c:i+a*s];let g=Ut(u[1]-u[0],n);if(g===l)break;l=g}return u}function uo(e,t,n=4,r={}){let o=e,i=t;if(!Number.isFinite(o)||!Number.isFinite(i))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),i<0&&(i=0)),o===i)return o===0?[0,1]:o>0?[0,o*1.25]:[o*1.25,0];let a=Ut(i-o,n);return[Math.floor(o/a+1e-9)*a,Math.ceil(i/a-1e-9)*a]}function pt(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=Ut(o-r,n),a=[],s=Math.ceil(r/i-1e-9)*i;for(let l=s,u=0;l<=o+i*1e-9&&u<200;l+=i,u++)a.push(Number((Math.round(l/i)*i).toPrecision(12)));return a}function On(e,t){let[n,r]=e,[o,i]=t,a=r===n?0:(i-o)/(r-n),s=(l=>o+(l-n)*a);return s.domain=e,s.range=t,s.invert=l=>a===0?n:n+(l-o)/a,s.ticks=(l=4)=>pt(n,r,l),s}function In(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[i,a]=He(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function ls(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(u,m=1)=>{let c=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let g of u){let f=Number((g*10**d).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&c.push(f)}return c},s=i>=110?a([1,2,5]):a([1],Math.max(1,Math.ceil(24/i)));if(s.length>=2)return s;let l=a([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:pt(e,t,3)}function mo(e,t){let n=On([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=()=>ls(e[0],e[1],Math.abs(t[1]-t[0])),r}function bt(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 cs=864e5;function fo(e,t,n,r=ie){let o=t-e;if(!(o>0))return[{t:e,label:gt(e,{locale:r,month:"short",day:"numeric"})}];let i=o/cs,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),u=(m,c,d,g=!1)=>{let f=new Date(m),b=-1,M=0;for(;f.getTime()<=t&&M++<500;){if(f.getTime()>=e){let w=f.getFullYear(),v=g&&!l&&w!==b;a.push({t:f.getTime(),label:gt(f,{locale:r,...d,...v?{year:"numeric"}:{}})}),b=w}c(f)}};if(i<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),c=[1,2,3,4,6,12].find(g=>g>=m)??12,d=new Date(s);d.setMinutes(0,0,0),u(d,g=>g.setHours(g.getHours()+c),{hour:"numeric"})}else if(i<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());u(m,c=>c.setDate(c.getDate()+1),{month:"numeric",day:"numeric"})}else if(i<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),u(m,c=>c.setDate(c.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=i/30.44,c=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(g=>g>=c)??120;if(d>=12){let g=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);u(g,f=>f.setFullYear(f.getFullYear()+d/12),{year:"numeric"})}else{let g=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=g.getMonth()%d;f&&g.setMonth(g.getMonth()+(d-f)),u(g,b=>b.setMonth(b.getMonth()+d),{month:"short"},!0)}}return a}function ho(e,t){let n=new Array(e),r=new Uint8Array(e),o=i=>{if(typeof i!="string"||i.length===0||i.length>9)return-1;let a=Number(i);return Number.isInteger(a)&&a>=0&&a<e&&String(a)===i?a:-1};return new Proxy(n,{get(i,a,s){let l=o(a);return l>=0?(r[l]||(i[l]=t(l),r[l]=1),i[l]):Reflect.get(i,a,s)},has(i,a){return o(a)>=0||Reflect.has(i,a)}})}var us=(e,t,n)=>e==="date"?ht(t,n)?.getTime()??NaN:Re(t);function go(e){if(!Cn(e.trim()))return e;let t=ht(e)?.getTime();return t===void 0||!Number.isFinite(t)?e:String(t)}function ms(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Cn(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function je(e,t,n,r,o={}){let i=Xe(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:Xe(n,"y"),u=!a&&r!==void 0?Xe(r,"series"):null,m=e.map((C,$)=>i(C,$)),c=o.xType??ms(m),d=o.locale??ie,g,f,b;if(c==="band"){let C=m.map(h=>String(h??""));g=Me(C);let $=new Map(g.map((h,D)=>[h,D]));f=g.map((h,D)=>D),b=Int32Array.from(C,h=>$.get(h)??-1)}else{let C=c==="date"?o.dayFirst??Lr(m):void 0,$=m.map(W=>us(c,W,C)),h=Array.from(new Set($.filter(W=>Number.isFinite(W)))).sort((W,G)=>W-G),D=new Map(h.map((W,G)=>[W,G]));f=h,g=h.map(String),b=Int32Array.from($,W=>D.get(W)??-1)}let M=o.dateFormat,w=C=>typeof C=="string"?Et(C.trim())?.[3]:void 0,v=c==="date"&&m.length<5e3?w(m[0]):void 0,S=(v===2||v===3)&&m.every(C=>w(C)===v),R=S&&v===3;if(c==="date"&&!M){let C=f.length>1?f[f.length-1]-f[0]:0;M=S&&v===2||C>864e5*120?{month:"short"}:C<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},C>864e5*800&&(M={year:"numeric",month:"short"})}let x;if(c==="band")x=g;else if(R&&!o.dateFormat){let C=J(d)==="ko";x=f.map($=>{let h=new Date($),D=Math.floor(h.getMonth()/3)+1;return C?`${h.getFullYear()}년 ${D}분기`:`Q${D} ${h.getFullYear()}`})}else{let C=f.every(Sn),$=c==="date"?new Intl.DateTimeFormat(d,M):new Intl.NumberFormat(d,C?{useGrouping:!1}:{maximumFractionDigits:6});x=f.length>1e3?ho(f.length,h=>$.format(f[h])):f.map(h=>$.format(h))}let _=s?[...s]:u?Me(e.map((C,$)=>String(u(C,$)??""))):[""],z=new Map(_.map((C,$)=>[C,$])),O=_.map(()=>new Array(g.length).fill(NaN)),I=_.map(()=>new Array(g.length).fill(null)),B=o.aggregate??"sum",E=B==="mean"?_.map(()=>new Uint32Array(g.length)):null,N=(C,$,h,D)=>{let W=O[C][$];B==="last"?O[C][$]=h:B==="count"?O[C][$]=(Number.isFinite(W)?W:0)+1:B==="mean"?Number.isFinite(h)&&(O[C][$]=(Number.isFinite(W)?W:0)+h,E[C][$]++):O[C][$]=Number.isFinite(W)?W+(Number.isFinite(h)?h:0):h,I[C][$]=D};for(let C=0;C<e.length;C++){let $=b[C];if($<0)continue;let h=e[C];if(s)for(let D=0;D<s.length;D++)N(D,$,Re(h[s[D]]),h);else{let D=u?z.get(String(u(h,C)??""))??0:0;N(D,$,Re(l(h,C)),h)}}if(E)for(let C=0;C<O.length;C++)for(let $=0;$<g.length;$++)E[C][$]>1&&(O[C][$]/=E[C][$]);return{type:c,keys:g,xnum:f,labels:x,series:_,values:O,rows:I}}var ds=140,xt=12,po=14,zn=20,bo=12.5;function fs(e,t,n=Kr){let r=Fe(t,t),o=new Map;e.forEach((a,s)=>{let l=r(a,s),u=o.get(l);u?u.push(a):o.set(l,[a])});let i=[...o.keys()].slice(0,n);return{values:i,groups:i.map(a=>o.get(a)),dropped:Math.max(0,o.size-n)}}function hs(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+xt)/(ds+xt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function gs(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*xt)/t));return{pw:r,ph:typeof n=="number"&&Number.isFinite(n)&&n>0?n:Math.max(120,Math.min(180,Math.round(r*.62)))}}var yt=e=>e.filter(Number.isFinite);function Yt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Wt(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return yt(n)}function yo(e,t,n,r,o,i){return je(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function ps(e,t,n,r,o,i){let a=Math.max(2,Math.round(i/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,u=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let x=t.flat(),_=r.refLines??{},[z,O]=bt([...Yt(x,r.x??"x"),...yt([Number(_.x)])]),[I,B]=bt([...Yt(x,r.y??"y"),...yt([Number(_.y)])].filter(N=>!s||N>0)),E=r.zero??!1;return{y:u??(s?In(I,B,a):He(I,B,a,{zero:E,pad:.08})),x:r.xDomain??He(z,O,Math.max(2,Math.round(o/110)),{zero:E,pad:.06}),sameKeys:!0}}let m=e==="bar",c=m&&r.orientation==="horizontal",d=n[0]?.keys.join(""),g=n.every(x=>x.keys.join("")===d),f=n.length>0&&n.every(x=>x.type!=="band"&&x.type===n[0].type),b=r.xDomain??(!m&&f?bt(n.flatMap(x=>yt(x.xnum))):void 0),M=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(M==="percent")return{x:b,sameKeys:g};if(u)return{y:u,x:b,sameKeys:g};let w=[];t.forEach((x,_)=>{let z=n[_];if(M==="stacked"||M==="auto"&&z.series.length>1){let I=En(z.values,"zero");I.y0.forEach(B=>w.push(...B)),I.y1.forEach(B=>w.push(...B))}else z.values.forEach(I=>w.push(...I));m&&!c&&r.line!==void 0&&yo(e,x,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(I=>w.push(...I)),m||w.push(...Yt(x,r.lower),...Yt(x,r.upper))}),m&&w.push(0),c||w.push(...ao(r.annotations));for(let x of r.referenceLines??[])w.push(x.y);r.signColors&&w.push(Number(r.baseline??0));let[v,S]=bt(yt(w).filter(x=>!s||x>0));return{y:s?In(v,S,a):m?He(v,S,c?Math.max(2,Math.round(o/120)):a):He(v,S,a,{zero:r.zero??e==="area"}),x:b,sameKeys:g}}function bs(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=je(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),u=(r.yScale==="log"&&e==="line"?mo:On)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),m=so(u,Dt(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),c=n.flatMap(x=>x.series),d=r.endLabels??n.some(x=>x.series.length>1),g=m+6,f=i-(d?Math.min(i*.28,Math.max(...c.map(x=>se(x,11,700)),20)+14):10),b=l.keys.length,[M,w]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,v=l.type==="number"?b>12:b>fo(M,w,Math.max(2,Math.floor((f-g)/64)),s).length;if(l.type==="band"||!b||v)return;let S=x=>g+(l.xnum[x]-M)/(w-M)*(f-g),R=x=>se(l.labels[x],pe);for(let x=1;;x++){let _=Array.from({length:Math.ceil(b/x)},(z,O)=>O*x);if(x>=b||_.every((z,O)=>!O||S(z)-S(_[O-1])>=(R(z)+R(_[O-1]))/2+8))return _.map(z=>({value:l.xnum[z],label:l.labels[z]}))}}function ys(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")}function xs(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${ys(`${e}|${t}|${o}|${Kt(r)}`)}`}function ks(e,t){return typeof e=="string"?t.includes(e):Array.isArray(e)&&e.length>0&&e.every(n=>typeof n=="string"&&t.includes(n))}var ws={en:{intro:(e,t)=>`${Ee(e,"panel")} by ${t}.`,endHigh:(e,t)=>` ${e} ends highest at ${t}.`,falling:e=>` Lower at the end than at the start: ${e}.`,noneFalling:" None is lower at the end than at the start.",total:(e,t)=>` ${e} has the largest total at ${t}.`,points:(e,t)=>` ${e} has the most points (${t}).`,dropped:(e,t)=>` Only the first ${e} of ${t} values are shown.`,more:", …",blank:"(blank)"},ko:{intro:(e,t)=>`${t}별 패널 ${e}개.`,endHigh:(e,t)=>` 마지막 값이 가장 큰 곳: ${e}(${t}).`,falling:e=>` 처음보다 끝이 낮은 곳: ${e}.`,noneFalling:" 처음보다 끝이 낮은 곳은 없어요.",total:(e,t)=>` 합계가 가장 큰 곳: ${e}(${t}).`,points:(e,t)=>` 점이 가장 많은 곳: ${e}(${t}개).`,dropped:(e,t)=>` ${t}개 중 앞의 ${e}개만 보여요.`,more:" 등",blank:"(빈 값)"}},Bn=18;function xo(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=fs(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=hs(s,a,e.columns),{pw:u,ph:m}=gs(s,l,e.height),c=e.scale!=="free",d=t==="scatter"?[]:o.map(E=>yo(t,E,n,n.y,n.series,n.aggregate)),g=c?ps(t,o,d,n,u,m):{sameKeys:!1},f=c?bs(t,o,d,n,g,u,m,e.locale):void 0,b=t==="bar"&&n.orientation==="horizontal",M=c&&(!b||g.sameKeys),w=c&&(b||g.x!==void 0||g.sameKeys),v=new Set(ks(e.highlight,r)?[e.highlight].flat():[]),S=v.size>0,R=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,x=e.syncId??xs(t,e.by,n,e.data),_=Lt(Ke(n.format,e.locale),n.unit),z=ws[e.lang],O=[],I=r.map(E=>E===""?z.blank:E);return{panels:r.map((E,N)=>{let C=o[N],$=I[N],h=N%l,D;if(t!=="scatter"){let G=d[N],le=ce=>G.values.reduce((xe,it)=>xe+(Number.isFinite(it[ce])?it[ce]:0),0),K=G.keys.map((ce,xe)=>xe).filter(ce=>G.values.some(xe=>Number.isFinite(xe[ce]))),oe=K[K.length-1];O.push({first:K.length?le(K[0]):NaN,last:K.length?le(oe):NaN,total:K.reduce((ce,xe)=>ce+le(xe),0)}),t!=="bar"&&G.series.length===1&&oe!==void 0&&(D=_(G.values[0][oe]))}else O.push({first:NaN,last:NaN,total:C.length});let W={data:C,width:u,height:m,ariaLabel:e.title?`${e.title}, ${$}`:$,syncId:x,highlight:S?v.has(E)?R?()=>!0:void 0:"none":e.highlight,showYAxis:!M||h===0,showXAxis:!w||N+l>=a};return g.y&&(W.yDomain=g.y),g.x&&(W.xDomain=g.x),f&&(W.xTicks=f),{value:E,label:$,props:W,last:D,isPicked:v.has(E)}}),cols:l,pw:u,ph:m,isPanelPick:S,description:$s(t,e.by,I,O,i,_,z)}}function $s(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=u=>ro(r.map(m=>m[u]));if(e==="line"||e==="area"){let u=l("last");u>=0&&(s+=a.endHigh(n[u],i(r[u].last)));let m=n.filter((c,d)=>r[d].last<r[d].first);s+=m.length?a.falling(`${m.slice(0,5).join(", ")}${m.length>5?a.more:""}`):a.noneFalling}else{let u=l("total");u>=0&&(s+=e==="bar"?a.total(n[u],i(r[u].total)):a.points(n[u],r[u].total))}return o&&(s+=a.dropped(n.length,n.length+o)),s}var de=F(Y(),1);function vs(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Ms(e,t,n=1/0){let r=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=Math.min(r*.5,n))}var Jt={threshold:.25,enoughPx:96,rootMargin:"0px"};function $o(e,t=!0){let[n,r]=(0,de.useState)({visible:!t,near:!t});return(0,de.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(a=>{let s=Ms(a[a.length-1],Jt.threshold,Jt.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:vs(Jt.threshold),rootMargin:Jt.rootMargin}),i=new IntersectionObserver(a=>{let s=a[a.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),i.observe(e),()=>{o.disconnect(),i.disconnect()}},[e,t]),n}function ko(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function Zt(e){let[t,n]=(0,de.useState)(null),[r,o]=(0,de.useState)(e??null),i=(0,de.useCallback)(a=>{n(a),a&&e===void 0&&o(ko(a))},[e]);return Ae(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=u=>o(m=>m!==null&&Math.abs(m-u)<.5?m:u),s=()=>a(ko(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(u=>{let m=u[u.length-1]?.contentRect;m?a(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var Ts=()=>()=>{};function rt(){return(0,de.useSyncExternalStore)(Ts,()=>!0,()=>!1)}var wo="(prefers-reduced-motion: reduce)";function qt(e="auto"){let[t,n]=(0,de.useState)(()=>ke&&typeof window.matchMedia=="function"?window.matchMedia(wo).matches:!1);return(0,de.useEffect)(()=>{if(e!=="auto"||!ke||typeof window.matchMedia!="function")return;let r=window.matchMedia(wo),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Te=F(V(),1),Ss=60,Cs=420;function vo(e){let t=ve(),n=e.chartProps??{},[,r,o]=Zt(e.width),i=e.width??(o||480),a=ue(e.locale??n.locale),s=J(a),l=(0,ot.useContext)(Ze),u=e.title??l,m=e.chart.facetPlan,c=(0,ot.useMemo)(()=>{let w=xo({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:i,height:e.height,title:u,locale:a,lang:s});return m?m(w,n,a):w},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(w,v)=>typeof v=="function"?String(v):v),e.highlight,e.syncId,i,e.height,u,a,s,m]),d=`${(0,ot.useId)().replace(/:/g,"")}fd`,g=qt(n.reducedMotion??"auto"),f=rt(),b=br({motion:{enabled:n.animate!==!1&&!g&&ke},hydrated:f},{waiting:!1,generation:0}),M=e.chart;return(0,Te.jsxs)("div",{ref:r,role:"group","aria-label":u,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Te.jsx)("p",{id:d,style:jt,children:e.description??c.description}),(0,Te.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${c.cols}, minmax(0, 1fr))`,columnGap:xt,rowGap:po,...c.legend?{marginTop:Bn}:null},children:c.panels.map((w,v)=>{let S=t.paint(w.isPicked?"accentText":c.isPanelPick?"muted":"ink");return(0,Te.jsxs)("div",{"data-facet":w.value,style:{minWidth:0,...pr(b,!1,"fade",v*Ss,Cs)},children:[(0,Te.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:zn,fontSize:bo,fontWeight:700,lineHeight:`${zn}px`,color:S},children:[(0,Te.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w.label}),w.last!==void 0?(0,Te.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:w.last}):null]}),(0,Te.jsx)(M,{...n,...w.props})]},w.value)})}),c.legend?(0,Te.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Bn},children:c.legend}):null]})}var Mo=["max","min","first","last","none"];function be(e,t,n,r,o="max"){let i=new Set,a=n.length,s=u=>{if(a&&u!=="none"){if(u==="first")i.add(0);else if(u==="last")i.add(a-1);else if(u==="max"||u==="min"){let m=-1,c=u==="max"?-1/0:1/0;r.forEach((d,g)=>{Number.isFinite(d)&&(u==="max"?d>c:d<c)&&(c=d,m=g)}),m>=0&&i.add(m)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((u,m)=>{m<a&&u!==null&&u!==void 0&&e(u,m)&&i.add(m)}),i;let l=Array.isArray(e)?e:[e];for(let u of l)typeof u=="number"?u>=0&&u<a&&i.add(u):u==="max"||u==="min"||u==="first"||u==="last"||u==="none"?s(u):n.forEach((m,c)=>{m===u&&i.add(c)});return i}var ye=F(Y(),1);async function As(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",i=await e.text();if(t==="text")return i;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(i))throw new Error(J(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ue(i);if(t==="json"||o.includes("json"))return JSON.parse(i);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return Ue(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):Ue(i)}async function Ns(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),i=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!i.ok)throw new Error(`HTTP ${i.status}${i.statusText?` ${i.statusText}`:""}`);r=await As(i,t.parse,o,t.locale)}return t.select&&(r=qr(r,t.select)),t.transform?t.transform(r):Be(r)}function To(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,ye.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,ye.useState)(0),u=ue(t.locale),m=(0,ye.useRef)(t);m.current={...t,locale:u};let c=(0,ye.useRef)(e);c.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",g=t.deps??[],f=JSON.stringify(g.map(w=>typeof w=="object"?JSON.stringify(w):String(w))),b=(0,ye.useRef)(!1);(0,ye.useEffect)(()=>{let w=c.current;if(!w||!r){a(R=>R.status==="loading"?{...R,status:"idle"}:R);return}let v=new AbortController,S=!0;return b.current=!0,a(R=>({...R,data:o?R.data:[],status:"loading",error:null})),Ns(w,{...m.current,signal:v.signal}).then(R=>{S&&a({data:R,status:"success",error:null,updatedAt:Date.now()})}).catch(R=>{!S||v.signal.aborted||a(x=>({...x,status:"error",error:R instanceof Error?R:new Error(String(R))}))}).finally(()=>{S&&(b.current=!1)}),()=>{S=!1,b.current=!1,v.abort()}},[d,r,s,f,o]),(0,ye.useEffect)(()=>{if(!n||!r)return;let w=setInterval(()=>{b.current||l(v=>v+1)},n);return()=>clearInterval(w)},[n,r]);let M=(0,ye.useCallback)(()=>l(w=>w+1),[]);return{data:i.data,status:i.status,loading:i.status==="loading",error:i.error,empty:i.status==="success"&&i.data.length===0,updatedAt:i.updatedAt,reload:M}}var jn=F(V(),1),Rs=["csv","svg","png"],Fs=/^[=+\-@\t\r\n=+-@]/,_s=/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?Fr(e.getTime()):String(e);return`"${(Fs.test(t)&&!Number.isFinite(Re(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Ps(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Ls(e,t){return`\uFEFF${[t.map(So),...e.map(r=>t.map(o=>So(r[o])))].map(r=>r.join(",")).join(`\r
22
+ `;function pr(e,t,n,r,o){if(e)return t?{opacity:0}:{animation:`ztd-${n} ${Math.round(o)}ms cubic-bezier(.22,.9,.3,1) ${Math.round(r)}ms backwards`}}function br(e,t){let[n]=(0,gr.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var hr=!1;function dt(){if(hr||typeof document>"u"||(hr=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=Oa,document.head.appendChild(e)}var At=F(Y(),1),ke=typeof window<"u"&&typeof document<"u",Ae=ke?At.useLayoutEffect:At.useEffect;function Rt(){return typeof performance<"u"?performance.now():Date.now()}var Re=F(Y(),1),Ia=(0,Re.createContext)(void 0),Nt=new Map;function za(e,t){let n=Nt.get(e);return n||Nt.set(e,n=new Set),n.add(t),()=>{n.delete(t),n.size||Nt.delete(e)}}function Ba(e,t,n){Nt.get(e)?.forEach(r=>r(t,n))}function Ha(e,t,n){let r=e.indexOf(n.key);return r>=0||t.length>1e3?r:t.indexOf(n.label)}function yr(e,t,n,r){let o=(0,Re.useContext)(Ia),i=t??o,[a]=(0,Re.useState)(()=>({})),s=(0,Re.useRef)({keys:n,labels:r});s.current={keys:n,labels:r},e.publish.current=i?u=>Ba(i,u===null||s.current.keys[u]===void 0?null:{key:s.current.keys[u],label:s.current.labels[u]},a):null;let l=e.applySync;(0,Re.useEffect)(()=>{if(i)return za(i,(u,m)=>{if(m===a)return;let c=u?Ha(s.current.keys,s.current.labels,u):-1;l(c<0?null:c)})},[i,a,l])}function J(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Ee(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var xr={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},kr={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var ja=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],Ga={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function Va(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function Wa(e){return Va(ja,e)}function wr(e,t){let n=Wa(e);return{text:n?n[t]:e,...Ga[n?.id??"basic"]}}var $r={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Oe(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),$r[t.toLowerCase()]&&(t=$r[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(a=>a+a).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let i=parseInt(o,16);return o.length===6?[i>>16&255,i>>8&255,i&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 i=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),a=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return i.some(s=>Number.isNaN(s))?null:[i[0],i[1],i[2],Number.isNaN(a)?1:a]}return null}function Tr(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 bn(e,t){let n=e[3];return[e[0]*n+t[0]*(1-n),e[1]*n+t[1]*(1-n),e[2]*n+t[2]*(1-n),1]}function qe(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ft(e){return .2126*qe(e[0])+.7152*qe(e[1])+.0722*qe(e[2])}function yn(e,t,n){let r=typeof e=="string"?Oe(e):e,o=typeof t=="string"?Oe(t):t;if(!r||!o)return 0;let i=n?typeof n=="string"?Oe(n):n:null;o[3]<1&&i&&(o=bn(o,i));let a=r[3]<1?bn(r,o):r,s=Ft(a),l=Ft(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function Ka(e){return[qe(e[0]),qe(e[1]),qe(e[2])]}function pn(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 vr(e){let[t,n,r]=Ka(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),i=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),a=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*i-.0040720468*a,1.9779984951*o-2.428592205*i+.4505937099*a,.0259040371*o+.7827717662*i-.808675766*a]}function Xa([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,i=(e-.1055613458*t-.0638541728*n)**3,a=(e-.0894841775*t-1.291485548*n)**3;return[pn(4.0767416621*o-3.3077115913*i+.2309699292*a),pn(-1.2684380046*o+2.6097574011*i-.3413193965*a),pn(-.0041960863*o-.7034186147*i+1.707614701*a),r]}function Qe(e,t,n){let r=Oe(e),o=Oe(t);if(!r||!o)return e;let i=vr(r),a=vr(o),s=Math.max(0,Math.min(1,n));return Tr(Xa([i[0]*s+a[0]*(1-s),i[1]*s+a[1]*(1-s),i[2]*s+a[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function xn(e,t,n){let r=t[0],o=-1;for(let i of t){let a=yn(i,e,n);a>o&&(o=a,r=i)}return r}function Q(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 wn(e,t){let n=xn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return yn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):xn(t,["#FFFFFF","#000000"])}function _t(e,t){let n=Qe(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:wn(e,n),raw:n}}function we(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=Q(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{if(i===1)r[a]=Q(e,"neutral");else if(s===0)r[a]=Q(e,"ink");else if(s===i-1)r[a]=Q(e,"neutral");else if(i===3)r[a]=Q(e,"strong");else{let l=(s-1)/Math.max(1,i-2);r[a]=l<=.001?Q(e,"strong"):_t(e,1-l)}}),r}var kn="mix:";function Ie(e){return e({theme:dn,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${kn}${o}`}).map(n=>n.fill)}function Mr(e,t){return t?.startsWith(kn)?e.mix("neutralStrong","neutral",Number(t.slice(kn.length))):e.color(t)}function We(e,t,n){return we(e,t+1,n).slice(0,t)}function Pt(e,t,n,r="neutral"){let o=Q(e,"accent"),i=Q(e,r);return Array.from({length:t},(a,s)=>n.has(s)?o:i)}function ft(e,t,n){let r=new Array(t),o=[];for(let a=0;a<t;a++)n.has(a)?r[a]=Q(e,"accent"):o.push(a);let i=o.length;return o.forEach((a,s)=>{i===1?r[a]=Q(e,"neutral"):s===0?r[a]=Q(e,"strong"):s===i-1?r[a]=Q(e,"neutral"):r[a]=_t(e,1-s/(i-1))}),r}var $e=F(Y(),1);var Dt=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),ie="en-US",Sr=new Map;function $n(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=Sr.get(r);return o||(o=new Intl.NumberFormat(e,n),Sr.set(r,o)),o}function vn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function tt(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ie,...r}=t;return vn($n(n,r).format(e))}var Tn=e=>e!==0&&Math.abs(e)<.05,Mn=(e,t,n="")=>`${tt(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function et(e,t={}){if(!Number.isFinite(e))return"-";if(Tn(e)&&t.maximumFractionDigits===void 0)return Mn(e,t.locale??ie,"%");let n=Math.abs(e);return`${tt(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Nr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ie,...r}=t;if(J(n)==="ko"){let o=Math.abs(e),i=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],a=i.findIndex(([s])=>o>=s);for(a<0&&(a=i.length-1);;){let[s,l]=i[a],u=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||u<100?1:0)),c=Math.round(u*10**m)/10**m;if(a>0&&c>=i[a-1][0]/s){a--;continue}return(e<0&&c!==0?"-":"")+tt(c,{locale:n,...r,maximumFractionDigits:m})+l}}return vn($n(n,{notation:"compact",...r}).format(e))}var Ua=(e,t=J(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Ke(e,t=ie,n){if(typeof e=="function")return e;let r=(o,i="",a="")=>{let s=$n(t,o);return l=>Number.isFinite(l)?`${a}${vn(s.format(l))}${i}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:i="",...a}=e;return r(a,o,i)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>et(o,{locale:t});case"ratio":return o=>et(o*100,{locale:t});case"compact":return o=>Nr(o,{locale:t});case"currency":return r(Ua(t));default:{let o=r({maximumFractionDigits:1});return i=>Tn(i)?Mn(i,t):o(i)}}}function Lt(e,t=ie,n=0){return e!==void 0?Ke(e,t):n>=1e5?r=>Tn(r)?Mn(r,t):Nr(r,{locale:t}):r=>tt(r,{locale:t})}function Ya(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,Ja=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,Za=["january","february","march","april","may","june","july","august","september","october","november","december"],Cr=e=>{let t=e.toLowerCase();return t.length<3?0:Za.findIndex(n=>n.startsWith(t))+1},Ar=e=>+e+(+e<30?2e3:1900);function Fr(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var qa=[/^(\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})일)?$/],_r=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Pr=/\{([^{}]+)\}/g;function Et(e,t){let n;for(let r of qa)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?[Ar(n[3]),+n[2],+n[1],1]:[Ar(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=_r.exec(e)){let r=+n[1],o=+n[3],i=r>12||o<=12&&t===!0;return[+n[4],i?o:r,i?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=Cr(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=Cr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Cn=e=>Ja.test(e)||Et(e)!==null;function Dr(e){let t;for(let n of e){let r=typeof n=="string"?_r.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function ht(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 ht(`${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=Et(n,t);if(r)return Ya(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 Rr=new Map;function gt(e,t={month:"short",day:"numeric"}){let n=ht(e);if(!n)return"-";let{locale:r=ie,...o}=t,i=r+JSON.stringify(o),a=Rr.get(i);return a||(a=new Intl.DateTimeFormat(r,o),Rr.set(i,a)),a.format(n)}var An=F(V(),1),Ot=(0,$e.createContext)({theme:Le,cssVars:!0});function Qa(e,t=Le){return e?typeof e=="string"?fn[e]??t:gn(t,e):t}function It(e){let t=(0,$e.useContext)(Ot),n=e.base?fn[e.base]:t.theme,r=(0,$e.useMemo)(()=>Qa(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,i=e.locale??t.locale,a=(0,$e.useMemo)(()=>({theme:r,cssVars:o,locale:i}),[r,o,i]),s=(0,$e.useMemo)(()=>hn(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,An.jsx)(Ot.Provider,{value:a,children:(0,An.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var ei=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Er(e){return ei.has(e)}function ti(e,t){let n=r=>t?`var(${Ct(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Er(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Er(r)?e[r]:r:e[o],mix:(r,o,i)=>{let a=Math.round(Math.max(0,Math.min(1,i))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${a}%, ${n(o)})`:Qe(e[r],e[o],i)}}}function ve(e){let t=(0,$e.useContext)(Ot);return(0,$e.useMemo)(()=>{let n=gn(t.theme,e);return ti(n,t.cssVars)},[t.theme,t.cssVars,e])}function ue(e){let t=(0,$e.useContext)(Ot);return e??t.locale??ie}function Or(e){return e?hn(e):{}}var zt=F(Y(),1),Rn=(0,zt.createContext)(void 0);function Ir(e){let t=(0,zt.useContext)(Rn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var P=F(V(),1),ni={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`},ri={en:ni,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var oi={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Nn=e=>ri[J(ue(e))];function Fn(e){let t=ve(e.theme),n=Nn(e.locale),[r,o]=(0,Bt.useState)(!1),i=e.size??11.5,a=e.onToggle,s=new Set(a?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.label)).length,u=(0,P.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((m,c)=>{let d=!s.has(m.label),g=d&&l===1,f=(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(ai,{p:t,item:m,off:!d}),(0,P.jsx)("span",{style:d?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,P.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:i,color:t.paint("muted"),lineHeight:1.3},children:a?(0,P.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":d,"aria-disabled":g||void 0,onClick:()=>{g||(a(m.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:g?"default":void 0},children:f}):f},c)})});return a?(0,P.jsxs)(P.Fragment,{children:[u,(0,P.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:oi,children:r?n.shown(l,e.items.length):""})]}):u}function ai({p:e,item:t,off:n}){let r=Mr(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,P.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,P.jsx)("line",{x1:1,x2:13,y1:4,y2:4,stroke:r,strokeWidth:2,strokeDasharray:o==="dash"?"3 2":void 0,strokeLinecap:"round"}),o==="line"?(0,P.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,P.jsx)("span",{"aria-hidden":"true",style:{width:9,height:9,flex:"none",borderRadius:o==="circle"?9:2.5,background:r,boxShadow:t.color==="neutral"||t.color==="neutralSoft"||!t.color?`inset 0 0 0 1px ${e.paint("line2")}`:void 0,opacity:n?.35:void 0}})}function ii(e){let t=ve(e.theme),n=wr(e.level,J(ue(e.locale)));return(0,P.jsx)("span",{style:{background:t.paint(n.bg),color:t.paint(n.fg),borderRadius:8,padding:"3px 9px",fontSize:12.5,fontWeight:700,lineHeight:"18px",whiteSpace:"nowrap",flex:"none"},children:n.text})}function si(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,P.jsxs)(P.Fragment,{children:[e.slice(0,r),(0,P.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function zr(e){let t=ve(e.theme),n=Nn(e.locale),[r,o]=(0,Bt.useState)(0);Ae(()=>dt(),[]);let i=()=>{o(d=>d+1),e.onReplay?.()},a=Array.isArray(e.legend)?(0,P.jsx)(Fn,{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,m=e.source!==void 0||e.note!==void 0?(0,P.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,c=e.takeaway!==void 0||e.level||e.sample?(0,P.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,P.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,P.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,P.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,P.jsx)(ii,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,P.jsxs)("section",{id:e.id,className:`ztd-card${e.className?` ${e.className}`:""}`,style:{background:t.paint("panel"),color:t.paint("ink"),border:`1px solid ${t.paint("line")}`,borderRadius:`var(--ztd-radius, ${t.theme.radius}px)`,padding:"20px 20px 16px",display:"flex",flexDirection:"column",gap:12,minWidth:0,boxSizing:"border-box",fontFamily:t.cssVars?`var(--ztd-font, ${t.theme.fontFamily})`:t.theme.fontFamily,wordBreak:"keep-all",textWrap:"balance",...e.style},children:[(0,P.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,P.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,P.jsx)("span",{style:{fontFamily:t.cssVars?`var(--ztd-mono, ${t.theme.monoFamily})`:t.theme.monoFamily,fontSize:17,fontWeight:700,color:t.paint("accentText"),letterSpacing:-.2,flex:"none"},children:l}):null,(0,P.jsx)(s,{style:{margin:0,fontSize:22,fontWeight:800,color:t.paint("ink"),letterSpacing:-.5,lineHeight:1.25,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:si(e.title,e.accent,t.paint("accentText"))}),e.actions,u?(0,P.jsx)("button",{type:"button",className:"ztd-btn",onClick:i,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,P.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,P.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,P.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||a?(0,P.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,P.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,P.jsx)("span",{}),a]}):null]}),(0,P.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,P.jsx)(Rn.Provider,{value:r,children:(0,P.jsx)(Ze.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,P.jsxs)(P.Fragment,{children:[m,c]}):c]})}function _n(e){let t=ve(e.theme),n=Nn(e.locale),r=e.height??220;if(Ae(()=>dt(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,P.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,P.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,P.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,P.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,P.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onRetry,style:{marginTop:4,background:t.paint("ink"),color:t.paint("onInk"),border:"none",borderRadius:14,padding:"5px 14px",fontSize:12.5,fontWeight:700},children:n.retry}):null]})})}return e.loading?(0,P.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,i)=>(0,P.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${i*90}ms`}},i))}):e.empty?(0,P.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,P.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,P.jsx)(P.Fragment,{children:e.children})}var ot=F(Y(),1);var me=F(Y(),1);var X=F(V(),1),Ht=60;var jt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Br(e){let{c:t,events:n}=e,r=(0,me.useId)().replace(/:/g,""),o=`${r}t`,i=`${r}d`;t.events.current=n,Ae(()=>{dt()},[]);let a=n.length,s=!e.noNav&&a>0,l=(0,me.useContext)(Ze),u=e.ariaLabel??l??e.kind,m=(0,me.useMemo)(()=>s?`${n.length}${n.slice(0,Ht).map($=>`${$.label}${$.series??""}${$.formatted??$.value??""}`).join("")}`:"",[n,s]),c=(0,me.useMemo)(()=>(0,X.jsx)(li,{label:u,events:n,t:t.t}),[u,m,t.t]),d=(0,me.useRef)(null);(0,me.useEffect)(()=>{let $=()=>{d.current=null};return window.addEventListener("scroll",$,{capture:!0,passive:!0}),window.addEventListener("resize",$,{passive:!0}),()=>{window.removeEventListener("scroll",$,{capture:!0}),window.removeEventListener("resize",$)}},[]),(0,me.useEffect)(()=>{d.current=null},[t.width,t.height]);let g=$=>{if($.target!==$.currentTarget)return;if(e.onKey?.($)){$.preventDefault();return}let h=t.active,L;switch($.key){case"ArrowRight":case"ArrowDown":L=h===null?0:(h+1)%a;break;case"ArrowLeft":case"ArrowUp":L=h===null?a-1:(h-1+a)%a;break;case"Home":L=0;break;case"End":L=a-1;break;case"Escape":if(h===null)return;L=null;break;case"Enter":case" ":h!==null&&($.preventDefault(),t.click(h));return;default:return}$.preventDefault(),t.setActive(L,"keyboard")},{via:f,node:y,setActive:T}=t;(0,me.useEffect)(()=>{if(f!=="touch"||!y)return;let $=h=>{y.contains(h.target)||T(null)};return document.addEventListener("pointerdown",$),()=>document.removeEventListener("pointerdown",$)},[f,y,T]);let w=t.active!==null?n[t.active]:null,v=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,S=v&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,N=typeof e.renderTip=="function"&&w?e.renderTip(w):null,x=e.announce??(t.via==="keyboard"&&w?`${w.label}${w.series?` ${w.series}`:""}: ${w.formatted??w.value??""} (${(t.active??0)+1}/${a})`:""),_;if(v){let $=v.x*S,h=t.width*S,L=`clamp(${(4-$).toFixed(1)}px, -50%, calc(${(h-$-4).toFixed(1)}px - 100%))`,W=v.y<64;_={position:"absolute",left:$,top:v.y*S,transform:`translate(${L}, ${W?"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*S-8)}}let z=$=>{d.current=null,$.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},O=$=>$?h=>{let L=d.current??(d.current=h.currentTarget.getBoundingClientRect());L.width&&$((h.clientX-L.left)/L.width*t.width,(h.clientY-L.top)/L.height*t.height,h)}:void 0,I=O(e.onPointerMove),B=O(e.onPointerDown),E=I||B?$=>{$.pointerType==="touch"&&I?.($),B?.($)}:void 0,R=O(e.onPointerUp),C=Or(e.theme);return(0,X.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":u,"aria-describedby":i,tabIndex:s?0:void 0,onKeyDown:s?g:void 0,onBlur:$=>{t.via==="keyboard"&&!$.currentTarget.contains($.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"),...C,...e.style},children:[t.pending?null:e.underlay,(0,X.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${i}`,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:I,onPointerDown:E,onPointerUp:R,onPointerCancel:R,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,X.jsx)("title",{id:o,children:u}),(0,X.jsx)("desc",{id:i,children:a||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,X.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,v?(0,X.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:_,children:N??(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:v.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:v.title}),v.rows.map(($,h)=>(0,X.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,X.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint($.strong?"ink":"muted")},children:[$.color?(0,X.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:$.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,$.label]}),(0,X.jsx)("span",{style:{fontWeight:$.strong===!1?500:700},children:$.value})]},h))]})}):null,(0,X.jsx)("span",{className:"ztd-sr",style:jt,"aria-live":"polite","aria-atomic":"true",children:x}),s&&!t.pending?c:null]})}function li({label:e,events:t,t:n}){return(0,X.jsx)("div",{className:"ztd-sr",style:jt,children:(0,X.jsxs)("table",{children:[(0,X.jsx)("caption",{children:n.table(e)}),(0,X.jsxs)("tbody",{children:[t.slice(0,Ht).map((r,o)=>(0,X.jsxs)("tr",{children:[(0,X.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,X.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Ht?(0,X.jsx)("tr",{children:(0,X.jsx)("td",{colSpan:2,children:n.more(t.length-Ht)})}):null]})]})})}function ze(e){let t=e.baseline??"central";return(0,X.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var b=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),ge=b("label","string",!0,"Item name field"),ne=b("value","number",!0,"Value field"),ci=[ge,ne],ui=[ge,ne],mi=[b("label","string",!0,"Stage name"),b("value","number",!0,"Users at the stage")],di=[ge,ne],fi=[b("label","string",!0,"Leaf (lowest level) name"),ne,b("group","string",!1,"Parent group field")],hi=[b("label","string",!0,"Leaf name"),ne,b("group","string",!1,"Parent group field")],gi=[ge,b("value","number",!0,"Change (total rows may omit it)"),b("type","string",!1,'"total" makes a total bar')],pi=[ge,ne],bi=[b("x","string",!0,"Column field"),b("series","string",!0,"Stacked series field"),ne],yi=[b("x","string",!0,"Column field"),b("y","string",!0,"Row field"),ne],xi=[b("axis","string",!0,"Metric (axis) field"),b("value","number",!0,"Value field",{multi:!0}),b("series","string",!1,"Series field")],ki=[b("x","number",!0,"x value"),b("y","number",!0,"y value"),b("size","number",!1,"Circle size"),b("label","string",!1,"Name")],jr=b("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),wi=[b("x","any",!0,"x field (date, number or category)"),b("y","number",!0,"y field. An array for wide tables",{multi:!0}),b("series","string",!1,"Series field (long tables)"),b("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),jr],$i=[b("x","any",!0,"x field"),b("y","number",!0,"y field. An array for wide tables",{multi:!0}),b("series","string",!1,"Series field"),b("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}),jr],vi=[b("x","any",!0,"x field"),b("y","number",!0,"y field",{multi:!0}),b("series","string",!1,"Series field")],Ti=[b("x","string",!0,"Category field"),b("y","number",!0,"Value field. An array for wide tables",{multi:!0}),b("series","string",!1,"Series field"),b("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})],Mi=[ge,ne],Si=[b("value","number",!0,"Value field",{prop:"valueKey"}),b("target","number",!1,"Target field",{prop:"targetKey"})],Ci=[ge,b("value","number",!0,"Actual value field"),b("target","number",!1,"Target field")],Ai=[b("x","any",!1,"x field"),b("y","number",!0,"y field")],Ri=[ge,b("x","string",!1,"Period field (long tables)"),b("value","number",!1,"Value field (long tables)")],Ni=[ge,b("start","number",!0,"Before value"),b("end","number",!0,"After value")],Fi=[ge,ne],_i=[b("value","number",!0,"Value field"),b("group","string",!1,"Group (row) field"),b("label","string",!1,"Dot name")],Pi=[b("group","string",!0,"Group field"),b("value","number",!0,"Value field")],Di=[b("source","string",!1,"Source node"),b("target","string",!1,"Target node"),b("dimensions","string",!1,"Stage columns of a wide table, left to right (2 to 6). Each row is one path, so source and target are not used. Without value, each row counts 1",{multi:!0}),b("value","number",!1,"Value field")],Li=[b("source","string",!0,"Sending group"),b("target","string",!0,"Receiving group"),ne],Ei=[b("date","date",!0,"Date field"),ne],Oi=[b("x","any",!0,"Period field"),b("series","string",!0,"Item field"),b("rank","number",!1,"Rank field (1 is first)"),b("value","number",!1,"Value field (instead of rank, largest is first)")],Ii=[b("group","string",!0,"Group field"),b("value","number",!0,"Value field")],zi=[b("label","string",!1,"Row name field")],Bi=[b("x","date",!0,"Date (period) field"),b("open","number",!0,"Open price field"),b("high","number",!0,"High price field"),b("low","number",!0,"Low price field"),b("close","number",!0,"Close price field"),b("volume","number",!1,"Volume field")],Hi=[ge,ne],ji=[b("x","any",!0,"Period field (date or category)"),b("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),b("series","string",!1,"Series field (long tables, back row only)"),b("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Gi=[b("value","number",!1,"Sample value field (raw rows)"),b("group","string",!1,"Group field. Up to 2 groups overlap"),b("x0","number",!1,"Bin start (pre-binned rows)"),b("x1","number",!1,"Bin end (pre-binned rows)"),b("count","number",!1,"Samples in the bin (pre-binned rows)")],Vi=[b("region","string",!0,"Region name or code, matched to a tile of options.map"),ne],Wi=[ge,ne,b("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],Ki=[b("source","string",!0,"Source node"),b("target","string",!0,"Target node"),b("value","number",!1,"Link weight. Without it every row counts 1")],Xi=[b("label","string",!0,"Row name. Items with the same name share a row"),b("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),b("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),b("group","string",!1,"Group field (one color per group, and the legend)"),b("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],Ui=[b("label","string",!0,"Node name field"),b("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),b("group","string",!1,"Parent group field (flat rows, as in the treemap)"),b("id","string",!1,"Row id for id/parent rows. Defaults to the label"),b("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],Yi=[b("region","string",!0,"Region name or code, matched to a region of options.map"),ne],Ji=[b("lon","number",!1,"Longitude (degrees)"),b("lat","number",!1,"Latitude (degrees)"),b("size","number",!1,"Value (circle area). Without it all circles match"),b("label","string",!1,"Place name"),b("region","string",!1,"Region of options.map, for rows without lon and lat"),b("group","string",!1,"Group field (one color per group)")],Zi=[b("source","string",!0,"Start: a name in options.places or a region"),b("target","string",!0,"End"),b("value","number",!1,"Amount. Without it each row counts 1")],qi=[b("cohort","any",!0,"Cohort: a name or a start date. Cohorts go in date order when all read as dates, otherwise in order of first appearance"),b("period","any",!0,"Periods since the cohort started: 0, 1, 2 ... In number order when all are numbers"),b("value","number",!0,"People still active, or the share still active (see options.valueType)"),b("size","number",!1,"Cohort size. The first value of each cohort counts")],Qi=[b("x","any",!0,"x field (date, number or category)"),b("y","number",!0,"y field. An array for wide tables",{multi:!0}),b("series","string",!1,"Series field (long tables)")],es=[b("x","number",!0,"x value"),b("y","number",!0,"y value"),b("series","string",!1,"Series field (one color per series)"),b("label","string",!1,"Name")],ts=[b("label","string",!0,"Row name field (one row per metric)"),b("x","any",!0,"Period field (date, number or category). Every row shares the same period axis"),ne,b("target","number",!1,"Target field. Each row uses its last filled value")],Hr={pie:ci,donut:ui,funnel:mi,waffle:di,treemap:fi,sunburst:hi,waterfall:gi,pareto:pi,marimekko:bi,heatmap:yi,radar:xi,bubble:ki,line:wi,area:$i,stream:vi,bar:Ti,radialBar:Mi,gauge:Si,bullet:Ci,sparkline:Ai,slope:Ri,dumbbell:Ni,lollipop:Fi,beeswarm:_i,ridgeline:Pi,sankey:Di,chord:Li,calendar:Ei,bump:Oi,box:Ii,parallel:zi,candlestick:Bi,segmented:Hi,skyline:ji,histogram:Gi,scatter:es,tileMap:Vi,barRace:Wi,network:Ki,timeline:Xi,tree:Ui,choropleth:Yi,symbolMap:Ji,flowMap:Zi,sparkTable:ts,cohort:qi,horizon:Qi},nt={pie:{component:"PieChart",name:"Pie chart",nameKo:"파이 차트"},donut:{component:"DonutChart",name:"Donut chart",nameKo:"도넛 차트"},funnel:{component:"FunnelChart",name:"Funnel chart",nameKo:"퍼널 차트"},waffle:{component:"WaffleChart",name:"Waffle chart",nameKo:"와플 차트"},treemap:{component:"Treemap",name:"Treemap",nameKo:"트리맵"},sunburst:{component:"SunburstChart",name:"Sunburst",nameKo:"선버스트"},waterfall:{component:"WaterfallChart",name:"Waterfall chart",nameKo:"폭포 차트"},pareto:{component:"ParetoChart",name:"Pareto chart",nameKo:"파레토 차트"},marimekko:{component:"MarimekkoChart",name:"Marimekko chart",nameKo:"마리메코 차트"},heatmap:{component:"Heatmap",name:"Heatmap",nameKo:"히트맵"},radar:{component:"RadarChart",name:"Radar chart",nameKo:"레이더 차트"},bubble:{component:"BubbleChart",name:"Bubble chart",nameKo:"버블 차트"},line:{component:"LineChart",name:"Line chart",nameKo:"라인 차트"},area:{component:"AreaChart",name:"Area chart",nameKo:"영역 차트"},stream:{component:"StreamGraph",name:"Streamgraph",nameKo:"스트림그래프"},bar:{component:"BarChart",name:"Bar chart",nameKo:"막대 차트"},radialBar:{component:"RadialBarChart",name:"Radial bar chart",nameKo:"방사형 막대"},gauge:{component:"GaugeChart",name:"Gauge",nameKo:"게이지"},bullet:{component:"BulletChart",name:"Bullet chart",nameKo:"불릿 차트"},sparkline:{component:"Sparkline",name:"Sparkline",nameKo:"스파크라인"},slope:{component:"SlopeChart",name:"Slope chart",nameKo:"슬로프 차트"},dumbbell:{component:"DumbbellChart",name:"Dumbbell chart",nameKo:"덤벨 차트"},lollipop:{component:"LollipopChart",name:"Lollipop chart",nameKo:"롤리팝 차트"},beeswarm:{component:"BeeswarmChart",name:"Beeswarm",nameKo:"비스웜"},ridgeline:{component:"RidgelineChart",name:"Ridgeline",nameKo:"릿지라인"},sankey:{component:"SankeyChart",name:"Sankey diagram",nameKo:"생키 다이어그램"},chord:{component:"ChordChart",name:"Chord diagram",nameKo:"코드 다이어그램"},calendar:{component:"CalendarHeatmap",name:"Calendar heatmap",nameKo:"캘린더 히트맵"},bump:{component:"BumpChart",name:"Bump chart",nameKo:"범프 차트"},box:{component:"BoxPlot",name:"Box / violin plot",nameKo:"박스 플롯"},parallel:{component:"ParallelCoordinates",name:"Parallel coordinates",nameKo:"평행 좌표"},candlestick:{component:"CandlestickChart",name:"Candlestick chart",nameKo:"캔들스틱"},segmented:{component:"SegmentedBar",name:"Segmented bar",nameKo:"비율 막대"},skyline:{component:"SkylineChart",name:"Skyline",nameKo:"스카이라인"},histogram:{component:"HistogramChart",name:"Histogram",nameKo:"히스토그램"},scatter:{component:"ScatterChart",name:"Scatter plot",nameKo:"산점도"},tileMap:{component:"TileMap",name:"Tile grid map",nameKo:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"},sparkTable:{component:"SparkTable",name:"KPI table",nameKo:"지표 표"},cohort:{component:"CohortChart",name:"Cohort chart",nameKo:"코호트 차트"},horizon:{component:"HorizonChart",name:"Horizon chart",nameKo:"호라이즌 차트"}};function Gr(e,t){return t==="ko"?e.nameKo:e.name}function Vr(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Wr=["line","area","bar","scatter"],Kr=24;var Pn=["line","area","bar","scatter","timeline"];function Dn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function Xr(e,t,n){return Pn.includes(e)&&!Dn(e,t,n).length&&!(e==="scatter"&&Gt(n))}function Gt(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function Ur(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",butterfly:"bar",pyramid:"bar",populationPyramid:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",raincloud:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap",alluvial:"sankey",parallelSets:"sankey",kpiTable:"sparkTable",metricTable:"sparkTable",sparklineTable:"sparkTable",retention:"cohort",cohortTable:"cohort",retentionTable:"cohort",horizonChart:"horizon",horizonGraph:"horizon"};function Vt(e){let t=Hr[e]?e:ns[e]??Object.keys(nt).find(n=>n.toLowerCase()===e.toLowerCase()||nt[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!nt[t]))return{type:t,component:nt[t].component,name:nt[t].name,nameKo:nt[t].nameKo,encoding:Hr[t]}}function Yr(e){let t=new Set,n=i=>{Array.isArray(i)?i.forEach(n):typeof i=="string"&&i&&t.add(i)},r=e.encoding??{};for(let i of Vt(e.type)?.encoding.map(a=>a.name)??Object.keys(r))n(r[i]);let o=e.options??{};for(let i of["dimensions","start","end","ranges"])n(o[i]);return[...t]}function Jr(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function rs(e,t){if(e==null||typeof e!="object")return;let n=e;if(Jr(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!Jr(r,o))return;r=r[o]}return r}}function Ne(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 Xe(e,t){if(typeof e=="function")return e;let n=e??t;return r=>rs(r,n)}function Wt(e,t){let n=Xe(e,t);return(r,o)=>Ne(n(r,o))}function Fe(e,t){let n=Xe(e,t);return(r,o)=>{let i=n(r,o);return i==null?"":i instanceof Date?new Date(i.getTime()-i.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(i)}}function Te(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function os(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,i=[","," ",";","|"],a=",",s=0;for(let l of i){let u=o(l);u>s&&(s=u,a=l)}return a}var as=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function Zr(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(as.test(t)||/^[-+]?\.\d+$/.test(t)){let n=Ne(t);if(Number.isFinite(n))return n}return t}function Ue(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let i=t.delimiter??os(o),a=[],s=[],l="",u=!1;for(let f=0;f<o.length;f++){let y=o[f];u?y==='"'?o[f+1]==='"'?(l+='"',f++):u=!1:l+=y:y==='"'&&!l.trim()?(u=!0,l=""):y===i?(s.push(l),l=""):y===`
24
+ `||y==="\r"?(y==="\r"&&o[f+1]===`
25
+ `&&f++,s.push(l),a.push(s),s=[],l=""):l+=y}(l!==""||s.length)&&(s.push(l),a.push(s));let m=a.filter(f=>!(f.length===1&&f[0].trim()===""));if(!m.length)return[];let c=f=>n?Zr(f):f;if(!r)return m.map(f=>Object.fromEntries(f.map((y,T)=>[String(T),c(y)])));let d=[],g=new Set;return m[0].forEach((f,y)=>{let T=f.trim()||`col${y+1}`,w=T;for(let v=2;g.has(w);v++)w=`${T}_${v}`;g.add(w),d.push(w)}),m.slice(1).map(f=>Object.fromEntries(d.map((y,T)=>[y,c(f[T]??"")])))}function Ln(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((a,s)=>String(a??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(a=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof a[l]=="string"?Zr(a[l]):a[l]??null])))}function is(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(i=>Array.isArray(i))){let i=Object.keys(e),a=Math.max(...o.map(s=>s.length));return Array.from({length:a},(s,l)=>Object.fromEntries(i.map(u=>[u,e[u][l]??null])))}return Object.entries(e).map(([i,a])=>({[n]:i,[r]:a}))}function qr(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 Be(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Be(JSON.parse(t))}catch{}return Ue(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Ln(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)?Be(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Ln(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)?Be(t.rows):Array.isArray(t.values)?Ln(t.values):Array.isArray(t.items)?Be(t.items):Array.isArray(t.results)?Be(t.results):is(t)}return[]}function Kt(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=i=>{try{return JSON.stringify(i)}catch{return String(i)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let i=0;i<t;i+=r)o.push(e[i]);return o.push(e[t-1]),`${t}:${n(o)}`}function En(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),i=e.map(()=>new Array(r).fill(0)),a=(l,u)=>{let m=e[l][u];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let u=1;u<r;u++){let m=0,c=0;for(let d=0;d<n;d++){let g=a(d,u),f=g-a(d,u-1),y=0;for(let T=0;T<d;T++)y+=a(T,u)-a(T,u-1);m+=g,c+=(f/2+y)*g}m&&(l-=c/m),s[u]=l}}for(let l=0;l<r;l++){if(t==="zero"){let c=0,d=0;for(let g=0;g<n;g++){let f=e[g][l],y=Number.isFinite(f)?f:0;y>=0?(o[g][l]=c,c+=y,i[g][l]=c):(o[g][l]=d,d+=y,i[g][l]=d)}continue}let u=0;for(let c=0;c<n;c++)u+=a(c,l);let m=t==="silhouette"?-u/2:s[l];for(let c=0;c<n;c++){let d=a(c,l);t==="expand"&&(d=u?d/u*100:0),o[c][l]=m,m+=d,i[c][l]=m}}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,i[n-1]?.[c]??0);let m=0;for(let c=0;c<r;c++)m+=((o[0]?.[c]??0)+(i[n-1]?.[c]??0))/2;m/=r;for(let c=0;c<n;c++)for(let d=0;d<r;d++)o[c][d]-=m,i[c][d]-=m}return{y0:o,y1:i}}function Qr(e,t,n=-1){if(!t.some(r=>r>=0))return-1;for(let r=e-1;r>=0;r--)if(r!==n&&!t.includes(r))return r;return-1}function eo(e){let t=e.length,n=e.map(u=>{let m=0,c=-1/0;return u.forEach((d,g)=>{d>c&&(c=d,m=g)}),m}),r=e.map(u=>u.reduce((m,c)=>m+(Number.isFinite(c)?c:0),0)),o=Array.from({length:t},(u,m)=>m).sort((u,m)=>n[u]-n[m]),i=[],a=[],s=0,l=0;for(let u of o)s<l?(i.push(u),s+=r[u]):(a.push(u),l+=r[u]);return[...a.reverse(),...i]}var ss=Math.PI*2;function to(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function no(e,t,n,r){return Math.max(0,Math.min(r-1,Math.round((e-t)/(n-t||1)*(r-1))))}function ro(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function ls(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function oo(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 Xt=new Map;function se(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=Xt.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let u=r.charCodeAt(l);ls(u)?a+=oo(u):s+=oo(u)}i=a+s*(n>=600?1.07:1),Xt.size>5e3&&Xt.clear(),Xt.set(o,i)}return i*t}var io=F(V(),1),cs=e=>Array.isArray(e)&&e.length===2;function ao(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&cs(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var co=F(V(),1),pe=10.5;function us(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let a=1;a<e.length;a++)o=Math.min(o,Math.abs(e[a]-e[a-1]));let i=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(a=>tt(a,{locale:n,maximumFractionDigits:i}))}function so(e,t,n){let r=18;for(let o of us(e,t,n))r=Math.max(r,se(o,pe));return Math.ceil(r+8)}function lo(e,t,n=pe,r=8,o=400,i){let a=t.length;if(a<=1)return t.map((c,d)=>d);let s=t.map(c=>se(c,n,o)),l=(c,d)=>Math.abs(e[d]-e[c])<(s[c]+s[d])/2+r,u=[];for(let c of i??[])u.some(d=>l(d,c))||u.push(c);let m=c=>!u.some(d=>l(d,c));for(let c=1;c<=a;c++){let d=u.slice();for(let g=0;g<a;g+=c)m(g)&&d.push(g);if(c>1&&(a-1)%c>c/2&&m(a-1)&&d.push(a-1),d.sort((g,f)=>g-f),d.every((g,f)=>!f||!l(d[f-1],g)))return d}return[0,a-1]}function Ut(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 He(e,t,n=4,r={}){let o=e,i=t;if(!Number.isFinite(o)||!Number.isFinite(i))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),i<0&&(i=0)),o===i)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let a=i-o,s=r.pad??.07,l=Ut(a,n),u=[o,i];for(let m=0;m<4;m++){let c=Math.ceil(i/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;u=[o===0?0:o-d<=l*.3?d:o-a*s,i===0?0:c-i<=l*.3?c:i+a*s];let g=Ut(u[1]-u[0],n);if(g===l)break;l=g}return u}function uo(e,t,n=4,r={}){let o=e,i=t;if(!Number.isFinite(o)||!Number.isFinite(i))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),i<0&&(i=0)),o===i)return o===0?[0,1]:o>0?[0,o*1.25]:[o*1.25,0];let a=Ut(i-o,n);return[Math.floor(o/a+1e-9)*a,Math.ceil(i/a-1e-9)*a]}function pt(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=Ut(o-r,n),a=[],s=Math.ceil(r/i-1e-9)*i;for(let l=s,u=0;l<=o+i*1e-9&&u<200;l+=i,u++)a.push(Number((Math.round(l/i)*i).toPrecision(12)));return a}function On(e,t){let[n,r]=e,[o,i]=t,a=r===n?0:(i-o)/(r-n),s=(l=>o+(l-n)*a);return s.domain=e,s.range=t,s.invert=l=>a===0?n:n+(l-o)/a,s.ticks=(l=4)=>pt(n,r,l),s}function In(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[i,a]=He(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function ms(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(u,m=1)=>{let c=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let g of u){let f=Number((g*10**d).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&c.push(f)}return c},s=i>=110?a([1,2,5]):a([1],Math.max(1,Math.ceil(24/i)));if(s.length>=2)return s;let l=a([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:pt(e,t,3)}function mo(e,t){let n=On([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=()=>ms(e[0],e[1],Math.abs(t[1]-t[0])),r}function bt(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 ds=864e5;function fo(e,t,n,r=ie){let o=t-e;if(!(o>0))return[{t:e,label:gt(e,{locale:r,month:"short",day:"numeric"})}];let i=o/ds,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),u=(m,c,d,g=!1)=>{let f=new Date(m),y=-1,T=0;for(;f.getTime()<=t&&T++<500;){if(f.getTime()>=e){let w=f.getFullYear(),v=g&&!l&&w!==y;a.push({t:f.getTime(),label:gt(f,{locale:r,...d,...v?{year:"numeric"}:{}})}),y=w}c(f)}};if(i<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),c=[1,2,3,4,6,12].find(g=>g>=m)??12,d=new Date(s);d.setMinutes(0,0,0),u(d,g=>g.setHours(g.getHours()+c),{hour:"numeric"})}else if(i<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());u(m,c=>c.setDate(c.getDate()+1),{month:"numeric",day:"numeric"})}else if(i<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),u(m,c=>c.setDate(c.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=i/30.44,c=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(g=>g>=c)??120;if(d>=12){let g=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);u(g,f=>f.setFullYear(f.getFullYear()+d/12),{year:"numeric"})}else{let g=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=g.getMonth()%d;f&&g.setMonth(g.getMonth()+(d-f)),u(g,y=>y.setMonth(y.getMonth()+d),{month:"short"},!0)}}return a}function ho(e,t){let n=new Array(e),r=new Uint8Array(e),o=i=>{if(typeof i!="string"||i.length===0||i.length>9)return-1;let a=Number(i);return Number.isInteger(a)&&a>=0&&a<e&&String(a)===i?a:-1};return new Proxy(n,{get(i,a,s){let l=o(a);return l>=0?(r[l]||(i[l]=t(l),r[l]=1),i[l]):Reflect.get(i,a,s)},has(i,a){return o(a)>=0||Reflect.has(i,a)}})}var fs=(e,t,n)=>e==="date"?ht(t,n)?.getTime()??NaN:Ne(t);function go(e){if(!Cn(e.trim()))return e;let t=ht(e)?.getTime();return t===void 0||!Number.isFinite(t)?e:String(t)}function hs(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Cn(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function je(e,t,n,r,o={}){let i=Xe(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:Xe(n,"y"),u=!a&&r!==void 0?Xe(r,"series"):null,m=e.map((C,$)=>i(C,$)),c=o.xType??hs(m),d=o.locale??ie,g,f,y;if(c==="band"){let C=m.map(h=>String(h??""));g=Te(C);let $=new Map(g.map((h,L)=>[h,L]));f=g.map((h,L)=>L),y=Int32Array.from(C,h=>$.get(h)??-1)}else{let C=c==="date"?o.dayFirst??Dr(m):void 0,$=m.map(W=>fs(c,W,C)),h=Array.from(new Set($.filter(W=>Number.isFinite(W)))).sort((W,G)=>W-G),L=new Map(h.map((W,G)=>[W,G]));f=h,g=h.map(String),y=Int32Array.from($,W=>L.get(W)??-1)}let T=o.dateFormat,w=C=>typeof C=="string"?Et(C.trim())?.[3]:void 0,v=c==="date"&&m.length<5e3?w(m[0]):void 0,S=(v===2||v===3)&&m.every(C=>w(C)===v),N=S&&v===3;if(c==="date"&&!T){let C=f.length>1?f[f.length-1]-f[0]:0;T=S&&v===2||C>864e5*120?{month:"short"}:C<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},C>864e5*800&&(T={year:"numeric",month:"short"})}let x;if(c==="band")x=g;else if(N&&!o.dateFormat){let C=J(d)==="ko";x=f.map($=>{let h=new Date($),L=Math.floor(h.getMonth()/3)+1;return C?`${h.getFullYear()}년 ${L}분기`:`Q${L} ${h.getFullYear()}`})}else{let C=f.every(Sn),$=c==="date"?new Intl.DateTimeFormat(d,T):new Intl.NumberFormat(d,C?{useGrouping:!1}:{maximumFractionDigits:6});x=f.length>1e3?ho(f.length,h=>$.format(f[h])):f.map(h=>$.format(h))}let _=s?[...s]:u?Te(e.map((C,$)=>String(u(C,$)??""))):[""],z=new Map(_.map((C,$)=>[C,$])),O=_.map(()=>new Array(g.length).fill(NaN)),I=_.map(()=>new Array(g.length).fill(null)),B=o.aggregate??"sum",E=B==="mean"?_.map(()=>new Uint32Array(g.length)):null,R=(C,$,h,L)=>{let W=O[C][$];B==="last"?O[C][$]=h:B==="count"?O[C][$]=(Number.isFinite(W)?W:0)+1:B==="mean"?Number.isFinite(h)&&(O[C][$]=(Number.isFinite(W)?W:0)+h,E[C][$]++):O[C][$]=Number.isFinite(W)?W+(Number.isFinite(h)?h:0):h,I[C][$]=L};for(let C=0;C<e.length;C++){let $=y[C];if($<0)continue;let h=e[C];if(s)for(let L=0;L<s.length;L++)R(L,$,Ne(h[s[L]]),h);else{let L=u?z.get(String(u(h,C)??""))??0:0;R(L,$,Ne(l(h,C)),h)}}if(E)for(let C=0;C<O.length;C++)for(let $=0;$<g.length;$++)E[C][$]>1&&(O[C][$]/=E[C][$]);return{type:c,keys:g,xnum:f,labels:x,series:_,values:O,rows:I}}var gs=140,xt=12,po=14,zn=20,bo=12.5;function ps(e,t,n=Kr){let r=Fe(t,t),o=new Map;e.forEach((a,s)=>{let l=r(a,s),u=o.get(l);u?u.push(a):o.set(l,[a])});let i=[...o.keys()].slice(0,n);return{values:i,groups:i.map(a=>o.get(a)),dropped:Math.max(0,o.size-n)}}function bs(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+xt)/(gs+xt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function ys(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*xt)/t));return{pw:r,ph:typeof n=="number"&&Number.isFinite(n)&&n>0?n:Math.max(120,Math.min(180,Math.round(r*.62)))}}var yt=e=>e.filter(Number.isFinite);function Yt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Wt(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return yt(n)}function yo(e,t,n,r,o,i){return je(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function xs(e,t,n,r,o,i){let a=Math.max(2,Math.round(i/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,u=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let x=t.flat(),_=r.refLines??{},[z,O]=bt([...Yt(x,r.x??"x"),...yt([Number(_.x)])]),[I,B]=bt([...Yt(x,r.y??"y"),...yt([Number(_.y)])].filter(R=>!s||R>0)),E=r.zero??!1;return{y:u??(s?In(I,B,a):He(I,B,a,{zero:E,pad:.08})),x:r.xDomain??He(z,O,Math.max(2,Math.round(o/110)),{zero:E,pad:.06}),sameKeys:!0}}let m=e==="bar",c=m&&r.orientation==="horizontal",d=n[0]?.keys.join(""),g=n.every(x=>x.keys.join("")===d),f=n.length>0&&n.every(x=>x.type!=="band"&&x.type===n[0].type),y=r.xDomain??(!m&&f?bt(n.flatMap(x=>yt(x.xnum))):void 0),T=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(T==="percent")return{x:y,sameKeys:g};if(u)return{y:u,x:y,sameKeys:g};let w=[];t.forEach((x,_)=>{let z=n[_];if(T==="stacked"||T==="auto"&&z.series.length>1){let I=En(z.values,"zero");I.y0.forEach(B=>w.push(...B)),I.y1.forEach(B=>w.push(...B))}else z.values.forEach(I=>w.push(...I));m&&!c&&r.line!==void 0&&yo(e,x,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(I=>w.push(...I)),m||w.push(...Yt(x,r.lower),...Yt(x,r.upper))}),m&&w.push(0),c||w.push(...ao(r.annotations));for(let x of r.referenceLines??[])w.push(x.y);r.signColors&&w.push(Number(r.baseline??0));let[v,S]=bt(yt(w).filter(x=>!s||x>0));return{y:s?In(v,S,a):m?He(v,S,c?Math.max(2,Math.round(o/120)):a):He(v,S,a,{zero:r.zero??e==="area"}),x:y,sameKeys:g}}function ks(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=je(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),u=(r.yScale==="log"&&e==="line"?mo:On)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),m=so(u,Lt(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),c=n.flatMap(x=>x.series),d=r.endLabels??n.some(x=>x.series.length>1),g=m+6,f=i-(d?Math.min(i*.28,Math.max(...c.map(x=>se(x,11,700)),20)+14):10),y=l.keys.length,[T,w]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,v=l.type==="number"?y>12:y>fo(T,w,Math.max(2,Math.floor((f-g)/64)),s).length;if(l.type==="band"||!y||v)return;let S=x=>g+(l.xnum[x]-T)/(w-T)*(f-g),N=x=>se(l.labels[x],pe);for(let x=1;;x++){let _=Array.from({length:Math.ceil(y/x)},(z,O)=>O*x);if(x>=y||_.every((z,O)=>!O||S(z)-S(_[O-1])>=(N(z)+N(_[O-1]))/2+8))return _.map(z=>({value:l.xnum[z],label:l.labels[z]}))}}function ws(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,"0")}function $s(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${ws(`${e}|${t}|${o}|${Kt(r)}`)}`}function vs(e,t){return typeof e=="string"?t.includes(e):Array.isArray(e)&&e.length>0&&e.every(n=>typeof n=="string"&&t.includes(n))}var Ts={en:{intro:(e,t)=>`${Ee(e,"panel")} by ${t}.`,endHigh:(e,t)=>` ${e} ends highest at ${t}.`,falling:e=>` Lower at the end than at the start: ${e}.`,noneFalling:" None is lower at the end than at the start.",total:(e,t)=>` ${e} has the largest total at ${t}.`,points:(e,t)=>` ${e} has the most points (${t}).`,dropped:(e,t)=>` Only the first ${e} of ${t} values are shown.`,more:", …",blank:"(blank)"},ko:{intro:(e,t)=>`${t}별 패널 ${e}개.`,endHigh:(e,t)=>` 마지막 값이 가장 큰 곳: ${e}(${t}).`,falling:e=>` 처음보다 끝이 낮은 곳: ${e}.`,noneFalling:" 처음보다 끝이 낮은 곳은 없어요.",total:(e,t)=>` 합계가 가장 큰 곳: ${e}(${t}).`,points:(e,t)=>` 점이 가장 많은 곳: ${e}(${t}개).`,dropped:(e,t)=>` ${t}개 중 앞의 ${e}개만 보여요.`,more:" 등",blank:"(빈 값)"}},Bn=18;function xo(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=ps(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=bs(s,a,e.columns),{pw:u,ph:m}=ys(s,l,e.height),c=e.scale!=="free",d=t==="scatter"?[]:o.map(E=>yo(t,E,n,n.y,n.series,n.aggregate)),g=c?xs(t,o,d,n,u,m):{sameKeys:!1},f=c?ks(t,o,d,n,g,u,m,e.locale):void 0,y=t==="bar"&&n.orientation==="horizontal",T=c&&(!y||g.sameKeys),w=c&&(y||g.x!==void 0||g.sameKeys),v=new Set(vs(e.highlight,r)?[e.highlight].flat():[]),S=v.size>0,N=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,x=e.syncId??$s(t,e.by,n,e.data),_=Dt(Ke(n.format,e.locale),n.unit),z=Ts[e.lang],O=[],I=r.map(E=>E===""?z.blank:E);return{panels:r.map((E,R)=>{let C=o[R],$=I[R],h=R%l,L;if(t!=="scatter"){let G=d[R],le=ce=>G.values.reduce((xe,it)=>xe+(Number.isFinite(it[ce])?it[ce]:0),0),K=G.keys.map((ce,xe)=>xe).filter(ce=>G.values.some(xe=>Number.isFinite(xe[ce]))),oe=K[K.length-1];O.push({first:K.length?le(K[0]):NaN,last:K.length?le(oe):NaN,total:K.reduce((ce,xe)=>ce+le(xe),0)}),t!=="bar"&&G.series.length===1&&oe!==void 0&&(L=_(G.values[0][oe]))}else O.push({first:NaN,last:NaN,total:C.length});let W={data:C,width:u,height:m,ariaLabel:e.title?`${e.title}, ${$}`:$,syncId:x,highlight:S?v.has(E)?N?()=>!0:void 0:"none":e.highlight,showYAxis:!T||h===0,showXAxis:!w||R+l>=a};return g.y&&(W.yDomain=g.y),g.x&&(W.xDomain=g.x),f&&(W.xTicks=f),{value:E,label:$,props:W,last:L,isPicked:v.has(E)}}),cols:l,pw:u,ph:m,isPanelPick:S,description:Ms(t,e.by,I,O,i,_,z)}}function Ms(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=u=>ro(r.map(m=>m[u]));if(e==="line"||e==="area"){let u=l("last");u>=0&&(s+=a.endHigh(n[u],i(r[u].last)));let m=n.filter((c,d)=>r[d].last<r[d].first);s+=m.length?a.falling(`${m.slice(0,5).join(", ")}${m.length>5?a.more:""}`):a.noneFalling}else{let u=l("total");u>=0&&(s+=e==="bar"?a.total(n[u],i(r[u].total)):a.points(n[u],r[u].total))}return o&&(s+=a.dropped(n.length,n.length+o)),s}var de=F(Y(),1);function Ss(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Cs(e,t,n=1/0){let r=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=Math.min(r*.5,n))}var Jt={threshold:.25,enoughPx:96,rootMargin:"0px"};function $o(e,t=!0){let[n,r]=(0,de.useState)({visible:!t,near:!t});return(0,de.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(a=>{let s=Cs(a[a.length-1],Jt.threshold,Jt.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:Ss(Jt.threshold),rootMargin:Jt.rootMargin}),i=new IntersectionObserver(a=>{let s=a[a.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),i.observe(e),()=>{o.disconnect(),i.disconnect()}},[e,t]),n}function ko(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function Zt(e){let[t,n]=(0,de.useState)(null),[r,o]=(0,de.useState)(e??null),i=(0,de.useCallback)(a=>{n(a),a&&e===void 0&&o(ko(a))},[e]);return Ae(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=u=>o(m=>m!==null&&Math.abs(m-u)<.5?m:u),s=()=>a(ko(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(u=>{let m=u[u.length-1]?.contentRect;m?a(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var As=()=>()=>{};function rt(){return(0,de.useSyncExternalStore)(As,()=>!0,()=>!1)}var wo="(prefers-reduced-motion: reduce)";function qt(e="auto"){let[t,n]=(0,de.useState)(()=>ke&&typeof window.matchMedia=="function"?window.matchMedia(wo).matches:!1);return(0,de.useEffect)(()=>{if(e!=="auto"||!ke||typeof window.matchMedia!="function")return;let r=window.matchMedia(wo),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Me=F(V(),1),Rs=60,Ns=420;function vo(e){let t=ve(),n=e.chartProps??{},[,r,o]=Zt(e.width),i=e.width??(o||480),a=ue(e.locale??n.locale),s=J(a),l=(0,ot.useContext)(Ze),u=e.title??l,m=e.chart.facetPlan,c=(0,ot.useMemo)(()=>{let w=xo({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:i,height:e.height,title:u,locale:a,lang:s});return m?m(w,n,a):w},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(w,v)=>typeof v=="function"?String(v):v),e.highlight,e.syncId,i,e.height,u,a,s,m]),d=`${(0,ot.useId)().replace(/:/g,"")}fd`,g=qt(n.reducedMotion??"auto"),f=rt(),y=br({motion:{enabled:n.animate!==!1&&!g&&ke},hydrated:f},{waiting:!1,generation:0}),T=e.chart;return(0,Me.jsxs)("div",{ref:r,role:"group","aria-label":u,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Me.jsx)("p",{id:d,style:jt,children:e.description??c.description}),(0,Me.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${c.cols}, minmax(0, 1fr))`,columnGap:xt,rowGap:po,...c.legend?{marginTop:Bn}:null},children:c.panels.map((w,v)=>{let S=t.paint(w.isPicked?"accentText":c.isPanelPick?"muted":"ink");return(0,Me.jsxs)("div",{"data-facet":w.value,style:{minWidth:0,...pr(y,!1,"fade",v*Rs,Ns)},children:[(0,Me.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:zn,fontSize:bo,fontWeight:700,lineHeight:`${zn}px`,color:S},children:[(0,Me.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w.label}),w.last!==void 0?(0,Me.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:w.last}):null]}),(0,Me.jsx)(T,{...n,...w.props})]},w.value)})}),c.legend?(0,Me.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Bn},children:c.legend}):null]})}var To=["max","min","first","last","none"];function be(e,t,n,r,o="max"){let i=new Set,a=n.length,s=u=>{if(a&&u!=="none"){if(u==="first")i.add(0);else if(u==="last")i.add(a-1);else if(u==="max"||u==="min"){let m=-1,c=u==="max"?-1/0:1/0;r.forEach((d,g)=>{Number.isFinite(d)&&(u==="max"?d>c:d<c)&&(c=d,m=g)}),m>=0&&i.add(m)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((u,m)=>{m<a&&u!==null&&u!==void 0&&e(u,m)&&i.add(m)}),i;let l=Array.isArray(e)?e:[e];for(let u of l)typeof u=="number"?u>=0&&u<a&&i.add(u):u==="max"||u==="min"||u==="first"||u==="last"||u==="none"?s(u):n.forEach((m,c)=>{m===u&&i.add(c)});return i}var ye=F(Y(),1);async function Fs(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",i=await e.text();if(t==="text")return i;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(i))throw new Error(J(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ue(i);if(t==="json"||o.includes("json"))return JSON.parse(i);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return Ue(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):Ue(i)}async function _s(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),i=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!i.ok)throw new Error(`HTTP ${i.status}${i.statusText?` ${i.statusText}`:""}`);r=await Fs(i,t.parse,o,t.locale)}return t.select&&(r=qr(r,t.select)),t.transform?t.transform(r):Be(r)}function Mo(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,ye.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,ye.useState)(0),u=ue(t.locale),m=(0,ye.useRef)(t);m.current={...t,locale:u};let c=(0,ye.useRef)(e);c.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",g=t.deps??[],f=JSON.stringify(g.map(w=>typeof w=="object"?JSON.stringify(w):String(w))),y=(0,ye.useRef)(!1);(0,ye.useEffect)(()=>{let w=c.current;if(!w||!r){a(N=>N.status==="loading"?{...N,status:"idle"}:N);return}let v=new AbortController,S=!0;return y.current=!0,a(N=>({...N,data:o?N.data:[],status:"loading",error:null})),_s(w,{...m.current,signal:v.signal}).then(N=>{S&&a({data:N,status:"success",error:null,updatedAt:Date.now()})}).catch(N=>{!S||v.signal.aborted||a(x=>({...x,status:"error",error:N instanceof Error?N:new Error(String(N))}))}).finally(()=>{S&&(y.current=!1)}),()=>{S=!1,y.current=!1,v.abort()}},[d,r,s,f,o]),(0,ye.useEffect)(()=>{if(!n||!r)return;let w=setInterval(()=>{y.current||l(v=>v+1)},n);return()=>clearInterval(w)},[n,r]);let T=(0,ye.useCallback)(()=>l(w=>w+1),[]);return{data:i.data,status:i.status,loading:i.status==="loading",error:i.error,empty:i.status==="success"&&i.data.length===0,updatedAt:i.updatedAt,reload:T}}var jn=F(V(),1),Ps=["csv","svg","png"],Ds=/^[=+\-@\t\r\n=+-@]/,Ls=/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?Fr(e.getTime()):String(e);return`"${(Ds.test(t)&&!Number.isFinite(Ne(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Es(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Os(e,t){return`\uFEFF${[t.map(So),...e.map(r=>t.map(o=>So(r[o])))].map(r=>r.join(",")).join(`\r
26
26
  `)}\r
27
- `}function Ds(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Hn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Co=2,Ge=16;function Ao(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,i,a,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${i}, ${a})`:`rgba(${o}, ${i}, ${a}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function No(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 Ro(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:i,height:a}=o.viewBox.baseVal,[s,l]=[i+Ge*2,a+Ge*2],u=o.cloneNode(!0),m=u.querySelectorAll("*"),c=new Map;o.querySelectorAll("*").forEach((f,b)=>{let M;for(let w of Array.from(f.attributes)){if(!_s.test(w.value))continue;let v=(M??(M=getComputedStyle(f))).getPropertyValue(w.name);v&&m[b].setAttribute(w.name,Ao(v,c))}}),u.removeAttribute("style");for(let[f,b]of Object.entries({viewBox:`${-Ge} ${-Ge} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))u.setAttribute(f,String(b));let d=Ao(getComputedStyle(r).backgroundColor,c),g=o.parentElement?.querySelector("canvas")??null;if(n){let f=u.querySelector("desc")?.nextSibling??u.firstChild;u.insertBefore(No("rect",{x:-Ge,y:-Ge,width:s,height:l,fill:d}),f),g&&u.insertBefore(No("image",{href:g.toDataURL(),width:i,height:a}),f)}return{svg:new XMLSerializer().serializeToString(u),w:s,h:l,vw:i,vh:a,bg:d,canvas:g}}function Es(e,t){let n=Ro(e,Co,!1);if(!n)return;let r=Co,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let i=o.getContext("2d");if(!i)return;i.fillStyle=n.bg,i.fillRect(0,0,o.width,o.height),n.canvas&&i.drawImage(n.canvas,Ge*r,Ge*r,n.vw*r,n.vh*r);let a=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{i.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(a),o.toBlob(l=>l&&Hn(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(a),s.src=a}function Fo(e){let t=ve(e.theme),n=J(ue(e.locale))==="ko",r=Ds(e.filename),o=(i,a)=>{if(i==="csv")return Hn(new Blob([Ls(e.data,e.columns?.length?e.columns:Ps(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(i==="png")return Es(a,r);let s=Ro(a,1,!0);s&&Hn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,jn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:Rs.filter(i=>!e.formats||e.formats.includes(i)).map(i=>{let a=i.toUpperCase(),s=n?`${a} 내려받기`:`Download ${a}`;return(0,jn.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(i,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:a},i)})})}var Po=F(V(),1);function _o(e,t=ie){let n=Ke(void 0,t),r=e.split(`
28
- `),o=(i,a)=>{if(a==="label")return i.label;if(a==="value")return i.formatted??(i.value===null?null:n(i.value));if(a==="series")return i.series??null;let s=i.datum&&typeof i.datum=="object"?i.datum[a]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?gt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,u=s.replace(Pr,(m,c)=>o(i,c.trim())??(l=!0,""));l||a.push(u)}return a.length?a.map((s,l)=>(0,Po.jsx)("div",{children:s},l)):null}}function Lo(e,t,n=!1){let r=Fe(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=Me(o);if(!n)return i;let a=new Map;for(let s of o)a.set(s,(a.get(s)??0)+1);return i.map((s,l)=>[s,l]).sort((s,l)=>a.get(s[0])-a.get(l[0])||s[1]-l[1]).map(([s])=>s)}function Do(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 Ue(t.csv)}return null}var jo=F(Y(),1);var ee=F(Y(),1);function Eo(e,t){let n=ve(e.theme),[r,o,i]=Zt(e.width),a=rt(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,u=e.height??l,m=qt(e.reducedMotion??"auto"),c=e.animate!==!1&&!m&&ke,d=$o(r,e.animateOnView!==!1&&c),g=ue(e.locale),f=J(g),b=(0,ee.useMemo)(()=>Ke(e.format,g,t.format),[e.format,g,t.format]),M=(0,ee.useCallback)(K=>et(K,{locale:g}),[g]),w=(0,ee.useMemo)(()=>Lt(b,e.unit),[b,e.unit]),v=(0,ee.useMemo)(()=>Kt(e.data),[e.data]),[S,R]=(0,ee.useState)(null),[x,_]=(0,ee.useState)(null),z=(0,ee.useRef)([]),O=(0,ee.useRef)(e.onHover);O.current=e.onHover;let I=(0,ee.useRef)(e.onClick);I.current=e.onClick;let B=(0,ee.useRef)(null),E=(0,ee.useRef)(null),N=(0,ee.useRef)(null),C=(0,ee.useCallback)((K,oe="pointer")=>{if(N.current!==K){N.current=K;let ce=K===null?null:z.current[K]??null;queueMicrotask(()=>O.current?.(ce)),E.current?.(K)}B.current=K===null?null:oe,R(K),_(B.current)},[]),$=(0,ee.useCallback)(K=>{B.current!=="keyboard"&&(B.current=K===null?null:"sync",R(K),_(B.current))},[]),h=(0,ee.useCallback)(K=>{let oe=z.current[K];oe&&I.current?.(oe)},[]),D=Ir(e.replayKey),W=e.width!==void 0||(i??0)>0,G={enabled:c,active:d.visible&&W,near:d.near,replayKey:D,dataKey:v,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},le=(0,ee.useCallback)((K,oe=1)=>S===null||S===K?oe:oe*.38,[S]);return{p:n,width:s,height:u,measured:W,responsive:e.width===void 0,pending:ke&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:G,fv:w,fmt:b,pct:M,locale:g,lang:f,t:f==="ko"?kr:xr,active:S,via:x,setActive:C,click:h,events:z,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:le,sig:v,description:e.description,reduced:m,publish:E,applySync:$}}var Z=F(Y(),1);function Os(e){return 1-Math.pow(1-e,3)}function Is(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function zs(e){return e==="easeInOut"?Is:e==="linear"?t=>t:Os}function Bs(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 at(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),i=Math.floor(o),a=Math.min(e.length-1,i+1);n[r]=e[i]+(e[a]-e[i])*(o-i)}return n}function Qt(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 Oo(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 Io(e,t,n,r){if(!t||!n||t.length!==n.length)return at(e,r);let o=[],i=0;for(let a=0;a<n.length;a++){let s=e.slice(i,i+t[a]);i+=t[a];for(let l of at(s,n[a]))o.push(l)}return o.length===r?o:at(e,r)}var en=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||!Qt(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 i=t.from??t.to,a=t.enter??i;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:i.slice(),enter:a.slice(),exit:(t.exit??a).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),i=this.make(r,r.to,0,0);o&&(i.order=o.order),i.done=!0,i.progress=1,n.set(r.key,i)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let i=this.tracks.get(o.key),a=this.make(o,o.from??o.to,1/0,o.delay??0);i&&(a.order=i.order),r=Math.max(r,o.delay??0),n.set(o.key,a)}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),Oo(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=Qt(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,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let u=a.to.length;s.from=Io(s.cur,s.parts,a.parts,u),s.vel=Io(s.curVel,s.parts,a.parts,u),s.parts=a.parts,s.to=a.to.slice(),Oo(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(a.from??a.to).slice(),s.enter=(a.enter??s.appear).slice(),s.exit=(a.exit??s.enter).slice(),s.data=a.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=Qt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let u=this.make(a,a.enter??a.from??a.to,n+l,0);u.done=Qt(u.from,u.to),this.tracks.set(a.key,u)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=at(a.exit,a.cur.length),a.t0=n,a.exiting=!0,a.done=!1,a.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=zs(this.easing),o=this.duration/1e3,i=this.omega,a=[];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=at(s.from,u)),s.vel.length!==u&&(s.vel=at(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 m;if(this.easing==="spring"){let c=Math.exp(-i*l),d=i*l>=8&&i*l<20,g=0;for(let f=0;f<u;f++){let b=s.from[f]-s.to[f],M=s.vel[f]+i*b;s.cur[f]=s.to[f]+(b+M*l)*c,s.curVel[f]=(s.vel[f]-i*M*l)*c,d&&g<.15&&(g=Math.max(g,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/i)))}m=i*l>=20||d&&g<.15,s.progress=Math.min(1,1-(1+i*l)*c)}else{let c=Math.min(1,l/o),d=r(c),g=Bs(this.easing,c)/o;for(let f=0;f<u;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*g;m=c>=1,s.progress=d}if(m){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&&a.push(s.key)}else n=!0}for(let s of a)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}},kt=new Set,tn=0;function zo(e){tn=0;let t=Array.from(kt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||kt.delete(n)}kt.size&&typeof requestAnimationFrame<"u"&&(tn=requestAnimationFrame(zo))}function Bo(e){return kt.add(e),!tn&&typeof requestAnimationFrame<"u"&&(tn=requestAnimationFrame(zo)),()=>{kt.delete(e)}}function Hs(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 Ho(e,t){let n=(0,Z.useMemo)(()=>Hs(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:u=900,stagger:m=0}=t,c=(0,Z.useRef)(null),d=(0,Z.useRef)("init"),g=(0,Z.useRef)(null),f=(0,Z.useRef)(s),b=(0,Z.useRef)(a),M=(0,Z.useRef)(!1),w=(0,Z.useRef)(0),[,v]=(0,Z.useState)(0),S=(0,Z.useRef)(null),R=(0,Z.useRef)(!0);c.current||(c.current=new en,c.current.configure(l,u),c.current.snap(n),g.current=n);let x=c.current;if(x.configure(l,u),g.current!==n){let E=d.current,N=!Object.is(f.current,s);x.sameTargets(n)?x.refreshData(n):!r||E==="init"?x.snap(n):E==="idle"?x.hold(n):E==="running"||N?x.update(n,Nt(),m):x.snap(n),g.current=n,f.current=s}let _=(0,Z.useRef)(()=>!1);_.current=E=>{if(!R.current)return!1;let N=x.step(E);return!N&&d.current==="running"&&(d.current="done"),v(C=>(C+1)%1e9),N||(S.current=null),N};let z=(0,Z.useCallback)(()=>{if(!ke||S.current||!x.animating)return;let E=N=>_.current(N);S.current=Bo(E)},[x]);Ae(()=>{let E=!Object.is(b.current,a);if(b.current=a,!r){(d.current!=="done"||x.animating)&&(x.snap(g.current??n),d.current="done",v(N=>N+1));return}d.current==="init"||E&&i?(x.hold(g.current??n),d.current="idle",M.current=!1,v(N=>N+1)):E&&(M.current=!0)},[r,a]),Ae(()=>{!r||!i||!M.current||(M.current=!1,x.hold(g.current??n),d.current="idle",v(E=>E+1))},[i,r]),(0,Z.useEffect)(()=>{r&&o&&d.current==="idle"&&(x.start(Nt()),w.current+=1,d.current="running",z(),v(E=>E+1))},[r,o,a,x,z]),(0,Z.useEffect)(()=>{x.animating&&z()}),(0,Z.useEffect)(()=>(R.current=!0,()=>{R.current=!1,S.current?.(),S.current=null}),[]);let O=Nt(),I=x.elapsed(O),B=r&&d.current==="idle";return{items:x.items(),get:E=>x.get(E),elapsed:B?0:I,fade:(E,N=320)=>B?0:Number.isFinite(I)?Math.max(0,Math.min(1,(I-E)/N)):1,waiting:B,animating:x.animating,generation:w.current}}var Gn=F(V(),1);function Go(e,t,n,r,o){if(r)return o==="categorical"?we(e,t,n):ft(e,t,n);if(o==="categorical")return we(e,t,n);let i=Q(e,"strong"),a=Q(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var js=F(Y(),1);var Vn=F(V(),1);var Vo=e=>e?"neutralStrong":"accent";var Wn=F(V(),1);function Wo(e,t,n,r){if(typeof e!="function")return be(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((a,s)=>[a,s])),i=new Set;return t.forEach((a,s)=>{let l=o.get(r(a,s));l!==void 0&&e(a,s)&&i.add(l)}),i}var Gs=F(Y(),1);var Xn=F(V(),1),Vs={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}, ${Ee(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Ko={en:Vs,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}일 이동평균`}},Kn=["ink","muted","dim"];function Xo(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,Kn.length)}var Ws=F(Y(),1);var qo=F(V(),1),Ks={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ee(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Xs={en:Ks,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Uo=(e,t)=>Xs[e].other(t);function Yo(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((i,a)=>({v:i.value,i:a})).sort((i,a)=>a.v-i.v).slice(0,Math.floor(t)).map(i=>i.i)),o=e.filter((i,a)=>!r.has(a));return{kept:e.filter((i,a)=>r.has(a)),other:n(o.length,to(o.map(i=>i.value)))}}var Jo=e=>Number.isFinite(e)&&e>0?e:0;function Zo(e,t,n,r){return r==="emphasis"?Pt(e,t,n):we(e,t,n)}var te=F(Y(),1);var A=F(V(),1),Us={kind:"Skyline",row:{back:"back",front:"front"},total:{back:"Back total",front:"Front total"},sum:"total",sumLabel:"Total",rate:"Front ÷ back",peak:e=>`Peak ${e}`,frontPeak:(e,t,n)=>`Front peak ${e} · ${t}${n?` (${n})`:""}`,range:(e,t)=>`${e}–${t}`,nothing:"Nothing to draw",ofBack:e=>`${e} of the back row`,cell:(e,t,n)=>`${e?`${e} `:""}${t}${n?` (${n})`:""}`,desc:(e,t,n,r)=>`${Ee(e,"series","series")} (${t}) stacked from ${n} to ${r}`,descPeak:(e,t)=>`Peak period ${e} at ${t}`,descFront:(e,t,n,r)=>`Front row (${e}) peaks at ${t} with ${n}${r?`, ${r} of the back row`:""}`,descFrontZero:e=>`The front row (${e}) is all zero`,merged:e=>`Neighboring periods are summed in groups of ${e}`,keys:"Use left and right arrows for periods, up and down to switch rows."},Ys={en:Us,ko:{kind:"스카이라인",row:{back:"뒷줄",front:"앞줄"},total:{back:"뒷줄 합계",front:"앞줄 합계"},sum:"합계",sumLabel:"합계",rate:"앞줄 ÷ 뒷줄",peak:e=>`최고 ${e}`,frontPeak:(e,t,n)=>`앞줄 최고 ${e} · ${t}${n?` (${n})`:""}`,range:(e,t)=>`${e}~${t}`,nothing:"그릴 값이 없어요",ofBack:e=>`뒷줄의 ${e}`,cell:(e,t,n)=>`${e?`${e} `:""}${t}${n?`(${n})`:""}`,desc:(e,t,n,r)=>`계열 ${e}개(${t})를 ${n}부터 ${r}까지 쌓았어요`,descPeak:(e,t)=>`가장 많은 기간 ${e} ${t}`,descFront:(e,t,n,r)=>`앞줄(${e})이 가장 많은 기간 ${t} ${n}${r?`, 뒷줄의 ${r}`:""}`,descFrontZero:e=>`앞줄(${e})은 모두 0이에요`,merged:e=>`이웃 기간을 ${e}개씩 합쳤어요`,keys:"←→로 기간을, ↑↓로 앞줄과 뒷줄을 옮겨요."}},Js={low:{cx:.8944271909999159,cy:.4472135954999579,face:.52,front:.14,gap:.05,depth:[.1,.32,.32]},high:{cx:.4472135954999579,cy:.8944271909999159,face:.54,front:.42,gap:.1,depth:[.1,.45,.42]}};var Zs=20,qs=40,Qs=.4,Qo=14,Un=10,el=20,_e=4,nn=26,ea=18,tl=["back","front"],nl=["back"],L=e=>Math.round(e*10)/10,Je=e=>e.map(([t,n])=>`${L(t)},${L(n)}`).join(" "),Ye=e=>e.reduce((t,n)=>t+n,0),ta=(e,t,n,r,o=400)=>{let i=se(t,n,o)/2;return Math.max(i+2,Math.min(r-i-2,e))};function rl(e,t){for(let n=1;n<t;n++){let r=Math.ceil(t/n);if(r<=qs&&e/(r+.55)>=Zs)return n}return Math.max(1,t)}function oa(e,t,n){let r=t-n*(Math.ceil(t/n)-1);return e===0?[0,r]:[r+(e-1)*n,r+e*n]}function na(e,t,n){return Array.from({length:Math.ceil(t/n)},(r,o)=>{let[i,a]=oa(o,t,n);return e.map(s=>Ye(s.slice(i,a).map(l=>Number.isFinite(l)&&l>0?l:0)))})}function ol(e){let t=Js[e.view??"high"],n=e.view==="low"||e.front.length?t.front:0,r=Math.min(t.depth[1],Math.max(t.depth[0],e.depth??t.depth[2])),o=I=>e.width-Un-(e.wall?I+14:8),i=0,a=0,s=[],l=[],u=[0,1];for(let I=0;I<3;I++){let B=rl(o(a),e.n);if(B===i)break;i=B,s=na(e.back,e.n,i),l=na(e.front,e.n,i),u=He(0,Math.max(0,...s.map(Ye),...l.map(Ye)),4);let E=e.tickFmt(u[1]);a=e.wall?Math.max(...pt(u[0],u[1],4).map(N=>se(E(N),pe))):0}let m=s.length,c=Math.max(1,o(a)/(m+.55)),d=t.face*c,g=e.height-e.below,f=e.legendH+el,b=(n+t.gap+r)*c*t.cy,M=e.view==="low"?1:Math.min(1,Qs*Math.max(0,g-f)/(b||1)),w=(n+t.gap)*c*M,v=w+r*c*M,S=g-v*t.cy,R=Math.max(0,S-f)/(u[1]||1),x=pt(u[0],u[1],4),_=x.length>1?(x[1]-x[0])*R:1/0,z=_>=Qo?1:_>0?Math.ceil(Qo/_):x.length,O=I=>Un+I*c;return{merge:i,shown:m,back:s,front:l,backTotal:s.map(Ye),frontTotal:l.map(Ye),ticks:x.filter((I,B)=>B%z===0),fmt:e.tickFmt(u[1]),k:R,s:c,w:d,floor:g,wallBase:S,top:f,cx:t.cx,cy:t.cy,lead:w,shift:[w*t.cx,w*t.cy],depthFront:n*c*M,depthBack:r*c*M,wallX:[Un+v*t.cx-6,O(m-1)+d+v*t.cx+6],slotX:O}}function al(e,t){return t?e==="ArrowUp"?"back":e==="ArrowDown"?"front":null:null}function il(e,t){let n=0;return e.map(r=>n+=r*t)}function sl(e,t){let{dx:n,dy:r}=e,o=e.base-t;return[[e.x,o],[e.x+n,o+r],[e.x+e.w+n,o+r],[e.x+e.w+n,e.base+r],[e.x+e.w,e.base],[e.x,e.base]]}function ll(e,t){return Array.from({length:t},(n,r)=>{let o=r%2===0?"accent2":"accent3",i=Math.max(.4,1-.3*Math.floor(r/2)),a=i===1?e.theme[o]:Qe(e.theme[o],e.theme.ink,i);return{role:"mix",fill:i===1?e.paint(o):e.mix(o,"ink",i),text:wn(e,a),raw:a}})}function cl(e,t,n){if(!n)return null;let r=s=>s>0?s:0,o=n.values.reduce((s,l)=>s+r(l),0);if(!(o>0))return null;let i=[],a=0;return n.values.forEach((s,l)=>{let u=e.x+e.w*a/o;a+=r(s);let m=e.x+e.w*a/o;m>u&&i.push((0,A.jsx)("polygon",{points:Je([[u,t],[m,t],[m+e.dx,t+e.dy],[u+e.dx,t+e.dy]]),fill:n.fills[l]??"none"},`l${l}`))}),i}function ra(e){let{p:t,g:n,cum:r,colors:o,hatch:i}=e,{dx:a,dy:s}=n,l=n.x+n.w,u=(v,S)=>Je([[l,v],[l+a,v+s],[l+a,S+s],[l,S]]),m=r[r.length-1]??0,c=n.base-m,d=[],g=[],f=0;if(r.forEach((v,S)=>{let R=n.base-f,x=n.base-v;v>f&&(d.push((0,A.jsx)("rect",{x:L(n.x),y:L(x),width:L(n.w),height:L(v-f),fill:o[S].fill},`f${S}`)),d.push((0,A.jsx)("polygon",{points:u(x,R),fill:o[S].fill},`s${S}`)),f>0&&g.push((0,A.jsx)("polyline",{points:Je([[n.x,R],[l,R],[l+a,R+s]]),fill:"none",stroke:t.paint("panel"),strokeWidth:1.2},`g${S}`))),f=v}),m<1&&!e.tile)return(0,A.jsx)("g",{children:d});let b=u(c,n.base),M=Je([[n.x,c],[l,c],[l+a,c+s],[n.x+a,c+s]]),w=cl(n,c,e.lidSplit);return(0,A.jsxs)("g",{children:[d,m>=1?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("polygon",{points:b,fill:"#000",fillOpacity:e.shade}),i?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("rect",{x:L(n.x),y:L(c),width:L(n.w),height:L(m),fill:i}),(0,A.jsx)("polygon",{points:b,fill:i})]}):null,g,(0,A.jsx)("line",{x1:L(l),x2:L(l),y1:L(c),y2:L(n.base),stroke:t.paint("panel"),strokeOpacity:.7})]}):null,w,(0,A.jsx)("polygon",{points:M,fill:w?"none":e.lid,stroke:e.lidStroke?t.paint(e.lidInk?"ink":"neutralStrong"):void 0,strokeOpacity:e.lidStroke?e.lidInk?.4:.55:void 0,strokeLinejoin:"round"}),e.lidHatch&&i?(0,A.jsx)("polygon",{points:M,fill:i}):null]})}function Yn(e){let{p:t}=e;return(0,A.jsx)("text",{x:L(e.x),y:L(e.y),dy:"0.35em",fontSize:e.size??11.5,fill:t.paint("ink"),textAnchor:"middle",fontWeight:700,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),stroke:t.paint("panel"),strokeWidth:4,strokeLinejoin:"round",paintOrder:"stroke",style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}function ul(e,t){let n=[],r=0,o=0;for(let i of e){let a=15+se(i.name,11.5);if(r>0){let s=i.divider?28:14;r+s+a>t?(r=0,o++):r+=s}n.push({x:r,line:o}),r+=a}return n}function ml(e){let{p:t,rates:n}=e,r=Math.max(0,...n.map(s=>s??0)),o=uo(0,r,2)[1],i=r>0?n.indexOf(r):-1,a=e.top+nn;return(0,A.jsxs)("g",{"aria-hidden":"true",children:[(0,A.jsx)(ze,{x:e.from,y:e.top-8,size:11,fill:t.paint("muted"),children:e.title}),(0,A.jsx)("line",{x1:L(e.from),x2:L(e.to),y1:L(e.top),y2:L(e.top),stroke:t.paint("line2")}),(0,A.jsx)("line",{x1:L(e.from),x2:L(e.to),y1:L(a),y2:L(a),stroke:t.paint("line")}),n.map((s,l)=>{if(s===null||s<=0)return null;let u=s/o*nn;return(0,A.jsx)("rect",{x:L(e.x(l)),y:L(a-u),width:L(e.w),height:L(u),rx:Math.min(1.5,u/2),fill:t.paint(l===i?"accent":"neutralStrong")},l)}),(0,A.jsx)(ze,{x:e.right,y:a,size:pe,fill:t.paint("muted"),children:"0"}),(0,A.jsx)(ze,{x:e.right,y:e.top,size:pe,fill:t.paint("muted"),children:e.pct(o)}),i>=0?(0,A.jsx)(Yn,{p:t,x:e.x(i)+e.w/2,y:a-r/o*nn-8,size:11,opacity:e.fade(i),children:e.pct(r)}):null]})}function Jn(e){let t=e.frontRate==="strip"&&e.front!==void 0,n=Eo(e,{height:p=>Math.max(300,Math.min(440,p*.58))+(t?40:0),duration:800,stagger:40}),{p:r,width:o,height:i}=n,a=Ys[n.lang],s=(0,te.useId)().replace(/:/g,""),[l,u]=(0,te.useState)("back"),m=(0,te.useMemo)(()=>e.front===void 0?[]:Array.isArray(e.front)?e.front:[e.front],[e.front]),c=(0,te.useMemo)(()=>je(e.data,e.x,e.y,e.series,{locale:n.locale,dayFirst:e.dayFirst}),[e.data,e.x,e.y,e.series,n.locale,e.dayFirst]),d=(0,te.useMemo)(()=>m.length?je(e.data,e.x,m,void 0,{locale:n.locale,xType:c.type,dayFirst:e.dayFirst}).values:[],[e.data,e.x,m,n.locale,c,e.dayFirst]),g=typeof e.y=="string"?e.y:n.t.value,f=(0,te.useMemo)(()=>c.series.map(p=>p||g),[c,g]),b=(0,te.useMemo)(()=>[...f,...m],[f,m]),M=f.length,w=m.length,v=w>0,S=v?l:"back",R=e.frontRate??"label",x=e.texture??"front",_=e.wall!==!1,z=e.view??"high",O=z==="high",I=t&&v,B=v&&!t&&n.showLabels,E=(0,te.useMemo)(()=>M>1||v?b.map((p,k)=>({name:p,divider:k===M&&M>0})):[],[b,M,v]),N=(0,te.useMemo)(()=>ul(E,o),[E,o]),C=N.length?(N[N.length-1].line+1)*ea+6:0,$=_e+(I?70:B?48:22),h=(0,te.useMemo)(()=>ol({width:o,height:i,back:c.values,front:d,n:c.keys.length,depth:e.depth,wall:_,view:z,legendH:C,below:$,tickFmt:p=>Dt(e.format,n.locale,p)}),[o,i,c,d,e.depth,_,z,C,$,e.format,n.locale]),{shown:D,merge:W}=h,G=(0,te.useMemo)(()=>{let p=c.keys.length;return Array.from({length:D},(k,T)=>{let[j,H]=oa(T,p,W),q=H-1,re=j===q;return{label:re?c.labels[j]:a.range(c.labels[j],c.labels[q]),key:re?c.keys[j]:`${c.keys[j]}~${c.keys[q]}`,sync:go(c.keys[j]),datum:re?c.rows[0]?.[j]??null:null}})},[D,W,c,a]),le=(0,te.useMemo)(()=>{let p=e.highlight,k=typeof p=="string"?b.includes(p):Array.isArray(p)&&p.some(U=>typeof U=="string"&&b.includes(U)),T=U=>O?U.size?We(r,w,U):ll(r,w):ft(r,w,U);if(M===1&&!k){let U=be(p,G.map(fe=>fe.datum),G.map(fe=>fe.label),h.backTotal,"max");return{periods:Pt(r,D,U),back:[Q(r,"neutral")],front:T(new Set),split:O}}let j=[...f.map((U,fe)=>Ye(h.back.map(he=>he[fe]))),...m.map((U,fe)=>Ye(h.front.map(he=>he[fe])))],H=be(typeof p=="function"?void 0:p,b,b,j,"first"),q=(U,fe)=>new Set([...H].filter(he=>he>=U&&he<U+fe).map(he=>he-U)),re=q(M,w);return{periods:null,back:ft(r,M,q(0,M)),front:T(re),split:O&&re.size===0}},[e.highlight,b,M,w,G,h,r,D,f,m,O]),K=(p,k)=>k==="front"?le.front:le.periods?[le.periods[p]]:le.back,oe=Ft(Oe(r.theme.panel)??[0,0,0,1])<.4?.3:.16,ce=`url(#${s}h)`,xe=p=>x==="all"||x==="front"&&p==="front",it=r.mix("panel","neutralSoft",.5),ba=r.paint("neutral"),st=(p,k)=>{let T=k==="back"?h.depthBack:h.depthFront,j=k==="back"?h.shift:[0,0];return{x:h.slotX(p)+j[0],base:h.floor-j[1],w:h.w,dx:T*h.cx,dy:-T*h.cy}},Le=(p,k)=>k==="back"?h.backTotal[p]:h.frontTotal[p],rn=(p,k)=>k==="back"?h.back[p]:h.front[p],on=(p,k)=>{let T=st(p,k);return T.base-Le(p,k)*h.k+T.dy},lt=v?tl:nl,ya=n.motion.duration??800,an=Math.min(n.motion.stagger??40,600/Math.max(1,D-1)),xa=(0,te.useMemo)(()=>G.flatMap((p,k)=>lt.map(T=>{let j=il(T==="back"?h.back[k]:h.front[k],h.k),H=j.map(()=>0);return{key:`${p.key}|${T}`,to:j,from:H,enter:H,delay:k*an+(T==="front"?120:0),data:{i:k,r:T}}})),[h,G,lt,an]),qn=Ho(xa,n.motion),Qn=new Map;for(let p of qn.items)p.exiting||Qn.set(`${p.data.i}|${p.data.r}`,p);let sn=p=>qn.fade(p*an+ya*.7,260),Se=n.fv,er=p=>et(p*100,{locale:n.locale,maximumFractionDigits:1}),ln=p=>h.backTotal[p]>0?h.frontTotal[p]/h.backTotal[p]:null,$t=p=>{let k=ln(p);return k===null?"":er(k)},tr=(p,k)=>(k==="back"?f:m).map((T,j)=>({name:T,v:rn(p,k)[j],sw:K(p,k)[j]})).reverse(),cn=(p,k)=>tr(p,k).map(T=>`${T.name} ${Se(T.v)}`).join(", "),vt=p=>(p==="back"?M:w)>1,ka=(p,k)=>{let T=vt(k)?[cn(p,k),`${a.sum} ${Se(Le(p,k))}`]:[cn(p,k)];return k==="front"&&R!==!1&&ln(p)!==null&&T.push(a.ofBack($t(p))),`${G[p].label}${v?` ${a.row[k]}`:""}: ${T.join(", ")} (${p+1}/${D})`},ct=h.backTotal.every(p=>p===0)&&h.frontTotal.every(p=>p===0),wa=(0,te.useMemo)(()=>ct?[]:G.map((p,k)=>({datum:p.datum,index:k,key:p.key,label:p.label,series:v?a.row[S]:void 0,value:Le(k,S),formatted:lt.map(T=>a.cell(v?a.row[T]:"",Se(Le(k,T)),vt(T)?cn(k,T):"")).join(", ")})),[h,G,a,S,Se,f,m]),nr=(0,te.useMemo)(()=>({keys:G.map(p=>p.sync),labels:G.map(p=>p.label)}),[G]);yr(n,e.syncId,nr.keys,nr.labels);let ae=n.active!==null&&n.active<D&&!ct?n.active:null,$a=(p,k,T)=>{let j=st(p,"back"),H=(j.w+j.dx)/2,q=j.x+H,re=Math.min(on(p,"back"),on(p,"front")),U=40+k.length*18;if(re-U-14>=2)return{x:q,y:re,title:T,rows:k};let fe=Math.max(112,se(T,11.5,600),...k.map(un=>(un.color?15:0)+se(un.label??"",12)+16+se(un.value,12,700)))+24,he=H+12+fe/2,Na=Math.max(4,Math.min(re,i-U-4));return{x:q+he+fe/2<=o-4?q+he:q-he,y:Na+U+14,title:T,rows:k}},rr=null;if(ae!==null){let p=[];for(let k of lt){let T=k===S;for(let j of tr(ae,k))p.push({label:j.name,value:Se(j.v),color:j.sw.fill,strong:vt(k)?T?void 0:!1:T});vt(k)&&p.push({label:v?a.total[k]:a.sumLabel,value:Se(Le(ae,k)),strong:T})}v&&R!==!1&&p.push({label:a.rate,value:$t(ae)||"-",strong:!1}),rr=$a(ae,p,G[ae].label)}let va=ae!==null&&n.via==="keyboard"?ka(ae,S):void 0,Ve=h.backTotal.indexOf(Math.max(...h.backTotal)),Ce=v?h.frontTotal.indexOf(Math.max(...h.frontTotal)):-1,or=a.kind;if(D){let p=[a.kind,a.desc(M,f.join(", "),G[0].label,G[D-1].label),a.descPeak(G[Ve].label,Se(h.backTotal[Ve]))];v&&p.push(h.frontTotal[Ce]>0?a.descFront(m.join(", "),G[Ce].label,Se(h.frontTotal[Ce]),$t(Ce)):a.descFrontZero(m.join(", "))),W>1&&p.push(a.merged(W)),or=p.join(". ")}let Ma=`${e.description??`${or}.`}${v?` ${a.keys}`:""}`,ar=(0,te.useMemo)(()=>{let p=G.map((k,T)=>ta(h.slotX(T)+h.w/2,k.label,pe,o));return{xs:p,show:lo(p,G.map(k=>k.label),pe,6)}},[h,G,o]),ir=h.floor+_e+20,Mt=I?ir+nn+14:h.floor+_e+12,Ta=(p,k,T)=>{if(ct)return;let j=no(p,h.slotX(0)+h.s*.49,h.slotX(D-1)+h.s*.49,D),H=O?h.depthFront*h.cy+4:6,q=!T&&v&&k>=h.floor-h.frontTotal[j]*h.k-H?"front":"back";q!==l&&u(q),j!==n.active&&n.setActive(j,T?"touch":"pointer")},Tt=h.top-10,ut=h.slotX(0)-8,mt=h.slotX(D-1)+h.w+8,St=h.lead+h.depthBack+8,Sa=Je([[ut,h.floor+_e],[mt,h.floor+_e],[mt+St*h.cx,h.floor+_e-St*h.cy],[ut+St*h.cx,h.floor+_e-St*h.cy]]),Ca=()=>{let p=st(Ve,"back"),k=a.peak(Se(h.backTotal[Ve])),T=Math.min(p.x+(p.w+p.dx)/2,(_?h.wallX[1]:o-2)-se(k,11.5,700)/2);return(0,A.jsx)(Yn,{p:r,x:T,y:on(Ve,"back")-11,opacity:sn(Ve),children:k})},Aa=()=>{let p=R==="label"?$t(Ce):"",k=a.frontPeak(G[Ce].label,Se(h.frontTotal[Ce]),p),T=h.slotX(Ce)+h.w/2;return(0,A.jsxs)("g",{opacity:sn(Ce),children:[(0,A.jsx)("line",{x1:L(T),x2:L(T),y1:L(Mt+8),y2:L(Mt+14),stroke:r.paint("muted")}),(0,A.jsx)(Yn,{p:r,x:ta(T,k,11,o,700),y:Mt+25,size:11,children:k})]})};return(0,A.jsxs)(Br,{c:n,kind:a.kind,ariaLabel:e.ariaLabel,description:Ma,events:wa,tip:rr,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,announce:va,onPointerMove:(p,k,T)=>Ta(p,k,T.pointerType==="touch"),onKey:p=>{let k=al(p.key,v);return k===null?!1:(k!==l&&u(k),ae===null&&!ct&&n.setActive(0,"keyboard"),!0)},defs:x!=="none"?(0,A.jsx)("pattern",{id:`${s}h`,width:4,height:4,patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:(0,A.jsx)("rect",{width:1.6,height:4,fill:r.paint("panel"),fillOpacity:.55})}):void 0,children:[(0,A.jsx)("g",{"aria-hidden":"true",children:E.map((p,k)=>{let{x:T,line:j}=N[k],H=j*ea+9,q=k>=M;return(0,A.jsxs)("g",{children:[p.divider&&T>0?(0,A.jsx)("line",{x1:T-14,x2:T-14,y1:H-7,y2:H+7,stroke:r.paint("line")}):null,(0,A.jsx)("rect",{x:T,y:H-5,width:10,height:10,rx:2,fill:q?le.front[k-M].fill:le.back[k].fill}),xe(q?"front":"back")?(0,A.jsx)("rect",{x:T,y:H-5,width:10,height:10,rx:2,fill:ce}):null,(0,A.jsx)(ze,{x:T+15,y:H,size:11.5,fill:r.paint("muted"),children:p.name})]},k)})}),ct?(0,A.jsx)(ze,{x:o/2,y:(h.top+h.floor)/2,anchor:"middle",size:13,fill:r.paint("muted"),children:a.nothing}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("g",{"aria-hidden":"true",children:[_?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("rect",{x:L(h.wallX[0]),y:L(Tt),width:L(Math.max(0,h.wallX[1]-h.wallX[0])),height:L(Math.max(0,h.wallBase-Tt)),fill:r.paint("line2"),fillOpacity:.6}),h.ticks.map(p=>{let k=h.wallBase-p*h.k;return(0,A.jsxs)("g",{children:[(0,A.jsx)("line",{x1:L(h.wallX[0]),x2:L(h.wallX[1]),y1:L(k),y2:L(k),stroke:r.paint("line")}),(0,A.jsx)(ze,{x:h.wallX[1]+6,y:k,size:pe,fill:r.paint("muted"),children:h.fmt(p)})]},p)})]}):null,(0,A.jsx)("polygon",{points:Sa,fill:r.paint("neutralSoft")}),(0,A.jsx)("rect",{x:L(ut),y:L(h.floor+_e),width:L(Math.max(0,mt-ut)),height:_e,fill:r.paint("line")})]}),G.map((p,k)=>(0,A.jsxs)("g",{className:"ztd-mark",opacity:ae===null||ae===k?1:.38,onClick:()=>n.click(k),style:{cursor:e.onClick?"pointer":void 0},children:[(0,A.jsx)("rect",{x:L(h.slotX(k)),y:L(Tt),width:L(h.s),height:L(Math.max(0,i-Tt)),fill:"transparent"}),lt.map(T=>{let j=Qn.get(`${k}|${T}`);if(!j)return null;let H=st(k,T),q=Le(k,T)*h.k;if(O)return Le(k,T)===0?(0,A.jsx)("polygon",{points:Je([[H.x,H.base],[H.x+H.w,H.base],[H.x+H.w+H.dx,H.base+H.dy],[H.x+H.dx,H.base+H.dy]]),fill:"none",stroke:r.paint("neutralStrong"),strokeOpacity:.7,strokeDasharray:"2 2"},T):(0,A.jsx)(ra,{p:r,g:H,cum:j.v,colors:K(k,T),hatch:xe(T)?ce:null,lid:T==="back"?it:ba,lidSplit:T==="front"&&le.split?{fills:K(k,T).map(re=>re.fill),values:rn(k,T)}:void 0,lidStroke:!0,lidInk:T==="front",lidHatch:T==="front",shade:oe,tile:!0},T);if(q>0&&q<1){let re=rn(k,T),U=re.length-1;for(;U>0&&!(re[U]>0);)U--;return(0,A.jsx)("line",{x1:L(H.x),x2:L(H.x+H.w),y1:L(H.base-.5),y2:L(H.base-.5),stroke:K(k,T)[U].fill},T)}return(0,A.jsx)(ra,{p:r,g:H,cum:j.v,colors:K(k,T),hatch:xe(T)?ce:null,lid:T==="back"?it:r.paint("neutralSoft"),lidStroke:T==="back",shade:oe},T)}),ae===k&&n.via!=="sync"?(0,A.jsx)("polygon",{points:Je(sl(st(k,S),Le(k,S)*h.k)),fill:"none",stroke:r.paint("ink"),strokeWidth:2,strokeLinejoin:"round",pointerEvents:"none"}):null]},p.key)),n.showLabels&&h.backTotal[Ve]>0?Ca():null,I?(0,A.jsx)(ml,{p:r,rates:G.map((p,k)=>ln(k)),x:h.slotX,w:h.w,from:ut,to:mt,top:ir,right:_?h.wallX[1]+6:mt+6,title:a.rate,pct:er,fade:sn}):null,(0,A.jsx)("g",{"aria-hidden":"true",children:ar.show.map(p=>(0,A.jsx)(ze,{x:ar.xs[p],y:Mt,anchor:"middle",size:pe,fill:r.paint(ae===p?"ink":"muted"),weight:ae===p?700:400,children:G[p].label},p))}),B&&h.frontTotal[Ce]>0?Aa():null]})]})}var dl=F(Y(),1);var la=F(V(),1);function aa(e,t){return t===!1?e.map((n,r)=>r):eo(e)}function ia(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return be(e,t,t,r,"max")}function sa(e,t,n){let r=new Array(t.length),o=t.filter(i=>!n.has(i));for(let i of t)n.has(i)&&(r[i]=Q(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?Q(e,"neutral"):_t(e,1-a/Math.max(1,o.length-1))),r}function ca(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Me(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function ua(e,t){return We(e,t+1,new Set)}var fl=F(Y(),1);var da=F(V(),1);var hl=26;var rm=hl*.62;function ma(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Mo.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var Pe=F(V(),1);function fa(e,t,n){let r=Vt(e);return r?.type==="scatter"&&t?.size!==void 0&&!Gt(n)?Vt("bubble"):r}function gl(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 pl(e,t,n,r=!1){let o=fa(e.type,e.encoding,e.options);if(!o||!t.length)return[];let i=e.encoding??{},a=e.options??{},s=a.highlight,l=new Set(!r&&Pn.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),u=c=>c.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(m.includes(o.type)){let c=Fe(i.label,"label"),d=Wt(i.value,"value"),g=o.type==="waffle",f=t.map((x,_)=>({r:x,label:c(x,_),value:g?d(x,_):Jo(d(x,_))})),{kept:b,other:M}=g?{kept:f,other:null}:Yo(f,a.other,(x,_)=>({r:{},label:Uo(J(n),x),value:_})),w=be(s,b.map(x=>x.r),b.map(x=>x.label),b.map(x=>x.value),g?"first":"max"),v=M?[...b,M]:b,S=Ie(x=>g?we(x,v.length,w):Zo(x,v.length,w,a.colorMode)),R=g&&a.shape==="arc";return v.map((x,_)=>({label:x.label,color:S[_],...R&&{shape:"circle"}}))}if(o.type==="candlestick"){let c=Xo(Array.isArray(a.ma)?a.ma:void 0,t.length),d=Ko[J(n)];return[{label:d.up,color:a.upColor??"accent"},{label:d.down,color:a.downColor??"neutralStrong"},...c.map((g,f)=>({label:d.maLegend(g),color:Kn[f],shape:"line"}))]}if(o.type==="network"){let c=ca(a.groups);if(c.length<2)return[];let d=Ie(g=>ua(g,c.length));return c.map((g,f)=>({label:g,color:d[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let c=Fe(i.group,"group"),d=Me(t.map((f,b)=>c(f,b)).filter(Boolean));if(d.length<2)return[];let g=Ie(f=>We(f,d.length,new Set));return d.map((f,b)=>({label:f,color:g[b],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||Gt(a))return[];let c=Fe(i.series,"series"),d=Me(t.map((b,M)=>c(b,M)));if(d.length<2)return[];let g=Wo(s,t,d,c),f=Ie(b=>We(b,d.length,g));return u(d.map((b,M)=>({label:b,color:f[M],shape:"circle"})))}if(o.type==="timeline"){let c=typeof i.group!="string",d=c?i.status:i.group;if(typeof d!="string")return[];let g=Lo(t,d,c),f=Ie(b=>we(b,g.length,ma(s,g)));return u(g.map((b,M)=>({label:b,color:f[M],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let c=[];if(Array.isArray(i.y))c=i.y;else if(typeof i.series=="string"){let S=Fe(i.series,"series");c=Me(t.map((R,x)=>S(R,x)))}let d=Ln(o.type,i,a);if(d.length){let S=be(s,c,c,c.map(()=>0),"none"),R=Ie(_=>we(_,c.length,S)),x=c.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:c.map((_,z)=>({label:_,color:R[z]}));return[...u(x),...d.map((_,z)=>({label:_,color:Vo(z),shape:"line"}))]}if(c.length<2)return[];let f=o.type==="bar"&&a.layout==="diverging"&&s===void 0?Qr(c.length,Array.isArray(a.negative)?a.negative.map(S=>c.indexOf(String(S))):[],typeof a.neutral=="string"?c.indexOf(a.neutral):-1):-1,b=f>=0?new Set([f]):be(s,c,c,c.map(()=>0),"first");if(o.type==="radar")return u(c.map((S,R)=>({label:S,color:b.has(R)?"accent":"neutralStrong",shape:"square"})));let M=a.colorMode,w=S=>we(S,c.length,b);if((o.type==="line"||o.type==="area")&&(w=S=>Go(S,c.length,b,o.type==="area",M)),o.type==="stream"){let S=je(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),R=aa(S.values,a.reorder),x=ia(s,S.series,S.values);w=_=>sa(_,R,x)}let v=Ie(w);return u(c.map((S,R)=>({label:S,color:v[R],...o.type==="line"&&{shape:"line"}})))}return[]}function bl(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Wr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function yl(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:u,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:i,highlight:a,syncId:s,title:l,description:u}}function ha(e,t){let{spec:n}=e,r=fa(n.type,n.encoding,n.options),o=(0,wt.useMemo)(()=>Do(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=Vr(n,e.locale),s=ue(a),l=J(s),u=To(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),m=Ur(n),c=(0,wt.useMemo)(()=>m?_o(m,s):void 0,[m,s]),d=n.options?.hidden,g=Array.isArray(d)?d.map(String):[],f=g.join(""),[b,M]=(0,wt.useState)(null);if(!r)return(0,Pe.jsx)(_n,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let w=o??u.data,v=t[r.type],S={...n.options??{}},R={...gl(r,n.encoding),...S,...c?{tooltip:c}:{},data:w,...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:a},x=n.card?.legend==="toggle"&&Xr(r.type,n.encoding??{},S),_=b&&b.base===f?b.hidden:g;x&&(R.hidden=_);let z=N=>M(C=>{let $=C&&C.base===f?C.hidden:g;return{base:f,hidden:$.includes(N)?$.filter(h=>h!==N):[...$,N]}}),O=R.height??220,I=bl(n,r.type),B=i&&!w.length&&(u.loading||u.error||u.empty)?(0,Pe.jsx)(_n,{loading:u.loading,error:u.error,empty:u.empty,onRetry:u.reload,height:O,locale:a}):I?(0,Pe.jsx)(vo,{chart:v,...yl(r.type,I,R)}):(0,Pe.jsx)(v,{...R});if(n.card){let N=n.card,C=N.legend==="auto"||N.legend==="toggle"?pl(n,w,s,x):N.legend,$=C?.length?x?(0,Pe.jsx)(Fn,{items:C,hidden:_,onToggle:z,locale:a}):C:void 0,h=N.download?(0,Pe.jsx)(Fo,{data:w,columns:Yr(n),filename:N.title??r.type,formats:Array.isArray(N.download)?N.download:void 0,locale:a}):void 0;B=(0,Pe.jsx)(zr,{number:N.number,title:N.title??Gr(r,l),subtitle:N.subtitle,legend:$,actions:h,source:N.source||void 0,note:N.note||void 0,accent:N.accent,takeaway:N.takeaway,level:N.level,sample:N.sample,replay:N.replay!==!1,className:e.className,locale:a,children:B})}let E=e.theme??n.theme;return E&&(B=(0,Pe.jsx)(It,{theme:E,children:B})),B}function xl({cfg:e,components:t}){let n=rt();return ha({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function pa(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,ga.hydrateRoot)(r,(0,Zn.createElement)(It,{theme:o.theme,cssVars:!0},(0,Zn.createElement)(xl,{cfg:o,components:{[e]:t}})))}pa("skyline",Jn);})();
27
+ `}function Is(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Hn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Co=2,Ge=16;function Ao(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,i,a,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${i}, ${a})`:`rgba(${o}, ${i}, ${a}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function Ro(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 No(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:i,height:a}=o.viewBox.baseVal,[s,l]=[i+Ge*2,a+Ge*2],u=o.cloneNode(!0),m=u.querySelectorAll("*"),c=new Map;o.querySelectorAll("*").forEach((f,y)=>{let T;for(let w of Array.from(f.attributes)){if(!Ls.test(w.value))continue;let v=(T??(T=getComputedStyle(f))).getPropertyValue(w.name);v&&m[y].setAttribute(w.name,Ao(v,c))}}),u.removeAttribute("style");for(let[f,y]of Object.entries({viewBox:`${-Ge} ${-Ge} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))u.setAttribute(f,String(y));let d=Ao(getComputedStyle(r).backgroundColor,c),g=o.parentElement?.querySelector("canvas")??null;if(n){let f=u.querySelector("desc")?.nextSibling??u.firstChild;u.insertBefore(Ro("rect",{x:-Ge,y:-Ge,width:s,height:l,fill:d}),f),g&&u.insertBefore(Ro("image",{href:g.toDataURL(),width:i,height:a}),f)}return{svg:new XMLSerializer().serializeToString(u),w:s,h:l,vw:i,vh:a,bg:d,canvas:g}}function zs(e,t){let n=No(e,Co,!1);if(!n)return;let r=Co,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let i=o.getContext("2d");if(!i)return;i.fillStyle=n.bg,i.fillRect(0,0,o.width,o.height),n.canvas&&i.drawImage(n.canvas,Ge*r,Ge*r,n.vw*r,n.vh*r);let a=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{i.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(a),o.toBlob(l=>l&&Hn(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(a),s.src=a}function Fo(e){let t=ve(e.theme),n=J(ue(e.locale))==="ko",r=Is(e.filename),o=(i,a)=>{if(i==="csv")return Hn(new Blob([Os(e.data,e.columns?.length?e.columns:Es(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(i==="png")return zs(a,r);let s=No(a,1,!0);s&&Hn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,jn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:Ps.filter(i=>!e.formats||e.formats.includes(i)).map(i=>{let a=i.toUpperCase(),s=n?`${a} 내려받기`:`Download ${a}`;return(0,jn.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(i,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:a},i)})})}var Po=F(V(),1);function _o(e,t=ie){let n=Ke(void 0,t),r=e.split(`
28
+ `),o=(i,a)=>{if(a==="label")return i.label;if(a==="value")return i.formatted??(i.value===null?null:n(i.value));if(a==="series")return i.series??null;let s=i.datum&&typeof i.datum=="object"?i.datum[a]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?gt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,u=s.replace(Pr,(m,c)=>o(i,c.trim())??(l=!0,""));l||a.push(u)}return a.length?a.map((s,l)=>(0,Po.jsx)("div",{children:s},l)):null}}function Do(e,t,n=!1){let r=Fe(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=Te(o);if(!n)return i;let a=new Map;for(let s of o)a.set(s,(a.get(s)??0)+1);return i.map((s,l)=>[s,l]).sort((s,l)=>a.get(s[0])-a.get(l[0])||s[1]-l[1]).map(([s])=>s)}function Lo(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 Ue(t.csv)}return null}var jo=F(Y(),1);var ee=F(Y(),1);function Eo(e,t){let n=ve(e.theme),[r,o,i]=Zt(e.width),a=rt(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,u=e.height??l,m=qt(e.reducedMotion??"auto"),c=e.animate!==!1&&!m&&ke,d=$o(r,e.animateOnView!==!1&&c),g=ue(e.locale),f=J(g),y=(0,ee.useMemo)(()=>Ke(e.format,g,t.format),[e.format,g,t.format]),T=(0,ee.useCallback)(K=>et(K,{locale:g}),[g]),w=(0,ee.useMemo)(()=>Dt(y,e.unit),[y,e.unit]),v=(0,ee.useMemo)(()=>Kt(e.data),[e.data]),[S,N]=(0,ee.useState)(null),[x,_]=(0,ee.useState)(null),z=(0,ee.useRef)([]),O=(0,ee.useRef)(e.onHover);O.current=e.onHover;let I=(0,ee.useRef)(e.onClick);I.current=e.onClick;let B=(0,ee.useRef)(null),E=(0,ee.useRef)(null),R=(0,ee.useRef)(null),C=(0,ee.useCallback)((K,oe="pointer")=>{if(R.current!==K){R.current=K;let ce=K===null?null:z.current[K]??null;queueMicrotask(()=>O.current?.(ce)),E.current?.(K)}B.current=K===null?null:oe,N(K),_(B.current)},[]),$=(0,ee.useCallback)(K=>{B.current!=="keyboard"&&(B.current=K===null?null:"sync",N(K),_(B.current))},[]),h=(0,ee.useCallback)(K=>{let oe=z.current[K];oe&&I.current?.(oe)},[]),L=Ir(e.replayKey),W=e.width!==void 0||(i??0)>0,G={enabled:c,active:d.visible&&W,near:d.near,replayKey:L,dataKey:v,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},le=(0,ee.useCallback)((K,oe=1)=>S===null||S===K?oe:oe*.38,[S]);return{p:n,width:s,height:u,measured:W,responsive:e.width===void 0,pending:ke&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:G,fv:w,fmt:y,pct:T,locale:g,lang:f,t:f==="ko"?kr:xr,active:S,via:x,setActive:C,click:h,events:z,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:le,sig:v,description:e.description,reduced:m,publish:E,applySync:$}}var Z=F(Y(),1);function Bs(e){return 1-Math.pow(1-e,3)}function Hs(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function js(e){return e==="easeInOut"?Hs:e==="linear"?t=>t:Bs}function Gs(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 at(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),i=Math.floor(o),a=Math.min(e.length-1,i+1);n[r]=e[i]+(e[a]-e[i])*(o-i)}return n}function Qt(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 Oo(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 Io(e,t,n,r){if(!t||!n||t.length!==n.length)return at(e,r);let o=[],i=0;for(let a=0;a<n.length;a++){let s=e.slice(i,i+t[a]);i+=t[a];for(let l of at(s,n[a]))o.push(l)}return o.length===r?o:at(e,r)}var en=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||!Qt(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 i=t.from??t.to,a=t.enter??i;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:i.slice(),enter:a.slice(),exit:(t.exit??a).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),i=this.make(r,r.to,0,0);o&&(i.order=o.order),i.done=!0,i.progress=1,n.set(r.key,i)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let i=this.tracks.get(o.key),a=this.make(o,o.from??o.to,1/0,o.delay??0);i&&(a.order=i.order),r=Math.max(r,o.delay??0),n.set(o.key,a)}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),Oo(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=Qt(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,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let u=a.to.length;s.from=Io(s.cur,s.parts,a.parts,u),s.vel=Io(s.curVel,s.parts,a.parts,u),s.parts=a.parts,s.to=a.to.slice(),Oo(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(a.from??a.to).slice(),s.enter=(a.enter??s.appear).slice(),s.exit=(a.exit??s.enter).slice(),s.data=a.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=Qt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let u=this.make(a,a.enter??a.from??a.to,n+l,0);u.done=Qt(u.from,u.to),this.tracks.set(a.key,u)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=at(a.exit,a.cur.length),a.t0=n,a.exiting=!0,a.done=!1,a.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=js(this.easing),o=this.duration/1e3,i=this.omega,a=[];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=at(s.from,u)),s.vel.length!==u&&(s.vel=at(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 m;if(this.easing==="spring"){let c=Math.exp(-i*l),d=i*l>=8&&i*l<20,g=0;for(let f=0;f<u;f++){let y=s.from[f]-s.to[f],T=s.vel[f]+i*y;s.cur[f]=s.to[f]+(y+T*l)*c,s.curVel[f]=(s.vel[f]-i*T*l)*c,d&&g<.15&&(g=Math.max(g,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/i)))}m=i*l>=20||d&&g<.15,s.progress=Math.min(1,1-(1+i*l)*c)}else{let c=Math.min(1,l/o),d=r(c),g=Gs(this.easing,c)/o;for(let f=0;f<u;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*g;m=c>=1,s.progress=d}if(m){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&&a.push(s.key)}else n=!0}for(let s of a)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}},kt=new Set,tn=0;function zo(e){tn=0;let t=Array.from(kt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||kt.delete(n)}kt.size&&typeof requestAnimationFrame<"u"&&(tn=requestAnimationFrame(zo))}function Bo(e){return kt.add(e),!tn&&typeof requestAnimationFrame<"u"&&(tn=requestAnimationFrame(zo)),()=>{kt.delete(e)}}function Vs(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 Ho(e,t){let n=(0,Z.useMemo)(()=>Vs(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:u=900,stagger:m=0}=t,c=(0,Z.useRef)(null),d=(0,Z.useRef)("init"),g=(0,Z.useRef)(null),f=(0,Z.useRef)(s),y=(0,Z.useRef)(a),T=(0,Z.useRef)(!1),w=(0,Z.useRef)(0),[,v]=(0,Z.useState)(0),S=(0,Z.useRef)(null),N=(0,Z.useRef)(!0);c.current||(c.current=new en,c.current.configure(l,u),c.current.snap(n),g.current=n);let x=c.current;if(x.configure(l,u),g.current!==n){let E=d.current,R=!Object.is(f.current,s);x.sameTargets(n)?x.refreshData(n):!r||E==="init"?x.snap(n):E==="idle"?x.hold(n):E==="running"||R?x.update(n,Rt(),m):x.snap(n),g.current=n,f.current=s}let _=(0,Z.useRef)(()=>!1);_.current=E=>{if(!N.current)return!1;let R=x.step(E);return!R&&d.current==="running"&&(d.current="done"),v(C=>(C+1)%1e9),R||(S.current=null),R};let z=(0,Z.useCallback)(()=>{if(!ke||S.current||!x.animating)return;let E=R=>_.current(R);S.current=Bo(E)},[x]);Ae(()=>{let E=!Object.is(y.current,a);if(y.current=a,!r){(d.current!=="done"||x.animating)&&(x.snap(g.current??n),d.current="done",v(R=>R+1));return}d.current==="init"||E&&i?(x.hold(g.current??n),d.current="idle",T.current=!1,v(R=>R+1)):E&&(T.current=!0)},[r,a]),Ae(()=>{!r||!i||!T.current||(T.current=!1,x.hold(g.current??n),d.current="idle",v(E=>E+1))},[i,r]),(0,Z.useEffect)(()=>{r&&o&&d.current==="idle"&&(x.start(Rt()),w.current+=1,d.current="running",z(),v(E=>E+1))},[r,o,a,x,z]),(0,Z.useEffect)(()=>{x.animating&&z()}),(0,Z.useEffect)(()=>(N.current=!0,()=>{N.current=!1,S.current?.(),S.current=null}),[]);let O=Rt(),I=x.elapsed(O),B=r&&d.current==="idle";return{items:x.items(),get:E=>x.get(E),elapsed:B?0:I,fade:(E,R=320)=>B?0:Number.isFinite(I)?Math.max(0,Math.min(1,(I-E)/R)):1,waiting:B,animating:x.animating,generation:w.current}}var Gn=F(V(),1);function Go(e,t,n,r,o){if(r)return o==="categorical"?we(e,t,n):ft(e,t,n);if(o==="categorical")return we(e,t,n);let i=Q(e,"strong"),a=Q(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var Ws=F(Y(),1);var Vn=F(V(),1);var Vo=e=>e?"neutralStrong":"accent";var Wn=F(V(),1);function Wo(e,t,n,r){if(typeof e!="function")return be(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((a,s)=>[a,s])),i=new Set;return t.forEach((a,s)=>{let l=o.get(r(a,s));l!==void 0&&e(a,s)&&i.add(l)}),i}var Ks=F(Y(),1);var Xn=F(V(),1),Xs={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}, ${Ee(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Ko={en:Xs,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}일 이동평균`}},Kn=["ink","muted","dim"];function Xo(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,Kn.length)}var Us=F(Y(),1);var qo=F(V(),1),Ys={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ee(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Js={en:Ys,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Uo=(e,t)=>Js[e].other(t);function Yo(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((i,a)=>({v:i.value,i:a})).sort((i,a)=>a.v-i.v).slice(0,Math.floor(t)).map(i=>i.i)),o=e.filter((i,a)=>!r.has(a));return{kept:e.filter((i,a)=>r.has(a)),other:n(o.length,to(o.map(i=>i.value)))}}var Jo=e=>Number.isFinite(e)&&e>0?e:0;function Zo(e,t,n,r){return r==="emphasis"?Pt(e,t,n):we(e,t,n)}var te=F(Y(),1);var A=F(V(),1),Zs={kind:"Skyline",row:{back:"back",front:"front"},total:{back:"Back total",front:"Front total"},sum:"total",sumLabel:"Total",rate:"Front ÷ back",peak:e=>`Peak ${e}`,frontPeak:(e,t,n)=>`Front peak ${e} · ${t}${n?` (${n})`:""}`,range:(e,t)=>`${e}–${t}`,nothing:"Nothing to draw",ofBack:e=>`${e} of the back row`,cell:(e,t,n)=>`${e?`${e} `:""}${t}${n?` (${n})`:""}`,desc:(e,t,n,r)=>`${Ee(e,"series","series")} (${t}) stacked from ${n} to ${r}`,descPeak:(e,t)=>`Peak period ${e} at ${t}`,descFront:(e,t,n,r)=>`Front row (${e}) peaks at ${t} with ${n}${r?`, ${r} of the back row`:""}`,descFrontZero:e=>`The front row (${e}) is all zero`,merged:e=>`Neighboring periods are summed in groups of ${e}`,keys:"Use left and right arrows for periods, up and down to switch rows."},qs={en:Zs,ko:{kind:"스카이라인",row:{back:"뒷줄",front:"앞줄"},total:{back:"뒷줄 합계",front:"앞줄 합계"},sum:"합계",sumLabel:"합계",rate:"앞줄 ÷ 뒷줄",peak:e=>`최고 ${e}`,frontPeak:(e,t,n)=>`앞줄 최고 ${e} · ${t}${n?` (${n})`:""}`,range:(e,t)=>`${e}~${t}`,nothing:"그릴 값이 없어요",ofBack:e=>`뒷줄의 ${e}`,cell:(e,t,n)=>`${e?`${e} `:""}${t}${n?`(${n})`:""}`,desc:(e,t,n,r)=>`계열 ${e}개(${t})를 ${n}부터 ${r}까지 쌓았어요`,descPeak:(e,t)=>`가장 많은 기간 ${e} ${t}`,descFront:(e,t,n,r)=>`앞줄(${e})이 가장 많은 기간 ${t} ${n}${r?`, 뒷줄의 ${r}`:""}`,descFrontZero:e=>`앞줄(${e})은 모두 0이에요`,merged:e=>`이웃 기간을 ${e}개씩 합쳤어요`,keys:"←→로 기간을, ↑↓로 앞줄과 뒷줄을 옮겨요."}},Qs={low:{cx:.8944271909999159,cy:.4472135954999579,face:.52,front:.14,gap:.05,depth:[.1,.32,.32]},high:{cx:.4472135954999579,cy:.8944271909999159,face:.54,front:.42,gap:.1,depth:[.1,.45,.42]}};var el=20,tl=40,nl=.4,Qo=14,Un=10,rl=20,_e=4,nn=26,ea=18,ol=["back","front"],al=["back"],D=e=>Math.round(e*10)/10,Je=e=>e.map(([t,n])=>`${D(t)},${D(n)}`).join(" "),Ye=e=>e.reduce((t,n)=>t+n,0),ta=(e,t,n,r,o=400)=>{let i=se(t,n,o)/2;return Math.max(i+2,Math.min(r-i-2,e))};function il(e,t){for(let n=1;n<t;n++){let r=Math.ceil(t/n);if(r<=tl&&e/(r+.55)>=el)return n}return Math.max(1,t)}function oa(e,t,n){let r=t-n*(Math.ceil(t/n)-1);return e===0?[0,r]:[r+(e-1)*n,r+e*n]}function na(e,t,n){return Array.from({length:Math.ceil(t/n)},(r,o)=>{let[i,a]=oa(o,t,n);return e.map(s=>Ye(s.slice(i,a).map(l=>Number.isFinite(l)&&l>0?l:0)))})}function sl(e){let t=Qs[e.view??"high"],n=e.view==="low"||e.front.length?t.front:0,r=Math.min(t.depth[1],Math.max(t.depth[0],e.depth??t.depth[2])),o=I=>e.width-Un-(e.wall?I+14:8),i=0,a=0,s=[],l=[],u=[0,1];for(let I=0;I<3;I++){let B=il(o(a),e.n);if(B===i)break;i=B,s=na(e.back,e.n,i),l=na(e.front,e.n,i),u=He(0,Math.max(0,...s.map(Ye),...l.map(Ye)),4);let E=e.tickFmt(u[1]);a=e.wall?Math.max(...pt(u[0],u[1],4).map(R=>se(E(R),pe))):0}let m=s.length,c=Math.max(1,o(a)/(m+.55)),d=t.face*c,g=e.height-e.below,f=e.legendH+rl,y=(n+t.gap+r)*c*t.cy,T=e.view==="low"?1:Math.min(1,nl*Math.max(0,g-f)/(y||1)),w=(n+t.gap)*c*T,v=w+r*c*T,S=g-v*t.cy,N=Math.max(0,S-f)/(u[1]||1),x=pt(u[0],u[1],4),_=x.length>1?(x[1]-x[0])*N:1/0,z=_>=Qo?1:_>0?Math.ceil(Qo/_):x.length,O=I=>Un+I*c;return{merge:i,shown:m,back:s,front:l,backTotal:s.map(Ye),frontTotal:l.map(Ye),ticks:x.filter((I,B)=>B%z===0),fmt:e.tickFmt(u[1]),k:N,s:c,w:d,floor:g,wallBase:S,top:f,cx:t.cx,cy:t.cy,lead:w,shift:[w*t.cx,w*t.cy],depthFront:n*c*T,depthBack:r*c*T,wallX:[Un+v*t.cx-6,O(m-1)+d+v*t.cx+6],slotX:O}}function ll(e,t){return t?e==="ArrowUp"?"back":e==="ArrowDown"?"front":null:null}function cl(e,t){let n=0;return e.map(r=>n+=r*t)}function ul(e,t){let{dx:n,dy:r}=e,o=e.base-t;return[[e.x,o],[e.x+n,o+r],[e.x+e.w+n,o+r],[e.x+e.w+n,e.base+r],[e.x+e.w,e.base],[e.x,e.base]]}function ml(e,t){return Array.from({length:t},(n,r)=>{let o=r%2===0?"accent2":"accent3",i=Math.max(.4,1-.3*Math.floor(r/2)),a=i===1?e.theme[o]:Qe(e.theme[o],e.theme.ink,i);return{role:"mix",fill:i===1?e.paint(o):e.mix(o,"ink",i),text:wn(e,a),raw:a}})}function dl(e,t,n){if(!n)return null;let r=s=>s>0?s:0,o=n.values.reduce((s,l)=>s+r(l),0);if(!(o>0))return null;let i=[],a=0;return n.values.forEach((s,l)=>{let u=e.x+e.w*a/o;a+=r(s);let m=e.x+e.w*a/o;m>u&&i.push((0,A.jsx)("polygon",{points:Je([[u,t],[m,t],[m+e.dx,t+e.dy],[u+e.dx,t+e.dy]]),fill:n.fills[l]??"none"},`l${l}`))}),i}function ra(e){let{p:t,g:n,cum:r,colors:o,hatch:i}=e,{dx:a,dy:s}=n,l=n.x+n.w,u=(v,S)=>Je([[l,v],[l+a,v+s],[l+a,S+s],[l,S]]),m=r[r.length-1]??0,c=n.base-m,d=[],g=[],f=0;if(r.forEach((v,S)=>{let N=n.base-f,x=n.base-v;v>f&&(d.push((0,A.jsx)("rect",{x:D(n.x),y:D(x),width:D(n.w),height:D(v-f),fill:o[S].fill},`f${S}`)),d.push((0,A.jsx)("polygon",{points:u(x,N),fill:o[S].fill},`s${S}`)),f>0&&g.push((0,A.jsx)("polyline",{points:Je([[n.x,N],[l,N],[l+a,N+s]]),fill:"none",stroke:t.paint("panel"),strokeWidth:1.2},`g${S}`))),f=v}),m<1&&!e.tile)return(0,A.jsx)("g",{children:d});let y=u(c,n.base),T=Je([[n.x,c],[l,c],[l+a,c+s],[n.x+a,c+s]]),w=dl(n,c,e.lidSplit);return(0,A.jsxs)("g",{children:[d,m>=1?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("polygon",{points:y,fill:"#000",fillOpacity:e.shade}),i?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("rect",{x:D(n.x),y:D(c),width:D(n.w),height:D(m),fill:i}),(0,A.jsx)("polygon",{points:y,fill:i})]}):null,g,(0,A.jsx)("line",{x1:D(l),x2:D(l),y1:D(c),y2:D(n.base),stroke:t.paint("panel"),strokeOpacity:.7})]}):null,w,(0,A.jsx)("polygon",{points:T,fill:w?"none":e.lid,stroke:e.lidStroke?t.paint(e.lidInk?"ink":"neutralStrong"):void 0,strokeOpacity:e.lidStroke?e.lidInk?.4:.55:void 0,strokeLinejoin:"round"}),e.lidHatch&&i?(0,A.jsx)("polygon",{points:T,fill:i}):null]})}function Yn(e){let{p:t}=e;return(0,A.jsx)("text",{x:D(e.x),y:D(e.y),dy:"0.35em",fontSize:e.size??11.5,fill:t.paint("ink"),textAnchor:"middle",fontWeight:700,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),stroke:t.paint("panel"),strokeWidth:4,strokeLinejoin:"round",paintOrder:"stroke",style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}function fl(e,t){let n=[],r=0,o=0;for(let i of e){let a=15+se(i.name,11.5);if(r>0){let s=i.divider?28:14;r+s+a>t?(r=0,o++):r+=s}n.push({x:r,line:o}),r+=a}return n}function hl(e){let{p:t,rates:n}=e,r=Math.max(0,...n.map(s=>s??0)),o=uo(0,r,2)[1],i=r>0?n.indexOf(r):-1,a=e.top+nn;return(0,A.jsxs)("g",{"aria-hidden":"true",children:[(0,A.jsx)(ze,{x:e.from,y:e.top-8,size:11,fill:t.paint("muted"),children:e.title}),(0,A.jsx)("line",{x1:D(e.from),x2:D(e.to),y1:D(e.top),y2:D(e.top),stroke:t.paint("line2")}),(0,A.jsx)("line",{x1:D(e.from),x2:D(e.to),y1:D(a),y2:D(a),stroke:t.paint("line")}),n.map((s,l)=>{if(s===null||s<=0)return null;let u=s/o*nn;return(0,A.jsx)("rect",{x:D(e.x(l)),y:D(a-u),width:D(e.w),height:D(u),rx:Math.min(1.5,u/2),fill:t.paint(l===i?"accent":"neutralStrong")},l)}),(0,A.jsx)(ze,{x:e.right,y:a,size:pe,fill:t.paint("muted"),children:"0"}),(0,A.jsx)(ze,{x:e.right,y:e.top,size:pe,fill:t.paint("muted"),children:e.pct(o)}),i>=0?(0,A.jsx)(Yn,{p:t,x:e.x(i)+e.w/2,y:a-r/o*nn-8,size:11,opacity:e.fade(i),children:e.pct(r)}):null]})}function Jn(e){let t=e.frontRate==="strip"&&e.front!==void 0,n=Eo(e,{height:p=>Math.max(300,Math.min(440,p*.58))+(t?40:0),duration:800,stagger:40}),{p:r,width:o,height:i}=n,a=qs[n.lang],s=(0,te.useId)().replace(/:/g,""),[l,u]=(0,te.useState)("back"),m=(0,te.useMemo)(()=>e.front===void 0?[]:Array.isArray(e.front)?e.front:[e.front],[e.front]),c=(0,te.useMemo)(()=>je(e.data,e.x,e.y,e.series,{locale:n.locale,dayFirst:e.dayFirst}),[e.data,e.x,e.y,e.series,n.locale,e.dayFirst]),d=(0,te.useMemo)(()=>m.length?je(e.data,e.x,m,void 0,{locale:n.locale,xType:c.type,dayFirst:e.dayFirst}).values:[],[e.data,e.x,m,n.locale,c,e.dayFirst]),g=typeof e.y=="string"?e.y:n.t.value,f=(0,te.useMemo)(()=>c.series.map(p=>p||g),[c,g]),y=(0,te.useMemo)(()=>[...f,...m],[f,m]),T=f.length,w=m.length,v=w>0,S=v?l:"back",N=e.frontRate??"label",x=e.texture??"front",_=e.wall!==!1,z=e.view??"high",O=z==="high",I=t&&v,B=v&&!t&&n.showLabels,E=(0,te.useMemo)(()=>T>1||v?y.map((p,k)=>({name:p,divider:k===T&&T>0})):[],[y,T,v]),R=(0,te.useMemo)(()=>fl(E,o),[E,o]),C=R.length?(R[R.length-1].line+1)*ea+6:0,$=_e+(I?70:B?48:22),h=(0,te.useMemo)(()=>sl({width:o,height:i,back:c.values,front:d,n:c.keys.length,depth:e.depth,wall:_,view:z,legendH:C,below:$,tickFmt:p=>Lt(e.format,n.locale,p)}),[o,i,c,d,e.depth,_,z,C,$,e.format,n.locale]),{shown:L,merge:W}=h,G=(0,te.useMemo)(()=>{let p=c.keys.length;return Array.from({length:L},(k,M)=>{let[j,H]=oa(M,p,W),q=H-1,re=j===q;return{label:re?c.labels[j]:a.range(c.labels[j],c.labels[q]),key:re?c.keys[j]:`${c.keys[j]}~${c.keys[q]}`,sync:go(c.keys[j]),datum:re?c.rows[0]?.[j]??null:null}})},[L,W,c,a]),le=(0,te.useMemo)(()=>{let p=e.highlight,k=typeof p=="string"?y.includes(p):Array.isArray(p)&&p.some(U=>typeof U=="string"&&y.includes(U)),M=U=>O?U.size?We(r,w,U):ml(r,w):ft(r,w,U);if(T===1&&!k){let U=be(p,G.map(fe=>fe.datum),G.map(fe=>fe.label),h.backTotal,"max");return{periods:Pt(r,L,U),back:[Q(r,"neutral")],front:M(new Set),split:O}}let j=[...f.map((U,fe)=>Ye(h.back.map(he=>he[fe]))),...m.map((U,fe)=>Ye(h.front.map(he=>he[fe])))],H=be(typeof p=="function"?void 0:p,y,y,j,"first"),q=(U,fe)=>new Set([...H].filter(he=>he>=U&&he<U+fe).map(he=>he-U)),re=q(T,w);return{periods:null,back:ft(r,T,q(0,T)),front:M(re),split:O&&re.size===0}},[e.highlight,y,T,w,G,h,r,L,f,m,O]),K=(p,k)=>k==="front"?le.front:le.periods?[le.periods[p]]:le.back,oe=Ft(Oe(r.theme.panel)??[0,0,0,1])<.4?.3:.16,ce=`url(#${s}h)`,xe=p=>x==="all"||x==="front"&&p==="front",it=r.mix("panel","neutralSoft",.5),ba=r.paint("neutral"),st=(p,k)=>{let M=k==="back"?h.depthBack:h.depthFront,j=k==="back"?h.shift:[0,0];return{x:h.slotX(p)+j[0],base:h.floor-j[1],w:h.w,dx:M*h.cx,dy:-M*h.cy}},De=(p,k)=>k==="back"?h.backTotal[p]:h.frontTotal[p],rn=(p,k)=>k==="back"?h.back[p]:h.front[p],on=(p,k)=>{let M=st(p,k);return M.base-De(p,k)*h.k+M.dy},lt=v?ol:al,ya=n.motion.duration??800,an=Math.min(n.motion.stagger??40,600/Math.max(1,L-1)),xa=(0,te.useMemo)(()=>G.flatMap((p,k)=>lt.map(M=>{let j=cl(M==="back"?h.back[k]:h.front[k],h.k),H=j.map(()=>0);return{key:`${p.key}|${M}`,to:j,from:H,enter:H,delay:k*an+(M==="front"?120:0),data:{i:k,r:M}}})),[h,G,lt,an]),qn=Ho(xa,n.motion),Qn=new Map;for(let p of qn.items)p.exiting||Qn.set(`${p.data.i}|${p.data.r}`,p);let sn=p=>qn.fade(p*an+ya*.7,260),Se=n.fv,er=p=>et(p*100,{locale:n.locale,maximumFractionDigits:1}),ln=p=>h.backTotal[p]>0?h.frontTotal[p]/h.backTotal[p]:null,$t=p=>{let k=ln(p);return k===null?"":er(k)},tr=(p,k)=>(k==="back"?f:m).map((M,j)=>({name:M,v:rn(p,k)[j],sw:K(p,k)[j]})).reverse(),cn=(p,k)=>tr(p,k).map(M=>`${M.name} ${Se(M.v)}`).join(", "),vt=p=>(p==="back"?T:w)>1,ka=(p,k)=>{let M=vt(k)?[cn(p,k),`${a.sum} ${Se(De(p,k))}`]:[cn(p,k)];return k==="front"&&N!==!1&&ln(p)!==null&&M.push(a.ofBack($t(p))),`${G[p].label}${v?` ${a.row[k]}`:""}: ${M.join(", ")} (${p+1}/${L})`},ct=h.backTotal.every(p=>p===0)&&h.frontTotal.every(p=>p===0),wa=(0,te.useMemo)(()=>ct?[]:G.map((p,k)=>({datum:p.datum,index:k,key:p.key,label:p.label,series:v?a.row[S]:void 0,value:De(k,S),formatted:lt.map(M=>a.cell(v?a.row[M]:"",Se(De(k,M)),vt(M)?cn(k,M):"")).join(", ")})),[h,G,a,S,Se,f,m]),nr=(0,te.useMemo)(()=>({keys:G.map(p=>p.sync),labels:G.map(p=>p.label)}),[G]);yr(n,e.syncId,nr.keys,nr.labels);let ae=n.active!==null&&n.active<L&&!ct?n.active:null,$a=(p,k,M)=>{let j=st(p,"back"),H=(j.w+j.dx)/2,q=j.x+H,re=Math.min(on(p,"back"),on(p,"front")),U=40+k.length*18;if(re-U-14>=2)return{x:q,y:re,title:M,rows:k};let fe=Math.max(112,se(M,11.5,600),...k.map(un=>(un.color?15:0)+se(un.label??"",12)+16+se(un.value,12,700)))+24,he=H+12+fe/2,Ra=Math.max(4,Math.min(re,i-U-4));return{x:q+he+fe/2<=o-4?q+he:q-he,y:Ra+U+14,title:M,rows:k}},rr=null;if(ae!==null){let p=[];for(let k of lt){let M=k===S;for(let j of tr(ae,k))p.push({label:j.name,value:Se(j.v),color:j.sw.fill,strong:vt(k)?M?void 0:!1:M});vt(k)&&p.push({label:v?a.total[k]:a.sumLabel,value:Se(De(ae,k)),strong:M})}v&&N!==!1&&p.push({label:a.rate,value:$t(ae)||"-",strong:!1}),rr=$a(ae,p,G[ae].label)}let va=ae!==null&&n.via==="keyboard"?ka(ae,S):void 0,Ve=h.backTotal.indexOf(Math.max(...h.backTotal)),Ce=v?h.frontTotal.indexOf(Math.max(...h.frontTotal)):-1,or=a.kind;if(L){let p=[a.kind,a.desc(T,f.join(", "),G[0].label,G[L-1].label),a.descPeak(G[Ve].label,Se(h.backTotal[Ve]))];v&&p.push(h.frontTotal[Ce]>0?a.descFront(m.join(", "),G[Ce].label,Se(h.frontTotal[Ce]),$t(Ce)):a.descFrontZero(m.join(", "))),W>1&&p.push(a.merged(W)),or=p.join(". ")}let Ta=`${e.description??`${or}.`}${v?` ${a.keys}`:""}`,ar=(0,te.useMemo)(()=>{let p=G.map((k,M)=>ta(h.slotX(M)+h.w/2,k.label,pe,o));return{xs:p,show:lo(p,G.map(k=>k.label),pe,6)}},[h,G,o]),ir=h.floor+_e+20,Tt=I?ir+nn+14:h.floor+_e+12,Ma=(p,k,M)=>{if(ct)return;let j=no(p,h.slotX(0)+h.s*.49,h.slotX(L-1)+h.s*.49,L),H=O?h.depthFront*h.cy+4:6,q=!M&&v&&k>=h.floor-h.frontTotal[j]*h.k-H?"front":"back";q!==l&&u(q),j!==n.active&&n.setActive(j,M?"touch":"pointer")},Mt=h.top-10,ut=h.slotX(0)-8,mt=h.slotX(L-1)+h.w+8,St=h.lead+h.depthBack+8,Sa=Je([[ut,h.floor+_e],[mt,h.floor+_e],[mt+St*h.cx,h.floor+_e-St*h.cy],[ut+St*h.cx,h.floor+_e-St*h.cy]]),Ca=()=>{let p=st(Ve,"back"),k=a.peak(Se(h.backTotal[Ve])),M=Math.min(p.x+(p.w+p.dx)/2,(_?h.wallX[1]:o-2)-se(k,11.5,700)/2);return(0,A.jsx)(Yn,{p:r,x:M,y:on(Ve,"back")-11,opacity:sn(Ve),children:k})},Aa=()=>{let p=N==="label"?$t(Ce):"",k=a.frontPeak(G[Ce].label,Se(h.frontTotal[Ce]),p),M=h.slotX(Ce)+h.w/2;return(0,A.jsxs)("g",{opacity:sn(Ce),children:[(0,A.jsx)("line",{x1:D(M),x2:D(M),y1:D(Tt+8),y2:D(Tt+14),stroke:r.paint("muted")}),(0,A.jsx)(Yn,{p:r,x:ta(M,k,11,o,700),y:Tt+25,size:11,children:k})]})};return(0,A.jsxs)(Br,{c:n,kind:a.kind,ariaLabel:e.ariaLabel,description:Ta,events:wa,tip:rr,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,announce:va,onPointerMove:(p,k,M)=>Ma(p,k,M.pointerType==="touch"),onKey:p=>{let k=ll(p.key,v);return k===null?!1:(k!==l&&u(k),ae===null&&!ct&&n.setActive(0,"keyboard"),!0)},defs:x!=="none"?(0,A.jsx)("pattern",{id:`${s}h`,width:4,height:4,patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:(0,A.jsx)("rect",{width:1.6,height:4,fill:r.paint("panel"),fillOpacity:.55})}):void 0,children:[(0,A.jsx)("g",{"aria-hidden":"true",children:E.map((p,k)=>{let{x:M,line:j}=R[k],H=j*ea+9,q=k>=T;return(0,A.jsxs)("g",{children:[p.divider&&M>0?(0,A.jsx)("line",{x1:M-14,x2:M-14,y1:H-7,y2:H+7,stroke:r.paint("line")}):null,(0,A.jsx)("rect",{x:M,y:H-5,width:10,height:10,rx:2,fill:q?le.front[k-T].fill:le.back[k].fill}),xe(q?"front":"back")?(0,A.jsx)("rect",{x:M,y:H-5,width:10,height:10,rx:2,fill:ce}):null,(0,A.jsx)(ze,{x:M+15,y:H,size:11.5,fill:r.paint("muted"),children:p.name})]},k)})}),ct?(0,A.jsx)(ze,{x:o/2,y:(h.top+h.floor)/2,anchor:"middle",size:13,fill:r.paint("muted"),children:a.nothing}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)("g",{"aria-hidden":"true",children:[_?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("rect",{x:D(h.wallX[0]),y:D(Mt),width:D(Math.max(0,h.wallX[1]-h.wallX[0])),height:D(Math.max(0,h.wallBase-Mt)),fill:r.paint("line2"),fillOpacity:.6}),h.ticks.map(p=>{let k=h.wallBase-p*h.k;return(0,A.jsxs)("g",{children:[(0,A.jsx)("line",{x1:D(h.wallX[0]),x2:D(h.wallX[1]),y1:D(k),y2:D(k),stroke:r.paint("line")}),(0,A.jsx)(ze,{x:h.wallX[1]+6,y:k,size:pe,fill:r.paint("muted"),children:h.fmt(p)})]},p)})]}):null,(0,A.jsx)("polygon",{points:Sa,fill:r.paint("neutralSoft")}),(0,A.jsx)("rect",{x:D(ut),y:D(h.floor+_e),width:D(Math.max(0,mt-ut)),height:_e,fill:r.paint("line")})]}),G.map((p,k)=>(0,A.jsxs)("g",{className:"ztd-mark",opacity:ae===null||ae===k?1:.38,onClick:()=>n.click(k),style:{cursor:e.onClick?"pointer":void 0},children:[(0,A.jsx)("rect",{x:D(h.slotX(k)),y:D(Mt),width:D(h.s),height:D(Math.max(0,i-Mt)),fill:"transparent"}),lt.map(M=>{let j=Qn.get(`${k}|${M}`);if(!j)return null;let H=st(k,M),q=De(k,M)*h.k;if(O)return De(k,M)===0?(0,A.jsx)("polygon",{points:Je([[H.x,H.base],[H.x+H.w,H.base],[H.x+H.w+H.dx,H.base+H.dy],[H.x+H.dx,H.base+H.dy]]),fill:"none",stroke:r.paint("neutralStrong"),strokeOpacity:.7,strokeDasharray:"2 2"},M):(0,A.jsx)(ra,{p:r,g:H,cum:j.v,colors:K(k,M),hatch:xe(M)?ce:null,lid:M==="back"?it:ba,lidSplit:M==="front"&&le.split?{fills:K(k,M).map(re=>re.fill),values:rn(k,M)}:void 0,lidStroke:!0,lidInk:M==="front",lidHatch:M==="front",shade:oe,tile:!0},M);if(q>0&&q<1){let re=rn(k,M),U=re.length-1;for(;U>0&&!(re[U]>0);)U--;return(0,A.jsx)("line",{x1:D(H.x),x2:D(H.x+H.w),y1:D(H.base-.5),y2:D(H.base-.5),stroke:K(k,M)[U].fill},M)}return(0,A.jsx)(ra,{p:r,g:H,cum:j.v,colors:K(k,M),hatch:xe(M)?ce:null,lid:M==="back"?it:r.paint("neutralSoft"),lidStroke:M==="back",shade:oe},M)}),ae===k&&n.via!=="sync"?(0,A.jsx)("polygon",{points:Je(ul(st(k,S),De(k,S)*h.k)),fill:"none",stroke:r.paint("ink"),strokeWidth:2,strokeLinejoin:"round",pointerEvents:"none"}):null]},p.key)),n.showLabels&&h.backTotal[Ve]>0?Ca():null,I?(0,A.jsx)(hl,{p:r,rates:G.map((p,k)=>ln(k)),x:h.slotX,w:h.w,from:ut,to:mt,top:ir,right:_?h.wallX[1]+6:mt+6,title:a.rate,pct:er,fade:sn}):null,(0,A.jsx)("g",{"aria-hidden":"true",children:ar.show.map(p=>(0,A.jsx)(ze,{x:ar.xs[p],y:Tt,anchor:"middle",size:pe,fill:r.paint(ae===p?"ink":"muted"),weight:ae===p?700:400,children:G[p].label},p))}),B&&h.frontTotal[Ce]>0?Aa():null]})]})}var gl=F(Y(),1);var la=F(V(),1);function aa(e,t){return t===!1?e.map((n,r)=>r):eo(e)}function ia(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return be(e,t,t,r,"max")}function sa(e,t,n){let r=new Array(t.length),o=t.filter(i=>!n.has(i));for(let i of t)n.has(i)&&(r[i]=Q(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?Q(e,"neutral"):_t(e,1-a/Math.max(1,o.length-1))),r}function ca(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Te(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function ua(e,t){return We(e,t+1,new Set)}var pl=F(Y(),1);var da=F(V(),1);var bl=26;var im=bl*.62;function ma(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!To.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var Pe=F(V(),1);function fa(e,t,n){let r=Vt(e);return r?.type==="scatter"&&t?.size!==void 0&&!Gt(n)?Vt("bubble"):r}function yl(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 xl(e,t,n,r=!1){let o=fa(e.type,e.encoding,e.options);if(!o||!t.length)return[];let i=e.encoding??{},a=e.options??{},s=a.highlight,l=new Set(!r&&Pn.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),u=c=>c.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(m.includes(o.type)){let c=Fe(i.label,"label"),d=Wt(i.value,"value"),g=o.type==="waffle",f=t.map((x,_)=>({r:x,label:c(x,_),value:g?d(x,_):Jo(d(x,_))})),{kept:y,other:T}=g?{kept:f,other:null}:Yo(f,a.other,(x,_)=>({r:{},label:Uo(J(n),x),value:_})),w=be(s,y.map(x=>x.r),y.map(x=>x.label),y.map(x=>x.value),g?"first":"max"),v=T?[...y,T]:y,S=Ie(x=>g?we(x,v.length,w):Zo(x,v.length,w,a.colorMode)),N=g&&a.shape==="arc";return v.map((x,_)=>({label:x.label,color:S[_],...N&&{shape:"circle"}}))}if(o.type==="candlestick"){let c=Xo(Array.isArray(a.ma)?a.ma:void 0,t.length),d=Ko[J(n)];return[{label:d.up,color:a.upColor??"accent"},{label:d.down,color:a.downColor??"neutralStrong"},...c.map((g,f)=>({label:d.maLegend(g),color:Kn[f],shape:"line"}))]}if(o.type==="network"){let c=ca(a.groups);if(c.length<2)return[];let d=Ie(g=>ua(g,c.length));return c.map((g,f)=>({label:g,color:d[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let c=Fe(i.group,"group"),d=Te(t.map((f,y)=>c(f,y)).filter(Boolean));if(d.length<2)return[];let g=Ie(f=>We(f,d.length,new Set));return d.map((f,y)=>({label:f,color:g[y],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||Gt(a))return[];let c=Fe(i.series,"series"),d=Te(t.map((y,T)=>c(y,T)));if(d.length<2)return[];let g=Wo(s,t,d,c),f=Ie(y=>We(y,d.length,g));return u(d.map((y,T)=>({label:y,color:f[T],shape:"circle"})))}if(o.type==="timeline"){let c=typeof i.group!="string",d=c?i.status:i.group;if(typeof d!="string")return[];let g=Do(t,d,c),f=Ie(y=>we(y,g.length,ma(s,g)));return u(g.map((y,T)=>({label:y,color:f[T],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let c=[];if(Array.isArray(i.y))c=i.y;else if(typeof i.series=="string"){let S=Fe(i.series,"series");c=Te(t.map((N,x)=>S(N,x)))}let d=Dn(o.type,i,a);if(d.length){let S=be(s,c,c,c.map(()=>0),"none"),N=Ie(_=>we(_,c.length,S)),x=c.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:c.map((_,z)=>({label:_,color:N[z]}));return[...u(x),...d.map((_,z)=>({label:_,color:Vo(z),shape:"line"}))]}if(c.length<2)return[];let f=o.type==="bar"&&a.layout==="diverging"&&s===void 0?Qr(c.length,Array.isArray(a.negative)?a.negative.map(S=>c.indexOf(String(S))):[],typeof a.neutral=="string"?c.indexOf(a.neutral):-1):-1,y=f>=0?new Set([f]):be(s,c,c,c.map(()=>0),"first");if(o.type==="radar")return u(c.map((S,N)=>({label:S,color:y.has(N)?"accent":"neutralStrong",shape:"square"})));let T=a.colorMode,w=S=>we(S,c.length,y);if((o.type==="line"||o.type==="area")&&(w=S=>Go(S,c.length,y,o.type==="area",T)),o.type==="stream"){let S=je(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),N=aa(S.values,a.reorder),x=ia(s,S.series,S.values);w=_=>sa(_,N,x)}let v=Ie(w);return u(c.map((S,N)=>({label:S,color:v[N],...o.type==="line"&&{shape:"line"}})))}return[]}function kl(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Wr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function wl(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:u,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:i,highlight:a,syncId:s,title:l,description:u}}function ha(e,t){let{spec:n}=e,r=fa(n.type,n.encoding,n.options),o=(0,wt.useMemo)(()=>Lo(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=Vr(n,e.locale),s=ue(a),l=J(s),u=Mo(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),m=Ur(n),c=(0,wt.useMemo)(()=>m?_o(m,s):void 0,[m,s]),d=n.options?.hidden,g=Array.isArray(d)?d.map(String):[],f=g.join(""),[y,T]=(0,wt.useState)(null);if(!r)return(0,Pe.jsx)(_n,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let w=o??u.data,v=t[r.type],S={...n.options??{}},N={...yl(r,n.encoding),...S,...c?{tooltip:c}:{},data:w,...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:a},x=n.card?.legend==="toggle"&&Xr(r.type,n.encoding??{},S),_=y&&y.base===f?y.hidden:g;x&&(N.hidden=_);let z=R=>T(C=>{let $=C&&C.base===f?C.hidden:g;return{base:f,hidden:$.includes(R)?$.filter(h=>h!==R):[...$,R]}}),O=N.height??220,I=kl(n,r.type),B=i&&!w.length&&(u.loading||u.error||u.empty)?(0,Pe.jsx)(_n,{loading:u.loading,error:u.error,empty:u.empty,onRetry:u.reload,height:O,locale:a}):I?(0,Pe.jsx)(vo,{chart:v,...wl(r.type,I,N)}):(0,Pe.jsx)(v,{...N});if(n.card){let R=n.card,C=R.legend==="auto"||R.legend==="toggle"?xl(n,w,s,x):R.legend,$=C?.length?x?(0,Pe.jsx)(Fn,{items:C,hidden:_,onToggle:z,locale:a}):C:void 0,h=R.download?(0,Pe.jsx)(Fo,{data:w,columns:Yr(n),filename:R.title??r.type,formats:Array.isArray(R.download)?R.download:void 0,locale:a}):void 0;B=(0,Pe.jsx)(zr,{number:R.number,title:R.title??Gr(r,l),subtitle:R.subtitle,legend:$,actions:h,source:R.source||void 0,note:R.note||void 0,accent:R.accent,takeaway:R.takeaway,level:R.level,sample:R.sample,replay:R.replay!==!1,className:e.className,locale:a,children:B})}let E=e.theme??n.theme;return E&&(B=(0,Pe.jsx)(It,{theme:E,children:B})),B}function $l({cfg:e,components:t}){let n=rt();return ha({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function pa(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,ga.hydrateRoot)(r,(0,Zn.createElement)(It,{theme:o.theme,cssVars:!0},(0,Zn.createElement)($l,{cfg:o,components:{[e]:t}})))}pa("skyline",Jn);})();