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