ztd-charts-cli 0.6.0 → 0.7.0

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