ztd-charts-cli 0.7.0 → 0.8.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 (54) hide show
  1. package/README.md +1 -1
  2. package/dist/api.d.ts +11 -1
  3. package/dist/api.js +5 -1
  4. package/dist/{chunk-4WXNLD5P.js → chunk-FB5WHEJX.js} +38 -15
  5. package/dist/cli.js +5 -4
  6. package/dist/client/NOTICE.md +39 -0
  7. package/dist/client/area.js +10 -10
  8. package/dist/client/bar.js +10 -10
  9. package/dist/client/barRace.js +28 -0
  10. package/dist/client/beeswarm.js +10 -10
  11. package/dist/client/box.js +10 -10
  12. package/dist/client/bubble.js +10 -10
  13. package/dist/client/bullet.js +9 -9
  14. package/dist/client/bump.js +10 -10
  15. package/dist/client/calendar.js +9 -9
  16. package/dist/client/candlestick.js +9 -9
  17. package/dist/client/chord.js +10 -10
  18. package/dist/client/choropleth.js +28 -0
  19. package/dist/client/donut.js +10 -10
  20. package/dist/client/dumbbell.js +9 -9
  21. package/dist/client/flowMap.js +28 -0
  22. package/dist/client/funnel.js +10 -10
  23. package/dist/client/gauge.js +10 -10
  24. package/dist/client/geo-kr-sido.js +1 -0
  25. package/dist/client/geo-us-states.js +1 -0
  26. package/dist/client/geo-world.js +1 -0
  27. package/dist/client/heatmap.js +9 -9
  28. package/dist/client/histogram.js +6 -6
  29. package/dist/client/line.js +10 -10
  30. package/dist/client/lollipop.js +10 -10
  31. package/dist/client/marimekko.js +6 -6
  32. package/dist/client/network.js +28 -0
  33. package/dist/client/parallel.js +9 -9
  34. package/dist/client/pareto.js +10 -10
  35. package/dist/client/pie.js +10 -10
  36. package/dist/client/radar.js +10 -10
  37. package/dist/client/radialBar.js +10 -10
  38. package/dist/client/ridgeline.js +10 -10
  39. package/dist/client/sankey.js +10 -10
  40. package/dist/client/scatter.js +10 -10
  41. package/dist/client/segmented.js +9 -9
  42. package/dist/client/skyline.js +10 -10
  43. package/dist/client/slope.js +10 -10
  44. package/dist/client/sparkline.js +10 -10
  45. package/dist/client/stream.js +10 -10
  46. package/dist/client/sunburst.js +9 -9
  47. package/dist/client/symbolMap.js +28 -0
  48. package/dist/client/tileMap.js +10 -10
  49. package/dist/client/timeline.js +28 -0
  50. package/dist/client/tree.js +28 -0
  51. package/dist/client/treemap.js +9 -9
  52. package/dist/client/waffle.js +9 -9
  53. package/dist/client/waterfall.js +10 -10
  54. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
- (()=>{var mo=Object.create;var cn=Object.defineProperty;var fo=Object.getOwnPropertyDescriptor;var ho=Object.getOwnPropertyNames;var go=Object.getPrototypeOf,po=Object.prototype.hasOwnProperty;var kt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var bo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ho(t))!po.call(e,o)&&o!==n&&cn(e,o,{get:()=>t[o],enumerable:!(r=fo(t,o))||r.enumerable});return e};var F=(e,t,n)=>(n=e!=null?mo(go(e)):{},bo(t||!e||!e.__esModule?cn(n,"default",{value:e,enumerable:!0}):n,e));var H=kt((Ai,un)=>{un.exports=globalThis.__ztdReact.react});var dn=kt((Fi,mn)=>{mn.exports=globalThis.__ztdReact["react-dom/client"]});var I=kt((Vi,jn)=>{jn.exports=globalThis.__ztdReact["react/jsx-runtime"]});var sn=F(H(),1),co=F(dn(),1);var Ke=F(H(),1);var at=F(H(),1);var fn=F(H(),1),ve=(0,fn.createContext)(void 0);var bn=F(H(),1);var yo=["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],hn='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',gn='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',he={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:hn,monoFamily:gn,radius:18,radiusCode:14,radiusMark:4},wt={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:hn,monoFamily:gn,radius:18,radiusCode:14,radiusMark:4},vt={dark:he,light:wt};function Ue(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function $t(e){let t={};for(let n of yo){let r=e[n];typeof r=="string"&&(t[Ue(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 Tt(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 xo=`
1
+ (()=>{var wo=Object.create;var fn=Object.defineProperty;var vo=Object.getOwnPropertyDescriptor;var $o=Object.getOwnPropertyNames;var To=Object.getPrototypeOf,Mo=Object.prototype.hasOwnProperty;var $t=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Co=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of $o(t))!Mo.call(e,o)&&o!==n&&fn(e,o,{get:()=>t[o],enumerable:!(r=vo(t,o))||r.enumerable});return e};var A=(e,t,n)=>(n=e!=null?wo(To(e)):{},Co(t||!e||!e.__esModule?fn(n,"default",{value:e,enumerable:!0}):n,e));var B=$t((Wi,hn)=>{hn.exports=globalThis.__ztdReact.react});var pn=$t((Ki,gn)=>{gn.exports=globalThis.__ztdReact["react-dom/client"]});var O=$t((is,Wn)=>{Wn.exports=globalThis.__ztdReact["react/jsx-runtime"]});var mn=A(B(),1),xo=A(pn(),1);var Ue=A(B(),1);var it=A(B(),1);var bn=A(B(),1),Me=(0,bn.createContext)(void 0);var wn=A(B(),1);var So=["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],yn='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',xn='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',ge={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:yn,monoFamily:xn,radius:18,radiusCode:14,radiusMark:4},Tt={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:yn,monoFamily:xn,radius:18,radiusCode:14,radiusMark:4},Mt={dark:ge,light:Tt};function Xe(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function Ct(e){let t={};for(let n of So){let r=e[n];typeof r=="string"&&(t[Xe(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 St(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 Ao=`
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,${he.accent});outline-offset:3px;border-radius:6px}
4
+ .ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${ge.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,${he.accent});outline-offset:2px}
12
+ .ztd-btn:focus-visible{outline:2px solid var(--ztd-accent,${ge.accent});outline-offset:2px}
13
13
  .ztd-card{transition:border-color .16s ease}
14
- .ztd-card:hover{border-color:var(--ztd-dim,${he.dim})}
14
+ .ztd-card:hover{border-color:var(--ztd-dim,${ge.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 yn(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 xn(e,t){let[n]=(0,bn.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var pn=!1;function Ee(){if(pn||typeof document>"u"||(pn=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=xo,document.head.appendChild(e)}var Xe=F(H(),1),ee=typeof window<"u"&&typeof document<"u",ae=ee?Xe.useLayoutEffect:Xe.useEffect;function Ye(){return typeof performance<"u"?performance.now():Date.now()}function j(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function ge(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var kn={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},wn={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var ko=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],wo={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function vo(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function $o(e){return vo(ko,e)}function vn(e,t){let n=$o(e);return{text:n?n[t]:e,...wo[n?.id??"basic"]}}var $n={white:"#ffffff",black:"#000000",transparent:"#00000000"};function $e(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),$n[t.toLowerCase()]&&(t=$n[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(i=>i+i).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let a=parseInt(o,16);return o.length===6?[a>>16&255,a>>8&255,a&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let a=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),i=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return a.some(s=>Number.isNaN(s))?null:[a[0],a[1],a[2],Number.isNaN(i)?1:i]}return null}function Mn(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 Mt(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 Te(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Tn(e){return .2126*Te(e[0])+.7152*Te(e[1])+.0722*Te(e[2])}function St(e,t,n){let r=typeof e=="string"?$e(e):e,o=typeof t=="string"?$e(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?$e(n):n:null;o[3]<1&&a&&(o=Mt(o,a));let i=r[3]<1?Mt(r,o):r,s=Tn(i),l=Tn(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function To(e){return[Te(e[0]),Te(e[1]),Te(e[2])]}function Ct(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 Cn(e){let[t,n,r]=To(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),i=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*a-.0040720468*i,1.9779984951*o-2.428592205*a+.4505937099*i,.0259040371*o+.7827717662*a-.808675766*i]}function Co([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,a=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[Ct(4.0767416621*o-3.3077115913*a+.2309699292*i),Ct(-1.2684380046*o+2.6097574011*a-.3413193965*i),Ct(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function qe(e,t,n){let r=$e(e),o=$e(t);if(!r||!o)return e;let a=Cn(r),i=Cn(o),s=Math.max(0,Math.min(1,n));return Mn(Co([a[0]*s+i[0]*(1-s),a[1]*s+i[1]*(1-s),a[2]*s+i[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function At(e,t,n){let r=t[0],o=-1;for(let a of t){let i=St(a,e,n);i>o&&(o=i,r=a)}return r}function V(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 Mo(e,t){let n=At(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return St(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):At(t,["#FFFFFF","#000000"])}function Je(e,t){let n=qe(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Mo(e,n),raw:n}}function ie(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=V(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=V(e,"neutral");else if(s===0)r[i]=V(e,"ink");else if(s===a-1)r[i]=V(e,"neutral");else if(a===3)r[i]=V(e,"strong");else{let l=(s-1)/Math.max(1,a-2);r[i]=l<=.001?V(e,"strong"):Je(e,1-l)}}),r}var Ft="mix:";function _e(e){return e({theme:wt,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${Ft}${o}`}).map(n=>n.fill)}function Sn(e,t){return t?.startsWith(Ft)?e.mix("neutralStrong","neutral",Number(t.slice(Ft.length))):e.color(t)}function An(e,t,n){return ie(e,t+1,n).slice(0,t)}function Fn(e,t,n,r="neutral"){let o=V(e,"accent"),a=V(e,r);return Array.from({length:t},(i,s)=>n.has(s)?o:a)}function Nn(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=V(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=V(e,"neutral"):s===0?r[i]=V(e,"strong"):s===a-1?r[i]=V(e,"neutral"):r[i]=Je(e,1-s/(a-1))}),r}var te=F(H(),1);var Qe=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),X="en-US",Rn=new Map;function Nt(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=Rn.get(r);return o||(o=new Intl.NumberFormat(e,n),Rn.set(r,o)),o}function Rt(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function Ce(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=X,...r}=t;return Rt(Nt(n,r).format(e))}var Pt=e=>e!==0&&Math.abs(e)<.05,Dt=(e,t,n="")=>`${Ce(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function Ze(e,t={}){if(!Number.isFinite(e))return"-";if(Pt(e)&&t.maximumFractionDigits===void 0)return Dt(e,t.locale??X,"%");let n=Math.abs(e);return`${Ce(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function En(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=X,...r}=t;if(j(n)==="ko"){let o=Math.abs(e),a=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],i=a.findIndex(([s])=>o>=s);for(i<0&&(i=a.length-1);;){let[s,l]=a[i],c=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**m)/10**m;if(i>0&&u>=a[i-1][0]/s){i--;continue}return(e<0&&u!==0?"-":"")+Ce(u,{locale:n,...r,maximumFractionDigits:m})+l}}return Rt(Nt(n,{notation:"compact",...r}).format(e))}var So=(e,t=j(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function ke(e,t=X,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=Nt(t,o);return l=>Number.isFinite(l)?`${i}${Rt(s.format(l))}${a}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:a="",...i}=e;return r(i,o,a)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>Ze(o,{locale:t});case"ratio":return o=>Ze(o*100,{locale:t});case"compact":return o=>En(o,{locale:t});case"currency":return r(So(t));default:{let o=r({maximumFractionDigits:1});return a=>Pt(a)?Dt(a,t):o(a)}}}function _n(e,t=X,n=0){return e!==void 0?ke(e,t):n>=1e5?r=>Pt(r)?Dt(r,t):En(r,{locale:t}):r=>Ce(r,{locale:t})}function Ao(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Lt=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Fo=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,No=["january","february","march","april","may","june","july","august","september","october","november","december"],Pn=e=>{let t=e.toLowerCase();return t.length<3?0:No.findIndex(n=>n.startsWith(t))+1},Dn=e=>+e+(+e<30?2e3:1900);function In(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Ro=[/^(\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})일)?$/],On=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Bn=/\{([^{}]+)\}/g;function et(e,t){let n;for(let r of Ro)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?[Dn(n[3]),+n[2],+n[1],1]:[Dn(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=On.exec(e)){let r=+n[1],o=+n[3],a=r>12||o<=12&&t===!0;return[+n[4],a?o:r,a?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=Pn(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=Pn(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var zn=e=>Fo.test(e)||et(e)!==null;function Hn(e){let t;for(let n of e){let r=typeof n=="string"?On.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function tt(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(Lt(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return tt(`${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 Ao(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 Ln=new Map;function Ie(e,t={month:"short",day:"numeric"}){let n=tt(e);if(!n)return"-";let{locale:r=X,...o}=t,a=r+JSON.stringify(o),i=Ln.get(a);return i||(i=new Intl.DateTimeFormat(r,o),Ln.set(a,i)),i.format(n)}var Et=F(I(),1),nt=(0,te.createContext)({theme:he,cssVars:!0});function Po(e,t=he){return e?typeof e=="string"?vt[e]??t:Tt(t,e):t}function rt(e){let t=(0,te.useContext)(nt),n=e.base?vt[e.base]:t.theme,r=(0,te.useMemo)(()=>Po(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,te.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,te.useMemo)(()=>$t(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Et.jsx)(nt.Provider,{value:i,children:(0,Et.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Do=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Vn(e){return Do.has(e)}function Lo(e,t){let n=r=>t?`var(${Ue(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Vn(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Vn(r)?e[r]:r:e[o],mix:(r,o,a)=>{let i=Math.round(Math.max(0,Math.min(1,a))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${i}%, ${n(o)})`:qe(e[r],e[o],a)}}}function ne(e){let t=(0,te.useContext)(nt);return(0,te.useMemo)(()=>{let n=Tt(t.theme,e);return Lo(n,t.cssVars)},[t.theme,t.cssVars,e])}function Y(e){let t=(0,te.useContext)(nt);return e??t.locale??X}function Wn(e){return e?$t(e):{}}var ot=F(H(),1),_t=(0,ot.createContext)(void 0);function Gn(e){let t=(0,ot.useContext)(_t);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var A=F(I(),1),Eo={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`},_o={en:Eo,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Io={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},It=e=>_o[j(Y(e))];function Ot(e){let t=ne(e.theme),n=It(e.locale),[r,o]=(0,at.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.label)).length,c=(0,A.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((m,u)=>{let d=!s.has(m.label),h=d&&l===1,f=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Oo,{p:t,item:m,off:!d}),(0,A.jsx)("span",{style:d?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,A.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,A.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":d,"aria-disabled":h||void 0,onClick:()=>{h||(i(m.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:h?"default":void 0},children:f}):f},u)})});return i?(0,A.jsxs)(A.Fragment,{children:[c,(0,A.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Io,children:r?n.shown(l,e.items.length):""})]}):c}function Oo({p:e,item:t,off:n}){let r=Sn(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,A.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,A.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,A.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,A.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 Bo(e){let t=ne(e.theme),n=vn(e.level,j(Y(e.locale)));return(0,A.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 zo(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,A.jsxs)(A.Fragment,{children:[e.slice(0,r),(0,A.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function Kn(e){let t=ne(e.theme),n=It(e.locale),[r,o]=(0,at.useState)(0);ae(()=>Ee(),[]);let a=()=>{o(d=>d+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,A.jsx)(Ot,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,c=e.replay||e.onReplay,m=e.source!==void 0||e.note!==void 0?(0,A.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,A.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,A.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,A.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,A.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,A.jsx)(Bo,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,A.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,A.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,A.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,A.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,A.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:zo(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,A.jsx)("button",{type:"button",className:"ztd-btn",onClick:a,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,A.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,A.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,A.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,A.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,A.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,A.jsx)("span",{}),i]}):null]}),(0,A.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,A.jsx)(_t.Provider,{value:r,children:(0,A.jsx)(ve.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,A.jsxs)(A.Fragment,{children:[m,u]}):u]})}function Bt(e){let t=ne(e.theme),n=It(e.locale),r=e.height??220;if(ae(()=>Ee(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,A.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,A.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,A.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,A.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,A.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,A.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,a)=>(0,A.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${a*90}ms`}},a))}):e.empty?(0,A.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,A.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,A.jsx)(A.Fragment,{children:e.children})}var Pe=F(H(),1);var q=F(H(),1);var O=F(I(),1),it=60;var st={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function Un(e){let{c:t,events:n}=e,r=(0,q.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,ae(()=>{Ee()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,q.useContext)(ve),c=e.ariaLabel??l??e.kind,m=(0,q.useMemo)(()=>s?`${n.length}${n.slice(0,it).map(x=>`${x.label}${x.series??""}${x.formatted??x.value??""}`).join("")}`:"",[n,s]),u=(0,q.useMemo)(()=>(0,O.jsx)(Ho,{label:c,events:n,t:t.t}),[c,m,t.t]),d=(0,q.useRef)(null);(0,q.useEffect)(()=>{let x=()=>{d.current=null};return window.addEventListener("scroll",x,{capture:!0,passive:!0}),window.addEventListener("resize",x,{passive:!0}),()=>{window.removeEventListener("scroll",x,{capture:!0}),window.removeEventListener("resize",x)}},[]),(0,q.useEffect)(()=>{d.current=null},[t.width,t.height]);let h=x=>{if(x.target!==x.currentTarget)return;if(e.onKey?.(x)){x.preventDefault();return}let C=t.active,D;switch(x.key){case"ArrowRight":case"ArrowDown":D=C===null?0:(C+1)%i;break;case"ArrowLeft":case"ArrowUp":D=C===null?i-1:(C-1+i)%i;break;case"Home":D=0;break;case"End":D=i-1;break;case"Escape":if(C===null)return;D=null;break;case"Enter":case" ":C!==null&&(x.preventDefault(),t.click(C));return;default:return}x.preventDefault(),t.setActive(D,"keyboard")},{via:f,node:p,setActive:y}=t;(0,q.useEffect)(()=>{if(f!=="touch"||!p)return;let x=C=>{p.contains(C.target)||y(null)};return document.addEventListener("pointerdown",x),()=>document.removeEventListener("pointerdown",x)},[f,p,y]);let k=t.active!==null?n[t.active]:null,g=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,$=g&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,v=typeof e.renderTip=="function"&&k?e.renderTip(k):null,b=e.announce??(t.via==="keyboard"&&k?`${k.label}${k.series?` ${k.series}`:""}: ${k.formatted??k.value??""} (${(t.active??0)+1}/${i})`:""),S;if(g){let x=g.x*$,C=t.width*$,D=`clamp(${(4-x).toFixed(1)}px, -50%, calc(${(C-x-4).toFixed(1)}px - 100%))`,_=g.y<64;S={position:"absolute",left:x,top:g.y*$,transform:`translate(${D}, ${_?"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*$-8)}}let P=x=>{d.current=null,x.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},L=x=>x?C=>{let D=d.current??(d.current=C.currentTarget.getBoundingClientRect());D.width&&x((C.clientX-D.left)/D.width*t.width,(C.clientY-D.top)/D.height*t.height,C)}:void 0,E=L(e.onPointerMove),R=L(e.onPointerDown),N=E||R?x=>{x.pointerType==="touch"&&E?.(x),R?.(x)}:void 0,M=L(e.onPointerUp),T=Wn(e.theme);return(0,O.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?h:void 0,onBlur:x=>{t.via==="keyboard"&&!x.currentTarget.contains(x.relatedTarget)&&t.setActive(null)},onPointerLeave:P,style:{width:"100%",maxWidth:t.measured?void 0:"100%",fontFamily:t.p.cssVars?`var(--ztd-font, ${t.p.theme.fontFamily})`:t.p.theme.fontFamily,color:t.p.paint("ink"),...T,...e.style},children:[t.pending?null:e.underlay,(0,O.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${a}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:E,onPointerDown:N,onPointerUp:M,onPointerCancel:M,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,O.jsx)("title",{id:o,children:c}),(0,O.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,O.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,g?(0,O.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:S,children:v??(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:g.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:g.title}),g.rows.map((x,C)=>(0,O.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,O.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(x.strong?"ink":"muted")},children:[x.color?(0,O.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:x.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,x.label]}),(0,O.jsx)("span",{style:{fontWeight:x.strong===!1?500:700},children:x.value})]},C))]})}):null,(0,O.jsx)("span",{className:"ztd-sr",style:st,"aria-live":"polite","aria-atomic":"true",children:b}),s&&!t.pending?u:null]})}function Ho({label:e,events:t,t:n}){return(0,O.jsx)("div",{className:"ztd-sr",style:st,children:(0,O.jsxs)("table",{children:[(0,O.jsx)("caption",{children:n.table(e)}),(0,O.jsxs)("tbody",{children:[t.slice(0,it).map((r,o)=>(0,O.jsxs)("tr",{children:[(0,O.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,O.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>it?(0,O.jsx)("tr",{children:(0,O.jsx)("td",{colSpan:2,children:n.more(t.length-it)})}):null]})]})})}function Oe(e){let t=e.baseline??"central";return(0,O.jsx)("text",{x:Math.round(e.x*10)/10,y:Math.round(e.y*10)/10,dy:t==="central"?"0.35em":t==="hanging"?"0.75em":void 0,fontSize:e.size??11,fill:e.fill??"currentColor",textAnchor:e.anchor??"start",fontWeight:e.weight??400,opacity:e.opacity===void 0||e.opacity>=1?void 0:Math.max(0,e.opacity),className:e.className,letterSpacing:e.letterSpacing,style:{pointerEvents:"none",fontVariantNumeric:"tabular-nums"},children:e.children})}var w=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),re=w("label","string",!0,"Item name field"),K=w("value","number",!0,"Value field"),jo=[re,K],Vo=[re,K],Wo=[w("label","string",!0,"Stage name"),w("value","number",!0,"Users at the stage")],Go=[re,K],Ko=[w("label","string",!0,"Leaf (lowest level) name"),K,w("group","string",!1,"Parent group field")],Uo=[w("label","string",!0,"Leaf name"),K,w("group","string",!1,"Parent group field")],Xo=[re,w("value","number",!0,"Change (total rows may omit it)"),w("type","string",!1,'"total" makes a total bar')],Yo=[re,K],qo=[w("x","string",!0,"Column field"),w("series","string",!0,"Stacked series field"),K],Jo=[w("x","string",!0,"Column field"),w("y","string",!0,"Row field"),K],Zo=[w("axis","string",!0,"Metric (axis) field"),w("value","number",!0,"Value field",{multi:!0}),w("series","string",!1,"Series field")],Qo=[w("x","number",!0,"x value"),w("y","number",!0,"y value"),w("size","number",!1,"Circle size"),w("label","string",!1,"Name")],Yn=w("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),ea=[w("x","any",!0,"x field (date, number or category)"),w("y","number",!0,"y field. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field (long tables)"),w("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),Yn],ta=[w("x","any",!0,"x field"),w("y","number",!0,"y field. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field"),w("lower","number",!1,'Lower bound of the range band, with stack "none" only. In wide tables an array in the order of y',{multi:!0}),Yn],na=[w("x","any",!0,"x field"),w("y","number",!0,"y field",{multi:!0}),w("series","string",!1,"Series field")],ra=[w("x","string",!0,"Category field"),w("y","number",!0,"Value field. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field"),w("line","number",!1,"Lines over vertical bars on the same axis, such as a target or last year. An array for several. Bars stay gray unless highlight is set, and with series the line averages rows of the same x",{multi:!0})],oa=[re,K],aa=[w("value","number",!0,"Value field",{prop:"valueKey"}),w("target","number",!1,"Target field",{prop:"targetKey"})],ia=[re,w("value","number",!0,"Actual value field"),w("target","number",!1,"Target field")],sa=[w("x","any",!1,"x field"),w("y","number",!0,"y field")],la=[re,w("x","string",!1,"Period field (long tables)"),w("value","number",!1,"Value field (long tables)")],ca=[re,w("start","number",!0,"Before value"),w("end","number",!0,"After value")],ua=[re,K],ma=[w("value","number",!0,"Value field"),w("group","string",!1,"Group (row) field"),w("label","string",!1,"Dot name")],da=[w("group","string",!0,"Group field"),w("value","number",!0,"Value field")],fa=[w("source","string",!0,"Source node"),w("target","string",!0,"Target node"),K],ha=[w("source","string",!0,"Sending group"),w("target","string",!0,"Receiving group"),K],ga=[w("date","date",!0,"Date field"),K],pa=[w("x","any",!0,"Period field"),w("series","string",!0,"Item field"),w("rank","number",!1,"Rank field (1 is first)"),w("value","number",!1,"Value field (instead of rank, largest is first)")],ba=[w("group","string",!0,"Group field"),w("value","number",!0,"Value field")],ya=[w("label","string",!1,"Row name field")],xa=[w("x","date",!0,"Date (period) field"),w("open","number",!0,"Open price field"),w("high","number",!0,"High price field"),w("low","number",!0,"Low price field"),w("close","number",!0,"Close price field"),w("volume","number",!1,"Volume field")],ka=[re,K],wa=[w("x","any",!0,"Period field (date or category)"),w("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),w("series","string",!1,"Series field (long tables, back row only)"),w("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],va=[w("value","number",!1,"Sample value field (raw rows)"),w("group","string",!1,"Group field. Up to 2 groups overlap"),w("x0","number",!1,"Bin start (pre-binned rows)"),w("x1","number",!1,"Bin end (pre-binned rows)"),w("count","number",!1,"Samples in the bin (pre-binned rows)")],$a=[w("region","string",!0,"Region name or code, matched to a tile of options.map"),K],Ta=[w("x","number",!0,"x value"),w("y","number",!0,"y value"),w("series","string",!1,"Series field (one color per series)"),w("label","string",!1,"Name")],Xn={pie:jo,donut:Vo,funnel:Wo,waffle:Go,treemap:Ko,sunburst:Uo,waterfall:Xo,pareto:Yo,marimekko:qo,heatmap:Jo,radar:Zo,bubble:Qo,line:ea,area:ta,stream:na,bar:ra,radialBar:oa,gauge:aa,bullet:ia,sparkline:sa,slope:la,dumbbell:ca,lollipop:ua,beeswarm:ma,ridgeline:da,sankey:fa,chord:ha,calendar:ga,bump:pa,box:ba,parallel:ya,candlestick:xa,segmented:ka,skyline:wa,histogram:va,scatter:Ta,tileMap:$a},Me={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:"타일 격자 지도"}};function qn(e,t){return t==="ko"?e.nameKo:e.name}function Jn(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var Zn=["line","area","bar","scatter"],Qn=24,zt=["line","area","bar","scatter"];function Ht(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function er(e,t,n){return zt.includes(e)&&!Ht(e,t,n).length}function tr(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Ca={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap"};function lt(e){let t=Xn[e]?e:Ca[e]??Object.keys(Me).find(n=>n.toLowerCase()===e.toLowerCase()||Me[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!Me[t]))return{type:t,component:Me[t].component,name:Me[t].name,nameKo:Me[t].nameKo,encoding:Xn[t]}}function nr(e){let t=new Set,n=a=>{Array.isArray(a)?a.forEach(n):typeof a=="string"&&a&&t.add(a)},r=e.encoding??{};for(let a of lt(e.type)?.encoding.map(i=>i.name)??Object.keys(r))n(r[a]);let o=e.options??{};for(let a of["dimensions","start","end","ranges"])n(o[a]);return[...t]}function rr(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function Ma(e,t){if(e==null||typeof e!="object")return;let n=e;if(rr(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!rr(r,o))return;r=r[o]}return r}}function ue(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 Se(e,t){if(typeof e=="function")return e;let n=e??t;return r=>Ma(r,n)}function Ae(e,t){let n=Se(e,t);return(r,o)=>ue(n(r,o))}function me(e,t){let n=Se(e,t);return(r,o)=>{let a=n(r,o);return a==null?"":a instanceof Date?new Date(a.getTime()-a.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(a)}}function Fe(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Sa(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
23
- `||c==="\r"))break;t.push(n?"":c)}let r=t.join(""),o=l=>r.split(l).length-1,a=[","," ",";","|"],i=",",s=0;for(let l of a){let c=o(l);c>s&&(s=c,i=l)}return i}var Aa=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function or(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(Aa.test(t)||/^[-+]?\.\d+$/.test(t)){let n=ue(t);if(Number.isFinite(n))return n}return t}function we(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??Sa(o),i=[],s=[],l="",c=!1;for(let f=0;f<o.length;f++){let p=o[f];c?p==='"'?o[f+1]==='"'?(l+='"',f++):c=!1:l+=p:p==='"'&&!l.trim()?(c=!0,l=""):p===a?(s.push(l),l=""):p===`
22
+ `;function vn(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 $n(e,t){let[n]=(0,wn.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var kn=!1;function Ee(){if(kn||typeof document>"u"||(kn=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=Ao,document.head.appendChild(e)}var Ye=A(B(),1),ne=typeof window<"u"&&typeof document<"u",ue=ne?Ye.useLayoutEffect:Ye.useEffect;function qe(){return typeof performance<"u"?performance.now():Date.now()}function j(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function pe(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var Tn={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},Mn={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var No=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],Ro={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function Fo(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function _o(e){return Fo(No,e)}function Cn(e,t){let n=_o(e);return{text:n?n[t]:e,...Ro[n?.id??"basic"]}}var Sn={white:"#ffffff",black:"#000000",transparent:"#00000000"};function Ce(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Sn[t.toLowerCase()]&&(t=Sn[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(i=>i+i).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let a=parseInt(o,16);return o.length===6?[a>>16&255,a>>8&255,a&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let a=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),i=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return a.some(s=>Number.isNaN(s))?null:[a[0],a[1],a[2],Number.isNaN(i)?1:i]}return null}function Rn(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 Nt(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 Se(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function An(e){return .2126*Se(e[0])+.7152*Se(e[1])+.0722*Se(e[2])}function Rt(e,t,n){let r=typeof e=="string"?Ce(e):e,o=typeof t=="string"?Ce(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?Ce(n):n:null;o[3]<1&&a&&(o=Nt(o,a));let i=r[3]<1?Nt(r,o):r,s=An(i),l=An(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function Po(e){return[Se(e[0]),Se(e[1]),Se(e[2])]}function At(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 Nn(e){let[t,n,r]=Po(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),i=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*a-.0040720468*i,1.9779984951*o-2.428592205*a+.4505937099*i,.0259040371*o+.7827717662*a-.808675766*i]}function Do([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,a=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[At(4.0767416621*o-3.3077115913*a+.2309699292*i),At(-1.2684380046*o+2.6097574011*a-.3413193965*i),At(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function Je(e,t,n){let r=Ce(e),o=Ce(t);if(!r||!o)return e;let a=Nn(r),i=Nn(o),s=Math.max(0,Math.min(1,n));return Rn(Do([a[0]*s+i[0]*(1-s),a[1]*s+i[1]*(1-s),a[2]*s+i[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function Ft(e,t,n){let r=t[0],o=-1;for(let a of t){let i=Rt(a,e,n);i>o&&(o=i,r=a)}return r}function G(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 Lo(e,t){let n=Ft(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Rt(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):Ft(t,["#FFFFFF","#000000"])}function Ze(e,t){let n=Je(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:Lo(e,n),raw:n}}function re(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=G(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=G(e,"neutral");else if(s===0)r[i]=G(e,"ink");else if(s===a-1)r[i]=G(e,"neutral");else if(a===3)r[i]=G(e,"strong");else{let l=(s-1)/Math.max(1,a-2);r[i]=l<=.001?G(e,"strong"):Ze(e,1-l)}}),r}var _t="mix:";function be(e){return e({theme:Tt,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${_t}${o}`}).map(n=>n.fill)}function Fn(e,t){return t?.startsWith(_t)?e.mix("neutralStrong","neutral",Number(t.slice(_t.length))):e.color(t)}function Oe(e,t,n){return re(e,t+1,n).slice(0,t)}function _n(e,t,n,r="neutral"){let o=G(e,"accent"),a=G(e,r);return Array.from({length:t},(i,s)=>n.has(s)?o:a)}function Pn(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=G(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=G(e,"neutral"):s===0?r[i]=G(e,"strong"):s===a-1?r[i]=G(e,"neutral"):r[i]=Ze(e,1-s/(a-1))}),r}var oe=A(B(),1);var et=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),X="en-US",Dn=new Map;function Pt(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=Dn.get(r);return o||(o=new Intl.NumberFormat(e,n),Dn.set(r,o)),o}function Dt(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function Ae(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=X,...r}=t;return Dt(Pt(n,r).format(e))}var Lt=e=>e!==0&&Math.abs(e)<.05,Et=(e,t,n="")=>`${Ae(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function Qe(e,t={}){if(!Number.isFinite(e))return"-";if(Lt(e)&&t.maximumFractionDigits===void 0)return Et(e,t.locale??X,"%");let n=Math.abs(e);return`${Ae(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function In(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=X,...r}=t;if(j(n)==="ko"){let o=Math.abs(e),a=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],i=a.findIndex(([s])=>o>=s);for(i<0&&(i=a.length-1);;){let[s,l]=a[i],c=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**m)/10**m;if(i>0&&u>=a[i-1][0]/s){i--;continue}return(e<0&&u!==0?"-":"")+Ae(u,{locale:n,...r,maximumFractionDigits:m})+l}}return Dt(Pt(n,{notation:"compact",...r}).format(e))}var Eo=(e,t=j(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function ve(e,t=X,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=Pt(t,o);return l=>Number.isFinite(l)?`${i}${Dt(s.format(l))}${a}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:a="",...i}=e;return r(i,o,a)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>Qe(o,{locale:t});case"ratio":return o=>Qe(o*100,{locale:t});case"compact":return o=>In(o,{locale:t});case"currency":return r(Eo(t));default:{let o=r({maximumFractionDigits:1});return a=>Lt(a)?Et(a,t):o(a)}}}function zn(e,t=X,n=0){return e!==void 0?ve(e,t):n>=1e5?r=>Lt(r)?Et(r,t):In(r,{locale:t}):r=>Ae(r,{locale:t})}function Oo(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var Ot=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,Io=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,zo=["january","february","march","april","may","june","july","august","september","october","november","december"],Ln=e=>{let t=e.toLowerCase();return t.length<3?0:zo.findIndex(n=>n.startsWith(t))+1},En=e=>+e+(+e<30?2e3:1900);function Bn(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var Bo=[/^(\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})일)?$/],Hn=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,jn=/\{([^{}]+)\}/g;function tt(e,t){let n;for(let r of Bo)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?[En(n[3]),+n[2],+n[1],1]:[En(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=Hn.exec(e)){let r=+n[1],o=+n[3],a=r>12||o<=12&&t===!0;return[+n[4],a?o:r,a?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=Ln(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=Ln(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Gn=e=>Io.test(e)||tt(e)!==null;function Vn(e){let t;for(let n of e){let r=typeof n=="string"?Hn.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function nt(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(Ot(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return nt(`${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=tt(n,t);if(r)return Oo(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 On=new Map;function Ie(e,t={month:"short",day:"numeric"}){let n=nt(e);if(!n)return"-";let{locale:r=X,...o}=t,a=r+JSON.stringify(o),i=On.get(a);return i||(i=new Intl.DateTimeFormat(r,o),On.set(a,i)),i.format(n)}var It=A(O(),1),rt=(0,oe.createContext)({theme:ge,cssVars:!0});function Ho(e,t=ge){return e?typeof e=="string"?Mt[e]??t:St(t,e):t}function ot(e){let t=(0,oe.useContext)(rt),n=e.base?Mt[e.base]:t.theme,r=(0,oe.useMemo)(()=>Ho(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,oe.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,oe.useMemo)(()=>Ct(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,It.jsx)(rt.Provider,{value:i,children:(0,It.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var jo=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Kn(e){return jo.has(e)}function Go(e,t){let n=r=>t?`var(${Xe(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Kn(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Kn(r)?e[r]:r:e[o],mix:(r,o,a)=>{let i=Math.round(Math.max(0,Math.min(1,a))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${i}%, ${n(o)})`:Je(e[r],e[o],a)}}}function ae(e){let t=(0,oe.useContext)(rt);return(0,oe.useMemo)(()=>{let n=St(t.theme,e);return Go(n,t.cssVars)},[t.theme,t.cssVars,e])}function Y(e){let t=(0,oe.useContext)(rt);return e??t.locale??X}function Un(e){return e?Ct(e):{}}var at=A(B(),1),zt=(0,at.createContext)(void 0);function Xn(e){let t=(0,at.useContext)(zt);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var N=A(O(),1),Vo={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`},Wo={en:Vo,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Ko={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Bt=e=>Wo[j(Y(e))];function Ht(e){let t=ae(e.theme),n=Bt(e.locale),[r,o]=(0,it.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.label)).length,c=(0,N.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((m,u)=>{let d=!s.has(m.label),h=d&&l===1,f=(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(Uo,{p:t,item:m,off:!d}),(0,N.jsx)("span",{style:d?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,N.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,N.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":d,"aria-disabled":h||void 0,onClick:()=>{h||(i(m.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:h?"default":void 0},children:f}):f},u)})});return i?(0,N.jsxs)(N.Fragment,{children:[c,(0,N.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Ko,children:r?n.shown(l,e.items.length):""})]}):c}function Uo({p:e,item:t,off:n}){let r=Fn(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,N.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,N.jsx)("line",{x1:1,x2:13,y1:4,y2:4,stroke:r,strokeWidth:2,strokeDasharray:o==="dash"?"3 2":void 0,strokeLinecap:"round"}),o==="line"?(0,N.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,N.jsx)("span",{"aria-hidden":"true",style:{width:9,height:9,flex:"none",borderRadius:o==="circle"?9:2.5,background:r,boxShadow:t.color==="neutral"||t.color==="neutralSoft"||!t.color?`inset 0 0 0 1px ${e.paint("line2")}`:void 0,opacity:n?.35:void 0}})}function Xo(e){let t=ae(e.theme),n=Cn(e.level,j(Y(e.locale)));return(0,N.jsx)("span",{style:{background:t.paint(n.bg),color:t.paint(n.fg),borderRadius:8,padding:"3px 9px",fontSize:12.5,fontWeight:700,lineHeight:"18px",whiteSpace:"nowrap",flex:"none"},children:n.text})}function Yo(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,N.jsxs)(N.Fragment,{children:[e.slice(0,r),(0,N.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function Yn(e){let t=ae(e.theme),n=Bt(e.locale),[r,o]=(0,it.useState)(0);ue(()=>Ee(),[]);let a=()=>{o(d=>d+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,N.jsx)(Ht,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,c=e.replay||e.onReplay,m=e.source!==void 0||e.note!==void 0?(0,N.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,N.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,N.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,N.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,N.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,N.jsx)(Xo,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,N.jsxs)("section",{id:e.id,className:`ztd-card${e.className?` ${e.className}`:""}`,style:{background:t.paint("panel"),color:t.paint("ink"),border:`1px solid ${t.paint("line")}`,borderRadius:`var(--ztd-radius, ${t.theme.radius}px)`,padding:"20px 20px 16px",display:"flex",flexDirection:"column",gap:12,minWidth:0,boxSizing:"border-box",fontFamily:t.cssVars?`var(--ztd-font, ${t.theme.fontFamily})`:t.theme.fontFamily,wordBreak:"keep-all",textWrap:"balance",...e.style},children:[(0,N.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,N.jsx)("span",{style:{fontFamily:t.cssVars?`var(--ztd-mono, ${t.theme.monoFamily})`:t.theme.monoFamily,fontSize:17,fontWeight:700,color:t.paint("accentText"),letterSpacing:-.2,flex:"none"},children:l}):null,(0,N.jsx)(s,{style:{margin:0,fontSize:22,fontWeight:800,color:t.paint("ink"),letterSpacing:-.5,lineHeight:1.25,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:Yo(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,N.jsx)("button",{type:"button",className:"ztd-btn",onClick:a,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,N.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,N.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,N.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,N.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,N.jsx)("span",{}),i]}):null]}),(0,N.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,N.jsx)(zt.Provider,{value:r,children:(0,N.jsx)(Me.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,N.jsxs)(N.Fragment,{children:[m,u]}):u]})}function jt(e){let t=ae(e.theme),n=Bt(e.locale),r=e.height??220;if(ue(()=>Ee(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,N.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,N.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,N.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,N.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,N.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onRetry,style:{marginTop:4,background:t.paint("ink"),color:t.paint("onInk"),border:"none",borderRadius:14,padding:"5px 14px",fontSize:12.5,fontWeight:700},children:n.retry}):null]})})}return e.loading?(0,N.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,a)=>(0,N.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${a*90}ms`}},a))}):e.empty?(0,N.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,N.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,N.jsx)(N.Fragment,{children:e.children})}var Pe=A(B(),1);var q=A(B(),1);var I=A(O(),1),st=60;var lt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function qn(e){let{c:t,events:n}=e,r=(0,q.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,ue(()=>{Ee()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,q.useContext)(Me),c=e.ariaLabel??l??e.kind,m=(0,q.useMemo)(()=>s?`${n.length}${n.slice(0,st).map(x=>`${x.label}${x.series??""}${x.formatted??x.value??""}`).join("")}`:"",[n,s]),u=(0,q.useMemo)(()=>(0,I.jsx)(qo,{label:c,events:n,t:t.t}),[c,m,t.t]),d=(0,q.useRef)(null);(0,q.useEffect)(()=>{let x=()=>{d.current=null};return window.addEventListener("scroll",x,{capture:!0,passive:!0}),window.addEventListener("resize",x,{passive:!0}),()=>{window.removeEventListener("scroll",x,{capture:!0}),window.removeEventListener("resize",x)}},[]),(0,q.useEffect)(()=>{d.current=null},[t.width,t.height]);let h=x=>{if(x.target!==x.currentTarget)return;if(e.onKey?.(x)){x.preventDefault();return}let T=t.active,P;switch(x.key){case"ArrowRight":case"ArrowDown":P=T===null?0:(T+1)%i;break;case"ArrowLeft":case"ArrowUp":P=T===null?i-1:(T-1+i)%i;break;case"Home":P=0;break;case"End":P=i-1;break;case"Escape":if(T===null)return;P=null;break;case"Enter":case" ":T!==null&&(x.preventDefault(),t.click(T));return;default:return}x.preventDefault(),t.setActive(P,"keyboard")},{via:f,node:p,setActive:k}=t;(0,q.useEffect)(()=>{if(f!=="touch"||!p)return;let x=T=>{p.contains(T.target)||k(null)};return document.addEventListener("pointerdown",x),()=>document.removeEventListener("pointerdown",x)},[f,p,k]);let w=t.active!==null?n[t.active]:null,g=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,v=g&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,C=typeof e.renderTip=="function"&&w?e.renderTip(w):null,b=e.announce??(t.via==="keyboard"&&w?`${w.label}${w.series?` ${w.series}`:""}: ${w.formatted??w.value??""} (${(t.active??0)+1}/${i})`:""),M;if(g){let x=g.x*v,T=t.width*v,P=`clamp(${(4-x).toFixed(1)}px, -50%, calc(${(T-x-4).toFixed(1)}px - 100%))`,E=g.y<64;M={position:"absolute",left:x,top:g.y*v,transform:`translate(${P}, ${E?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*v-8)}}let _=x=>{d.current=null,x.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},D=x=>x?T=>{let P=d.current??(d.current=T.currentTarget.getBoundingClientRect());P.width&&x((T.clientX-P.left)/P.width*t.width,(T.clientY-P.top)/P.height*t.height,T)}:void 0,L=D(e.onPointerMove),F=D(e.onPointerDown),R=L||F?x=>{x.pointerType==="touch"&&L?.(x),F?.(x)}:void 0,S=D(e.onPointerUp),$=Un(e.theme);return(0,I.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?h:void 0,onBlur:x=>{t.via==="keyboard"&&!x.currentTarget.contains(x.relatedTarget)&&t.setActive(null)},onPointerLeave:_,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"),...$,...e.style},children:[t.pending?null:e.underlay,(0,I.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${a}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:L,onPointerDown:R,onPointerUp:S,onPointerCancel:S,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,I.jsx)("title",{id:o,children:c}),(0,I.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,I.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,g?(0,I.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:M,children:C??(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:g.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:g.title}),g.rows.map((x,T)=>(0,I.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,I.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(x.strong?"ink":"muted")},children:[x.color?(0,I.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:x.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,x.label]}),(0,I.jsx)("span",{style:{fontWeight:x.strong===!1?500:700},children:x.value})]},T))]})}):null,(0,I.jsx)("span",{className:"ztd-sr",style:lt,"aria-live":"polite","aria-atomic":"true",children:b}),s&&!t.pending?u:null]})}function qo({label:e,events:t,t:n}){return(0,I.jsx)("div",{className:"ztd-sr",style:lt,children:(0,I.jsxs)("table",{children:[(0,I.jsx)("caption",{children:n.table(e)}),(0,I.jsxs)("tbody",{children:[t.slice(0,st).map((r,o)=>(0,I.jsxs)("tr",{children:[(0,I.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,I.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>st?(0,I.jsx)("tr",{children:(0,I.jsx)("td",{colSpan:2,children:n.more(t.length-st)})}):null]})]})})}function ze(e){let t=e.baseline??"central";return(0,I.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}),Z=y("label","string",!0,"Item name field"),K=y("value","number",!0,"Value field"),Jo=[Z,K],Zo=[Z,K],Qo=[y("label","string",!0,"Stage name"),y("value","number",!0,"Users at the stage")],ea=[Z,K],ta=[y("label","string",!0,"Leaf (lowest level) name"),K,y("group","string",!1,"Parent group field")],na=[y("label","string",!0,"Leaf name"),K,y("group","string",!1,"Parent group field")],ra=[Z,y("value","number",!0,"Change (total rows may omit it)"),y("type","string",!1,'"total" makes a total bar')],oa=[Z,K],aa=[y("x","string",!0,"Column field"),y("series","string",!0,"Stacked series field"),K],ia=[y("x","string",!0,"Column field"),y("y","string",!0,"Row field"),K],sa=[y("axis","string",!0,"Metric (axis) field"),y("value","number",!0,"Value field",{multi:!0}),y("series","string",!1,"Series field")],la=[y("x","number",!0,"x value"),y("y","number",!0,"y value"),y("size","number",!1,"Circle size"),y("label","string",!1,"Name")],Zn=y("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),ca=[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}),Zn],ua=[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}),Zn],ma=[y("x","any",!0,"x field"),y("y","number",!0,"y field",{multi:!0}),y("series","string",!1,"Series field")],da=[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})],fa=[Z,K],ha=[y("value","number",!0,"Value field",{prop:"valueKey"}),y("target","number",!1,"Target field",{prop:"targetKey"})],ga=[Z,y("value","number",!0,"Actual value field"),y("target","number",!1,"Target field")],pa=[y("x","any",!1,"x field"),y("y","number",!0,"y field")],ba=[Z,y("x","string",!1,"Period field (long tables)"),y("value","number",!1,"Value field (long tables)")],ya=[Z,y("start","number",!0,"Before value"),y("end","number",!0,"After value")],xa=[Z,K],ka=[y("value","number",!0,"Value field"),y("group","string",!1,"Group (row) field"),y("label","string",!1,"Dot name")],wa=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],va=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),K],$a=[y("source","string",!0,"Sending group"),y("target","string",!0,"Receiving group"),K],Ta=[y("date","date",!0,"Date field"),K],Ma=[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)")],Ca=[y("group","string",!0,"Group field"),y("value","number",!0,"Value field")],Sa=[y("label","string",!1,"Row name field")],Aa=[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")],Na=[Z,K],Ra=[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})],Fa=[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)")],_a=[y("region","string",!0,"Region name or code, matched to a tile of options.map"),K],Pa=[Z,K,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")],Da=[y("source","string",!0,"Source node"),y("target","string",!0,"Target node"),y("value","number",!1,"Link weight. Without it every row counts 1")],La=[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")],Ea=[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")],Oa=[y("region","string",!0,"Region name or code, matched to a region of options.map"),K],Ia=[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)")],za=[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")],Ba=[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")],Jn={pie:Jo,donut:Zo,funnel:Qo,waffle:ea,treemap:ta,sunburst:na,waterfall:ra,pareto:oa,marimekko:aa,heatmap:ia,radar:sa,bubble:la,line:ca,area:ua,stream:ma,bar:da,radialBar:fa,gauge:ha,bullet:ga,sparkline:pa,slope:ba,dumbbell:ya,lollipop:xa,beeswarm:ka,ridgeline:wa,sankey:va,chord:$a,calendar:Ta,bump:Ma,box:Ca,parallel:Sa,candlestick:Aa,segmented:Na,skyline:Ra,histogram:Fa,scatter:Ba,tileMap:_a,barRace:Pa,network:Da,timeline:La,tree:Ea,choropleth:Oa,symbolMap:Ia,flowMap:za},Ne={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 Qn(e,t){return t==="ko"?e.nameKo:e.name}function er(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var tr=["line","area","bar","scatter"],nr=24,Gt=["line","area","bar","scatter","timeline"];function Vt(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function rr(e,t,n){return Gt.includes(e)&&!Vt(e,t,n).length&&!(e==="scatter"&&ct(n))}function ct(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function or(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Ha={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",calendarHeatmap:"calendar","parallel-coordinates":"parallel",parallelCoordinates:"parallel",mekko:"marimekko",spider:"radar",ohlc:"candlestick",candle:"candlestick",stock:"candlestick",segment:"segmented",segmentedBar:"segmented",proportionBar:"segmented",stackedBar100:"segmented",hist:"histogram",tilemap:"tileMap",tileGrid:"tileMap",cartogram:"tileMap",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap"};function ut(e){let t=Jn[e]?e:Ha[e]??Object.keys(Ne).find(n=>n.toLowerCase()===e.toLowerCase()||Ne[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!Ne[t]))return{type:t,component:Ne[t].component,name:Ne[t].name,nameKo:Ne[t].nameKo,encoding:Jn[t]}}function ar(e){let t=new Set,n=a=>{Array.isArray(a)?a.forEach(n):typeof a=="string"&&a&&t.add(a)},r=e.encoding??{};for(let a of ut(e.type)?.encoding.map(i=>i.name)??Object.keys(r))n(r[a]);let o=e.options??{};for(let a of["dimensions","start","end","ranges"])n(o[a]);return[...t]}function ir(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function ja(e,t){if(e==null||typeof e!="object")return;let n=e;if(ir(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!ir(r,o))return;r=r[o]}return r}}function me(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 $e(e,t){if(typeof e=="function")return e;let n=e??t;return r=>ja(r,n)}function Re(e,t){let n=$e(e,t);return(r,o)=>me(n(r,o))}function Q(e,t){let n=$e(e,t);return(r,o)=>{let a=n(r,o);return a==null?"":a instanceof Date?new Date(a.getTime()-a.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(a)}}function ie(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Ga(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
23
+ `||c==="\r"))break;t.push(n?"":c)}let r=t.join(""),o=l=>r.split(l).length-1,a=[","," ",";","|"],i=",",s=0;for(let l of a){let c=o(l);c>s&&(s=c,i=l)}return i}var Va=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function sr(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(Va.test(t)||/^[-+]?\.\d+$/.test(t)){let n=me(t);if(Number.isFinite(n))return n}return t}function Te(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??Ga(o),i=[],s=[],l="",c=!1;for(let f=0;f<o.length;f++){let p=o[f];c?p==='"'?o[f+1]==='"'?(l+='"',f++):c=!1:l+=p:p==='"'&&!l.trim()?(c=!0,l=""):p===a?(s.push(l),l=""):p===`
24
24
  `||p==="\r"?(p==="\r"&&o[f+1]===`
25
- `&&f++,s.push(l),i.push(s),s=[],l=""):l+=p}(l!==""||s.length)&&(s.push(l),i.push(s));let m=i.filter(f=>!(f.length===1&&f[0].trim()===""));if(!m.length)return[];let u=f=>n?or(f):f;if(!r)return m.map(f=>Object.fromEntries(f.map((p,y)=>[String(y),u(p)])));let d=[],h=new Set;return m[0].forEach((f,p)=>{let y=f.trim()||`col${p+1}`,k=y;for(let g=2;h.has(k);g++)k=`${y}_${g}`;h.add(k),d.push(k)}),m.slice(1).map(f=>Object.fromEntries(d.map((p,y)=>[p,u(f[y]??"")])))}function jt(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((i,s)=>String(i??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(i=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof i[l]=="string"?or(i[l]):i[l]??null])))}function Fa(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,l)=>Object.fromEntries(a.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function ar(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 pe(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return pe(JSON.parse(t))}catch{}return we(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?jt(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)?pe(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?jt(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)?pe(t.rows):Array.isArray(t.values)?jt(t.values):Array.isArray(t.items)?pe(t.items):Array.isArray(t.results)?pe(t.results):Fa(t)}return[]}function ct(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=a=>{try{return JSON.stringify(a)}catch{return String(a)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let a=0;a<t;a+=r)o.push(e[a]);return o.push(e[t-1]),`${t}:${n(o)}`}function Vt(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(l,c)=>{let m=e[l][c];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let m=0,u=0;for(let d=0;d<n;d++){let h=i(d,c),f=h-i(d,c-1),p=0;for(let y=0;y<d;y++)p+=i(y,c)-i(y,c-1);m+=h,u+=(f/2+p)*h}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,d=0;for(let h=0;h<n;h++){let f=e[h][l],p=Number.isFinite(f)?f:0;p>=0?(o[h][l]=u,u+=p,a[h][l]=u):(o[h][l]=d,d+=p,a[h][l]=d)}continue}let c=0;for(let u=0;u<n;u++)c+=i(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let d=i(u,l);t==="expand"&&(d=c?d/c*100:0),o[u][l]=m,m+=d,a[u][l]=m}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,a[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let d=0;d<r;d++)o[u][d]-=m,a[u][d]-=m}return{y0:o,y1:a}}function ir(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 sr(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((d,h)=>{d>u&&(u=d,m=h)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),a=[],i=[],s=0,l=0;for(let c of o)s<l?(a.push(c),s+=r[c]):(i.push(c),l+=r[c]);return[...i.reverse(),...a]}var Na=Math.PI*2;function ut(e,t,n){return e<t?t:e>n?n:e}function Be(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function z(e){return Math.round(e*100)/100}function Wt(e,t,n,r,o){if(n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),n<=.01||r<=.01)return"";let a=typeof o=="number"?{tl:o,tr:o,br:o,bl:o}:o,i=Math.min(n,r)/2,s=ut(a.tl??0,0,i),l=ut(a.tr??0,0,i),c=ut(a.br??0,0,i),m=ut(a.bl??0,0,i);return`M${z(e+s)},${z(t)}H${z(e+n-l)}`+(l?`A${z(l)},${z(l)} 0 0 1 ${z(e+n)},${z(t+l)}`:"")+`V${z(t+r-c)}`+(c?`A${z(c)},${z(c)} 0 0 1 ${z(e+n-c)},${z(t+r)}`:"")+`H${z(e+m)}`+(m?`A${z(m)},${z(m)} 0 0 1 ${z(e)},${z(t+r-m)}`:"")+`V${z(t+s)}`+(s?`A${z(s)},${z(s)} 0 0 1 ${z(e+s)},${z(t)}`:"")+"Z"}function lr(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function ur(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function cr(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 mt=new Map;function de(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=mt.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);ur(c)?i+=cr(c):s+=cr(c)}a=i+s*(n>=600?1.07:1),mt.size>5e3&&mt.clear(),mt.set(o,a)}return a*t}function ze(e,t,n,r=400){if(e=e.trim(),de(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let l=a+i+1>>1;de(e.slice(0,l)+o,n,r)<=t?a=l:i=l-1}a>0&&(e.charCodeAt(a-1)&64512)===55296&&a--;let s=e.slice(0,a).trimEnd();return s.length<(ur(s.charCodeAt(0))?2:3)?"":s+o}var dr=F(I(),1),Ra=e=>Array.isArray(e)&&e.length===2;function mr(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Ra(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var hr=F(I(),1),Gt=10.5;function Pa(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let i=1;i<e.length;i++)o=Math.min(o,Math.abs(e[i]-e[i-1]));let a=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(i=>Ce(i,{locale:n,maximumFractionDigits:a}))}function fr(e,t,n){let r=18;for(let o of Pa(e,t,n))r=Math.max(r,de(o,Gt));return Math.ceil(r+8)}function Kt(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 Ne(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,l=Kt(i,n),c=[o,a];for(let m=0;m<4;m++){let u=Math.ceil(a/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-d<=l*.3?d:o-i*s,a===0?0:u-a<=l*.3?u:a+i*s];let h=Kt(c[1]-c[0],n);if(h===l)break;l=h}return c}function gr(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=Kt(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let l=s,c=0;l<=o+a*1e-9&&c<200;l+=a,c++)i.push(Number((Math.round(l/a)*a).toPrecision(12)));return i}function Ut(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(l=>o+(l-n)*i);return s.domain=e,s.range=t,s.invert=l=>i===0?n:n+(l-o)/i,s.ticks=(l=4)=>gr(n,r,l),s}function Xt(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[a,i]=Ne(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function Da(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(c,m=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let h of c){let f=Number((h*10**d).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&u.push(f)}return u},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let l=i([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:gr(e,t,3)}function pr(e,t){let n=Ut([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=()=>Da(e[0],e[1],Math.abs(t[1]-t[0])),r}function He(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 La=864e5;function br(e,t,n,r=X){let o=t-e;if(!(o>0))return[{t:e,label:Ie(e,{locale:r,month:"short",day:"numeric"})}];let a=o/La,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,d,h=!1)=>{let f=new Date(m),p=-1,y=0;for(;f.getTime()<=t&&y++<500;){if(f.getTime()>=e){let k=f.getFullYear(),g=h&&!l&&k!==p;i.push({t:f.getTime(),label:Ie(f,{locale:r,...d,...g?{year:"numeric"}:{}})}),p=k}u(f)}};if(a<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(h=>h>=m)??12,d=new Date(s);d.setMinutes(0,0,0),c(d,h=>h.setHours(h.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=a/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(h=>h>=u)??120;if(d>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(h,f=>f.setFullYear(f.getFullYear()+d/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%d;f&&h.setMonth(h.getMonth()+(d-f)),c(h,p=>p.setMonth(p.getMonth()+d),{month:"short"},!0)}}return i}function yr(e,t){let n=new Array(e),r=new Uint8Array(e),o=a=>{if(typeof a!="string"||a.length===0||a.length>9)return-1;let i=Number(a);return Number.isInteger(i)&&i>=0&&i<e&&String(i)===a?i:-1};return new Proxy(n,{get(a,i,s){let l=o(i);return l>=0?(r[l]||(a[l]=t(l),r[l]=1),a[l]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var Ea=(e,t,n)=>e==="date"?tt(t,n)?.getTime()??NaN:ue(t);function _a(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&zn(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 a=Se(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:Se(n,"y"),c=!i&&r!==void 0?Se(r,"series"):null,m=e.map((T,x)=>a(T,x)),u=o.xType??_a(m),d=o.locale??X,h,f,p;if(u==="band"){let T=m.map(C=>String(C??""));h=Fe(T);let x=new Map(h.map((C,D)=>[C,D]));f=h.map((C,D)=>D),p=Int32Array.from(T,C=>x.get(C)??-1)}else{let T=u==="date"?o.dayFirst??Hn(m):void 0,x=m.map(_=>Ea(u,_,T)),C=Array.from(new Set(x.filter(_=>Number.isFinite(_)))).sort((_,U)=>_-U),D=new Map(C.map((_,U)=>[_,U]));f=C,h=C.map(String),p=Int32Array.from(x,_=>D.get(_)??-1)}let y=o.dateFormat,k=T=>typeof T=="string"?et(T.trim())?.[3]:void 0,g=u==="date"&&m.length<5e3?k(m[0]):void 0,$=(g===2||g===3)&&m.every(T=>k(T)===g),v=$&&g===3;if(u==="date"&&!y){let T=f.length>1?f[f.length-1]-f[0]:0;y=$&&g===2||T>864e5*120?{month:"short"}:T<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},T>864e5*800&&(y={year:"numeric",month:"short"})}let b;if(u==="band")b=h;else if(v&&!o.dateFormat){let T=j(d)==="ko";b=f.map(x=>{let C=new Date(x),D=Math.floor(C.getMonth()/3)+1;return T?`${C.getFullYear()}년 ${D}분기`:`Q${D} ${C.getFullYear()}`})}else{let T=f.every(Lt),x=u==="date"?new Intl.DateTimeFormat(d,y):new Intl.NumberFormat(d,T?{useGrouping:!1}:{maximumFractionDigits:6});b=f.length>1e3?yr(f.length,C=>x.format(f[C])):f.map(C=>x.format(C))}let S=s?[...s]:c?Fe(e.map((T,x)=>String(c(T,x)??""))):[""],P=new Map(S.map((T,x)=>[T,x])),L=S.map(()=>new Array(h.length).fill(NaN)),E=S.map(()=>new Array(h.length).fill(null)),R=o.aggregate??"sum",N=R==="mean"?S.map(()=>new Uint32Array(h.length)):null,M=(T,x,C,D)=>{let _=L[T][x];R==="last"?L[T][x]=C:R==="count"?L[T][x]=(Number.isFinite(_)?_:0)+1:R==="mean"?Number.isFinite(C)&&(L[T][x]=(Number.isFinite(_)?_:0)+C,N[T][x]++):L[T][x]=Number.isFinite(_)?_+(Number.isFinite(C)?C:0):C,E[T][x]=D};for(let T=0;T<e.length;T++){let x=p[T];if(x<0)continue;let C=e[T];if(s)for(let D=0;D<s.length;D++)M(D,x,ue(C[s[D]]),C);else{let D=c?P.get(String(c(C,T)??""))??0:0;M(D,x,ue(l(C,T)),C)}}if(N)for(let T=0;T<L.length;T++)for(let x=0;x<h.length;x++)N[T][x]>1&&(L[T][x]/=N[T][x]);return{type:u,keys:h,xnum:f,labels:b,series:S,values:L,rows:E}}var Ia=140,We=12,xr=14,Yt=20,kr=12.5;function Oa(e,t,n=Qn){let r=me(t,t),o=new Map;e.forEach((i,s)=>{let l=r(i,s),c=o.get(l);c?c.push(i):o.set(l,[i])});let a=[...o.keys()].slice(0,n);return{values:a,groups:a.map(i=>o.get(i)),dropped:Math.max(0,o.size-n)}}function Ba(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+We)/(Ia+We))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function za(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*We)/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 Ve=e=>e.filter(Number.isFinite);function dt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Ae(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return Ve(n)}function wr(e,t,n,r,o,a){return je(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function Ha(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let b=t.flat(),S=r.refLines??{},[P,L]=He([...dt(b,r.x??"x"),...Ve([Number(S.x)])]),[E,R]=He([...dt(b,r.y??"y"),...Ve([Number(S.y)])].filter(M=>!s||M>0)),N=r.zero??!1;return{y:c??(s?Xt(E,R,i):Ne(E,R,i,{zero:N,pad:.08})),x:r.xDomain??Ne(P,L,Math.max(2,Math.round(o/110)),{zero:N,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",d=n[0]?.keys.join(""),h=n.every(b=>b.keys.join("")===d),f=n.length>0&&n.every(b=>b.type!=="band"&&b.type===n[0].type),p=r.xDomain??(!m&&f?He(n.flatMap(b=>Ve(b.xnum))):void 0),y=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(y==="percent")return{x:p,sameKeys:h};if(c)return{y:c,x:p,sameKeys:h};let k=[];t.forEach((b,S)=>{let P=n[S];if(y==="stacked"||y==="auto"&&P.series.length>1){let E=Vt(P.values,"zero");E.y0.forEach(R=>k.push(...R)),E.y1.forEach(R=>k.push(...R))}else P.values.forEach(E=>k.push(...E));m&&!u&&r.line!==void 0&&wr(e,b,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(E=>k.push(...E)),m||k.push(...dt(b,r.lower),...dt(b,r.upper))}),m&&k.push(0),u||k.push(...mr(r.annotations));for(let b of r.referenceLines??[])k.push(b.y);r.signColors&&k.push(Number(r.baseline??0));let[g,$]=He(Ve(k).filter(b=>!s||b>0));return{y:s?Xt(g,$,i):m?Ne(g,$,u?Math.max(2,Math.round(o/120)):i):Ne(g,$,i,{zero:r.zero??e==="area"}),x:p,sameKeys:h}}function ja(e,t,n,r,o,a,i,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}),c=(r.yScale==="log"&&e==="line"?pr:Ut)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),m=fr(c,_n(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(b=>b.series),d=r.endLabels??n.some(b=>b.series.length>1),h=m+6,f=a-(d?Math.min(a*.28,Math.max(...u.map(b=>de(b,11,700)),20)+14):10),p=l.keys.length,[y,k]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,g=l.type==="number"?p>12:p>br(y,k,Math.max(2,Math.floor((f-h)/64)),s).length;if(l.type==="band"||!p||g)return;let $=b=>h+(l.xnum[b]-y)/(k-y)*(f-h),v=b=>de(l.labels[b],Gt);for(let b=1;;b++){let S=Array.from({length:Math.ceil(p/b)},(P,L)=>L*b);if(b>=p||S.every((P,L)=>!L||$(P)-$(S[L-1])>=(v(P)+v(S[L-1]))/2+8))return S.map(P=>({value:l.xnum[P],label:l.labels[P]}))}}function Va(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 Wa(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${Va(`${e}|${t}|${o}|${ct(r)}`)}`}function Ga(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 Ka={en:{intro:(e,t)=>`${ge(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:"(빈 값)"}};function vr(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=Oa(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=Ba(s,i,e.columns),{pw:c,ph:m}=za(s,l,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(N=>wr(t,N,n,n.y,n.series,n.aggregate)),h=u?Ha(t,o,d,n,c,m):{sameKeys:!1},f=u?ja(t,o,d,n,h,c,m,e.locale):void 0,p=t==="bar"&&n.orientation==="horizontal",y=u&&(!p||h.sameKeys),k=u&&(p||h.x!==void 0||h.sameKeys),g=new Set(Ga(e.highlight,r)?[e.highlight].flat():[]),$=g.size>0,v=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,b=e.syncId??Wa(t,e.by,n,e.data),S=Qe(ke(n.format,e.locale),n.unit),P=Ka[e.lang],L=[],E=r.map(N=>N===""?P.blank:N);return{panels:r.map((N,M)=>{let T=o[M],x=E[M],C=M%l,D;if(t!=="scatter"){let U=d[M],ye=ce=>U.values.reduce((xe,ln)=>xe+(Number.isFinite(ln[ce])?ln[ce]:0),0),B=U.keys.map((ce,xe)=>xe).filter(ce=>U.values.some(xe=>Number.isFinite(xe[ce]))),Q=B[B.length-1];L.push({first:B.length?ye(B[0]):NaN,last:B.length?ye(Q):NaN,total:B.reduce((ce,xe)=>ce+ye(xe),0)}),t!=="bar"&&U.series.length===1&&Q!==void 0&&(D=S(U.values[0][Q]))}else L.push({first:NaN,last:NaN,total:T.length});let _={data:T,width:c,height:m,ariaLabel:e.title?`${e.title}, ${x}`:x,syncId:b,highlight:$?g.has(N)?v?()=>!0:void 0:"none":e.highlight,showYAxis:!y||C===0,showXAxis:!k||M+l>=i};return h.y&&(_.yDomain=h.y),h.x&&(_.xDomain=h.x),f&&(_.xTicks=f),{value:N,label:x,props:_,last:D,isPicked:g.has(N)}}),cols:l,pw:c,ph:m,isPanelPick:$,description:Ua(t,e.by,E,L,a,S,P)}}function Ua(e,t,n,r,o,a,i){let s=i.intro(n.length,t),l=c=>lr(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=i.endHigh(n[c],a(r[c].last)));let m=n.filter((u,d)=>r[d].last<r[d].first);s+=m.length?i.falling(`${m.slice(0,5).join(", ")}${m.length>5?i.more:""}`):i.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?i.total(n[c],a(r[c].total)):i.points(n[c],r[c].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var J=F(H(),1);function Xa(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Ya(e,t){let n=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=n*.5)}function Cr(e,t=!0){let[n,r]=(0,J.useState)({visible:!t,near:!t});return(0,J.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(i=>{let s=Ya(i[i.length-1],.25);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:Xa(.25),rootMargin:"0px 0px -8% 0px"}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),a.observe(e),()=>{o.disconnect(),a.disconnect()}},[e,t]),n}function $r(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function ft(e){let[t,n]=(0,J.useState)(null),[r,o]=(0,J.useState)(e??null),a=(0,J.useCallback)(i=>{n(i),i&&e===void 0&&o($r(i))},[e]);return ae(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>i($r(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?i(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var qa=()=>()=>{};function Re(){return(0,J.useSyncExternalStore)(qa,()=>!0,()=>!1)}var Tr="(prefers-reduced-motion: reduce)";function ht(e="auto"){let[t,n]=(0,J.useState)(()=>ee&&typeof window.matchMedia=="function"?window.matchMedia(Tr).matches:!1);return(0,J.useEffect)(()=>{if(e!=="auto"||!ee||typeof window.matchMedia!="function")return;let r=window.matchMedia(Tr),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var se=F(I(),1),Ja=60,Za=420;function Mr(e){let t=ne(),n=e.chartProps??{},[,r,o]=ft(e.width),a=e.width??(o||480),i=Y(e.locale??n.locale),s=j(i),l=(0,Pe.useContext)(ve),c=e.title??l,m=(0,Pe.useMemo)(()=>vr({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:a,height:e.height,title:c,locale:i,lang:s}),[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(y,k)=>typeof k=="function"?String(k):k),e.highlight,e.syncId,a,e.height,c,i,s]),u=`${(0,Pe.useId)().replace(/:/g,"")}fd`,d=ht(n.reducedMotion??"auto"),h=Re(),f=xn({motion:{enabled:n.animate!==!1&&!d&&ee},hydrated:h},{waiting:!1,generation:0}),p=e.chart;return(0,se.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":u,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,se.jsx)("p",{id:u,style:st,children:e.description??m.description}),(0,se.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${m.cols}, minmax(0, 1fr))`,columnGap:We,rowGap:xr},children:m.panels.map((y,k)=>{let g=t.paint(y.isPicked?"accentText":m.isPanelPick?"muted":"ink");return(0,se.jsxs)("div",{"data-facet":y.value,style:{minWidth:0,...yn(f,!1,"fade",k*Ja,Za)},children:[(0,se.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Yt,fontSize:kr,fontWeight:700,lineHeight:`${Yt}px`,color:g},children:[(0,se.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.label}),y.last!==void 0?(0,se.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:y.last}):null]}),(0,se.jsx)(p,{...n,...y.props})]},y.value)})})]})}function le(e,t,n,r,o="max"){let a=new Set,i=n.length,s=c=>{if(i&&c!=="none"){if(c==="first")a.add(0);else if(c==="last")a.add(i-1);else if(c==="max"||c==="min"){let m=-1,u=c==="max"?-1/0:1/0;r.forEach((d,h)=>{Number.isFinite(d)&&(c==="max"?d>u:d<u)&&(u=d,m=h)}),m>=0&&a.add(m)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((c,m)=>{m<i&&c!==null&&c!==void 0&&e(c,m)&&a.add(m)}),a;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<i&&a.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&a.add(u)});return a}var Z=F(H(),1);async function Qa(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",a=await e.text();if(t==="text")return a;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(a))throw new Error(j(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return we(a);if(t==="json"||o.includes("json"))return JSON.parse(a);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return we(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):we(a)}async function ei(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),a=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!a.ok)throw new Error(`HTTP ${a.status}${a.statusText?` ${a.statusText}`:""}`);r=await Qa(a,t.parse,o,t.locale)}return t.select&&(r=ar(r,t.select)),t.transform?t.transform(r):pe(r)}function Sr(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,Z.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,Z.useState)(0),c=Y(t.locale),m=(0,Z.useRef)(t);m.current={...t,locale:c};let u=(0,Z.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],f=JSON.stringify(h.map(k=>typeof k=="object"?JSON.stringify(k):String(k))),p=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{let k=u.current;if(!k||!r){i(v=>v.status==="loading"?{...v,status:"idle"}:v);return}let g=new AbortController,$=!0;return p.current=!0,i(v=>({...v,data:o?v.data:[],status:"loading",error:null})),ei(k,{...m.current,signal:g.signal}).then(v=>{$&&i({data:v,status:"success",error:null,updatedAt:Date.now()})}).catch(v=>{!$||g.signal.aborted||i(b=>({...b,status:"error",error:v instanceof Error?v:new Error(String(v))}))}).finally(()=>{$&&(p.current=!1)}),()=>{$=!1,p.current=!1,g.abort()}},[d,r,s,f,o]),(0,Z.useEffect)(()=>{if(!n||!r)return;let k=setInterval(()=>{p.current||l(g=>g+1)},n);return()=>clearInterval(k)},[n,r]);let y=(0,Z.useCallback)(()=>l(k=>k+1),[]);return{data:a.data,status:a.status,loading:a.status==="loading",error:a.error,empty:a.status==="success"&&a.data.length===0,updatedAt:a.updatedAt,reload:y}}var Jt=F(I(),1),ti=["csv","svg","png"],ni=/^[=+\-@\t\r\n=+-@]/,ri=/var\(|color-mix\(/;function Ar(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?In(e.getTime()):String(e);return`"${(ni.test(t)&&!Number.isFinite(ue(t))?`'${t}`:t).replace(/"/g,'""')}"`}function oi(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function ai(e,t){return`\uFEFF${[t.map(Ar),...e.map(r=>t.map(o=>Ar(r[o])))].map(r=>r.join(",")).join(`\r
25
+ `&&f++,s.push(l),i.push(s),s=[],l=""):l+=p}(l!==""||s.length)&&(s.push(l),i.push(s));let m=i.filter(f=>!(f.length===1&&f[0].trim()===""));if(!m.length)return[];let u=f=>n?sr(f):f;if(!r)return m.map(f=>Object.fromEntries(f.map((p,k)=>[String(k),u(p)])));let d=[],h=new Set;return m[0].forEach((f,p)=>{let k=f.trim()||`col${p+1}`,w=k;for(let g=2;h.has(w);g++)w=`${k}_${g}`;h.add(w),d.push(w)}),m.slice(1).map(f=>Object.fromEntries(d.map((p,k)=>[p,u(f[k]??"")])))}function Wt(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((i,s)=>String(i??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(i=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof i[l]=="string"?sr(i[l]):i[l]??null])))}function Wa(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,l)=>Object.fromEntries(a.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function lr(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 ye(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return ye(JSON.parse(t))}catch{}return Te(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Wt(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)?ye(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Wt(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)?ye(t.rows):Array.isArray(t.values)?Wt(t.values):Array.isArray(t.items)?ye(t.items):Array.isArray(t.results)?ye(t.results):Wa(t)}return[]}function mt(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=a=>{try{return JSON.stringify(a)}catch{return String(a)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let a=0;a<t;a+=r)o.push(e[a]);return o.push(e[t-1]),`${t}:${n(o)}`}function Kt(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(l,c)=>{let m=e[l][c];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let m=0,u=0;for(let d=0;d<n;d++){let h=i(d,c),f=h-i(d,c-1),p=0;for(let k=0;k<d;k++)p+=i(k,c)-i(k,c-1);m+=h,u+=(f/2+p)*h}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,d=0;for(let h=0;h<n;h++){let f=e[h][l],p=Number.isFinite(f)?f:0;p>=0?(o[h][l]=u,u+=p,a[h][l]=u):(o[h][l]=d,d+=p,a[h][l]=d)}continue}let c=0;for(let u=0;u<n;u++)c+=i(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let d=i(u,l);t==="expand"&&(d=c?d/c*100:0),o[u][l]=m,m+=d,a[u][l]=m}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,a[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let d=0;d<r;d++)o[u][d]-=m,a[u][d]-=m}return{y0:o,y1:a}}function cr(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 ur(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((d,h)=>{d>u&&(u=d,m=h)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),a=[],i=[],s=0,l=0;for(let c of o)s<l?(a.push(c),s+=r[c]):(i.push(c),l+=r[c]);return[...i.reverse(),...a]}var Ka=Math.PI*2;function dt(e,t,n){return e<t?t:e>n?n:e}function Be(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function H(e){return Math.round(e*100)/100}function Ut(e,t,n,r,o){if(n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),n<=.01||r<=.01)return"";let a=typeof o=="number"?{tl:o,tr:o,br:o,bl:o}:o,i=Math.min(n,r)/2,s=dt(a.tl??0,0,i),l=dt(a.tr??0,0,i),c=dt(a.br??0,0,i),m=dt(a.bl??0,0,i);return`M${H(e+s)},${H(t)}H${H(e+n-l)}`+(l?`A${H(l)},${H(l)} 0 0 1 ${H(e+n)},${H(t+l)}`:"")+`V${H(t+r-c)}`+(c?`A${H(c)},${H(c)} 0 0 1 ${H(e+n-c)},${H(t+r)}`:"")+`H${H(e+m)}`+(m?`A${H(m)},${H(m)} 0 0 1 ${H(e)},${H(t+r-m)}`:"")+`V${H(t+s)}`+(s?`A${H(s)},${H(s)} 0 0 1 ${H(e+s)},${H(t)}`:"")+"Z"}function mr(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function fr(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function dr(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 ft=new Map;function fe(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=ft.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);fr(c)?i+=dr(c):s+=dr(c)}a=i+s*(n>=600?1.07:1),ft.size>5e3&&ft.clear(),ft.set(o,a)}return a*t}function He(e,t,n,r=400){if(e=e.trim(),fe(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let l=a+i+1>>1;fe(e.slice(0,l)+o,n,r)<=t?a=l:i=l-1}a>0&&(e.charCodeAt(a-1)&64512)===55296&&a--;let s=e.slice(0,a).trimEnd();return s.length<(fr(s.charCodeAt(0))?2:3)?"":s+o}var gr=A(O(),1),Ua=e=>Array.isArray(e)&&e.length===2;function hr(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Ua(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var br=A(O(),1),Xt=10.5;function Xa(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let i=1;i<e.length;i++)o=Math.min(o,Math.abs(e[i]-e[i-1]));let a=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(i=>Ae(i,{locale:n,maximumFractionDigits:a}))}function pr(e,t,n){let r=18;for(let o of Xa(e,t,n))r=Math.max(r,fe(o,Xt));return Math.ceil(r+8)}function Yt(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 Fe(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,l=Yt(i,n),c=[o,a];for(let m=0;m<4;m++){let u=Math.ceil(a/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-d<=l*.3?d:o-i*s,a===0?0:u-a<=l*.3?u:a+i*s];let h=Yt(c[1]-c[0],n);if(h===l)break;l=h}return c}function yr(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=Yt(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let l=s,c=0;l<=o+a*1e-9&&c<200;l+=a,c++)i.push(Number((Math.round(l/a)*a).toPrecision(12)));return i}function qt(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(l=>o+(l-n)*i);return s.domain=e,s.range=t,s.invert=l=>i===0?n:n+(l-o)/i,s.ticks=(l=4)=>yr(n,r,l),s}function Jt(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[a,i]=Fe(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function Ya(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(c,m=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let h of c){let f=Number((h*10**d).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&u.push(f)}return u},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let l=i([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:yr(e,t,3)}function xr(e,t){let n=qt([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=()=>Ya(e[0],e[1],Math.abs(t[1]-t[0])),r}function je(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 qa=864e5;function kr(e,t,n,r=X){let o=t-e;if(!(o>0))return[{t:e,label:Ie(e,{locale:r,month:"short",day:"numeric"})}];let a=o/qa,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,d,h=!1)=>{let f=new Date(m),p=-1,k=0;for(;f.getTime()<=t&&k++<500;){if(f.getTime()>=e){let w=f.getFullYear(),g=h&&!l&&w!==p;i.push({t:f.getTime(),label:Ie(f,{locale:r,...d,...g?{year:"numeric"}:{}})}),p=w}u(f)}};if(a<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(h=>h>=m)??12,d=new Date(s);d.setMinutes(0,0,0),c(d,h=>h.setHours(h.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=a/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(h=>h>=u)??120;if(d>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(h,f=>f.setFullYear(f.getFullYear()+d/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%d;f&&h.setMonth(h.getMonth()+(d-f)),c(h,p=>p.setMonth(p.getMonth()+d),{month:"short"},!0)}}return i}function wr(e,t){let n=new Array(e),r=new Uint8Array(e),o=a=>{if(typeof a!="string"||a.length===0||a.length>9)return-1;let i=Number(a);return Number.isInteger(i)&&i>=0&&i<e&&String(i)===a?i:-1};return new Proxy(n,{get(a,i,s){let l=o(i);return l>=0?(r[l]||(a[l]=t(l),r[l]=1),a[l]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var Ja=(e,t,n)=>e==="date"?nt(t,n)?.getTime()??NaN:me(t);function Za(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Gn(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function Ge(e,t,n,r,o={}){let a=$e(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:$e(n,"y"),c=!i&&r!==void 0?$e(r,"series"):null,m=e.map(($,x)=>a($,x)),u=o.xType??Za(m),d=o.locale??X,h,f,p;if(u==="band"){let $=m.map(T=>String(T??""));h=ie($);let x=new Map(h.map((T,P)=>[T,P]));f=h.map((T,P)=>P),p=Int32Array.from($,T=>x.get(T)??-1)}else{let $=u==="date"?o.dayFirst??Vn(m):void 0,x=m.map(E=>Ja(u,E,$)),T=Array.from(new Set(x.filter(E=>Number.isFinite(E)))).sort((E,U)=>E-U),P=new Map(T.map((E,U)=>[E,U]));f=T,h=T.map(String),p=Int32Array.from(x,E=>P.get(E)??-1)}let k=o.dateFormat,w=$=>typeof $=="string"?tt($.trim())?.[3]:void 0,g=u==="date"&&m.length<5e3?w(m[0]):void 0,v=(g===2||g===3)&&m.every($=>w($)===g),C=v&&g===3;if(u==="date"&&!k){let $=f.length>1?f[f.length-1]-f[0]:0;k=v&&g===2||$>864e5*120?{month:"short"}:$<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},$>864e5*800&&(k={year:"numeric",month:"short"})}let b;if(u==="band")b=h;else if(C&&!o.dateFormat){let $=j(d)==="ko";b=f.map(x=>{let T=new Date(x),P=Math.floor(T.getMonth()/3)+1;return $?`${T.getFullYear()}년 ${P}분기`:`Q${P} ${T.getFullYear()}`})}else{let $=f.every(Ot),x=u==="date"?new Intl.DateTimeFormat(d,k):new Intl.NumberFormat(d,$?{useGrouping:!1}:{maximumFractionDigits:6});b=f.length>1e3?wr(f.length,T=>x.format(f[T])):f.map(T=>x.format(T))}let M=s?[...s]:c?ie(e.map(($,x)=>String(c($,x)??""))):[""],_=new Map(M.map(($,x)=>[$,x])),D=M.map(()=>new Array(h.length).fill(NaN)),L=M.map(()=>new Array(h.length).fill(null)),F=o.aggregate??"sum",R=F==="mean"?M.map(()=>new Uint32Array(h.length)):null,S=($,x,T,P)=>{let E=D[$][x];F==="last"?D[$][x]=T:F==="count"?D[$][x]=(Number.isFinite(E)?E:0)+1:F==="mean"?Number.isFinite(T)&&(D[$][x]=(Number.isFinite(E)?E:0)+T,R[$][x]++):D[$][x]=Number.isFinite(E)?E+(Number.isFinite(T)?T:0):T,L[$][x]=P};for(let $=0;$<e.length;$++){let x=p[$];if(x<0)continue;let T=e[$];if(s)for(let P=0;P<s.length;P++)S(P,x,me(T[s[P]]),T);else{let P=c?_.get(String(c(T,$)??""))??0:0;S(P,x,me(l(T,$)),T)}}if(R)for(let $=0;$<D.length;$++)for(let x=0;x<h.length;x++)R[$][x]>1&&(D[$][x]/=R[$][x]);return{type:u,keys:h,xnum:f,labels:b,series:M,values:D,rows:L}}var Qa=140,We=12,vr=14,Zt=20,$r=12.5;function ei(e,t,n=nr){let r=Q(t,t),o=new Map;e.forEach((i,s)=>{let l=r(i,s),c=o.get(l);c?c.push(i):o.set(l,[i])});let a=[...o.keys()].slice(0,n);return{values:a,groups:a.map(i=>o.get(i)),dropped:Math.max(0,o.size-n)}}function ti(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+We)/(Qa+We))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function ni(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*We)/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 Ve=e=>e.filter(Number.isFinite);function ht(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=Re(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return Ve(n)}function Tr(e,t,n,r,o,a){return Ge(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function ri(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let b=t.flat(),M=r.refLines??{},[_,D]=je([...ht(b,r.x??"x"),...Ve([Number(M.x)])]),[L,F]=je([...ht(b,r.y??"y"),...Ve([Number(M.y)])].filter(S=>!s||S>0)),R=r.zero??!1;return{y:c??(s?Jt(L,F,i):Fe(L,F,i,{zero:R,pad:.08})),x:r.xDomain??Fe(_,D,Math.max(2,Math.round(o/110)),{zero:R,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",d=n[0]?.keys.join(""),h=n.every(b=>b.keys.join("")===d),f=n.length>0&&n.every(b=>b.type!=="band"&&b.type===n[0].type),p=r.xDomain??(!m&&f?je(n.flatMap(b=>Ve(b.xnum))):void 0),k=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(k==="percent")return{x:p,sameKeys:h};if(c)return{y:c,x:p,sameKeys:h};let w=[];t.forEach((b,M)=>{let _=n[M];if(k==="stacked"||k==="auto"&&_.series.length>1){let L=Kt(_.values,"zero");L.y0.forEach(F=>w.push(...F)),L.y1.forEach(F=>w.push(...F))}else _.values.forEach(L=>w.push(...L));m&&!u&&r.line!==void 0&&Tr(e,b,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(L=>w.push(...L)),m||w.push(...ht(b,r.lower),...ht(b,r.upper))}),m&&w.push(0),u||w.push(...hr(r.annotations));for(let b of r.referenceLines??[])w.push(b.y);r.signColors&&w.push(Number(r.baseline??0));let[g,v]=je(Ve(w).filter(b=>!s||b>0));return{y:s?Jt(g,v,i):m?Fe(g,v,u?Math.max(2,Math.round(o/120)):i):Fe(g,v,i,{zero:r.zero??e==="area"}),x:p,sameKeys:h}}function oi(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=Ge(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?xr:qt)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),m=pr(c,zn(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(b=>b.series),d=r.endLabels??n.some(b=>b.series.length>1),h=m+6,f=a-(d?Math.min(a*.28,Math.max(...u.map(b=>fe(b,11,700)),20)+14):10),p=l.keys.length,[k,w]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,g=l.type==="number"?p>12:p>kr(k,w,Math.max(2,Math.floor((f-h)/64)),s).length;if(l.type==="band"||!p||g)return;let v=b=>h+(l.xnum[b]-k)/(w-k)*(f-h),C=b=>fe(l.labels[b],Xt);for(let b=1;;b++){let M=Array.from({length:Math.ceil(p/b)},(_,D)=>D*b);if(b>=p||M.every((_,D)=>!D||v(_)-v(M[D-1])>=(C(_)+C(M[D-1]))/2+8))return M.map(_=>({value:l.xnum[_],label:l.labels[_]}))}}function ai(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 ii(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${ai(`${e}|${t}|${o}|${mt(r)}`)}`}function si(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 li={en:{intro:(e,t)=>`${pe(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:"(빈 값)"}},Qt=18;function Mr(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=ei(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=ti(s,i,e.columns),{pw:c,ph:m}=ni(s,l,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(R=>Tr(t,R,n,n.y,n.series,n.aggregate)),h=u?ri(t,o,d,n,c,m):{sameKeys:!1},f=u?oi(t,o,d,n,h,c,m,e.locale):void 0,p=t==="bar"&&n.orientation==="horizontal",k=u&&(!p||h.sameKeys),w=u&&(p||h.x!==void 0||h.sameKeys),g=new Set(si(e.highlight,r)?[e.highlight].flat():[]),v=g.size>0,C=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,b=e.syncId??ii(t,e.by,n,e.data),M=et(ve(n.format,e.locale),n.unit),_=li[e.lang],D=[],L=r.map(R=>R===""?_.blank:R);return{panels:r.map((R,S)=>{let $=o[S],x=L[S],T=S%l,P;if(t!=="scatter"){let U=d[S],ke=de=>U.values.reduce((we,dn)=>we+(Number.isFinite(dn[de])?dn[de]:0),0),z=U.keys.map((de,we)=>we).filter(de=>U.values.some(we=>Number.isFinite(we[de]))),te=z[z.length-1];D.push({first:z.length?ke(z[0]):NaN,last:z.length?ke(te):NaN,total:z.reduce((de,we)=>de+ke(we),0)}),t!=="bar"&&U.series.length===1&&te!==void 0&&(P=M(U.values[0][te]))}else D.push({first:NaN,last:NaN,total:$.length});let E={data:$,width:c,height:m,ariaLabel:e.title?`${e.title}, ${x}`:x,syncId:b,highlight:v?g.has(R)?C?()=>!0:void 0:"none":e.highlight,showYAxis:!k||T===0,showXAxis:!w||S+l>=i};return h.y&&(E.yDomain=h.y),h.x&&(E.xDomain=h.x),f&&(E.xTicks=f),{value:R,label:x,props:E,last:P,isPicked:g.has(R)}}),cols:l,pw:c,ph:m,isPanelPick:v,description:ci(t,e.by,L,D,a,M,_)}}function ci(e,t,n,r,o,a,i){let s=i.intro(n.length,t),l=c=>mr(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=i.endHigh(n[c],a(r[c].last)));let m=n.filter((u,d)=>r[d].last<r[d].first);s+=m.length?i.falling(`${m.slice(0,5).join(", ")}${m.length>5?i.more:""}`):i.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?i.total(n[c],a(r[c].total)):i.points(n[c],r[c].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var J=A(B(),1);function ui(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function mi(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 gt={threshold:.25,enoughPx:96,rootMargin:"0px"};function Ar(e,t=!0){let[n,r]=(0,J.useState)({visible:!t,near:!t});return(0,J.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(i=>{let s=mi(i[i.length-1],gt.threshold,gt.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:ui(gt.threshold),rootMargin:gt.rootMargin}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),a.observe(e),()=>{o.disconnect(),a.disconnect()}},[e,t]),n}function Cr(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function pt(e){let[t,n]=(0,J.useState)(null),[r,o]=(0,J.useState)(e??null),a=(0,J.useCallback)(i=>{n(i),i&&e===void 0&&o(Cr(i))},[e]);return ue(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>i(Cr(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?i(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var di=()=>()=>{};function _e(){return(0,J.useSyncExternalStore)(di,()=>!0,()=>!1)}var Sr="(prefers-reduced-motion: reduce)";function bt(e="auto"){let[t,n]=(0,J.useState)(()=>ne&&typeof window.matchMedia=="function"?window.matchMedia(Sr).matches:!1);return(0,J.useEffect)(()=>{if(e!=="auto"||!ne||typeof window.matchMedia!="function")return;let r=window.matchMedia(Sr),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var se=A(O(),1),fi=60,hi=420;function Nr(e){let t=ae(),n=e.chartProps??{},[,r,o]=pt(e.width),a=e.width??(o||480),i=Y(e.locale??n.locale),s=j(i),l=(0,Pe.useContext)(Me),c=e.title??l,m=e.chart.facetPlan,u=(0,Pe.useMemo)(()=>{let w=Mr({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:a,height:e.height,title:c,locale:i,lang:s});return m?m(w,n,i):w},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(w,g)=>typeof g=="function"?String(g):g),e.highlight,e.syncId,a,e.height,c,i,s,m]),d=`${(0,Pe.useId)().replace(/:/g,"")}fd`,h=bt(n.reducedMotion??"auto"),f=_e(),p=$n({motion:{enabled:n.animate!==!1&&!h&&ne},hydrated:f},{waiting:!1,generation:0}),k=e.chart;return(0,se.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,se.jsx)("p",{id:d,style:lt,children:e.description??u.description}),(0,se.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:We,rowGap:vr,...u.legend?{marginTop:Qt}:null},children:u.panels.map((w,g)=>{let v=t.paint(w.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,se.jsxs)("div",{"data-facet":w.value,style:{minWidth:0,...vn(p,!1,"fade",g*fi,hi)},children:[(0,se.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Zt,fontSize:$r,fontWeight:700,lineHeight:`${Zt}px`,color:v},children:[(0,se.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:w.label}),w.last!==void 0?(0,se.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:w.last}):null]}),(0,se.jsx)(k,{...n,...w.props})]},w.value)})}),u.legend?(0,se.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Qt},children:u.legend}):null]})}var Rr=["max","min","first","last","none"];function le(e,t,n,r,o="max"){let a=new Set,i=n.length,s=c=>{if(i&&c!=="none"){if(c==="first")a.add(0);else if(c==="last")a.add(i-1);else if(c==="max"||c==="min"){let m=-1,u=c==="max"?-1/0:1/0;r.forEach((d,h)=>{Number.isFinite(d)&&(c==="max"?d>u:d<u)&&(u=d,m=h)}),m>=0&&a.add(m)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((c,m)=>{m<i&&c!==null&&c!==void 0&&e(c,m)&&a.add(m)}),a;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<i&&a.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&a.add(u)});return a}var ee=A(B(),1);async function gi(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",a=await e.text();if(t==="text")return a;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(a))throw new Error(j(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Te(a);if(t==="json"||o.includes("json"))return JSON.parse(a);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return Te(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):Te(a)}async function pi(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),a=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!a.ok)throw new Error(`HTTP ${a.status}${a.statusText?` ${a.statusText}`:""}`);r=await gi(a,t.parse,o,t.locale)}return t.select&&(r=lr(r,t.select)),t.transform?t.transform(r):ye(r)}function Fr(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,ee.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,ee.useState)(0),c=Y(t.locale),m=(0,ee.useRef)(t);m.current={...t,locale:c};let u=(0,ee.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],f=JSON.stringify(h.map(w=>typeof w=="object"?JSON.stringify(w):String(w))),p=(0,ee.useRef)(!1);(0,ee.useEffect)(()=>{let w=u.current;if(!w||!r){i(C=>C.status==="loading"?{...C,status:"idle"}:C);return}let g=new AbortController,v=!0;return p.current=!0,i(C=>({...C,data:o?C.data:[],status:"loading",error:null})),pi(w,{...m.current,signal:g.signal}).then(C=>{v&&i({data:C,status:"success",error:null,updatedAt:Date.now()})}).catch(C=>{!v||g.signal.aborted||i(b=>({...b,status:"error",error:C instanceof Error?C:new Error(String(C))}))}).finally(()=>{v&&(p.current=!1)}),()=>{v=!1,p.current=!1,g.abort()}},[d,r,s,f,o]),(0,ee.useEffect)(()=>{if(!n||!r)return;let w=setInterval(()=>{p.current||l(g=>g+1)},n);return()=>clearInterval(w)},[n,r]);let k=(0,ee.useCallback)(()=>l(w=>w+1),[]);return{data:a.data,status:a.status,loading:a.status==="loading",error:a.error,empty:a.status==="success"&&a.data.length===0,updatedAt:a.updatedAt,reload:k}}var tn=A(O(),1),bi=["csv","svg","png"],yi=/^[=+\-@\t\r\n=+-@]/,xi=/var\(|color-mix\(/;function _r(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?Bn(e.getTime()):String(e);return`"${(yi.test(t)&&!Number.isFinite(me(t))?`'${t}`:t).replace(/"/g,'""')}"`}function ki(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function wi(e,t){return`\uFEFF${[t.map(_r),...e.map(r=>t.map(o=>_r(r[o])))].map(r=>r.join(",")).join(`\r
26
26
  `)}\r
27
- `}function ii(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function qt(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Fr=2,be=16;function Nr(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,a,i,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${a}, ${i})`:`rgba(${o}, ${a}, ${i}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function Rr(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 Pr(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:a,height:i}=o.viewBox.baseVal,[s,l]=[a+be*2,i+be*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((f,p)=>{let y;for(let k of Array.from(f.attributes)){if(!ri.test(k.value))continue;let g=(y??(y=getComputedStyle(f))).getPropertyValue(k.name);g&&m[p].setAttribute(k.name,Nr(g,u))}}),c.removeAttribute("style");for(let[f,p]of Object.entries({viewBox:`${-be} ${-be} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(f,String(p));let d=Nr(getComputedStyle(r).backgroundColor,u),h=o.parentElement?.querySelector("canvas")??null;if(n){let f=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(Rr("rect",{x:-be,y:-be,width:s,height:l,fill:d}),f),h&&c.insertBefore(Rr("image",{href:h.toDataURL(),width:a,height:i}),f)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:a,vh:i,bg:d,canvas:h}}function si(e,t){let n=Pr(e,Fr,!1);if(!n)return;let r=Fr,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let a=o.getContext("2d");if(!a)return;a.fillStyle=n.bg,a.fillRect(0,0,o.width,o.height),n.canvas&&a.drawImage(n.canvas,be*r,be*r,n.vw*r,n.vh*r);let i=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{a.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(i),o.toBlob(l=>l&&qt(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Dr(e){let t=ne(e.theme),n=j(Y(e.locale))==="ko",r=ii(e.filename),o=(a,i)=>{if(a==="csv")return qt(new Blob([ai(e.data,e.columns?.length?e.columns:oi(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return si(i,r);let s=Pr(i,1,!0);s&&qt(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,Jt.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:ti.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,Jt.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(a,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:i},a)})})}var Er=F(I(),1);function Lr(e,t=X){let n=ke(void 0,t),r=e.split(`
28
- `),o=(a,i)=>{if(i==="label")return a.label;if(i==="value")return a.formatted??(a.value===null?null:n(a.value));if(i==="series")return a.series??null;let s=a.datum&&typeof a.datum=="object"?a.datum[i]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?Ie(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,c=s.replace(Bn,(m,u)=>o(a,u.trim())??(l=!0,""));l||i.push(c)}return i.length?i.map((s,l)=>(0,Er.jsx)("div",{children:s},l)):null}}function _r(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 we(t.csv)}return null}var Vr=F(H(),1);var G=F(H(),1);function Ir(e,t){let n=ne(e.theme),[r,o,a]=ft(e.width),i=Re(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=ht(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&ee,d=Cr(r,e.animateOnView!==!1&&u),h=Y(e.locale),f=j(h),p=(0,G.useMemo)(()=>ke(e.format,h,t.format),[e.format,h,t.format]),y=(0,G.useCallback)(B=>Ze(B,{locale:h}),[h]),k=(0,G.useMemo)(()=>Qe(p,e.unit),[p,e.unit]),g=(0,G.useMemo)(()=>ct(e.data),[e.data]),[$,v]=(0,G.useState)(null),[b,S]=(0,G.useState)(null),P=(0,G.useRef)([]),L=(0,G.useRef)(e.onHover);L.current=e.onHover;let E=(0,G.useRef)(e.onClick);E.current=e.onClick;let R=(0,G.useRef)(null),N=(0,G.useRef)(null),M=(0,G.useRef)(null),T=(0,G.useCallback)((B,Q="pointer")=>{if(M.current!==B){M.current=B;let ce=B===null?null:P.current[B]??null;queueMicrotask(()=>L.current?.(ce)),N.current?.(B)}R.current=B===null?null:Q,v(B),S(R.current)},[]),x=(0,G.useCallback)(B=>{R.current!=="keyboard"&&(R.current=B===null?null:"sync",v(B),S(R.current))},[]),C=(0,G.useCallback)(B=>{let Q=P.current[B];Q&&E.current?.(Q)},[]),D=Gn(e.replayKey),_=e.width!==void 0||(a??0)>0,U={enabled:u,active:d.visible&&_,near:d.near,replayKey:D,dataKey:g,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},ye=(0,G.useCallback)((B,Q=1)=>$===null||$===B?Q:Q*.38,[$]);return{p:n,width:s,height:c,measured:_,responsive:e.width===void 0,pending:ee&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:U,fv:k,fmt:p,pct:y,locale:h,lang:f,t:f==="ko"?wn:kn,active:$,via:b,setActive:T,click:C,events:P,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:ye,sig:g,description:e.description,reduced:m,publish:N,applySync:x}}var W=F(H(),1);function li(e){return 1-Math.pow(1-e,3)}function ci(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function ui(e){return e==="easeInOut"?ci:e==="linear"?t=>t:li}function mi(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 De(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),a=Math.floor(o),i=Math.min(e.length-1,a+1);n[r]=e[a]+(e[i]-e[a])*(o-a)}return n}function gt(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 Or(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 Br(e,t,n,r){if(!t||!n||t.length!==n.length)return De(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let l of De(s,n[i]))o.push(l)}return o.length===r?o:De(e,r)}var pt=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||!gt(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let a=t.from??t.to,i=t.enter??a;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:a.slice(),enter:i.slice(),exit:(t.exit??i).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),a=this.make(r,r.to,0,0);o&&(a.order=o.order),a.done=!0,a.progress=1,n.set(r.key,a)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let a=this.tracks.get(o.key),i=this.make(o,o.from??o.to,1/0,o.delay??0);a&&(i.order=a.order),r=Math.max(r,o.delay??0),n.set(o.key,i)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),Or(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=gt(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),l=r>0?Math.min(a*r,240):0;if(s){let c=i.to.length;s.from=Br(s.cur,s.parts,i.parts,c),s.vel=Br(s.curVel,s.parts,i.parts,c),s.parts=i.parts,s.to=i.to.slice(),Or(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=gt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(i,i.enter??i.from??i.to,n+l,0);c.done=gt(c.from,c.to),this.tracks.set(i.key,c)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=De(i.exit,i.cur.length),i.t0=n,i.exiting=!0,i.done=!1,i.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=ui(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=De(s.from,c)),s.vel.length!==c&&(s.vel=De(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-a*l),d=a*l>=8&&a*l<20,h=0;for(let f=0;f<c;f++){let p=s.from[f]-s.to[f],y=s.vel[f]+a*p;s.cur[f]=s.to[f]+(p+y*l)*u,s.curVel[f]=(s.vel[f]-a*y*l)*u,d&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/a)))}m=a*l>=20||d&&h<.15,s.progress=Math.min(1,1-(1+a*l)*u)}else{let u=Math.min(1,l/o),d=r(u),h=mi(this.easing,u)/o;for(let f=0;f<c;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*h;m=u>=1,s.progress=d}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&i.push(s.key)}else n=!0}for(let s of i)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Ge=new Set,bt=0;function zr(e){bt=0;let t=Array.from(Ge);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Ge.delete(n)}Ge.size&&typeof requestAnimationFrame<"u"&&(bt=requestAnimationFrame(zr))}function Hr(e){return Ge.add(e),!bt&&typeof requestAnimationFrame<"u"&&(bt=requestAnimationFrame(zr)),()=>{Ge.delete(e)}}function di(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 jr(e,t){let n=(0,W.useMemo)(()=>di(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,W.useRef)(null),d=(0,W.useRef)("init"),h=(0,W.useRef)(null),f=(0,W.useRef)(s),p=(0,W.useRef)(i),y=(0,W.useRef)(!1),k=(0,W.useRef)(0),[,g]=(0,W.useState)(0),$=(0,W.useRef)(null),v=(0,W.useRef)(!0);u.current||(u.current=new pt,u.current.configure(l,c),u.current.snap(n),h.current=n);let b=u.current;if(b.configure(l,c),h.current!==n){let N=d.current,M=!Object.is(f.current,s);b.sameTargets(n)?b.refreshData(n):!r||N==="init"?b.snap(n):N==="idle"?b.hold(n):N==="running"||M?b.update(n,Ye(),m):b.snap(n),h.current=n,f.current=s}let S=(0,W.useRef)(()=>!1);S.current=N=>{if(!v.current)return!1;let M=b.step(N);return!M&&d.current==="running"&&(d.current="done"),g(T=>(T+1)%1e9),M||($.current=null),M};let P=(0,W.useCallback)(()=>{if(!ee||$.current||!b.animating)return;let N=M=>S.current(M);$.current=Hr(N)},[b]);ae(()=>{let N=!Object.is(p.current,i);if(p.current=i,!r){(d.current!=="done"||b.animating)&&(b.snap(h.current??n),d.current="done",g(M=>M+1));return}d.current==="init"||N&&a?(b.hold(h.current??n),d.current="idle",y.current=!1,g(M=>M+1)):N&&(y.current=!0)},[r,i]),ae(()=>{!r||!a||!y.current||(y.current=!1,b.hold(h.current??n),d.current="idle",g(N=>N+1))},[a,r]),(0,W.useEffect)(()=>{r&&o&&d.current==="idle"&&(b.start(Ye()),k.current+=1,d.current="running",P(),g(N=>N+1))},[r,o,i,b,P]),(0,W.useEffect)(()=>{b.animating&&P()}),(0,W.useEffect)(()=>(v.current=!0,()=>{v.current=!1,$.current?.(),$.current=null}),[]);let L=Ye(),E=b.elapsed(L),R=r&&d.current==="idle";return{items:b.items(),get:N=>b.get(N),elapsed:R?0:E,fade:(N,M=320)=>R?0:Number.isFinite(E)?Math.max(0,Math.min(1,(E-N)/M)):1,waiting:R,animating:b.animating,generation:k.current}}var Zt=F(I(),1);function Wr(e,t,n,r,o){if(r)return o==="categorical"?ie(e,t,n):Nn(e,t,n);if(o==="categorical")return ie(e,t,n);let a=V(e,"strong"),i=V(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?i:a)}var fi=F(H(),1);var Qt=F(I(),1);var Gr=e=>e?"neutralStrong":"accent";var en=F(I(),1);function Kr(e,t,n,r){if(typeof e!="function")return le(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let l=o.get(r(i,s));l!==void 0&&e(i,s)&&a.add(l)}),a}var hi=F(H(),1);var nn=F(I(),1),gi={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}, ${ge(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Ur={en:gi,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}일 이동평균`}},tn=["ink","muted","dim"];function Xr(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,tn.length)}var pi=F(H(),1);var Qr=F(I(),1),bi={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${ge(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},yi={en:bi,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Yr=(e,t)=>yi[e].other(t);function qr(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((a,i)=>({v:a.value,i})).sort((a,i)=>i.v-a.v).slice(0,Math.floor(t)).map(a=>a.i)),o=e.filter((a,i)=>!r.has(i));return{kept:e.filter((a,i)=>r.has(i)),other:n(o.length,Be(o.map(a=>a.value)))}}var Jr=e=>Number.isFinite(e)&&e>0?e:0;function Zr(e,t,n,r){return r==="emphasis"?Fn(e,t,n):ie(e,t,n)}var xi=F(H(),1);var ro=F(I(),1);function eo(e,t){return t===!1?e.map((n,r)=>r):sr(e)}function to(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return le(e,t,t,r,"max")}function no(e,t,n){let r=new Array(t.length),o=t.filter(a=>!n.has(a));for(let a of t)n.has(a)&&(r[a]=V(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?V(e,"neutral"):Je(e,1-i/Math.max(1,o.length-1))),r}function oo(e,t,n,r){return e<=0||t<=0?1/0:Math.max(r*r*n/(e*e),e*e/(r*r*t))}function ao(e,t){let n=Be(e.map(u=>Math.max(0,u))),r=e.map(()=>({x:t.x,y:t.y,w:0,h:0}));if(n<=0||t.w<=0||t.h<=0)return r;let o=t.w*t.h/n,a=e.map((u,d)=>({v:Math.max(0,u)*o,i:d})).filter(u=>u.v>0),i=t.x,s=t.y,l=t.w,c=t.h,m=0;for(;m<a.length;){let u=Math.min(l,c),d=a[m].v,h=d,f=d,p=m+1;for(;p<a.length;){let y=a[p].v;if(oo(d+y,Math.min(h,y),Math.max(f,y),u)>oo(d,h,f,u))break;d+=y,h=Math.min(h,y),f=Math.max(f,y),p++}if(l>=c){let y=c>0?d/c:0,k=s;for(let g=m;g<p;g++){let $=y>0?a[g].v/y:0;r[a[g].i]={x:i,y:k,w:y,h:$},k+=$}i+=y,l-=y}else{let y=l>0?d/l:0,k=i;for(let g=m;g<p;g++){let $=y>0?a[g].v/y:0;r[a[g].i]={x:k,y:s,w:$,h:y},k+=$}s+=y,c-=y}m=p}return r}function io(e,t,n="All"){let r=me(t.label,"label"),o=Ae(t.value,"value"),a={id:"",label:n,value:0,depth:0,parent:null,children:[],datum:null,index:0},i=t.children??"children",s=e.some(m=>m&&typeof m=="object"&&Array.isArray(m[i])),l=(m,u,d)=>{let h=m.children.find(f=>f.label===u);return h||(h={id:m.id?`${m.id}/${u}`:u,label:u,value:0,depth:m.depth+1,parent:m,children:[],datum:d,index:m.children.length},m.children.push(h)),h};if(s){let m=(u,d)=>{d.forEach((h,f)=>{let p=h,y=l(u,r(p,f)||`#${f+1}`,p),k=h[i];Array.isArray(k)&&k.length?m(y,k):y.value+=Math.max(0,o(p,f)||0)})};m(a,e)}else{let m=t.group?me(t.group,"group"):null;e.forEach((u,d)=>{let h=a;if(t.path?.length)for(let p of t.path){let y=u[p];y==null||y===""||(h=l(h,String(y),null))}else if(m){let p=m(u,d);p&&(h=l(h,p,null))}let f=l(h,r(u,d)||`#${d+1}`,u);f.datum=u,f.value+=Math.max(0,o(u,d)||0)})}let c=m=>(m.children.length&&(m.value=Be(m.children.map(c))),m.value);return c(a),a}function rn(e){return e.children.length?e.children.flatMap(t=>rn(t)):[e]}function on(e){e.children.sort((t,n)=>n.value-t.value),e.children.forEach((t,n)=>{t.index=n,on(t)})}var xt=F(H(),1);var oe=F(I(),1),ki={kind:"Treemap",ofTotal:"% of total",desc:e=>`${ge(e,"item")}. Largest`},wi={en:ki,ko:{kind:"트리맵",ofTotal:"전체 대비",desc:e=>`${e}개 항목. 큰 항목`}},Le=3,yt=16;function an(e){let t=Ir(e,{height:g=>Math.max(180,Math.min(280,g*.58)),duration:700,stagger:45}),{p:n,width:r,height:o}=t,a=(0,xt.useMemo)(()=>{let g=io(e.data,{label:e.label,value:e.value,group:e.group,path:e.path,children:e.children});return e.sort!==!1&&on(g),g},[e.data,e.label,e.value,e.group,e.path,e.children,e.sort]),i=(0,xt.useMemo)(()=>{let g=a.value||1,$=a.children.some(R=>R.children.length>0),v=[],b=[],S=rn(a),P=le(e.highlight,S.map(R=>R.datum),S.map(R=>R.label),S.map(R=>R.value),"max"),L=new Set([...P].map(R=>S[R])),E=(R,N,M)=>{let T=R.children,x=ao(T.map(C=>C.value),N);T.forEach((C,D)=>{let _=x[D];if(C.children.length){let U=$&&_.h>yt+18&&_.w>40?yt:0;b.push({node:C,rect:_,pct:C.value/g*100});let ye={x:_.x,y:_.y+U,w:_.w,h:_.h-U};E(C,ye,M+1)}else v.push({i:S.indexOf(C),node:C,rect:_,hi:L.has(C),pct:C.value/g*100})})};return E(a,{x:0,y:0,w:r+Le,h:o+Le},0),v.sort((R,N)=>R.i-N.i),{cells:v,groups:b,total:g,lv:S}},[a,r,o,e.highlight]),s=t.motion.stagger??45,l=(0,xt.useMemo)(()=>i.cells.map((g,$)=>{let v=g.rect,b=Math.max(0,v.w-Le),S=Math.max(0,v.h-Le);return{key:`t:${g.node.id}`,to:[v.x,v.y,b,S,1],from:[v.x+b*.04,v.y+S*.04,b*.92,S*.92,0],enter:[v.x+b/2,v.y+S/2,0,0,0],delay:$*s,data:g}}),[i,s]),c=jr(l,t.motion),m=V(n,"neutral"),u=V(n,"accent"),d=e.labelMode??"both",h=i.cells.map(g=>({datum:g.node.datum,index:g.i,key:g.node.id,label:g.node.label,series:g.node.parent&&g.node.parent.depth>0?g.node.parent.label:void 0,value:g.node.value,formatted:`${t.fv(g.node.value)} · ${t.pct(g.pct)}`})),f=new Map(i.cells.map(g=>[g.i,g])),p=wi[t.lang],y=null;if(t.active!==null){let g=f.get(t.active);g&&(y={x:g.rect.x+(g.rect.w-Le)/2,y:g.rect.y+4,title:g.node.parent&&g.node.parent.depth>0?`${g.node.parent.label} › ${g.node.label}`:g.node.label,rows:[{label:t.t.value,value:t.fv(g.node.value),color:g.hi?u.fill:m.fill},{label:p.ofTotal,value:t.pct(g.pct)}]})}let k=e.description??`${p.kind}. ${p.desc(i.cells.length)}: ${[...i.cells].sort((g,$)=>$.node.value-g.node.value).slice(0,3).map(g=>`${g.node.label} ${t.pct(g.pct)}`).join(", ")}.`;return(0,oe.jsxs)(Un,{c:t,kind:p.kind,ariaLabel:e.ariaLabel,description:k,events:h,tip:y,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[i.groups.map((g,$)=>{if(!(g.rect.h>yt+18&&g.rect.w>40))return null;let b=`${g.node.label} ${t.pct(g.pct)}`;return(0,oe.jsx)(Oe,{x:g.rect.x+1,y:g.rect.y+yt/2-1,size:10.5,weight:500,fill:n.paint("muted"),opacity:c.fade($*s*2,300),children:ze(b,g.rect.w-Le-2,10.5)},g.node.id)}),c.items.map(g=>{let $=g.data,[v,b,S,P,L]=g.v,E=$.hi?u:m,R=$.node.label,N=t.pct($.pct),M=7,T=S>120&&P>60?12:11,x=d==="both"&&P>=T*2+16&&S>=Math.min(de(R,T,700),40)+M*2,C=P>=T+12&&S>=30,D=t.active===$.i;return(0,oe.jsxs)("g",{opacity:g.exiting?L*.6:t.dim($.i),className:"ztd-mark",onPointerEnter:_=>t.setActive($.i,_.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click($.i),style:{cursor:e.onClick?"pointer":void 0},children:[(0,oe.jsx)("path",{d:Wt(v,b,S,P,Math.min(n.theme.radiusMark+1,S/4,P/4)),fill:E.fill,opacity:L}),D&&t.via==="keyboard"?(0,oe.jsx)("path",{d:Wt(v+1,b+1,S-2,P-2,4),fill:"none",stroke:n.paint("ink"),strokeWidth:2}):null,d!=="none"&&t.showLabels&&C?(0,oe.jsxs)("g",{opacity:L*c.fade($.i*s+200,260),children:[d==="value"?(0,oe.jsx)(Oe,{x:v+M,y:b+M+T/2+1,size:T,weight:700,fill:E.text,children:N}):(0,oe.jsx)(Oe,{x:v+M,y:b+M+T/2+1,size:T,weight:700,fill:E.text,children:ze(R,S-M*2,T,700)}),x?(0,oe.jsx)(Oe,{x:v+M,y:b+M+T*1.7+2,size:T-.5,weight:500,fill:E.text,children:ze(N,S-M*2,T-.5)}):null]}):null]},g.key)})]})}var fe=F(I(),1);function so(e,t){let n=lt(e);return n?.type==="scatter"&&t?.size!==void 0?lt("bubble"):n}function vi(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 $i(e,t,n,r=!1){let o=so(e.type,e.encoding);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&zt.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(m.includes(o.type)){let u=me(a.label,"label"),d=Ae(a.value,"value"),h=o.type==="waffle",f=t.map((v,b)=>({r:v,label:u(v,b),value:h?d(v,b):Jr(d(v,b))})),{kept:p,other:y}=h?{kept:f,other:null}:qr(f,i.other,(v,b)=>({r:{},label:Yr(j(n),v),value:b})),k=le(s,p.map(v=>v.r),p.map(v=>v.label),p.map(v=>v.value),h?"first":"max"),g=y?[...p,y]:p,$=_e(v=>h?ie(v,g.length,k):Zr(v,g.length,k,i.colorMode));return g.map((v,b)=>({label:v.label,color:$[b]}))}if(o.type==="candlestick"){let u=Xr(Array.isArray(i.ma)?i.ma:void 0,t.length),d=Ur[j(n)];return[{label:d.up,color:i.upColor??"accent"},{label:d.down,color:i.downColor??"neutralStrong"},...u.map((h,f)=>({label:d.maLegend(h),color:tn[f],shape:"line"}))]}if(o.type==="scatter"){if(typeof a.series!="string")return[];let u=me(a.series,"series"),d=Fe(t.map((p,y)=>u(p,y)));if(d.length<2)return[];let h=Kr(s,t,d,u),f=_e(p=>An(p,d.length,h));return c(d.map((p,y)=>({label:p,color:f[y],shape:"circle"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(a.y))u=a.y;else if(typeof a.series=="string"){let $=me(a.series,"series");u=Fe(t.map((v,b)=>$(v,b)))}let d=Ht(o.type,a,i);if(d.length){let $=le(s,u,u,u.map(()=>0),"none"),v=_e(S=>ie(S,u.length,$)),b=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((S,P)=>({label:S,color:v[P]}));return[...c(b),...d.map((S,P)=>({label:S,color:Gr(P),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&i.layout==="diverging"&&s===void 0?ir(u.length,Array.isArray(i.negative)?i.negative.map($=>u.indexOf(String($))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,p=f>=0?new Set([f]):le(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map(($,v)=>({label:$,color:p.has(v)?"accent":"neutralStrong",shape:"square"})));let y=i.colorMode,k=$=>ie($,u.length,p);if((o.type==="line"||o.type==="area")&&(k=$=>Wr($,u.length,p,o.type==="area",y)),o.type==="stream"){let $=je(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),v=eo($.values,i.reorder),b=to(s,$.series,$.values);k=S=>no(S,v,b)}let g=_e(k);return c(u.map(($,v)=>({label:$,color:g[v],...o.type==="line"&&{shape:"line"}})))}return[]}function Ti(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Zn.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Ci(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:a,highlight:i,syncId:s,title:l,description:c}}function lo(e,t){let{spec:n}=e,r=so(n.type,n.encoding),o=(0,Ke.useMemo)(()=>_r(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=Jn(n,e.locale),s=Y(i),l=j(s),c=Sr(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),m=tr(n),u=(0,Ke.useMemo)(()=>m?Lr(m,s):void 0,[m,s]),d=n.options?.hidden,h=Array.isArray(d)?d.map(String):[],f=h.join(""),[p,y]=(0,Ke.useState)(null);if(!r)return(0,fe.jsx)(Bt,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let k=o??c.data,g=t[r.type],$={...n.options??{}},v={...vi(r,n.encoding),...$,...u?{tooltip:u}:{},data:k,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:i},b=n.card?.legend==="toggle"&&er(r.type,n.encoding??{},$),S=p&&p.base===f?p.hidden:h;b&&(v.hidden=S);let P=M=>y(T=>{let x=T&&T.base===f?T.hidden:h;return{base:f,hidden:x.includes(M)?x.filter(C=>C!==M):[...x,M]}}),L=v.height??220,E=Ti(n,r.type),R=a&&!k.length&&(c.loading||c.error||c.empty)?(0,fe.jsx)(Bt,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:L,locale:i}):E?(0,fe.jsx)(Mr,{chart:g,...Ci(r.type,E,v)}):(0,fe.jsx)(g,{...v});if(n.card){let M=n.card,T=M.legend==="auto"||M.legend==="toggle"?$i(n,k,s,b):M.legend,x=T?.length?b?(0,fe.jsx)(Ot,{items:T,hidden:S,onToggle:P,locale:i}):T:void 0,C=M.download?(0,fe.jsx)(Dr,{data:k,columns:nr(n),filename:M.title??r.type,formats:Array.isArray(M.download)?M.download:void 0,locale:i}):void 0;R=(0,fe.jsx)(Kn,{number:M.number,title:M.title??qn(r,l),subtitle:M.subtitle,legend:x,actions:C,source:M.source||void 0,note:M.note||void 0,accent:M.accent,takeaway:M.takeaway,level:M.level,sample:M.sample,replay:M.replay!==!1,className:e.className,locale:i,children:R})}let N=e.theme??n.theme;return N&&(R=(0,fe.jsx)(rt,{theme:N,children:R})),R}function Mi({cfg:e,components:t}){let n=Re();return lo({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function uo(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,co.hydrateRoot)(r,(0,sn.createElement)(rt,{theme:o.theme,cssVars:!0},(0,sn.createElement)(Mi,{cfg:o,components:{[e]:t}})))}uo("treemap",an);})();
27
+ `}function vi(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function en(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Pr=2,xe=16;function Dr(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,a,i,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${a}, ${i})`:`rgba(${o}, ${a}, ${i}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function Lr(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 Er(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:a,height:i}=o.viewBox.baseVal,[s,l]=[a+xe*2,i+xe*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((f,p)=>{let k;for(let w of Array.from(f.attributes)){if(!xi.test(w.value))continue;let g=(k??(k=getComputedStyle(f))).getPropertyValue(w.name);g&&m[p].setAttribute(w.name,Dr(g,u))}}),c.removeAttribute("style");for(let[f,p]of Object.entries({viewBox:`${-xe} ${-xe} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(f,String(p));let d=Dr(getComputedStyle(r).backgroundColor,u),h=o.parentElement?.querySelector("canvas")??null;if(n){let f=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(Lr("rect",{x:-xe,y:-xe,width:s,height:l,fill:d}),f),h&&c.insertBefore(Lr("image",{href:h.toDataURL(),width:a,height:i}),f)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:a,vh:i,bg:d,canvas:h}}function $i(e,t){let n=Er(e,Pr,!1);if(!n)return;let r=Pr,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let a=o.getContext("2d");if(!a)return;a.fillStyle=n.bg,a.fillRect(0,0,o.width,o.height),n.canvas&&a.drawImage(n.canvas,xe*r,xe*r,n.vw*r,n.vh*r);let i=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{a.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(i),o.toBlob(l=>l&&en(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Or(e){let t=ae(e.theme),n=j(Y(e.locale))==="ko",r=vi(e.filename),o=(a,i)=>{if(a==="csv")return en(new Blob([wi(e.data,e.columns?.length?e.columns:ki(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return $i(i,r);let s=Er(i,1,!0);s&&en(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,tn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:bi.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,tn.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(a,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:i},a)})})}var zr=A(O(),1);function Ir(e,t=X){let n=ve(void 0,t),r=e.split(`
28
+ `),o=(a,i)=>{if(i==="label")return a.label;if(i==="value")return a.formatted??(a.value===null?null:n(a.value));if(i==="series")return a.series??null;let s=a.datum&&typeof a.datum=="object"?a.datum[i]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?Ie(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,c=s.replace(jn,(m,u)=>o(a,u.trim())??(l=!0,""));l||i.push(c)}return i.length?i.map((s,l)=>(0,zr.jsx)("div",{children:s},l)):null}}function Br(e,t,n=!1){let r=Q(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),a=ie(o);if(!n)return a;let i=new Map;for(let s of o)i.set(s,(i.get(s)??0)+1);return a.map((s,l)=>[s,l]).sort((s,l)=>i.get(s[0])-i.get(l[0])||s[1]-l[1]).map(([s])=>s)}function Hr(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 Te(t.csv)}return null}var Xr=A(B(),1);var W=A(B(),1);function jr(e,t){let n=ae(e.theme),[r,o,a]=pt(e.width),i=_e(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=bt(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&ne,d=Ar(r,e.animateOnView!==!1&&u),h=Y(e.locale),f=j(h),p=(0,W.useMemo)(()=>ve(e.format,h,t.format),[e.format,h,t.format]),k=(0,W.useCallback)(z=>Qe(z,{locale:h}),[h]),w=(0,W.useMemo)(()=>et(p,e.unit),[p,e.unit]),g=(0,W.useMemo)(()=>mt(e.data),[e.data]),[v,C]=(0,W.useState)(null),[b,M]=(0,W.useState)(null),_=(0,W.useRef)([]),D=(0,W.useRef)(e.onHover);D.current=e.onHover;let L=(0,W.useRef)(e.onClick);L.current=e.onClick;let F=(0,W.useRef)(null),R=(0,W.useRef)(null),S=(0,W.useRef)(null),$=(0,W.useCallback)((z,te="pointer")=>{if(S.current!==z){S.current=z;let de=z===null?null:_.current[z]??null;queueMicrotask(()=>D.current?.(de)),R.current?.(z)}F.current=z===null?null:te,C(z),M(F.current)},[]),x=(0,W.useCallback)(z=>{F.current!=="keyboard"&&(F.current=z===null?null:"sync",C(z),M(F.current))},[]),T=(0,W.useCallback)(z=>{let te=_.current[z];te&&L.current?.(te)},[]),P=Xn(e.replayKey),E=e.width!==void 0||(a??0)>0,U={enabled:u,active:d.visible&&E,near:d.near,replayKey:P,dataKey:g,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},ke=(0,W.useCallback)((z,te=1)=>v===null||v===z?te:te*.38,[v]);return{p:n,width:s,height:c,measured:E,responsive:e.width===void 0,pending:ne&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:U,fv:w,fmt:p,pct:k,locale:h,lang:f,t:f==="ko"?Mn:Tn,active:v,via:b,setActive:$,click:T,events:_,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:ke,sig:g,description:e.description,reduced:m,publish:R,applySync:x}}var V=A(B(),1);function Ti(e){return 1-Math.pow(1-e,3)}function Mi(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Ci(e){return e==="easeInOut"?Mi:e==="linear"?t=>t:Ti}function Si(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 De(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),a=Math.floor(o),i=Math.min(e.length-1,a+1);n[r]=e[a]+(e[i]-e[a])*(o-a)}return n}function yt(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 Gr(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 Vr(e,t,n,r){if(!t||!n||t.length!==n.length)return De(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let l of De(s,n[i]))o.push(l)}return o.length===r?o:De(e,r)}var xt=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||!yt(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let a=t.from??t.to,i=t.enter??a;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:a.slice(),enter:i.slice(),exit:(t.exit??i).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),a=this.make(r,r.to,0,0);o&&(a.order=o.order),a.done=!0,a.progress=1,n.set(r.key,a)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let a=this.tracks.get(o.key),i=this.make(o,o.from??o.to,1/0,o.delay??0);a&&(i.order=a.order),r=Math.max(r,o.delay??0),n.set(o.key,i)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),Gr(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=yt(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),l=r>0?Math.min(a*r,240):0;if(s){let c=i.to.length;s.from=Vr(s.cur,s.parts,i.parts,c),s.vel=Vr(s.curVel,s.parts,i.parts,c),s.parts=i.parts,s.to=i.to.slice(),Gr(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=yt(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(i,i.enter??i.from??i.to,n+l,0);c.done=yt(c.from,c.to),this.tracks.set(i.key,c)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=De(i.exit,i.cur.length),i.t0=n,i.exiting=!0,i.done=!1,i.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=Ci(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=De(s.from,c)),s.vel.length!==c&&(s.vel=De(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-a*l),d=a*l>=8&&a*l<20,h=0;for(let f=0;f<c;f++){let p=s.from[f]-s.to[f],k=s.vel[f]+a*p;s.cur[f]=s.to[f]+(p+k*l)*u,s.curVel[f]=(s.vel[f]-a*k*l)*u,d&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/a)))}m=a*l>=20||d&&h<.15,s.progress=Math.min(1,1-(1+a*l)*u)}else{let u=Math.min(1,l/o),d=r(u),h=Si(this.easing,u)/o;for(let f=0;f<c;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*h;m=u>=1,s.progress=d}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&i.push(s.key)}else n=!0}for(let s of i)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Ke=new Set,kt=0;function Wr(e){kt=0;let t=Array.from(Ke);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Ke.delete(n)}Ke.size&&typeof requestAnimationFrame<"u"&&(kt=requestAnimationFrame(Wr))}function Kr(e){return Ke.add(e),!kt&&typeof requestAnimationFrame<"u"&&(kt=requestAnimationFrame(Wr)),()=>{Ke.delete(e)}}function Ai(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 Ur(e,t){let n=(0,V.useMemo)(()=>Ai(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,V.useRef)(null),d=(0,V.useRef)("init"),h=(0,V.useRef)(null),f=(0,V.useRef)(s),p=(0,V.useRef)(i),k=(0,V.useRef)(!1),w=(0,V.useRef)(0),[,g]=(0,V.useState)(0),v=(0,V.useRef)(null),C=(0,V.useRef)(!0);u.current||(u.current=new xt,u.current.configure(l,c),u.current.snap(n),h.current=n);let b=u.current;if(b.configure(l,c),h.current!==n){let R=d.current,S=!Object.is(f.current,s);b.sameTargets(n)?b.refreshData(n):!r||R==="init"?b.snap(n):R==="idle"?b.hold(n):R==="running"||S?b.update(n,qe(),m):b.snap(n),h.current=n,f.current=s}let M=(0,V.useRef)(()=>!1);M.current=R=>{if(!C.current)return!1;let S=b.step(R);return!S&&d.current==="running"&&(d.current="done"),g($=>($+1)%1e9),S||(v.current=null),S};let _=(0,V.useCallback)(()=>{if(!ne||v.current||!b.animating)return;let R=S=>M.current(S);v.current=Kr(R)},[b]);ue(()=>{let R=!Object.is(p.current,i);if(p.current=i,!r){(d.current!=="done"||b.animating)&&(b.snap(h.current??n),d.current="done",g(S=>S+1));return}d.current==="init"||R&&a?(b.hold(h.current??n),d.current="idle",k.current=!1,g(S=>S+1)):R&&(k.current=!0)},[r,i]),ue(()=>{!r||!a||!k.current||(k.current=!1,b.hold(h.current??n),d.current="idle",g(R=>R+1))},[a,r]),(0,V.useEffect)(()=>{r&&o&&d.current==="idle"&&(b.start(qe()),w.current+=1,d.current="running",_(),g(R=>R+1))},[r,o,i,b,_]),(0,V.useEffect)(()=>{b.animating&&_()}),(0,V.useEffect)(()=>(C.current=!0,()=>{C.current=!1,v.current?.(),v.current=null}),[]);let D=qe(),L=b.elapsed(D),F=r&&d.current==="idle";return{items:b.items(),get:R=>b.get(R),elapsed:F?0:L,fade:(R,S=320)=>F?0:Number.isFinite(L)?Math.max(0,Math.min(1,(L-R)/S)):1,waiting:F,animating:b.animating,generation:w.current}}var nn=A(O(),1);function Yr(e,t,n,r,o){if(r)return o==="categorical"?re(e,t,n):Pn(e,t,n);if(o==="categorical")return re(e,t,n);let a=G(e,"strong"),i=G(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?i:a)}var Ni=A(B(),1);var rn=A(O(),1);var qr=e=>e?"neutralStrong":"accent";var on=A(O(),1);function Jr(e,t,n,r){if(typeof e!="function")return le(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let l=o.get(r(i,s));l!==void 0&&e(i,s)&&a.add(l)}),a}var Ri=A(B(),1);var sn=A(O(),1),Fi={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}, ${pe(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Zr={en:Fi,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}일 이동평균`}},an=["ink","muted","dim"];function Qr(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,an.length)}var _i=A(B(),1);var oo=A(O(),1),Pi={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${pe(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Di={en:Pi,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},eo=(e,t)=>Di[e].other(t);function to(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((a,i)=>({v:a.value,i})).sort((a,i)=>i.v-a.v).slice(0,Math.floor(t)).map(a=>a.i)),o=e.filter((a,i)=>!r.has(i));return{kept:e.filter((a,i)=>r.has(i)),other:n(o.length,Be(o.map(a=>a.value)))}}var no=e=>Number.isFinite(e)&&e>0?e:0;function ro(e,t,n,r){return r==="emphasis"?_n(e,t,n):re(e,t,n)}var Li=A(B(),1);var lo=A(O(),1);function ao(e,t){return t===!1?e.map((n,r)=>r):ur(e)}function io(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return le(e,t,t,r,"max")}function so(e,t,n){let r=new Array(t.length),o=t.filter(a=>!n.has(a));for(let a of t)n.has(a)&&(r[a]=G(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?G(e,"neutral"):Ze(e,1-i/Math.max(1,o.length-1))),r}function co(e,t,n,r){return e<=0||t<=0?1/0:Math.max(r*r*n/(e*e),e*e/(r*r*t))}function uo(e,t){let n=Be(e.map(u=>Math.max(0,u))),r=e.map(()=>({x:t.x,y:t.y,w:0,h:0}));if(n<=0||t.w<=0||t.h<=0)return r;let o=t.w*t.h/n,a=e.map((u,d)=>({v:Math.max(0,u)*o,i:d})).filter(u=>u.v>0),i=t.x,s=t.y,l=t.w,c=t.h,m=0;for(;m<a.length;){let u=Math.min(l,c),d=a[m].v,h=d,f=d,p=m+1;for(;p<a.length;){let k=a[p].v;if(co(d+k,Math.min(h,k),Math.max(f,k),u)>co(d,h,f,u))break;d+=k,h=Math.min(h,k),f=Math.max(f,k),p++}if(l>=c){let k=c>0?d/c:0,w=s;for(let g=m;g<p;g++){let v=k>0?a[g].v/k:0;r[a[g].i]={x:i,y:w,w:k,h:v},w+=v}i+=k,l-=k}else{let k=l>0?d/l:0,w=i;for(let g=m;g<p;g++){let v=k>0?a[g].v/k:0;r[a[g].i]={x:w,y:s,w:v,h:k},w+=v}s+=k,c-=k}m=p}return r}function mo(e,t,n="All"){let r=Q(t.label,"label"),o=Re(t.value,"value"),a={id:"",label:n,value:0,depth:0,parent:null,children:[],datum:null,index:0},i=t.children??"children",s=e.some(m=>m&&typeof m=="object"&&Array.isArray(m[i])),l=(m,u,d)=>{let h=m.children.find(f=>f.label===u);return h||(h={id:m.id?`${m.id}/${u}`:u,label:u,value:0,depth:m.depth+1,parent:m,children:[],datum:d,index:m.children.length},m.children.push(h)),h};if(s){let m=(u,d)=>{d.forEach((h,f)=>{let p=h,k=l(u,r(p,f)||`#${f+1}`,p),w=h[i];Array.isArray(w)&&w.length?m(k,w):k.value+=Math.max(0,o(p,f)||0)})};m(a,e)}else{let m=t.group?Q(t.group,"group"):null;e.forEach((u,d)=>{let h=a;if(t.path?.length)for(let p of t.path){let k=u[p];k==null||k===""||(h=l(h,String(k),null))}else if(m){let p=m(u,d);p&&(h=l(h,p,null))}let f=l(h,r(u,d)||`#${d+1}`,u);f.datum=u,f.value+=Math.max(0,o(u,d)||0)})}let c=m=>(m.children.length&&(m.value=Be(m.children.map(c))),m.value);return c(a),a}function ln(e){return e.children.length?e.children.flatMap(t=>ln(t)):[e]}function cn(e){e.children.sort((t,n)=>n.value-t.value),e.children.forEach((t,n)=>{t.index=n,cn(t)})}function fo(e){return!e||typeof e!="object"||Array.isArray(e)?[]:ie(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function ho(e,t){return Oe(e,t+1,new Set)}var Ei=A(B(),1);var po=A(O(),1);function go(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Rr.includes(o)&&t.forEach((a,i)=>a===o&&r.add(i));return r}var vt=A(B(),1);var ce=A(O(),1),Oi={kind:"Treemap",ofTotal:"% of total",desc:e=>`${pe(e,"item")}. Largest`},Ii={en:Oi,ko:{kind:"트리맵",ofTotal:"전체 대비",desc:e=>`${e}개 항목. 큰 항목`}},Le=3,wt=16;function un(e){let t=jr(e,{height:g=>Math.max(180,Math.min(280,g*.58)),duration:700,stagger:45}),{p:n,width:r,height:o}=t,a=(0,vt.useMemo)(()=>{let g=mo(e.data,{label:e.label,value:e.value,group:e.group,path:e.path,children:e.children});return e.sort!==!1&&cn(g),g},[e.data,e.label,e.value,e.group,e.path,e.children,e.sort]),i=(0,vt.useMemo)(()=>{let g=a.value||1,v=a.children.some(F=>F.children.length>0),C=[],b=[],M=ln(a),_=le(e.highlight,M.map(F=>F.datum),M.map(F=>F.label),M.map(F=>F.value),"max"),D=new Set([..._].map(F=>M[F])),L=(F,R,S)=>{let $=F.children,x=uo($.map(T=>T.value),R);$.forEach((T,P)=>{let E=x[P];if(T.children.length){let U=v&&E.h>wt+18&&E.w>40?wt:0;b.push({node:T,rect:E,pct:T.value/g*100});let ke={x:E.x,y:E.y+U,w:E.w,h:E.h-U};L(T,ke,S+1)}else C.push({i:M.indexOf(T),node:T,rect:E,hi:D.has(T),pct:T.value/g*100})})};return L(a,{x:0,y:0,w:r+Le,h:o+Le},0),C.sort((F,R)=>F.i-R.i),{cells:C,groups:b,total:g,lv:M}},[a,r,o,e.highlight]),s=t.motion.stagger??45,l=(0,vt.useMemo)(()=>i.cells.map((g,v)=>{let C=g.rect,b=Math.max(0,C.w-Le),M=Math.max(0,C.h-Le);return{key:`t:${g.node.id}`,to:[C.x,C.y,b,M,1],from:[C.x+b*.04,C.y+M*.04,b*.92,M*.92,0],enter:[C.x+b/2,C.y+M/2,0,0,0],delay:v*s,data:g}}),[i,s]),c=Ur(l,t.motion),m=G(n,"neutral"),u=G(n,"accent"),d=e.labelMode??"both",h=i.cells.map(g=>({datum:g.node.datum,index:g.i,key:g.node.id,label:g.node.label,series:g.node.parent&&g.node.parent.depth>0?g.node.parent.label:void 0,value:g.node.value,formatted:`${t.fv(g.node.value)} · ${t.pct(g.pct)}`})),f=new Map(i.cells.map(g=>[g.i,g])),p=Ii[t.lang],k=null;if(t.active!==null){let g=f.get(t.active);g&&(k={x:g.rect.x+(g.rect.w-Le)/2,y:g.rect.y+4,title:g.node.parent&&g.node.parent.depth>0?`${g.node.parent.label} › ${g.node.label}`:g.node.label,rows:[{label:t.t.value,value:t.fv(g.node.value),color:g.hi?u.fill:m.fill},{label:p.ofTotal,value:t.pct(g.pct)}]})}let w=e.description??`${p.kind}. ${p.desc(i.cells.length)}: ${[...i.cells].sort((g,v)=>v.node.value-g.node.value).slice(0,3).map(g=>`${g.node.label} ${t.pct(g.pct)}`).join(", ")}.`;return(0,ce.jsxs)(qn,{c:t,kind:p.kind,ariaLabel:e.ariaLabel,description:w,events:h,tip:k,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[i.groups.map((g,v)=>{if(!(g.rect.h>wt+18&&g.rect.w>40))return null;let b=`${g.node.label} ${t.pct(g.pct)}`;return(0,ce.jsx)(ze,{x:g.rect.x+1,y:g.rect.y+wt/2-1,size:10.5,weight:500,fill:n.paint("muted"),opacity:c.fade(v*s*2,300),children:He(b,g.rect.w-Le-2,10.5)},g.node.id)}),c.items.map(g=>{let v=g.data,[C,b,M,_,D]=g.v,L=v.hi?u:m,F=v.node.label,R=t.pct(v.pct),S=7,$=M>120&&_>60?12:11,x=d==="both"&&_>=$*2+16&&M>=Math.min(fe(F,$,700),40)+S*2,T=_>=$+12&&M>=30,P=t.active===v.i;return(0,ce.jsxs)("g",{opacity:g.exiting?D*.6:t.dim(v.i),className:"ztd-mark",onPointerEnter:E=>t.setActive(v.i,E.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(v.i),style:{cursor:e.onClick?"pointer":void 0},children:[(0,ce.jsx)("path",{d:Ut(C,b,M,_,Math.min(n.theme.radiusMark+1,M/4,_/4)),fill:L.fill,opacity:D}),P&&t.via==="keyboard"?(0,ce.jsx)("path",{d:Ut(C+1,b+1,M-2,_-2,4),fill:"none",stroke:n.paint("ink"),strokeWidth:2}):null,d!=="none"&&t.showLabels&&T?(0,ce.jsxs)("g",{opacity:D*c.fade(v.i*s+200,260),children:[d==="value"?(0,ce.jsx)(ze,{x:C+S,y:b+S+$/2+1,size:$,weight:700,fill:L.text,children:R}):(0,ce.jsx)(ze,{x:C+S,y:b+S+$/2+1,size:$,weight:700,fill:L.text,children:He(F,M-S*2,$,700)}),x?(0,ce.jsx)(ze,{x:C+S,y:b+S+$*1.7+2,size:$-.5,weight:500,fill:L.text,children:He(R,M-S*2,$-.5)}):null]}):null]},g.key)})]})}var he=A(O(),1);function bo(e,t,n){let r=ut(e);return r?.type==="scatter"&&t?.size!==void 0&&!ct(n)?ut("bubble"):r}function zi(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 Bi(e,t,n,r=!1){let o=bo(e.type,e.encoding,e.options);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&Gt.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(m.includes(o.type)){let u=Q(a.label,"label"),d=Re(a.value,"value"),h=o.type==="waffle",f=t.map((b,M)=>({r:b,label:u(b,M),value:h?d(b,M):no(d(b,M))})),{kept:p,other:k}=h?{kept:f,other:null}:to(f,i.other,(b,M)=>({r:{},label:eo(j(n),b),value:M})),w=le(s,p.map(b=>b.r),p.map(b=>b.label),p.map(b=>b.value),h?"first":"max"),g=k?[...p,k]:p,v=be(b=>h?re(b,g.length,w):ro(b,g.length,w,i.colorMode)),C=h&&i.shape==="arc";return g.map((b,M)=>({label:b.label,color:v[M],...C&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Qr(Array.isArray(i.ma)?i.ma:void 0,t.length),d=Zr[j(n)];return[{label:d.up,color:i.upColor??"accent"},{label:d.down,color:i.downColor??"neutralStrong"},...u.map((h,f)=>({label:d.maLegend(h),color:an[f],shape:"line"}))]}if(o.type==="network"){let u=fo(i.groups);if(u.length<2)return[];let d=be(h=>ho(h,u.length));return u.map((h,f)=>({label:h,color:d[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof a.group!="string")return[];let u=Q(a.group,"group"),d=ie(t.map((f,p)=>u(f,p)).filter(Boolean));if(d.length<2)return[];let h=be(f=>Oe(f,d.length,new Set));return d.map((f,p)=>({label:f,color:h[p],shape:"circle"}))}if(o.type==="scatter"){if(typeof a.series!="string"||ct(i))return[];let u=Q(a.series,"series"),d=ie(t.map((p,k)=>u(p,k)));if(d.length<2)return[];let h=Jr(s,t,d,u),f=be(p=>Oe(p,d.length,h));return c(d.map((p,k)=>({label:p,color:f[k],shape:"circle"})))}if(o.type==="timeline"){let u=typeof a.group!="string",d=u?a.status:a.group;if(typeof d!="string")return[];let h=Br(t,d,u),f=be(p=>re(p,h.length,go(s,h)));return c(h.map((p,k)=>({label:p,color:f[k],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(a.y))u=a.y;else if(typeof a.series=="string"){let v=Q(a.series,"series");u=ie(t.map((C,b)=>v(C,b)))}let d=Vt(o.type,a,i);if(d.length){let v=le(s,u,u,u.map(()=>0),"none"),C=be(M=>re(M,u.length,v)),b=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((M,_)=>({label:M,color:C[_]}));return[...c(b),...d.map((M,_)=>({label:M,color:qr(_),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&i.layout==="diverging"&&s===void 0?cr(u.length,Array.isArray(i.negative)?i.negative.map(v=>u.indexOf(String(v))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,p=f>=0?new Set([f]):le(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((v,C)=>({label:v,color:p.has(C)?"accent":"neutralStrong",shape:"square"})));let k=i.colorMode,w=v=>re(v,u.length,p);if((o.type==="line"||o.type==="area")&&(w=v=>Yr(v,u.length,p,o.type==="area",k)),o.type==="stream"){let v=Ge(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),C=ao(v.values,i.reorder),b=io(s,v.series,v.values);w=M=>so(M,C,b)}let g=be(w);return c(u.map((v,C)=>({label:v,color:g[C],...o.type==="line"&&{shape:"line"}})))}return[]}function Hi(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&tr.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function ji(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:a,highlight:i,syncId:s,title:l,description:c}}function yo(e,t){let{spec:n}=e,r=bo(n.type,n.encoding,n.options),o=(0,Ue.useMemo)(()=>Hr(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=er(n,e.locale),s=Y(i),l=j(s),c=Fr(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),m=or(n),u=(0,Ue.useMemo)(()=>m?Ir(m,s):void 0,[m,s]),d=n.options?.hidden,h=Array.isArray(d)?d.map(String):[],f=h.join(""),[p,k]=(0,Ue.useState)(null);if(!r)return(0,he.jsx)(jt,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let w=o??c.data,g=t[r.type],v={...n.options??{}},C={...zi(r,n.encoding),...v,...u?{tooltip:u}:{},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:i},b=n.card?.legend==="toggle"&&rr(r.type,n.encoding??{},v),M=p&&p.base===f?p.hidden:h;b&&(C.hidden=M);let _=S=>k($=>{let x=$&&$.base===f?$.hidden:h;return{base:f,hidden:x.includes(S)?x.filter(T=>T!==S):[...x,S]}}),D=C.height??220,L=Hi(n,r.type),F=a&&!w.length&&(c.loading||c.error||c.empty)?(0,he.jsx)(jt,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:D,locale:i}):L?(0,he.jsx)(Nr,{chart:g,...ji(r.type,L,C)}):(0,he.jsx)(g,{...C});if(n.card){let S=n.card,$=S.legend==="auto"||S.legend==="toggle"?Bi(n,w,s,b):S.legend,x=$?.length?b?(0,he.jsx)(Ht,{items:$,hidden:M,onToggle:_,locale:i}):$:void 0,T=S.download?(0,he.jsx)(Or,{data:w,columns:ar(n),filename:S.title??r.type,formats:Array.isArray(S.download)?S.download:void 0,locale:i}):void 0;F=(0,he.jsx)(Yn,{number:S.number,title:S.title??Qn(r,l),subtitle:S.subtitle,legend:x,actions:T,source:S.source||void 0,note:S.note||void 0,accent:S.accent,takeaway:S.takeaway,level:S.level,sample:S.sample,replay:S.replay!==!1,className:e.className,locale:i,children:F})}let R=e.theme??n.theme;return R&&(F=(0,he.jsx)(ot,{theme:R,children:F})),F}function Gi({cfg:e,components:t}){let n=_e();return yo({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function ko(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,xo.hydrateRoot)(r,(0,mn.createElement)(ot,{theme:o.theme,cssVars:!0},(0,mn.createElement)(Gi,{cfg:o,components:{[e]:t}})))}ko("treemap",un);})();