ztd-charts-cli 0.6.0 → 0.7.0

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