ztd-charts-cli 0.10.0 → 0.11.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 (48) hide show
  1. package/dist/api.js +1 -1
  2. package/dist/{chunk-QVGOP3IE.js → chunk-ZZGASY2Y.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 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","accent2","accent3","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",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: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",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: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=`
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((Ki,hn)=>{hn.exports=globalThis.__ztdReact.react});var pn=$t((Ui,gn)=>{gn.exports=globalThis.__ztdReact["react-dom/client"]});var O=$t((ss,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","accent2","accent3","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",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: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",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: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
4
  .ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${ge.accent});outline-offset:3px;border-radius:6px}
@@ -25,4 +25,4 @@
25
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
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);})();
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);var Oi=26;var hc=Oi*.62;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),Ii={kind:"Treemap",ofTotal:"% of total",desc:e=>`${pe(e,"item")}. Largest`},zi={en:Ii,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=zi[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 Bi(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 Hi(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 ji(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 Gi(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={...Bi(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=ji(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,...Gi(r.type,L,C)}):(0,he.jsx)(g,{...C});if(n.card){let S=n.card,$=S.legend==="auto"||S.legend==="toggle"?Hi(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 Vi({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)(Vi,{cfg:o,components:{[e]:t}})))}ko("treemap",un);})();