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