ztd-charts-cli 0.10.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/api.js +1 -1
  2. package/dist/{chunk-QVGOP3IE.js → chunk-JTT5G6KW.js} +1 -1
  3. package/dist/cli.js +1 -1
  4. package/dist/client/area.js +6 -6
  5. package/dist/client/bar.js +5 -5
  6. package/dist/client/barRace.js +2 -2
  7. package/dist/client/beeswarm.js +2 -2
  8. package/dist/client/box.js +6 -6
  9. package/dist/client/bubble.js +6 -6
  10. package/dist/client/bullet.js +5 -5
  11. package/dist/client/bump.js +6 -6
  12. package/dist/client/calendar.js +5 -5
  13. package/dist/client/candlestick.js +4 -4
  14. package/dist/client/chord.js +5 -5
  15. package/dist/client/choropleth.js +5 -5
  16. package/dist/client/donut.js +6 -6
  17. package/dist/client/dumbbell.js +2 -2
  18. package/dist/client/flowMap.js +4 -4
  19. package/dist/client/funnel.js +2 -2
  20. package/dist/client/gauge.js +2 -2
  21. package/dist/client/heatmap.js +5 -5
  22. package/dist/client/histogram.js +5 -5
  23. package/dist/client/line.js +6 -6
  24. package/dist/client/lollipop.js +5 -5
  25. package/dist/client/marimekko.js +6 -6
  26. package/dist/client/network.js +5 -5
  27. package/dist/client/parallel.js +6 -6
  28. package/dist/client/pareto.js +5 -5
  29. package/dist/client/pie.js +6 -6
  30. package/dist/client/radar.js +6 -6
  31. package/dist/client/radialBar.js +2 -2
  32. package/dist/client/ridgeline.js +4 -4
  33. package/dist/client/sankey.js +4 -4
  34. package/dist/client/scatter.js +6 -6
  35. package/dist/client/segmented.js +2 -2
  36. package/dist/client/skyline.js +2 -2
  37. package/dist/client/slope.js +5 -5
  38. package/dist/client/sparkline.js +6 -6
  39. package/dist/client/stream.js +6 -6
  40. package/dist/client/sunburst.js +2 -2
  41. package/dist/client/symbolMap.js +5 -5
  42. package/dist/client/tileMap.js +6 -6
  43. package/dist/client/timeline.js +10 -10
  44. package/dist/client/tree.js +5 -5
  45. package/dist/client/treemap.js +2 -2
  46. package/dist/client/waffle.js +5 -5
  47. package/dist/client/waterfall.js +5 -5
  48. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- (()=>{var uo=Object.create;var on=Object.defineProperty;var mo=Object.getOwnPropertyDescriptor;var fo=Object.getOwnPropertyNames;var ho=Object.getPrototypeOf,go=Object.prototype.hasOwnProperty;var yt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var po=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of fo(t))!go.call(e,o)&&o!==n&&on(e,o,{get:()=>t[o],enumerable:!(r=mo(t,o))||r.enumerable});return e};var C=(e,t,n)=>(n=e!=null?uo(ho(e)):{},po(t||!e||!e.__esModule?on(n,"default",{value:e,enumerable:!0}):n,e));var H=yt((Li,an)=>{an.exports=globalThis.__ztdReact.react});var ln=yt((Ei,sn)=>{sn.exports=globalThis.__ztdReact["react-dom/client"]});var L=yt((Ji,On)=>{On.exports=globalThis.__ztdReact["react/jsx-runtime"]});var nn=C(H(),1),lo=C(ln(),1);var We=C(H(),1);var ot=C(H(),1);var cn=C(H(),1),Ce=(0,cn.createContext)(void 0);var fn=C(H(),1);var bo=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],un='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',mn='"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",accent2:"#FF8CC1",accent3:"#38C6F6",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:un,monoFamily:mn,radius:18,radiusCode:14,radiusMark:4},xt={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",accent2:"#D8488C",accent3:"#659815",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:un,monoFamily:mn,radius:18,radiusCode:14,radiusMark:4},kt={dark:he,light:xt};function Ke(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function wt(e){let t={};for(let n of bo){let r=e[n];typeof r=="string"&&(t[Ke(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 vt(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 yo=`
1
+ (()=>{var uo=Object.create;var on=Object.defineProperty;var mo=Object.getOwnPropertyDescriptor;var fo=Object.getOwnPropertyNames;var ho=Object.getPrototypeOf,go=Object.prototype.hasOwnProperty;var yt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var po=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of fo(t))!go.call(e,o)&&o!==n&&on(e,o,{get:()=>t[o],enumerable:!(r=mo(t,o))||r.enumerable});return e};var C=(e,t,n)=>(n=e!=null?uo(ho(e)):{},po(t||!e||!e.__esModule?on(n,"default",{value:e,enumerable:!0}):n,e));var H=yt((Ei,an)=>{an.exports=globalThis.__ztdReact.react});var ln=yt((Oi,sn)=>{sn.exports=globalThis.__ztdReact["react-dom/client"]});var L=yt((qi,On)=>{On.exports=globalThis.__ztdReact["react/jsx-runtime"]});var nn=C(H(),1),lo=C(ln(),1);var We=C(H(),1);var ot=C(H(),1);var cn=C(H(),1),Ce=(0,cn.createContext)(void 0);var fn=C(H(),1);var bo=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],un='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',mn='"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",accent2:"#FF8CC1",accent3:"#38C6F6",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:un,monoFamily:mn,radius:18,radiusCode:14,radiusMark:4},xt={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",accent2:"#D8488C",accent3:"#659815",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:un,monoFamily:mn,radius:18,radiusCode:14,radiusMark:4},kt={dark:he,light:xt};function Ke(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function wt(e){let t={};for(let n of bo){let r=e[n];typeof r=="string"&&(t[Ke(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 vt(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 yo=`
2
2
  .ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
3
3
  .ztd-root:focus{outline:none}
4
4
  .ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${he.accent});outline-offset:3px;border-radius:6px}
@@ -25,4 +25,4 @@
25
25
  `&&f++,s.push(l),a.push(s),s=[],l=""):l+=b}(l!==""||s.length)&&(s.push(l),a.push(s));let d=a.filter(f=>!(f.length===1&&f[0].trim()===""));if(!d.length)return[];let u=f=>n?Qn(f):f;if(!r)return d.map(f=>Object.fromEntries(f.map((b,v)=>[String(v),u(b)])));let m=[],h=new Set;return d[0].forEach((f,b)=>{let v=f.trim()||`col${b+1}`,k=v;for(let T=2;h.has(k);T++)k=`${v}_${T}`;h.add(k),m.push(k)}),d.slice(1).map(f=>Object.fromEntries(m.map((b,v)=>[b,u(f[v]??"")])))}function Bt(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((a,s)=>String(a??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(a=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof a[l]=="string"?Qn(a[l]):a[l]??null])))}function La(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(i=>Array.isArray(i))){let i=Object.keys(e),a=Math.max(...o.map(s=>s.length));return Array.from({length:a},(s,l)=>Object.fromEntries(i.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([i,a])=>({[n]:i,[r]:a}))}function er(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 Te(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Bt(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)?Bt(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)?Bt(t.values):Array.isArray(t.items)?pe(t.items):Array.isArray(t.results)?pe(t.results):La(t)}return[]}function ct(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=i=>{try{return JSON.stringify(i)}catch{return String(i)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let i=0;i<t;i+=r)o.push(e[i]);return o.push(e[t-1]),`${t}:${n(o)}`}function Ht(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),i=e.map(()=>new Array(r).fill(0)),a=(l,c)=>{let d=e[l][c];return Number.isFinite(d)&&d>0?d:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let d=0,u=0;for(let m=0;m<n;m++){let h=a(m,c),f=h-a(m,c-1),b=0;for(let v=0;v<m;v++)b+=a(v,c)-a(v,c-1);d+=h,u+=(f/2+b)*h}d&&(l-=u/d),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,m=0;for(let h=0;h<n;h++){let f=e[h][l],b=Number.isFinite(f)?f:0;b>=0?(o[h][l]=u,u+=b,i[h][l]=u):(o[h][l]=m,m+=b,i[h][l]=m)}continue}let c=0;for(let u=0;u<n;u++)c+=a(u,l);let d=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let m=a(u,l);t==="expand"&&(m=c?m/c*100:0),o[u][l]=d,d+=m,i[u][l]=d}}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,i[n-1]?.[u]??0);let d=0;for(let u=0;u<r;u++)d+=((o[0]?.[u]??0)+(i[n-1]?.[u]??0))/2;d/=r;for(let u=0;u<n;u++)for(let m=0;m<r;m++)o[u][m]-=d,i[u][m]-=d}return{y0:o,y1:i}}function tr(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 nr(e){let t=e.length,n=e.map(c=>{let d=0,u=-1/0;return c.forEach((m,h)=>{m>u&&(u=m,d=h)}),d}),r=e.map(c=>c.reduce((d,u)=>d+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,d)=>d).sort((c,d)=>n[c]-n[d]),i=[],a=[],s=0,l=0;for(let c of o)s<l?(i.push(c),s+=r[c]):(a.push(c),l+=r[c]);return[...a.reverse(),...i]}var Ea=Math.PI*2;function rr(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function or(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function ir(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function ar(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 ut=new Map;function ee(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,i=ut.get(o);if(i===void 0){let a=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);ir(c)?a+=ar(c):s+=ar(c)}i=a+s*(n>=600?1.07:1),ut.size>5e3&&ut.clear(),ut.set(o,i)}return i*t}function jt(e,t,n,r=400){if(e=e.trim(),ee(e,n,r)<=t)return e;let o="…",i=0,a=e.length;for(;i<a;){let l=i+a+1>>1;ee(e.slice(0,l)+o,n,r)<=t?i=l:a=l-1}i>0&&(e.charCodeAt(i-1)&64512)===55296&&i--;let s=e.slice(0,i).trimEnd();return s.length<(ir(s.charCodeAt(0))?2:3)?"":s+o}var lr=C(L(),1),Oa=e=>Array.isArray(e)&&e.length===2;function sr(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Oa(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var ur=C(L(),1),ze=10.5;function Ia(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let a=1;a<e.length;a++)o=Math.min(o,Math.abs(e[a]-e[a-1]));let i=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(a=>Re(a,{locale:n,maximumFractionDigits:i}))}function cr(e,t,n){let r=18;for(let o of Ia(e,t,n))r=Math.max(r,ee(o,ze));return Math.ceil(r+8)}function Gt(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 be(e,t,n=4,r={}){let o=e,i=t;if(!Number.isFinite(o)||!Number.isFinite(i))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),i<0&&(i=0)),o===i)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let a=i-o,s=r.pad??.07,l=Gt(a,n),c=[o,i];for(let d=0;d<4;d++){let u=Math.ceil(i/l-1e-9)*l,m=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-m<=l*.3?m:o-a*s,i===0?0:u-i<=l*.3?u:i+a*s];let h=Gt(c[1]-c[0],n);if(h===l)break;l=h}return c}function mr(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),i=Gt(o-r,n),a=[],s=Math.ceil(r/i-1e-9)*i;for(let l=s,c=0;l<=o+i*1e-9&&c<200;l+=i,c++)a.push(Number((Math.round(l/i)*i).toPrecision(12)));return a}function Be(e,t){let[n,r]=e,[o,i]=t,a=r===n?0:(i-o)/(r-n),s=(l=>o+(l-n)*a);return s.domain=e,s.range=t,s.invert=l=>a===0?n:n+(l-o)/a,s.ticks=(l=4)=>mr(n,r,l),s}function Vt(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[i,a]=be(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**i,10**a]}function za(e,t,n){let r=Math.log10(e),o=Math.log10(t),i=n/Math.max(1e-9,o-r),a=(c,d=1)=>{let u=[];for(let m=Math.floor(r);m<=Math.ceil(o);m++)if(!(m%d))for(let h of c){let f=Number((h*10**m).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&u.push(f)}return u},s=i>=110?a([1,2,5]):a([1],Math.max(1,Math.ceil(24/i)));if(s.length>=2)return s;let l=a([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:mr(e,t,3)}function dr(e,t){let n=Be([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=()=>za(e[0],e[1],Math.abs(t[1]-t[0])),r}function Me(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 Ba=864e5;function fr(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 i=o/Ba,a=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(d,u,m,h=!1)=>{let f=new Date(d),b=-1,v=0;for(;f.getTime()<=t&&v++<500;){if(f.getTime()>=e){let k=f.getFullYear(),T=h&&!l&&k!==b;a.push({t:f.getTime(),label:Ie(f,{locale:r,...m,...T?{year:"numeric"}:{}})}),b=k}u(f)}};if(i<=1.5){let d=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(h=>h>=d)??12,m=new Date(s);m.setMinutes(0,0,0),c(m,h=>h.setHours(h.getHours()+u),{hour:"numeric"})}else if(i<=n*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(d,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(i<=n*7*1.2){let d=new Date(s.getFullYear(),s.getMonth(),s.getDate());d.setDate(d.getDate()+(8-d.getDay())%7),c(d,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let d=i/30.44,u=Math.max(1,Math.ceil(d/Math.max(1,n))),m=[1,2,3,6,12,24,60].find(h=>h>=u)??120;if(m>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(h,f=>f.setFullYear(f.getFullYear()+m/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%m;f&&h.setMonth(h.getMonth()+(m-f)),c(h,b=>b.setMonth(b.getMonth()+m),{month:"short"},!0)}}return a}function hr(e,t){let n=new Array(e),r=new Uint8Array(e),o=i=>{if(typeof i!="string"||i.length===0||i.length>9)return-1;let a=Number(i);return Number.isInteger(a)&&a>=0&&a<e&&String(a)===i?a:-1};return new Proxy(n,{get(i,a,s){let l=o(a);return l>=0?(r[l]||(i[l]=t(l),r[l]=1),i[l]):Reflect.get(i,a,s)},has(i,a){return o(a)>=0||Reflect.has(i,a)}})}var Ha=(e,t,n)=>e==="date"?et(t,n)?.getTime()??NaN:me(t);function ja(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Ln(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function He(e,t,n,r,o={}){let i=ve(t,"x"),a=Array.isArray(n),s=a?n:null,l=a?null:ve(n,"y"),c=!a&&r!==void 0?ve(r,"series"):null,d=e.map((w,x)=>i(w,x)),u=o.xType??ja(d),m=o.locale??X,h,f,b;if(u==="band"){let w=d.map($=>String($??""));h=se(w);let x=new Map(h.map(($,_)=>[$,_]));f=h.map(($,_)=>_),b=Int32Array.from(w,$=>x.get($)??-1)}else{let w=u==="date"?o.dayFirst??En(d):void 0,x=d.map(A=>Ha(u,A,w)),$=Array.from(new Set(x.filter(A=>Number.isFinite(A)))).sort((A,I)=>A-I),_=new Map($.map((A,I)=>[A,I]));f=$,h=$.map(String),b=Int32Array.from(x,A=>_.get(A)??-1)}let v=o.dateFormat,k=w=>typeof w=="string"?Qe(w.trim())?.[3]:void 0,T=u==="date"&&d.length<5e3?k(d[0]):void 0,M=(T===2||T===3)&&d.every(w=>k(w)===T),R=M&&T===3;if(u==="date"&&!v){let w=f.length>1?f[f.length-1]-f[0]:0;v=M&&T===2||w>864e5*120?{month:"short"}:w<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},w>864e5*800&&(v={year:"numeric",month:"short"})}let y;if(u==="band")y=h;else if(R&&!o.dateFormat){let w=j(m)==="ko";y=f.map(x=>{let $=new Date(x),_=Math.floor($.getMonth()/3)+1;return w?`${$.getFullYear()}년 ${_}분기`:`Q${_} ${$.getFullYear()}`})}else{let w=f.every(_t),x=u==="date"?new Intl.DateTimeFormat(m,v):new Intl.NumberFormat(m,w?{useGrouping:!1}:{maximumFractionDigits:6});y=f.length>1e3?hr(f.length,$=>x.format(f[$])):f.map($=>x.format($))}let N=s?[...s]:c?se(e.map((w,x)=>String(c(w,x)??""))):[""],P=new Map(N.map((w,x)=>[w,x])),D=N.map(()=>new Array(h.length).fill(NaN)),O=N.map(()=>new Array(h.length).fill(null)),E=o.aggregate??"sum",F=E==="mean"?N.map(()=>new Uint32Array(h.length)):null,p=(w,x,$,_)=>{let A=D[w][x];E==="last"?D[w][x]=$:E==="count"?D[w][x]=(Number.isFinite(A)?A:0)+1:E==="mean"?Number.isFinite($)&&(D[w][x]=(Number.isFinite(A)?A:0)+$,F[w][x]++):D[w][x]=Number.isFinite(A)?A+(Number.isFinite($)?$:0):$,O[w][x]=_};for(let w=0;w<e.length;w++){let x=b[w];if(x<0)continue;let $=e[w];if(s)for(let _=0;_<s.length;_++)p(_,x,me($[s[_]]),$);else{let _=c?P.get(String(c($,w)??""))??0:0;p(_,x,me(l($,w)),$)}}if(F)for(let w=0;w<D.length;w++)for(let x=0;x<h.length;x++)F[w][x]>1&&(D[w][x]/=F[w][x]);return{type:u,keys:h,xnum:f,labels:y,series:N,values:D,rows:O}}var Ga=140,Ge=12,gr=14,Wt=20,pr=12.5;function Va(e,t,n=Xn){let r=ie(t,t),o=new Map;e.forEach((a,s)=>{let l=r(a,s),c=o.get(l);c?c.push(a):o.set(l,[a])});let i=[...o.keys()].slice(0,n);return{values:i,groups:i.map(a=>o.get(a)),dropped:Math.max(0,o.size-n)}}function Wa(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+Ge)/(Ga+Ge))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function Ka(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*Ge)/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 je=e=>e.filter(Number.isFinite);function mt(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=$e(r,String(r));e.forEach((i,a)=>n.push(o(i,a)))}return je(n)}function br(e,t,n,r,o,i){return He(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:i,dayFirst:n.dayFirst})}function Ua(e,t,n,r,o,i){let a=Math.max(2,Math.round(i/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let y=t.flat(),N=r.refLines??{},[P,D]=Me([...mt(y,r.x??"x"),...je([Number(N.x)])]),[O,E]=Me([...mt(y,r.y??"y"),...je([Number(N.y)])].filter(p=>!s||p>0)),F=r.zero??!1;return{y:c??(s?Vt(O,E,a):be(O,E,a,{zero:F,pad:.08})),x:r.xDomain??be(P,D,Math.max(2,Math.round(o/110)),{zero:F,pad:.06}),sameKeys:!0}}let d=e==="bar",u=d&&r.orientation==="horizontal",m=n[0]?.keys.join(""),h=n.every(y=>y.keys.join("")===m),f=n.length>0&&n.every(y=>y.type!=="band"&&y.type===n[0].type),b=r.xDomain??(!d&&f?Me(n.flatMap(y=>je(y.xnum))):void 0),v=d?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(v==="percent")return{x:b,sameKeys:h};if(c)return{y:c,x:b,sameKeys:h};let k=[];t.forEach((y,N)=>{let P=n[N];if(v==="stacked"||v==="auto"&&P.series.length>1){let O=Ht(P.values,"zero");O.y0.forEach(E=>k.push(...E)),O.y1.forEach(E=>k.push(...E))}else P.values.forEach(O=>k.push(...O));d&&!u&&r.line!==void 0&&br(e,y,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(O=>k.push(...O)),d||k.push(...mt(y,r.lower),...mt(y,r.upper))}),d&&k.push(0),u||k.push(...sr(r.annotations));for(let y of r.referenceLines??[])k.push(y.y);r.signColors&&k.push(Number(r.baseline??0));let[T,M]=Me(je(k).filter(y=>!s||y>0));return{y:s?Vt(T,M,a):d?be(T,M,u?Math.max(2,Math.round(o/120)):a):be(T,M,a,{zero:r.zero??e==="area"}),x:b,sameKeys:h}}function Xa(e,t,n,r,o,i,a,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=He(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?dr:Be)(o.y,[a-22,10]).ticks(Math.max(2,Math.round(a/70))),d=cr(c,Fn(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(y=>y.series),m=r.endLabels??n.some(y=>y.series.length>1),h=d+6,f=i-(m?Math.min(i*.28,Math.max(...u.map(y=>ee(y,11,700)),20)+14):10),b=l.keys.length,[v,k]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,T=l.type==="number"?b>12:b>fr(v,k,Math.max(2,Math.floor((f-h)/64)),s).length;if(l.type==="band"||!b||T)return;let M=y=>h+(l.xnum[y]-v)/(k-v)*(f-h),R=y=>ee(l.labels[y],ze);for(let y=1;;y++){let N=Array.from({length:Math.ceil(b/y)},(P,D)=>D*y);if(y>=b||N.every((P,D)=>!D||M(P)-M(N[D-1])>=(R(P)+R(N[D-1]))/2+8))return N.map(P=>({value:l.xnum[P],label:l.labels[P]}))}}function Ya(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 Ja(e,t,n,r){let o=[n.x,n.y,n.series].map(i=>JSON.stringify(i??null)).join("|");return`ztd-facet-${Ya(`${e}|${t}|${o}|${ct(r)}`)}`}function qa(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 Za={en:{intro:(e,t)=>`${Se(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:"(빈 값)"}},Kt=18;function yr(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:i}=Va(e.data,e.by),a=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=Wa(s,a,e.columns),{pw:c,ph:d}=Ka(s,l,e.height),u=e.scale!=="free",m=t==="scatter"?[]:o.map(F=>br(t,F,n,n.y,n.series,n.aggregate)),h=u?Ua(t,o,m,n,c,d):{sameKeys:!1},f=u?Xa(t,o,m,n,h,c,d,e.locale):void 0,b=t==="bar"&&n.orientation==="horizontal",v=u&&(!b||h.sameKeys),k=u&&(b||h.x!==void 0||h.sameKeys),T=new Set(qa(e.highlight,r)?[e.highlight].flat():[]),M=T.size>0,R=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,y=e.syncId??Ja(t,e.by,n,e.data),N=Ze(we(n.format,e.locale),n.unit),P=Za[e.lang],D=[],O=r.map(F=>F===""?P.blank:F);return{panels:r.map((F,p)=>{let w=o[p],x=O[p],$=p%l,_;if(t!=="scatter"){let I=m[p],xe=de=>I.values.reduce((ke,rn)=>ke+(Number.isFinite(rn[de])?rn[de]:0),0),B=I.keys.map((de,ke)=>ke).filter(de=>I.values.some(ke=>Number.isFinite(ke[de]))),Y=B[B.length-1];D.push({first:B.length?xe(B[0]):NaN,last:B.length?xe(Y):NaN,total:B.reduce((de,ke)=>de+xe(ke),0)}),t!=="bar"&&I.series.length===1&&Y!==void 0&&(_=N(I.values[0][Y]))}else D.push({first:NaN,last:NaN,total:w.length});let A={data:w,width:c,height:d,ariaLabel:e.title?`${e.title}, ${x}`:x,syncId:y,highlight:M?T.has(F)?R?()=>!0:void 0:"none":e.highlight,showYAxis:!v||$===0,showXAxis:!k||p+l>=a};return h.y&&(A.yDomain=h.y),h.x&&(A.xDomain=h.x),f&&(A.xTicks=f),{value:F,label:x,props:A,last:_,isPicked:T.has(F)}}),cols:l,pw:c,ph:d,isPanelPick:M,description:Qa(t,e.by,O,D,i,N,P)}}function Qa(e,t,n,r,o,i,a){let s=a.intro(n.length,t),l=c=>or(r.map(d=>d[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=a.endHigh(n[c],i(r[c].last)));let d=n.filter((u,m)=>r[m].last<r[m].first);s+=d.length?a.falling(`${d.slice(0,5).join(", ")}${d.length>5?a.more:""}`):a.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?a.total(n[c],i(r[c].total)):a.points(n[c],r[c].total))}return o&&(s+=a.dropped(n.length,n.length+o)),s}var Z=C(H(),1);function ei(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function ti(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 dt={threshold:.25,enoughPx:96,rootMargin:"0px"};function wr(e,t=!0){let[n,r]=(0,Z.useState)({visible:!t,near:!t});return(0,Z.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(a=>{let s=ti(a[a.length-1],dt.threshold,dt.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:ei(dt.threshold),rootMargin:dt.rootMargin}),i=new IntersectionObserver(a=>{let s=a[a.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),i.observe(e),()=>{o.disconnect(),i.disconnect()}},[e,t]),n}function xr(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function ft(e){let[t,n]=(0,Z.useState)(null),[r,o]=(0,Z.useState)(e??null),i=(0,Z.useCallback)(a=>{n(a),a&&e===void 0&&o(xr(a))},[e]);return ue(()=>{if(e!==void 0){o(e);return}if(!t)return;let a=c=>o(d=>d!==null&&Math.abs(d-c)<.5?d:c),s=()=>a(xr(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let d=c[c.length-1]?.contentRect;d?a(d.width>0?Math.round(d.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,i,r]}var ni=()=>()=>{};function Pe(){return(0,Z.useSyncExternalStore)(ni,()=>!0,()=>!1)}var kr="(prefers-reduced-motion: reduce)";function ht(e="auto"){let[t,n]=(0,Z.useState)(()=>ne&&typeof window.matchMedia=="function"?window.matchMedia(kr).matches:!1);return(0,Z.useEffect)(()=>{if(e!=="auto"||!ne||typeof window.matchMedia!="function")return;let r=window.matchMedia(kr),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var le=C(L(),1),ri=60,oi=420;function vr(e){let t=ae(),n=e.chartProps??{},[,r,o]=ft(e.width),i=e.width??(o||480),a=J(e.locale??n.locale),s=j(a),l=(0,De.useContext)(Ce),c=e.title??l,d=e.chart.facetPlan,u=(0,De.useMemo)(()=>{let k=yr({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:i,height:e.height,title:c,locale:a,lang:s});return d?d(k,n,a):k},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(k,T)=>typeof T=="function"?String(T):T),e.highlight,e.syncId,i,e.height,c,a,s,d]),m=`${(0,De.useId)().replace(/:/g,"")}fd`,h=ht(n.reducedMotion??"auto"),f=Pe(),b=gn({motion:{enabled:n.animate!==!1&&!h&&ne},hydrated:f},{waiting:!1,generation:0}),v=e.chart;return(0,le.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":m,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,le.jsx)("p",{id:m,style:it,children:e.description??u.description}),(0,le.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:Ge,rowGap:gr,...u.legend?{marginTop:Kt}:null},children:u.panels.map((k,T)=>{let M=t.paint(k.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,le.jsxs)("div",{"data-facet":k.value,style:{minWidth:0,...hn(b,!1,"fade",T*ri,oi)},children:[(0,le.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Wt,fontSize:pr,fontWeight:700,lineHeight:`${Wt}px`,color:M},children:[(0,le.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.label}),k.last!==void 0?(0,le.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:k.last}):null]}),(0,le.jsx)(v,{...n,...k.props})]},k.value)})}),u.legend?(0,le.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Kt},children:u.legend}):null]})}var $r=["max","min","first","last","none"];function ce(e,t,n,r,o="max"){let i=new Set,a=n.length,s=c=>{if(a&&c!=="none"){if(c==="first")i.add(0);else if(c==="last")i.add(a-1);else if(c==="max"||c==="min"){let d=-1,u=c==="max"?-1/0:1/0;r.forEach((m,h)=>{Number.isFinite(m)&&(c==="max"?m>u:m<u)&&(u=m,d=h)}),d>=0&&i.add(d)}}};if(e==null)return s(o),i;if(typeof e=="function")return t.forEach((c,d)=>{d<a&&c!==null&&c!==void 0&&e(c,d)&&i.add(d)}),i;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<a&&i.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((d,u)=>{d===c&&i.add(u)});return i}var te=C(H(),1);async function ai(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",i=await e.text();if(t==="text")return i;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(i))throw new Error(j(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Te(i);if(t==="json"||o.includes("json"))return JSON.parse(i);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return Te(i);let a=i.trim();return a.startsWith("{")||a.startsWith("[")?JSON.parse(a):Te(i)}async function ii(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),i=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!i.ok)throw new Error(`HTTP ${i.status}${i.statusText?` ${i.statusText}`:""}`);r=await ai(i,t.parse,o,t.locale)}return t.select&&(r=er(r,t.select)),t.transform?t.transform(r):pe(r)}function Tr(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[i,a]=(0,te.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,te.useState)(0),c=J(t.locale),d=(0,te.useRef)(t);d.current={...t,locale:c};let u=(0,te.useRef)(e);u.current=e;let m=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))),b=(0,te.useRef)(!1);(0,te.useEffect)(()=>{let k=u.current;if(!k||!r){a(R=>R.status==="loading"?{...R,status:"idle"}:R);return}let T=new AbortController,M=!0;return b.current=!0,a(R=>({...R,data:o?R.data:[],status:"loading",error:null})),ii(k,{...d.current,signal:T.signal}).then(R=>{M&&a({data:R,status:"success",error:null,updatedAt:Date.now()})}).catch(R=>{!M||T.signal.aborted||a(y=>({...y,status:"error",error:R instanceof Error?R:new Error(String(R))}))}).finally(()=>{M&&(b.current=!1)}),()=>{M=!1,b.current=!1,T.abort()}},[m,r,s,f,o]),(0,te.useEffect)(()=>{if(!n||!r)return;let k=setInterval(()=>{b.current||l(T=>T+1)},n);return()=>clearInterval(k)},[n,r]);let v=(0,te.useCallback)(()=>l(k=>k+1),[]);return{data:i.data,status:i.status,loading:i.status==="loading",error:i.error,empty:i.status==="success"&&i.data.length===0,updatedAt:i.updatedAt,reload:v}}var Xt=C(L(),1),si=["csv","svg","png"],li=/^[=+\-@\t\r\n=+-@]/,ci=/var\(|color-mix\(/;function Mr(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?_n(e.getTime()):String(e);return`"${(li.test(t)&&!Number.isFinite(me(t))?`'${t}`:t).replace(/"/g,'""')}"`}function ui(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function mi(e,t){return`\uFEFF${[t.map(Mr),...e.map(r=>t.map(o=>Mr(r[o])))].map(r=>r.join(",")).join(`\r
26
26
  `)}\r
27
27
  `}function di(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Ut(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Cr=2,ye=16;function Sr(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,i,a,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${i}, ${a})`:`rgba(${o}, ${i}, ${a}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function Ar(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 Nr(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:i,height:a}=o.viewBox.baseVal,[s,l]=[i+ye*2,a+ye*2],c=o.cloneNode(!0),d=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((f,b)=>{let v;for(let k of Array.from(f.attributes)){if(!ci.test(k.value))continue;let T=(v??(v=getComputedStyle(f))).getPropertyValue(k.name);T&&d[b].setAttribute(k.name,Sr(T,u))}}),c.removeAttribute("style");for(let[f,b]of Object.entries({viewBox:`${-ye} ${-ye} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(f,String(b));let m=Sr(getComputedStyle(r).backgroundColor,u),h=o.parentElement?.querySelector("canvas")??null;if(n){let f=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(Ar("rect",{x:-ye,y:-ye,width:s,height:l,fill:m}),f),h&&c.insertBefore(Ar("image",{href:h.toDataURL(),width:i,height:a}),f)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:i,vh:a,bg:m,canvas:h}}function fi(e,t){let n=Nr(e,Cr,!1);if(!n)return;let r=Cr,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let i=o.getContext("2d");if(!i)return;i.fillStyle=n.bg,i.fillRect(0,0,o.width,o.height),n.canvas&&i.drawImage(n.canvas,ye*r,ye*r,n.vw*r,n.vh*r);let a=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{i.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(a),o.toBlob(l=>l&&Ut(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(a),s.src=a}function Rr(e){let t=ae(e.theme),n=j(J(e.locale))==="ko",r=di(e.filename),o=(i,a)=>{if(i==="csv")return Ut(new Blob([mi(e.data,e.columns?.length?e.columns:ui(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(i==="png")return fi(a,r);let s=Nr(a,1,!0);s&&Ut(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,Xt.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:si.filter(i=>!e.formats||e.formats.includes(i)).map(i=>{let a=i.toUpperCase(),s=n?`${a} 내려받기`:`Download ${a}`;return(0,Xt.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(i,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:a},i)})})}var _r=C(L(),1);function Fr(e,t=X){let n=we(void 0,t),r=e.split(`
28
- `),o=(i,a)=>{if(a==="label")return i.label;if(a==="value")return i.formatted??(i.value===null?null:n(i.value));if(a==="series")return i.series??null;let s=i.datum&&typeof i.datum=="object"?i.datum[a]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?Ie(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,c=s.replace(Dn,(d,u)=>o(i,u.trim())??(l=!0,""));l||a.push(c)}return a.length?a.map((s,l)=>(0,_r.jsx)("div",{children:s},l)):null}}function Pr(e,t,n=!1){let r=ie(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=se(o);if(!n)return i;let a=new Map;for(let s of o)a.set(s,(a.get(s)??0)+1);return i.map((s,l)=>[s,l]).sort((s,l)=>a.get(s[0])-a.get(l[0])||s[1]-l[1]).map(([s])=>s)}function Dr(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 Hr=C(H(),1);var W=C(H(),1);function Lr(e,t){let n=ae(e.theme),[r,o,i]=ft(e.width),a=Pe(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,d=ht(e.reducedMotion??"auto"),u=e.animate!==!1&&!d&&ne,m=wr(r,e.animateOnView!==!1&&u),h=J(e.locale),f=j(h),b=(0,W.useMemo)(()=>we(e.format,h,t.format),[e.format,h,t.format]),v=(0,W.useCallback)(B=>qe(B,{locale:h}),[h]),k=(0,W.useMemo)(()=>Ze(b,e.unit),[b,e.unit]),T=(0,W.useMemo)(()=>ct(e.data),[e.data]),[M,R]=(0,W.useState)(null),[y,N]=(0,W.useState)(null),P=(0,W.useRef)([]),D=(0,W.useRef)(e.onHover);D.current=e.onHover;let O=(0,W.useRef)(e.onClick);O.current=e.onClick;let E=(0,W.useRef)(null),F=(0,W.useRef)(null),p=(0,W.useRef)(null),w=(0,W.useCallback)((B,Y="pointer")=>{if(p.current!==B){p.current=B;let de=B===null?null:P.current[B]??null;queueMicrotask(()=>D.current?.(de)),F.current?.(B)}E.current=B===null?null:Y,R(B),N(E.current)},[]),x=(0,W.useCallback)(B=>{E.current!=="keyboard"&&(E.current=B===null?null:"sync",R(B),N(E.current))},[]),$=(0,W.useCallback)(B=>{let Y=P.current[B];Y&&O.current?.(Y)},[]),_=Bn(e.replayKey),A=e.width!==void 0||(i??0)>0,I={enabled:u,active:m.visible&&A,near:m.near,replayKey:_,dataKey:T,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},xe=(0,W.useCallback)((B,Y=1)=>M===null||M===B?Y:Y*.38,[M]);return{p:n,width:s,height:c,measured:A,responsive:e.width===void 0,pending:ne&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:I,fv:k,fmt:b,pct:v,locale:h,lang:f,t:f==="ko"?bn:pn,active:M,via:y,setActive:w,click:$,events:P,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:xe,sig:T,description:e.description,reduced:d,publish:F,applySync:x}}var G=C(H(),1);function hi(e){return 1-Math.pow(1-e,3)}function gi(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function pi(e){return e==="easeInOut"?gi:e==="linear"?t=>t:hi}function bi(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 Le(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),i=Math.floor(o),a=Math.min(e.length-1,i+1);n[r]=e[i]+(e[a]-e[i])*(o-i)}return n}function 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 Er(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 Or(e,t,n,r){if(!t||!n||t.length!==n.length)return Le(e,r);let o=[],i=0;for(let a=0;a<n.length;a++){let s=e.slice(i,i+t[a]);i+=t[a];for(let l of Le(s,n[a]))o.push(l)}return o.length===r?o:Le(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 i=t.from??t.to,a=t.enter??i;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:i.slice(),enter:a.slice(),exit:(t.exit??a).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),i=this.make(r,r.to,0,0);o&&(i.order=o.order),i.done=!0,i.progress=1,n.set(r.key,i)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let i=this.tracks.get(o.key),a=this.make(o,o.from??o.to,1/0,o.delay??0);i&&(a.order=i.order),r=Math.max(r,o.delay??0),n.set(o.key,a)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),Er(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,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let c=a.to.length;s.from=Or(s.cur,s.parts,a.parts,c),s.vel=Or(s.curVel,s.parts,a.parts,c),s.parts=a.parts,s.to=a.to.slice(),Er(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(a.from??a.to).slice(),s.enter=(a.enter??s.appear).slice(),s.exit=(a.exit??s.enter).slice(),s.data=a.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=gt(s.from,s.to)&&s.vel.every(d=>Math.abs(d)<1e-6),s.progress=s.done?1:0}else{let c=this.make(a,a.enter??a.from??a.to,n+l,0);c.done=gt(c.from,c.to),this.tracks.set(a.key,c)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=Le(a.exit,a.cur.length),a.t0=n,a.exiting=!0,a.done=!1,a.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=pi(this.easing),o=this.duration/1e3,i=this.omega,a=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=Le(s.from,c)),s.vel.length!==c&&(s.vel=Le(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 d;if(this.easing==="spring"){let u=Math.exp(-i*l),m=i*l>=8&&i*l<20,h=0;for(let f=0;f<c;f++){let b=s.from[f]-s.to[f],v=s.vel[f]+i*b;s.cur[f]=s.to[f]+(b+v*l)*u,s.curVel[f]=(s.vel[f]-i*v*l)*u,m&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/i)))}d=i*l>=20||m&&h<.15,s.progress=Math.min(1,1-(1+i*l)*u)}else{let u=Math.min(1,l/o),m=r(u),h=bi(this.easing,u)/o;for(let f=0;f<c;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*m,s.curVel[f]=(s.to[f]-s.from[f])*h;d=u>=1,s.progress=m}if(d){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&&a.push(s.key)}else n=!0}for(let s of a)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Ve=new Set,bt=0;function Ir(e){bt=0;let t=Array.from(Ve);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Ve.delete(n)}Ve.size&&typeof requestAnimationFrame<"u"&&(bt=requestAnimationFrame(Ir))}function zr(e){return Ve.add(e),!bt&&typeof requestAnimationFrame<"u"&&(bt=requestAnimationFrame(Ir)),()=>{Ve.delete(e)}}function yi(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 Br(e,t){let n=(0,G.useMemo)(()=>yi(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:c=900,stagger:d=0}=t,u=(0,G.useRef)(null),m=(0,G.useRef)("init"),h=(0,G.useRef)(null),f=(0,G.useRef)(s),b=(0,G.useRef)(a),v=(0,G.useRef)(!1),k=(0,G.useRef)(0),[,T]=(0,G.useState)(0),M=(0,G.useRef)(null),R=(0,G.useRef)(!0);u.current||(u.current=new pt,u.current.configure(l,c),u.current.snap(n),h.current=n);let y=u.current;if(y.configure(l,c),h.current!==n){let F=m.current,p=!Object.is(f.current,s);y.sameTargets(n)?y.refreshData(n):!r||F==="init"?y.snap(n):F==="idle"?y.hold(n):F==="running"||p?y.update(n,Xe(),d):y.snap(n),h.current=n,f.current=s}let N=(0,G.useRef)(()=>!1);N.current=F=>{if(!R.current)return!1;let p=y.step(F);return!p&&m.current==="running"&&(m.current="done"),T(w=>(w+1)%1e9),p||(M.current=null),p};let P=(0,G.useCallback)(()=>{if(!ne||M.current||!y.animating)return;let F=p=>N.current(p);M.current=zr(F)},[y]);ue(()=>{let F=!Object.is(b.current,a);if(b.current=a,!r){(m.current!=="done"||y.animating)&&(y.snap(h.current??n),m.current="done",T(p=>p+1));return}m.current==="init"||F&&i?(y.hold(h.current??n),m.current="idle",v.current=!1,T(p=>p+1)):F&&(v.current=!0)},[r,a]),ue(()=>{!r||!i||!v.current||(v.current=!1,y.hold(h.current??n),m.current="idle",T(F=>F+1))},[i,r]),(0,G.useEffect)(()=>{r&&o&&m.current==="idle"&&(y.start(Xe()),k.current+=1,m.current="running",P(),T(F=>F+1))},[r,o,a,y,P]),(0,G.useEffect)(()=>{y.animating&&P()}),(0,G.useEffect)(()=>(R.current=!0,()=>{R.current=!1,M.current?.(),M.current=null}),[]);let D=Xe(),O=y.elapsed(D),E=r&&m.current==="idle";return{items:y.items(),get:F=>y.get(F),elapsed:E?0:O,fade:(F,p=320)=>E?0:Number.isFinite(O)?Math.max(0,Math.min(1,(O-F)/p)):1,waiting:E,animating:y.animating,generation:k.current}}var Yt=C(L(),1);function jr(e,t,n,r,o){if(r)return o==="categorical"?re(e,t,n):Mn(e,t,n);if(o==="categorical")return re(e,t,n);let i=V(e,"strong"),a=V(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var xi=C(H(),1);var Jt=C(L(),1);var Gr=e=>e?"neutralStrong":"accent";var qt=C(L(),1);function Vr(e,t,n,r){if(typeof e!="function")return ce(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((a,s)=>[a,s])),i=new Set;return t.forEach((a,s)=>{let l=o.get(r(a,s));l!==void 0&&e(a,s)&&i.add(l)}),i}var ki=C(H(),1);var Qt=C(L(),1),wi={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}, ${Se(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Wr={en:wi,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}일 이동평균`}},Zt=["ink","muted","dim"];function Kr(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,Zt.length)}var en=C(H(),1);var K=C(L(),1),vi={kind:"Dumbbell chart",names:["Before","After"],diff:"Difference"},$i={en:vi,ko:{kind:"덤벨 차트",names:["이전","이후"],diff:"차이"}};function tn(e){let t=e.data.length,n=Lr(e,{height:()=>Math.max(150,Math.min(360,t*30+44)),duration:800,stagger:70}),{p:r,width:o,height:i}=n,a=$i[n.lang],s=e.labels??a.names,l=(0,en.useMemo)(()=>{let p=ie(e.label,"label"),w=$e(e.start,"start"),x=$e(e.end,"end"),$=e.data.map((A,I)=>({i:I,label:p(A,I),a:w(A,I),b:x(A,I),hi:!1,datum:A})).filter(A=>Number.isFinite(A.a)&&Number.isFinite(A.b));e.sort!==!1&&($=[...$].sort((A,I)=>I.b-A.b)),$.forEach((A,I)=>A.i=I);let _=ce(e.highlight,$.map(A=>A.datum),$.map(A=>A.label),$.map(A=>A.b-A.a),"max");return $.map(A=>({...A,hi:_.has(A.i)}))},[e.data,e.label,e.start,e.end,e.sort,e.highlight]),[c,d]=Me(l.flatMap(p=>[p.a,p.b])),u=be(c,d,4,{zero:e.zero??!1,pad:.08}),m=Math.min(o*.3,Math.max(...l.map(p=>ee(p.label,11.5,700)),24)+10),h=22,f=18,b=Math.max(...l.map(p=>ee(n.fmt(p.b),11,800)),10)+14,v=Be(u,[m+10,o-b]),k=(i-h-f)/Math.max(1,l.length),T=p=>h+k*p+k/2,M=n.motion.stagger??70,R=(0,en.useMemo)(()=>l.map((p,w)=>({key:`d:${p.label}`,to:[v(p.a),v(p.b),1],from:[v(p.a),v(p.a),0],enter:[v(p.a),v(p.a),0],delay:w*M,data:p})),[l,o,u[0],u[1],M]),y=Br(R,n.motion),N=V(r,"accent"),P=l.map(p=>({datum:p.datum,index:p.i,key:p.label,label:p.label,value:p.b,formatted:`${s[0]} ${n.fv(p.a)} → ${s[1]} ${n.fv(p.b)}`})),D=null;if(n.active!==null&&l[n.active]){let p=l[n.active];D={x:v(Math.max(p.a,p.b)),y:T(n.active)-6,title:p.label,rows:[{label:s[0],value:n.fv(p.a),color:r.paint("neutralStrong")},{label:s[1],value:n.fv(p.b),color:p.hi?N.fill:r.paint("ink")},{label:a.diff,value:`${p.b-p.a>=0?"+":"−"}${n.fv(Math.abs(p.b-p.a))}`}]}}let O=v.ticks(Math.max(2,Math.round(o/120))),E=n.motion.duration??800,F=e.description??`${a.kind}. ${l.map(p=>`${p.label} ${n.fv(p.a)}→${n.fv(p.b)}`).join(", ")}.`;return(0,K.jsxs)(jn,{c:n,kind:a.kind,ariaLabel:e.ariaLabel,description:F,events:P,tip:D,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[(0,K.jsxs)("g",{"aria-hidden":"true",children:[O.map(p=>(0,K.jsxs)("g",{children:[(0,K.jsx)("line",{x1:v(p),x2:v(p),y1:h-4,y2:i-f,stroke:r.paint("line")}),(0,K.jsx)(Fe,{x:v(p),y:i-f+10,anchor:"middle",size:ze,fill:r.paint("muted"),children:n.fmt(p)})]},p)),(0,K.jsx)("circle",{cx:m+14,cy:8,r:4,fill:r.paint("neutralStrong")}),(0,K.jsx)(Fe,{x:m+22,y:8,size:10.5,fill:r.paint("muted"),children:s[0]}),(0,K.jsx)("circle",{cx:m+32+ee(s[0],10.5),cy:8,r:4.5,fill:r.paint("ink")}),(0,K.jsx)(Fe,{x:m+40+ee(s[0],10.5),y:8,size:10.5,fill:r.paint("muted"),children:s[1]})]}),y.items.map(p=>{let w=p.data;if(p.exiting)return null;let x=w.i,[$,_,A]=p.v,I=T(x),xe=w.hi?N.fill:r.paint("ink"),B=_>=$;return(0,K.jsxs)("g",{className:"ztd-mark",opacity:n.dim(x),onPointerEnter:Y=>n.setActive(w.i,Y.pointerType==="touch"?"touch":"pointer"),onClick:()=>n.click(w.i),children:[(0,K.jsx)("rect",{x:0,y:I-k/2,width:o,height:k,fill:"transparent"}),(0,K.jsx)("line",{x1:$,x2:_,y1:I,y2:I,stroke:w.hi?N.fill:r.paint("neutral"),strokeOpacity:w.hi?.55:1,strokeWidth:4,strokeLinecap:"round"}),(0,K.jsx)("circle",{cx:$,cy:I,r:4.5,fill:r.paint("neutralStrong"),opacity:Math.min(1,A*2)}),(0,K.jsx)("circle",{cx:_,cy:I,r:5.5,fill:xe,stroke:n.active===w.i&&n.via==="keyboard"?r.paint("ink"):"none",strokeWidth:2,opacity:A}),(0,K.jsx)(Fe,{x:m,y:I,anchor:"end",size:11.5,weight:w.hi?800:600,fill:r.paint(w.hi?"ink":"muted"),children:jt(w.label,m-4,11.5,700)}),n.showLabels?(0,K.jsx)(Fe,{x:B?_+10:_-10,y:I,anchor:B?"start":"end",size:11,weight:w.hi?800:600,fill:r.paint(w.hi?"ink":"muted"),opacity:y.fade(x*M+E*.4,260),children:n.fmt(w.b)}):null]},p.key)})]})}var Ti=C(H(),1);var qr=C(L(),1),Mi={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Se(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Ci={en:Mi,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Ur=(e,t)=>Ci[e].other(t);function Xr(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((i,a)=>({v:i.value,i:a})).sort((i,a)=>a.v-i.v).slice(0,Math.floor(t)).map(i=>i.i)),o=e.filter((i,a)=>!r.has(a));return{kept:e.filter((i,a)=>r.has(a)),other:n(o.length,rr(o.map(i=>i.value)))}}var Yr=e=>Number.isFinite(e)&&e>0?e:0;function Jr(e,t,n,r){return r==="emphasis"?Tn(e,t,n):re(e,t,n)}var Si=C(H(),1);var to=C(L(),1);function Zr(e,t){return t===!1?e.map((n,r)=>r):nr(e)}function Qr(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return ce(e,t,t,r,"max")}function eo(e,t,n){let r=new Array(t.length),o=t.filter(i=>!n.has(i));for(let i of t)n.has(i)&&(r[i]=V(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?V(e,"neutral"):Je(e,1-a/Math.max(1,o.length-1))),r}function no(e){return!e||typeof e!="object"||Array.isArray(e)?[]:se(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function ro(e,t){return Oe(e,t+1,new Set)}var Ai=C(H(),1);var ao=C(L(),1);function oo(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!$r.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var fe=C(L(),1);function io(e,t,n){let r=lt(e);return r?.type==="scatter"&&t?.size!==void 0&&!st(n)?lt("bubble"):r}function Ni(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 Ri(e,t,n,r=!1){let o=io(e.type,e.encoding,e.options);if(!o||!t.length)return[];let i=e.encoding??{},a=e.options??{},s=a.highlight,l=new Set(!r&&It.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),c=u=>u.filter(m=>!l.has(m.label)),d=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(d.includes(o.type)){let u=ie(i.label,"label"),m=$e(i.value,"value"),h=o.type==="waffle",f=t.map((y,N)=>({r:y,label:u(y,N),value:h?m(y,N):Yr(m(y,N))})),{kept:b,other:v}=h?{kept:f,other:null}:Xr(f,a.other,(y,N)=>({r:{},label:Ur(j(n),y),value:N})),k=ce(s,b.map(y=>y.r),b.map(y=>y.label),b.map(y=>y.value),h?"first":"max"),T=v?[...b,v]:b,M=ge(y=>h?re(y,T.length,k):Jr(y,T.length,k,a.colorMode)),R=h&&a.shape==="arc";return T.map((y,N)=>({label:y.label,color:M[N],...R&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Kr(Array.isArray(a.ma)?a.ma:void 0,t.length),m=Wr[j(n)];return[{label:m.up,color:a.upColor??"accent"},{label:m.down,color:a.downColor??"neutralStrong"},...u.map((h,f)=>({label:m.maLegend(h),color:Zt[f],shape:"line"}))]}if(o.type==="network"){let u=no(a.groups);if(u.length<2)return[];let m=ge(h=>ro(h,u.length));return u.map((h,f)=>({label:h,color:m[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let u=ie(i.group,"group"),m=se(t.map((f,b)=>u(f,b)).filter(Boolean));if(m.length<2)return[];let h=ge(f=>Oe(f,m.length,new Set));return m.map((f,b)=>({label:f,color:h[b],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||st(a))return[];let u=ie(i.series,"series"),m=se(t.map((b,v)=>u(b,v)));if(m.length<2)return[];let h=Vr(s,t,m,u),f=ge(b=>Oe(b,m.length,h));return c(m.map((b,v)=>({label:b,color:f[v],shape:"circle"})))}if(o.type==="timeline"){let u=typeof i.group!="string",m=u?i.status:i.group;if(typeof m!="string")return[];let h=Pr(t,m,u),f=ge(b=>re(b,h.length,oo(s,h)));return c(h.map((b,v)=>({label:b,color:f[v],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(i.y))u=i.y;else if(typeof i.series=="string"){let M=ie(i.series,"series");u=se(t.map((R,y)=>M(R,y)))}let m=zt(o.type,i,a);if(m.length){let M=ce(s,u,u,u.map(()=>0),"none"),R=ge(N=>re(N,u.length,M)),y=u.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:u.map((N,P)=>({label:N,color:R[P]}));return[...c(y),...m.map((N,P)=>({label:N,color:Gr(P),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&a.layout==="diverging"&&s===void 0?tr(u.length,Array.isArray(a.negative)?a.negative.map(M=>u.indexOf(String(M))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,b=f>=0?new Set([f]):ce(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((M,R)=>({label:M,color:b.has(R)?"accent":"neutralStrong",shape:"square"})));let v=a.colorMode,k=M=>re(M,u.length,b);if((o.type==="line"||o.type==="area")&&(k=M=>jr(M,u.length,b,o.type==="area",v)),o.type==="stream"){let M=He(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),R=Zr(M.values,a.reorder),y=Qr(s,M.series,M.values);k=N=>eo(N,R,y)}let T=ge(k);return c(u.map((M,R)=>({label:M,color:T[R],...o.type==="line"&&{shape:"line"}})))}return[]}function Fi(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Un.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function _i(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:c,...d}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:d,width:o,height:i,highlight:a,syncId:s,title:l,description:c}}function so(e,t){let{spec:n}=e,r=io(n.type,n.encoding,n.options),o=(0,We.useMemo)(()=>Dr(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=Kn(n,e.locale),s=J(a),l=j(s),c=Tr(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),d=Jn(n),u=(0,We.useMemo)(()=>d?Fr(d,s):void 0,[d,s]),m=n.options?.hidden,h=Array.isArray(m)?m.map(String):[],f=h.join(""),[b,v]=(0,We.useState)(null);if(!r)return(0,fe.jsx)(Ot,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let k=o??c.data,T=t[r.type],M={...n.options??{}},R={...Ni(r,n.encoding),...M,...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:a},y=n.card?.legend==="toggle"&&Yn(r.type,n.encoding??{},M),N=b&&b.base===f?b.hidden:h;y&&(R.hidden=N);let P=p=>v(w=>{let x=w&&w.base===f?w.hidden:h;return{base:f,hidden:x.includes(p)?x.filter($=>$!==p):[...x,p]}}),D=R.height??220,O=Fi(n,r.type),E=i&&!k.length&&(c.loading||c.error||c.empty)?(0,fe.jsx)(Ot,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:D,locale:a}):O?(0,fe.jsx)(vr,{chart:T,..._i(r.type,O,R)}):(0,fe.jsx)(T,{...R});if(n.card){let p=n.card,w=p.legend==="auto"||p.legend==="toggle"?Ri(n,k,s,y):p.legend,x=w?.length?y?(0,fe.jsx)(Et,{items:w,hidden:N,onToggle:P,locale:a}):w:void 0,$=p.download?(0,fe.jsx)(Rr,{data:k,columns:qn(n),filename:p.title??r.type,formats:Array.isArray(p.download)?p.download:void 0,locale:a}):void 0;E=(0,fe.jsx)(Hn,{number:p.number,title:p.title??Wn(r,l),subtitle:p.subtitle,legend:x,actions:$,source:p.source||void 0,note:p.note||void 0,accent:p.accent,takeaway:p.takeaway,level:p.level,sample:p.sample,replay:p.replay!==!1,className:e.className,locale:a,children:E})}let F=e.theme??n.theme;return F&&(E=(0,fe.jsx)(nt,{theme:F,children:E})),E}function Pi({cfg:e,components:t}){let n=Pe();return so({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function co(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,lo.hydrateRoot)(r,(0,nn.createElement)(nt,{theme:o.theme,cssVars:!0},(0,nn.createElement)(Pi,{cfg:o,components:{[e]:t}})))}co("dumbbell",tn);})();
28
+ `),o=(i,a)=>{if(a==="label")return i.label;if(a==="value")return i.formatted??(i.value===null?null:n(i.value));if(a==="series")return i.series??null;let s=i.datum&&typeof i.datum=="object"?i.datum[a]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?Ie(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return i=>{let a=[];for(let s of r){let l=!1,c=s.replace(Dn,(d,u)=>o(i,u.trim())??(l=!0,""));l||a.push(c)}return a.length?a.map((s,l)=>(0,_r.jsx)("div",{children:s},l)):null}}function Pr(e,t,n=!1){let r=ie(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),i=se(o);if(!n)return i;let a=new Map;for(let s of o)a.set(s,(a.get(s)??0)+1);return i.map((s,l)=>[s,l]).sort((s,l)=>a.get(s[0])-a.get(l[0])||s[1]-l[1]).map(([s])=>s)}function Dr(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 Hr=C(H(),1);var W=C(H(),1);function Lr(e,t){let n=ae(e.theme),[r,o,i]=ft(e.width),a=Pe(),s=e.width??(i||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,d=ht(e.reducedMotion??"auto"),u=e.animate!==!1&&!d&&ne,m=wr(r,e.animateOnView!==!1&&u),h=J(e.locale),f=j(h),b=(0,W.useMemo)(()=>we(e.format,h,t.format),[e.format,h,t.format]),v=(0,W.useCallback)(B=>qe(B,{locale:h}),[h]),k=(0,W.useMemo)(()=>Ze(b,e.unit),[b,e.unit]),T=(0,W.useMemo)(()=>ct(e.data),[e.data]),[M,R]=(0,W.useState)(null),[y,N]=(0,W.useState)(null),P=(0,W.useRef)([]),D=(0,W.useRef)(e.onHover);D.current=e.onHover;let O=(0,W.useRef)(e.onClick);O.current=e.onClick;let E=(0,W.useRef)(null),F=(0,W.useRef)(null),p=(0,W.useRef)(null),w=(0,W.useCallback)((B,Y="pointer")=>{if(p.current!==B){p.current=B;let de=B===null?null:P.current[B]??null;queueMicrotask(()=>D.current?.(de)),F.current?.(B)}E.current=B===null?null:Y,R(B),N(E.current)},[]),x=(0,W.useCallback)(B=>{E.current!=="keyboard"&&(E.current=B===null?null:"sync",R(B),N(E.current))},[]),$=(0,W.useCallback)(B=>{let Y=P.current[B];Y&&O.current?.(Y)},[]),_=Bn(e.replayKey),A=e.width!==void 0||(i??0)>0,I={enabled:u,active:m.visible&&A,near:m.near,replayKey:_,dataKey:T,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},xe=(0,W.useCallback)((B,Y=1)=>M===null||M===B?Y:Y*.38,[M]);return{p:n,width:s,height:c,measured:A,responsive:e.width===void 0,pending:ne&&a&&e.width===void 0&&i===null,node:r,hydrated:a,ref:o,motion:I,fv:k,fmt:b,pct:v,locale:h,lang:f,t:f==="ko"?bn:pn,active:M,via:y,setActive:w,click:$,events:P,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:xe,sig:T,description:e.description,reduced:d,publish:F,applySync:x}}var G=C(H(),1);function hi(e){return 1-Math.pow(1-e,3)}function gi(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function pi(e){return e==="easeInOut"?gi:e==="linear"?t=>t:hi}function bi(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 Le(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),i=Math.floor(o),a=Math.min(e.length-1,i+1);n[r]=e[i]+(e[a]-e[i])*(o-i)}return n}function 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 Er(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 Or(e,t,n,r){if(!t||!n||t.length!==n.length)return Le(e,r);let o=[],i=0;for(let a=0;a<n.length;a++){let s=e.slice(i,i+t[a]);i+=t[a];for(let l of Le(s,n[a]))o.push(l)}return o.length===r?o:Le(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 i=t.from??t.to,a=t.enter??i;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:i.slice(),enter:a.slice(),exit:(t.exit??a).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),i=this.make(r,r.to,0,0);o&&(i.order=o.order),i.done=!0,i.progress=1,n.set(r.key,i)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let i=this.tracks.get(o.key),a=this.make(o,o.from??o.to,1/0,o.delay??0);i&&(a.order=i.order),r=Math.max(r,o.delay??0),n.set(o.key,a)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),Er(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,i=0;for(let a of t){o.add(a.key);let s=this.tracks.get(a.key),l=r>0?Math.min(i*r,240):0;if(s){let c=a.to.length;s.from=Or(s.cur,s.parts,a.parts,c),s.vel=Or(s.curVel,s.parts,a.parts,c),s.parts=a.parts,s.to=a.to.slice(),Er(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(a.from??a.to).slice(),s.enter=(a.enter??s.appear).slice(),s.exit=(a.exit??s.enter).slice(),s.data=a.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=gt(s.from,s.to)&&s.vel.every(d=>Math.abs(d)<1e-6),s.progress=s.done?1:0}else{let c=this.make(a,a.enter??a.from??a.to,n+l,0);c.done=gt(c.from,c.to),this.tracks.set(a.key,c)}i++}for(let a of this.tracks.values())o.has(a.key)||a.exiting||(a.from=a.cur.slice(),a.vel=a.curVel.slice(),a.to=Le(a.exit,a.cur.length),a.t0=n,a.exiting=!0,a.done=!1,a.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=pi(this.easing),o=this.duration/1e3,i=this.omega,a=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=Le(s.from,c)),s.vel.length!==c&&(s.vel=Le(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 d;if(this.easing==="spring"){let u=Math.exp(-i*l),m=i*l>=8&&i*l<20,h=0;for(let f=0;f<c;f++){let b=s.from[f]-s.to[f],v=s.vel[f]+i*b;s.cur[f]=s.to[f]+(b+v*l)*u,s.curVel[f]=(s.vel[f]-i*v*l)*u,m&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/i)))}d=i*l>=20||m&&h<.15,s.progress=Math.min(1,1-(1+i*l)*u)}else{let u=Math.min(1,l/o),m=r(u),h=bi(this.easing,u)/o;for(let f=0;f<c;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*m,s.curVel[f]=(s.to[f]-s.from[f])*h;d=u>=1,s.progress=m}if(d){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&&a.push(s.key)}else n=!0}for(let s of a)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Ve=new Set,bt=0;function Ir(e){bt=0;let t=Array.from(Ve);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Ve.delete(n)}Ve.size&&typeof requestAnimationFrame<"u"&&(bt=requestAnimationFrame(Ir))}function zr(e){return Ve.add(e),!bt&&typeof requestAnimationFrame<"u"&&(bt=requestAnimationFrame(Ir)),()=>{Ve.delete(e)}}function yi(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 Br(e,t){let n=(0,G.useMemo)(()=>yi(e),[e]),{enabled:r,active:o,near:i=!0,replayKey:a,dataKey:s,easing:l="spring",duration:c=900,stagger:d=0}=t,u=(0,G.useRef)(null),m=(0,G.useRef)("init"),h=(0,G.useRef)(null),f=(0,G.useRef)(s),b=(0,G.useRef)(a),v=(0,G.useRef)(!1),k=(0,G.useRef)(0),[,T]=(0,G.useState)(0),M=(0,G.useRef)(null),R=(0,G.useRef)(!0);u.current||(u.current=new pt,u.current.configure(l,c),u.current.snap(n),h.current=n);let y=u.current;if(y.configure(l,c),h.current!==n){let F=m.current,p=!Object.is(f.current,s);y.sameTargets(n)?y.refreshData(n):!r||F==="init"?y.snap(n):F==="idle"?y.hold(n):F==="running"||p?y.update(n,Xe(),d):y.snap(n),h.current=n,f.current=s}let N=(0,G.useRef)(()=>!1);N.current=F=>{if(!R.current)return!1;let p=y.step(F);return!p&&m.current==="running"&&(m.current="done"),T(w=>(w+1)%1e9),p||(M.current=null),p};let P=(0,G.useCallback)(()=>{if(!ne||M.current||!y.animating)return;let F=p=>N.current(p);M.current=zr(F)},[y]);ue(()=>{let F=!Object.is(b.current,a);if(b.current=a,!r){(m.current!=="done"||y.animating)&&(y.snap(h.current??n),m.current="done",T(p=>p+1));return}m.current==="init"||F&&i?(y.hold(h.current??n),m.current="idle",v.current=!1,T(p=>p+1)):F&&(v.current=!0)},[r,a]),ue(()=>{!r||!i||!v.current||(v.current=!1,y.hold(h.current??n),m.current="idle",T(F=>F+1))},[i,r]),(0,G.useEffect)(()=>{r&&o&&m.current==="idle"&&(y.start(Xe()),k.current+=1,m.current="running",P(),T(F=>F+1))},[r,o,a,y,P]),(0,G.useEffect)(()=>{y.animating&&P()}),(0,G.useEffect)(()=>(R.current=!0,()=>{R.current=!1,M.current?.(),M.current=null}),[]);let D=Xe(),O=y.elapsed(D),E=r&&m.current==="idle";return{items:y.items(),get:F=>y.get(F),elapsed:E?0:O,fade:(F,p=320)=>E?0:Number.isFinite(O)?Math.max(0,Math.min(1,(O-F)/p)):1,waiting:E,animating:y.animating,generation:k.current}}var Yt=C(L(),1);function jr(e,t,n,r,o){if(r)return o==="categorical"?re(e,t,n):Mn(e,t,n);if(o==="categorical")return re(e,t,n);let i=V(e,"strong"),a=V(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?a:i)}var xi=C(H(),1);var Jt=C(L(),1);var Gr=e=>e?"neutralStrong":"accent";var qt=C(L(),1);function Vr(e,t,n,r){if(typeof e!="function")return ce(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((a,s)=>[a,s])),i=new Set;return t.forEach((a,s)=>{let l=o.get(r(a,s));l!==void 0&&e(a,s)&&i.add(l)}),i}var ki=C(H(),1);var Qt=C(L(),1),wi={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}, ${Se(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},Wr={en:wi,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}일 이동평균`}},Zt=["ink","muted","dim"];function Kr(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,Zt.length)}var en=C(H(),1);var K=C(L(),1),vi={kind:"Dumbbell chart",names:["Before","After"],diff:"Difference"},$i={en:vi,ko:{kind:"덤벨 차트",names:["이전","이후"],diff:"차이"}};function tn(e){let t=e.data.length,n=Lr(e,{height:()=>Math.max(150,Math.min(360,t*30+44)),duration:800,stagger:70}),{p:r,width:o,height:i}=n,a=$i[n.lang],s=e.labels??a.names,l=(0,en.useMemo)(()=>{let p=ie(e.label,"label"),w=$e(e.start,"start"),x=$e(e.end,"end"),$=e.data.map((A,I)=>({i:I,label:p(A,I),a:w(A,I),b:x(A,I),hi:!1,datum:A})).filter(A=>Number.isFinite(A.a)&&Number.isFinite(A.b));e.sort!==!1&&($=[...$].sort((A,I)=>I.b-A.b)),$.forEach((A,I)=>A.i=I);let _=ce(e.highlight,$.map(A=>A.datum),$.map(A=>A.label),$.map(A=>A.b-A.a),"max");return $.map(A=>({...A,hi:_.has(A.i)}))},[e.data,e.label,e.start,e.end,e.sort,e.highlight]),[c,d]=Me(l.flatMap(p=>[p.a,p.b])),u=be(c,d,4,{zero:e.zero??!1,pad:.08}),m=Math.min(o*.3,Math.max(...l.map(p=>ee(p.label,11.5,700)),24)+10),h=22,f=18,b=Math.max(...l.map(p=>ee(n.fmt(p.b),11,800)),10)+14,v=Be(u,[m+10,o-b]),k=(i-h-f)/Math.max(1,l.length),T=p=>h+k*p+k/2,M=n.motion.stagger??70,R=(0,en.useMemo)(()=>l.map((p,w)=>({key:`d:${p.label}`,to:[v(p.a),v(p.b),1],from:[v(p.a),v(p.a),0],enter:[v(p.a),v(p.a),0],delay:w*M,data:p})),[l,o,u[0],u[1],M]),y=Br(R,n.motion),N=V(r,"accent"),P=l.map(p=>({datum:p.datum,index:p.i,key:p.label,label:p.label,value:p.b,formatted:`${s[0]} ${n.fv(p.a)} → ${s[1]} ${n.fv(p.b)}`})),D=null;if(n.active!==null&&l[n.active]){let p=l[n.active];D={x:v(Math.max(p.a,p.b)),y:T(n.active)-6,title:p.label,rows:[{label:s[0],value:n.fv(p.a),color:r.paint("neutralStrong")},{label:s[1],value:n.fv(p.b),color:p.hi?N.fill:r.paint("ink")},{label:a.diff,value:`${p.b-p.a>=0?"+":"−"}${n.fv(Math.abs(p.b-p.a))}`}]}}let O=v.ticks(Math.max(2,Math.round(o/120))),E=n.motion.duration??800,F=e.description??`${a.kind}. ${l.map(p=>`${p.label} ${n.fv(p.a)}→${n.fv(p.b)}`).join(", ")}.`;return(0,K.jsxs)(jn,{c:n,kind:a.kind,ariaLabel:e.ariaLabel,description:F,events:P,tip:D,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[(0,K.jsxs)("g",{"aria-hidden":"true",children:[O.map(p=>(0,K.jsxs)("g",{children:[(0,K.jsx)("line",{x1:v(p),x2:v(p),y1:h-4,y2:i-f,stroke:r.paint("line")}),(0,K.jsx)(Fe,{x:v(p),y:i-f+10,anchor:"middle",size:ze,fill:r.paint("muted"),children:n.fmt(p)})]},p)),(0,K.jsx)("circle",{cx:m+14,cy:8,r:4,fill:r.paint("neutralStrong")}),(0,K.jsx)(Fe,{x:m+22,y:8,size:10.5,fill:r.paint("muted"),children:s[0]}),(0,K.jsx)("circle",{cx:m+32+ee(s[0],10.5),cy:8,r:4.5,fill:r.paint("ink")}),(0,K.jsx)(Fe,{x:m+40+ee(s[0],10.5),y:8,size:10.5,fill:r.paint("muted"),children:s[1]})]}),y.items.map(p=>{let w=p.data;if(p.exiting)return null;let x=w.i,[$,_,A]=p.v,I=T(x),xe=w.hi?N.fill:r.paint("ink"),B=_>=$;return(0,K.jsxs)("g",{className:"ztd-mark",opacity:n.dim(x),onPointerEnter:Y=>n.setActive(w.i,Y.pointerType==="touch"?"touch":"pointer"),onClick:()=>n.click(w.i),children:[(0,K.jsx)("rect",{x:0,y:I-k/2,width:o,height:k,fill:"transparent"}),(0,K.jsx)("line",{x1:$,x2:_,y1:I,y2:I,stroke:w.hi?N.fill:r.paint("neutral"),strokeOpacity:w.hi?.55:1,strokeWidth:4,strokeLinecap:"round"}),(0,K.jsx)("circle",{cx:$,cy:I,r:4.5,fill:r.paint("neutralStrong"),opacity:Math.min(1,A*2)}),(0,K.jsx)("circle",{cx:_,cy:I,r:5.5,fill:xe,stroke:n.active===w.i&&n.via==="keyboard"?r.paint("ink"):"none",strokeWidth:2,opacity:A}),(0,K.jsx)(Fe,{x:m,y:I,anchor:"end",size:11.5,weight:w.hi?800:600,fill:r.paint(w.hi?"ink":"muted"),children:jt(w.label,m-4,11.5,700)}),n.showLabels?(0,K.jsx)(Fe,{x:B?_+10:_-10,y:I,anchor:B?"start":"end",size:11,weight:w.hi?800:600,fill:r.paint(w.hi?"ink":"muted"),opacity:y.fade(x*M+E*.4,260),children:n.fmt(w.b)}):null]},p.key)})]})}var Ti=C(H(),1);var qr=C(L(),1),Mi={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Se(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},Ci={en:Mi,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Ur=(e,t)=>Ci[e].other(t);function Xr(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((i,a)=>({v:i.value,i:a})).sort((i,a)=>a.v-i.v).slice(0,Math.floor(t)).map(i=>i.i)),o=e.filter((i,a)=>!r.has(a));return{kept:e.filter((i,a)=>r.has(a)),other:n(o.length,rr(o.map(i=>i.value)))}}var Yr=e=>Number.isFinite(e)&&e>0?e:0;function Jr(e,t,n,r){return r==="emphasis"?Tn(e,t,n):re(e,t,n)}var Si=C(H(),1);var to=C(L(),1);function Zr(e,t){return t===!1?e.map((n,r)=>r):nr(e)}function Qr(e,t,n){let r=n.map(o=>o.reduce((i,a)=>i+(Number.isFinite(a)?a:0),0));return ce(e,t,t,r,"max")}function eo(e,t,n){let r=new Array(t.length),o=t.filter(i=>!n.has(i));for(let i of t)n.has(i)&&(r[i]=V(e,"accent"));return o.forEach((i,a)=>r[i]=o.length===1?V(e,"neutral"):Je(e,1-a/Math.max(1,o.length-1))),r}function no(e){return!e||typeof e!="object"||Array.isArray(e)?[]:se(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function ro(e,t){return Oe(e,t+1,new Set)}var Ai=C(H(),1);var ao=C(L(),1);var Ni=26;var mc=Ni*.62;function oo(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!$r.includes(o)&&t.forEach((i,a)=>i===o&&r.add(a));return r}var fe=C(L(),1);function io(e,t,n){let r=lt(e);return r?.type==="scatter"&&t?.size!==void 0&&!st(n)?lt("bubble"):r}function Ri(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 Fi(e,t,n,r=!1){let o=io(e.type,e.encoding,e.options);if(!o||!t.length)return[];let i=e.encoding??{},a=e.options??{},s=a.highlight,l=new Set(!r&&It.includes(o.type)&&Array.isArray(a.hidden)?a.hidden.map(String):[]),c=u=>u.filter(m=>!l.has(m.label)),d=["pie","donut","waffle"];if(o.type==="donut"&&a.legend!=="none")return[];if(d.includes(o.type)){let u=ie(i.label,"label"),m=$e(i.value,"value"),h=o.type==="waffle",f=t.map((y,N)=>({r:y,label:u(y,N),value:h?m(y,N):Yr(m(y,N))})),{kept:b,other:v}=h?{kept:f,other:null}:Xr(f,a.other,(y,N)=>({r:{},label:Ur(j(n),y),value:N})),k=ce(s,b.map(y=>y.r),b.map(y=>y.label),b.map(y=>y.value),h?"first":"max"),T=v?[...b,v]:b,M=ge(y=>h?re(y,T.length,k):Jr(y,T.length,k,a.colorMode)),R=h&&a.shape==="arc";return T.map((y,N)=>({label:y.label,color:M[N],...R&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=Kr(Array.isArray(a.ma)?a.ma:void 0,t.length),m=Wr[j(n)];return[{label:m.up,color:a.upColor??"accent"},{label:m.down,color:a.downColor??"neutralStrong"},...u.map((h,f)=>({label:m.maLegend(h),color:Zt[f],shape:"line"}))]}if(o.type==="network"){let u=no(a.groups);if(u.length<2)return[];let m=ge(h=>ro(h,u.length));return u.map((h,f)=>({label:h,color:m[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof i.group!="string")return[];let u=ie(i.group,"group"),m=se(t.map((f,b)=>u(f,b)).filter(Boolean));if(m.length<2)return[];let h=ge(f=>Oe(f,m.length,new Set));return m.map((f,b)=>({label:f,color:h[b],shape:"circle"}))}if(o.type==="scatter"){if(typeof i.series!="string"||st(a))return[];let u=ie(i.series,"series"),m=se(t.map((b,v)=>u(b,v)));if(m.length<2)return[];let h=Vr(s,t,m,u),f=ge(b=>Oe(b,m.length,h));return c(m.map((b,v)=>({label:b,color:f[v],shape:"circle"})))}if(o.type==="timeline"){let u=typeof i.group!="string",m=u?i.status:i.group;if(typeof m!="string")return[];let h=Pr(t,m,u),f=ge(b=>re(b,h.length,oo(s,h)));return c(h.map((b,v)=>({label:b,color:f[v],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(i.y))u=i.y;else if(typeof i.series=="string"){let M=ie(i.series,"series");u=se(t.map((R,y)=>M(R,y)))}let m=zt(o.type,i,a);if(m.length){let M=ce(s,u,u,u.map(()=>0),"none"),R=ge(N=>re(N,u.length,M)),y=u.length<2?[{label:String((Array.isArray(i.y)?i.y[0]:i.y)??"y"),color:"neutral"}]:u.map((N,P)=>({label:N,color:R[P]}));return[...c(y),...m.map((N,P)=>({label:N,color:Gr(P),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&a.layout==="diverging"&&s===void 0?tr(u.length,Array.isArray(a.negative)?a.negative.map(M=>u.indexOf(String(M))):[],typeof a.neutral=="string"?u.indexOf(a.neutral):-1):-1,b=f>=0?new Set([f]):ce(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((M,R)=>({label:M,color:b.has(R)?"accent":"neutralStrong",shape:"square"})));let v=a.colorMode,k=M=>re(M,u.length,b);if((o.type==="line"||o.type==="area")&&(k=M=>jr(M,u.length,b,o.type==="area",v)),o.type==="stream"){let M=He(t,i.x,i.y,i.series,{xType:a.xType,locale:n,aggregate:a.aggregate,dayFirst:a.dayFirst}),R=Zr(M.values,a.reorder),y=Qr(s,M.series,M.values);k=N=>eo(N,R,y)}let T=ge(k);return c(u.map((M,R)=>({label:M,color:T[R],...o.type==="line"&&{shape:"line"}})))}return[]}function _i(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&Un.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Pi(e,t,n){let{data:r,width:o,height:i,highlight:a,syncId:s,ariaLabel:l,description:c,...d}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:d,width:o,height:i,highlight:a,syncId:s,title:l,description:c}}function so(e,t){let{spec:n}=e,r=io(n.type,n.encoding,n.options),o=(0,We.useMemo)(()=>Dr(n.data),[n.data]),i=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,a=Kn(n,e.locale),s=J(a),l=j(s),c=Tr(i?.url??null,{parse:i?.format??"auto",select:i?.select,init:e.fetchInit,locale:s}),d=Jn(n),u=(0,We.useMemo)(()=>d?Fr(d,s):void 0,[d,s]),m=n.options?.hidden,h=Array.isArray(m)?m.map(String):[],f=h.join(""),[b,v]=(0,We.useState)(null);if(!r)return(0,fe.jsx)(Ot,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:a});let k=o??c.data,T=t[r.type],M={...n.options??{}},R={...Ri(r,n.encoding),...M,...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:a},y=n.card?.legend==="toggle"&&Yn(r.type,n.encoding??{},M),N=b&&b.base===f?b.hidden:h;y&&(R.hidden=N);let P=p=>v(w=>{let x=w&&w.base===f?w.hidden:h;return{base:f,hidden:x.includes(p)?x.filter($=>$!==p):[...x,p]}}),D=R.height??220,O=_i(n,r.type),E=i&&!k.length&&(c.loading||c.error||c.empty)?(0,fe.jsx)(Ot,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:D,locale:a}):O?(0,fe.jsx)(vr,{chart:T,...Pi(r.type,O,R)}):(0,fe.jsx)(T,{...R});if(n.card){let p=n.card,w=p.legend==="auto"||p.legend==="toggle"?Fi(n,k,s,y):p.legend,x=w?.length?y?(0,fe.jsx)(Et,{items:w,hidden:N,onToggle:P,locale:a}):w:void 0,$=p.download?(0,fe.jsx)(Rr,{data:k,columns:qn(n),filename:p.title??r.type,formats:Array.isArray(p.download)?p.download:void 0,locale:a}):void 0;E=(0,fe.jsx)(Hn,{number:p.number,title:p.title??Wn(r,l),subtitle:p.subtitle,legend:x,actions:$,source:p.source||void 0,note:p.note||void 0,accent:p.accent,takeaway:p.takeaway,level:p.level,sample:p.sample,replay:p.replay!==!1,className:e.className,locale:a,children:E})}let F=e.theme??n.theme;return F&&(E=(0,fe.jsx)(nt,{theme:F,children:E})),E}function Di({cfg:e,components:t}){let n=Pe();return so({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function co(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,lo.hydrateRoot)(r,(0,nn.createElement)(nt,{theme:o.theme,cssVars:!0},(0,nn.createElement)(Di,{cfg:o,components:{[e]:t}})))}co("dumbbell",tn);})();