ztd-charts-cli 0.11.3 → 0.13.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 (52) hide show
  1. package/README.md +1 -1
  2. package/dist/api.js +1 -1
  3. package/dist/{chunk-VUZPZ5FT.js → chunk-LR5X5LI2.js} +53 -29
  4. package/dist/cli.js +6 -1
  5. package/dist/client/area.js +6 -6
  6. package/dist/client/bar.js +9 -9
  7. package/dist/client/barRace.js +6 -6
  8. package/dist/client/beeswarm.js +7 -7
  9. package/dist/client/box.js +9 -9
  10. package/dist/client/bubble.js +7 -7
  11. package/dist/client/bullet.js +6 -6
  12. package/dist/client/bump.js +6 -6
  13. package/dist/client/calendar.js +10 -10
  14. package/dist/client/candlestick.js +6 -6
  15. package/dist/client/chord.js +7 -7
  16. package/dist/client/choropleth.js +9 -9
  17. package/dist/client/cohort.js +28 -0
  18. package/dist/client/donut.js +6 -6
  19. package/dist/client/dumbbell.js +6 -6
  20. package/dist/client/flowMap.js +7 -7
  21. package/dist/client/funnel.js +9 -9
  22. package/dist/client/gauge.js +6 -6
  23. package/dist/client/heatmap.js +9 -9
  24. package/dist/client/histogram.js +6 -6
  25. package/dist/client/horizon.js +28 -0
  26. package/dist/client/line.js +6 -6
  27. package/dist/client/lollipop.js +6 -6
  28. package/dist/client/marimekko.js +6 -6
  29. package/dist/client/network.js +9 -9
  30. package/dist/client/parallel.js +6 -6
  31. package/dist/client/pareto.js +6 -6
  32. package/dist/client/pie.js +6 -6
  33. package/dist/client/radar.js +7 -7
  34. package/dist/client/radialBar.js +6 -6
  35. package/dist/client/ridgeline.js +6 -6
  36. package/dist/client/sankey.js +10 -10
  37. package/dist/client/scatter.js +10 -10
  38. package/dist/client/segmented.js +6 -6
  39. package/dist/client/skyline.js +7 -7
  40. package/dist/client/slope.js +6 -6
  41. package/dist/client/sparkTable.js +28 -0
  42. package/dist/client/sparkline.js +6 -6
  43. package/dist/client/stream.js +7 -7
  44. package/dist/client/sunburst.js +7 -7
  45. package/dist/client/symbolMap.js +7 -7
  46. package/dist/client/tileMap.js +6 -6
  47. package/dist/client/timeline.js +9 -9
  48. package/dist/client/tree.js +6 -6
  49. package/dist/client/treemap.js +7 -7
  50. package/dist/client/waffle.js +7 -7
  51. package/dist/client/waterfall.js +6 -6
  52. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- (()=>{var Ua=Object.create;var kr=Object.defineProperty;var Ya=Object.getOwnPropertyDescriptor;var qa=Object.getOwnPropertyNames;var Ja=Object.getPrototypeOf,Za=Object.prototype.hasOwnProperty;var Tn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var Qa=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of qa(t))!Za.call(e,o)&&o!==n&&kr(e,o,{get:()=>t[o],enumerable:!(r=Ya(t,o))||r.enumerable});return e};var A=(e,t,n)=>(n=e!=null?Ua(Ja(e)):{},Qa(t||!e||!e.__esModule?kr(n,"default",{value:e,enumerable:!0}):n,e));var U=Tn((Tl,wr)=>{wr.exports=globalThis.__ztdReact.react});var $r=Tn((Ml,vr)=>{vr.exports=globalThis.__ztdReact["react-dom/client"]});var z=Tn((zl,Jr)=>{Jr.exports=globalThis.__ztdReact["react/jsx-runtime"]});var ir=A(U(),1),Pa=A($r(),1);var Ct=A(U(),1);var Yt=A(U(),1);var Tr=A(U(),1),et=(0,Tr.createContext)(void 0);var Ar=A(U(),1);var ei=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],Mr='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',Cr='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',He={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",accent2:"#FF8CC1",accent3:"#38C6F6",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:Mr,monoFamily:Cr,radius:18,radiusCode:14,radiusMark:4},Mn={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",accent2:"#D8488C",accent3:"#659815",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:Mr,monoFamily:Cr,radius:18,radiusCode:14,radiusMark:4},Cn={dark:He,light:Mn};function Ot(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function Sn(e){let t={};for(let n of ei){let r=e[n];typeof r=="string"&&(t[Ot(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 An(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 ti=`
1
+ (()=>{var Ya=Object.create;var wr=Object.defineProperty;var qa=Object.getOwnPropertyDescriptor;var Ja=Object.getOwnPropertyNames;var Za=Object.getPrototypeOf,Qa=Object.prototype.hasOwnProperty;var Mn=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var ei=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ja(t))!Qa.call(e,o)&&o!==n&&wr(e,o,{get:()=>t[o],enumerable:!(r=qa(t,o))||r.enumerable});return e};var R=(e,t,n)=>(n=e!=null?Ya(Za(e)):{},ei(t||!e||!e.__esModule?wr(n,"default",{value:e,enumerable:!0}):n,e));var U=Mn((Al,vr)=>{vr.exports=globalThis.__ztdReact.react});var Tr=Mn((Rl,$r)=>{$r.exports=globalThis.__ztdReact["react-dom/client"]});var O=Mn((Gl,Zr)=>{Zr.exports=globalThis.__ztdReact["react/jsx-runtime"]});var sr=R(U(),1),Pa=R(Tr(),1);var St=R(U(),1);var qt=R(U(),1);var Mr=R(U(),1),tt=(0,Mr.createContext)(void 0);var Rr=R(U(),1);var ti=["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],Cr='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',Sr='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',He={name:"dark",bg:"#14171B",panel:"#14171B",ink:"#F1F3F5",muted:"#A3ABB5",dim:"#5B636D",accent:"#D6FD70",accentText:"#D6FD70",onAccent:"#14171B",accent2:"#FF8CC1",accent3:"#38C6F6",onInk:"#14171B",line:"#2A2F36",line2:"#22272D",neutral:"#3A414A",neutralStrong:"#5F6772",onNeutralStrong:"#F1F3F5",neutralSoft:"#262B31",lift:"#1D2126",tint:"rgba(214, 253, 112, 0.14)",fontFamily:Cr,monoFamily:Sr,radius:18,radiusCode:14,radiusMark:4},Cn={name:"light",bg:"#FFFFFF",panel:"#FFFFFF",ink:"#14171B",muted:"#5D6570",dim:"#B3B9C2",accent:"#0B8FD8",accentText:"#006DA8",onAccent:"#14171B",accent2:"#D8488C",accent3:"#659815",onInk:"#FFFFFF",line:"#E6E9ED",line2:"#F0F2F5",neutral:"#D5DAE0",neutralStrong:"#9AA3AE",onNeutralStrong:"#14171B",neutralSoft:"#EEF1F4",lift:"#F4F6F8",tint:"rgba(11, 143, 216, 0.12)",fontFamily:Cr,monoFamily:Sr,radius:18,radiusCode:14,radiusMark:4},Sn={dark:He,light:Cn};function It(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function An(e){let t={};for(let n of ti){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 Rn(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 ni=`
2
2
  .ztd-root{position:relative;-webkit-tap-highlight-color:transparent}
3
3
  .ztd-root:focus{outline:none}
4
4
  .ztd-root:focus-visible{outline:2px solid var(--ztd-accent,${He.accent});outline-offset:3px;border-radius:6px}
@@ -19,10 +19,10 @@
19
19
  @keyframes ztd-pulse{0%,100%{opacity:.55}50%{opacity:1}}
20
20
  .ztd-skeleton{animation:ztd-pulse 1.4s ease-in-out infinite}
21
21
  @media (prefers-reduced-motion: reduce){.ztd-skeleton{animation:none}}
22
- `;function Nr(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 Rr(e,t){let[n]=(0,Ar.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var Sr=!1;function bt(){if(Sr||typeof document>"u"||(Sr=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=ti,document.head.appendChild(e)}var It=A(U(),1),$e=typeof window<"u"&&typeof document<"u",Fe=$e?It.useLayoutEffect:It.useEffect;function zt(){return typeof performance<"u"?performance.now():Date.now()}function Y(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 Fr={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},Pr={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var ni=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],ri={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function oi(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function ai(e){return oi(ni,e)}function _r(e,t){let n=ai(e);return{text:n?n[t]:e,...ri[n?.id??"basic"]}}var Lr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function tt(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Lr[t.toLowerCase()]&&(t=Lr[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(i=>i+i).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let a=parseInt(o,16);return o.length===6?[a>>16&255,a>>8&255,a&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let a=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),i=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return a.some(s=>Number.isNaN(s))?null:[a[0],a[1],a[2],Number.isNaN(i)?1:i]}return null}function Or(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 Rn(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 nt(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Dr(e){return .2126*nt(e[0])+.7152*nt(e[1])+.0722*nt(e[2])}function Fn(e,t,n){let r=typeof e=="string"?tt(e):e,o=typeof t=="string"?tt(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?tt(n):n:null;o[3]<1&&a&&(o=Rn(o,a));let i=r[3]<1?Rn(r,o):r,s=Dr(i),l=Dr(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function ii(e){return[nt(e[0]),nt(e[1]),nt(e[2])]}function Nn(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 Er(e){let[t,n,r]=ii(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),i=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*a-.0040720468*i,1.9779984951*o-2.428592205*a+.4505937099*i,.0259040371*o+.7827717662*a-.808675766*i]}function si([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,a=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[Nn(4.0767416621*o-3.3077115913*a+.2309699292*i),Nn(-1.2684380046*o+2.6097574011*a-.3413193965*i),Nn(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function Bt(e,t,n){let r=tt(e),o=tt(t);if(!r||!o)return e;let a=Er(r),i=Er(o),s=Math.max(0,Math.min(1,n));return Or(si([a[0]*s+i[0]*(1-s),a[1]*s+i[1]*(1-s),a[2]*s+i[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function Pn(e,t,n){let r=t[0],o=-1;for(let a of t){let i=Fn(a,e,n);i>o&&(o=i,r=a)}return r}function J(e,t){let n=e.theme;switch(t){case"accent":return{role:t,fill:e.paint("accent"),text:e.paint("onAccent"),raw:n.accent};case"ink":return{role:t,fill:e.paint("ink"),text:e.paint("onInk"),raw:n.ink};case"strong":return{role:t,fill:e.paint("neutralStrong"),text:e.paint("onNeutralStrong"),raw:n.neutralStrong};case"soft":return{role:t,fill:e.paint("neutralSoft"),text:e.paint("ink"),raw:n.neutralSoft};default:return{role:"neutral",fill:e.paint("neutral"),text:e.paint("ink"),raw:n.neutral}}}function li(e,t){let n=Pn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return Fn(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):Pn(t,["#FFFFFF","#000000"])}function Ht(e,t){let n=Bt(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:li(e,n),raw:n}}function Te(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=J(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=J(e,"neutral");else if(s===0)r[i]=J(e,"ink");else if(s===a-1)r[i]=J(e,"neutral");else if(a===3)r[i]=J(e,"strong");else{let l=(s-1)/Math.max(1,a-2);r[i]=l<=.001?J(e,"strong"):Ht(e,1-l)}}),r}var _n="mix:";function je(e){return e({theme:Mn,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${_n}${o}`}).map(n=>n.fill)}function Ir(e,t){return t?.startsWith(_n)?e.mix("neutralStrong","neutral",Number(t.slice(_n.length))):e.color(t)}function yt(e,t,n){return Te(e,t+1,n).slice(0,t)}function zr(e,t,n,r="neutral"){let o=J(e,"accent"),a=J(e,r);return Array.from({length:t},(i,s)=>n.has(s)?o:a)}function Br(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=J(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=J(e,"neutral"):s===0?r[i]=J(e,"strong"):s===a-1?r[i]=J(e,"neutral"):r[i]=Ht(e,1-s/(a-1))}),r}var Me=A(U(),1);var Gt=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),ue="en-US",Hr=new Map;function Ln(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=Hr.get(r);return o||(o=new Intl.NumberFormat(e,n),Hr.set(r,o)),o}function Dn(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function rt(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ue,...r}=t;return Dn(Ln(n,r).format(e))}var En=e=>e!==0&&Math.abs(e)<.05,On=(e,t,n="")=>`${rt(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function jt(e,t={}){if(!Number.isFinite(e))return"-";if(En(e)&&t.maximumFractionDigits===void 0)return On(e,t.locale??ue,"%");let n=Math.abs(e);return`${rt(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Wr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ue,...r}=t;if(Y(n)==="ko"){let o=Math.abs(e),a=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],i=a.findIndex(([s])=>o>=s);for(i<0&&(i=a.length-1);;){let[s,l]=a[i],c=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**m)/10**m;if(i>0&&u>=a[i-1][0]/s){i--;continue}return(e<0&&u!==0?"-":"")+rt(u,{locale:n,...r,maximumFractionDigits:m})+l}}return Dn(Ln(n,{notation:"compact",...r}).format(e))}var ci=(e,t=Y(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Ye(e,t=ue,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=Ln(t,o);return l=>Number.isFinite(l)?`${i}${Dn(s.format(l))}${a}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:a="",...i}=e;return r(i,o,a)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>jt(o,{locale:t});case"ratio":return o=>jt(o*100,{locale:t});case"compact":return o=>Wr(o,{locale:t});case"currency":return r(ci(t));default:{let o=r({maximumFractionDigits:1});return a=>En(a)?On(a,t):o(a)}}}function xt(e,t=ue,n=0){return e!==void 0?Ye(e,t):n>=1e5?r=>En(r)?On(r,t):Wr(r,{locale:t}):r=>rt(r,{locale:t})}function ui(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var In=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,mi=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,di=["january","february","march","april","may","june","july","august","september","october","november","december"],jr=e=>{let t=e.toLowerCase();return t.length<3?0:di.findIndex(n=>n.startsWith(t))+1},Gr=e=>+e+(+e<30?2e3:1900);function Kr(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var fi=[/^(\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})일)?$/],Xr=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Ur=/\{([^{}]+)\}/g;function Vt(e,t){let n;for(let r of fi)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?[Gr(n[3]),+n[2],+n[1],1]:[Gr(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=Xr.exec(e)){let r=+n[1],o=+n[3],a=r>12||o<=12&&t===!0;return[+n[4],a?o:r,a?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=jr(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=jr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var Yr=e=>mi.test(e)||Vt(e)!==null;function qr(e){let t;for(let n of e){let r=typeof n=="string"?Xr.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function Wt(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(In(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return Wt(`${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=Vt(n,t);if(r)return ui(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 Vr=new Map;function kt(e,t={month:"short",day:"numeric"}){let n=Wt(e);if(!n)return"-";let{locale:r=ue,...o}=t,a=r+JSON.stringify(o),i=Vr.get(a);return i||(i=new Intl.DateTimeFormat(r,o),Vr.set(a,i)),i.format(n)}var zn=A(z(),1),Kt=(0,Me.createContext)({theme:He,cssVars:!0});function hi(e,t=He){return e?typeof e=="string"?Cn[e]??t:An(t,e):t}function Xt(e){let t=(0,Me.useContext)(Kt),n=e.base?Cn[e.base]:t.theme,r=(0,Me.useMemo)(()=>hi(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,Me.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,Me.useMemo)(()=>Sn(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,zn.jsx)(Kt.Provider,{value:i,children:(0,zn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var gi=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Zr(e){return gi.has(e)}function pi(e,t){let n=r=>t?`var(${Ot(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?Zr(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Zr(r)?e[r]:r:e[o],mix:(r,o,a)=>{let i=Math.round(Math.max(0,Math.min(1,a))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${i}%, ${n(o)})`:Bt(e[r],e[o],a)}}}function Ce(e){let t=(0,Me.useContext)(Kt);return(0,Me.useMemo)(()=>{let n=An(t.theme,e);return pi(n,t.cssVars)},[t.theme,t.cssVars,e])}function he(e){let t=(0,Me.useContext)(Kt);return e??t.locale??ue}function Qr(e){return e?Sn(e):{}}var Ut=A(U(),1),Bn=(0,Ut.createContext)(void 0);function eo(e){let t=(0,Ut.useContext)(Bn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var N=A(z(),1),bi={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`},yi={en:bi,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var xi={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Hn=e=>yi[Y(he(e))];function jn(e){let t=Ce(e.theme),n=Hn(e.locale),[r,o]=(0,Yt.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.label)).length,c=(0,N.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((m,u)=>{let d=!s.has(m.label),h=d&&l===1,f=(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(ki,{p:t,item:m,off:!d}),(0,N.jsx)("span",{style:d?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,N.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,N.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":d,"aria-disabled":h||void 0,onClick:()=>{h||(i(m.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:h?"default":void 0},children:f}):f},u)})});return i?(0,N.jsxs)(N.Fragment,{children:[c,(0,N.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:xi,children:r?n.shown(l,e.items.length):""})]}):c}function ki({p:e,item:t,off:n}){let r=Ir(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,N.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,N.jsx)("line",{x1:1,x2:13,y1:4,y2:4,stroke:r,strokeWidth:2,strokeDasharray:o==="dash"?"3 2":void 0,strokeLinecap:"round"}),o==="line"?(0,N.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,N.jsx)("span",{"aria-hidden":"true",style:{width:9,height:9,flex:"none",borderRadius:o==="circle"?9:2.5,background:r,boxShadow:t.color==="neutral"||t.color==="neutralSoft"||!t.color?`inset 0 0 0 1px ${e.paint("line2")}`:void 0,opacity:n?.35:void 0}})}function wi(e){let t=Ce(e.theme),n=_r(e.level,Y(he(e.locale)));return(0,N.jsx)("span",{style:{background:t.paint(n.bg),color:t.paint(n.fg),borderRadius:8,padding:"3px 9px",fontSize:12.5,fontWeight:700,lineHeight:"18px",whiteSpace:"nowrap",flex:"none"},children:n.text})}function vi(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,N.jsxs)(N.Fragment,{children:[e.slice(0,r),(0,N.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function to(e){let t=Ce(e.theme),n=Hn(e.locale),[r,o]=(0,Yt.useState)(0);Fe(()=>bt(),[]);let a=()=>{o(d=>d+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,N.jsx)(jn,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,c=e.replay||e.onReplay,m=e.source!==void 0||e.note!==void 0?(0,N.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,N.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,N.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,N.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,N.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,N.jsx)(wi,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,N.jsxs)("section",{id:e.id,className:`ztd-card${e.className?` ${e.className}`:""}`,style:{background:t.paint("panel"),color:t.paint("ink"),border:`1px solid ${t.paint("line")}`,borderRadius:`var(--ztd-radius, ${t.theme.radius}px)`,padding:"20px 20px 16px",display:"flex",flexDirection:"column",gap:12,minWidth:0,boxSizing:"border-box",fontFamily:t.cssVars?`var(--ztd-font, ${t.theme.fontFamily})`:t.theme.fontFamily,wordBreak:"keep-all",textWrap:"balance",...e.style},children:[(0,N.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,N.jsx)("span",{style:{fontFamily:t.cssVars?`var(--ztd-mono, ${t.theme.monoFamily})`:t.theme.monoFamily,fontSize:17,fontWeight:700,color:t.paint("accentText"),letterSpacing:-.2,flex:"none"},children:l}):null,(0,N.jsx)(s,{style:{margin:0,fontSize:22,fontWeight:800,color:t.paint("ink"),letterSpacing:-.5,lineHeight:1.25,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:vi(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,N.jsx)("button",{type:"button",className:"ztd-btn",onClick:a,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,N.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,N.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,N.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,N.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,N.jsx)("span",{}),i]}):null]}),(0,N.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,N.jsx)(Bn.Provider,{value:r,children:(0,N.jsx)(et.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,N.jsxs)(N.Fragment,{children:[m,u]}):u]})}function Gn(e){let t=Ce(e.theme),n=Hn(e.locale),r=e.height??220;if(Fe(()=>bt(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,N.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,N.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,N.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,N.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,N.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onRetry,style:{marginTop:4,background:t.paint("ink"),color:t.paint("onInk"),border:"none",borderRadius:14,padding:"5px 14px",fontSize:12.5,fontWeight:700},children:n.retry}):null]})})}return e.loading?(0,N.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,a)=>(0,N.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${a*90}ms`}},a))}):e.empty?(0,N.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,N.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,N.jsx)(N.Fragment,{children:e.children})}var ut=A(U(),1);var ge=A(U(),1);var W=A(z(),1),qt=60;var Jt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function no(e){let{c:t,events:n}=e,r=(0,ge.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,Fe(()=>{bt()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,ge.useContext)(et),c=e.ariaLabel??l??e.kind,m=(0,ge.useMemo)(()=>s?`${n.length}${n.slice(0,qt).map(x=>`${x.label}${x.series??""}${x.formatted??x.value??""}`).join("")}`:"",[n,s]),u=(0,ge.useMemo)(()=>(0,W.jsx)($i,{label:c,events:n,t:t.t}),[c,m,t.t]),d=(0,ge.useRef)(null);(0,ge.useEffect)(()=>{let x=()=>{d.current=null};return window.addEventListener("scroll",x,{capture:!0,passive:!0}),window.addEventListener("resize",x,{passive:!0}),()=>{window.removeEventListener("scroll",x,{capture:!0}),window.removeEventListener("resize",x)}},[]),(0,ge.useEffect)(()=>{d.current=null},[t.width,t.height]);let h=x=>{if(x.target!==x.currentTarget)return;if(e.onKey?.(x)){x.preventDefault();return}let C=t.active,L;switch(x.key){case"ArrowRight":case"ArrowDown":L=C===null?0:(C+1)%i;break;case"ArrowLeft":case"ArrowUp":L=C===null?i-1:(C-1+i)%i;break;case"Home":L=0;break;case"End":L=i-1;break;case"Escape":if(C===null)return;L=null;break;case"Enter":case" ":C!==null&&(x.preventDefault(),t.click(C));return;default:return}x.preventDefault(),t.setActive(L,"keyboard")},{via:f,node:b,setActive:$}=t;(0,ge.useEffect)(()=>{if(f!=="touch"||!b)return;let x=C=>{b.contains(C.target)||$(null)};return document.addEventListener("pointerdown",x),()=>document.removeEventListener("pointerdown",x)},[f,b,$]);let k=t.active!==null?n[t.active]:null,w=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,T=w&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,S=typeof e.renderTip=="function"&&k?e.renderTip(k):null,g=e.announce??(t.via==="keyboard"&&k?`${k.label}${k.series?` ${k.series}`:""}: ${k.formatted??k.value??""} (${(t.active??0)+1}/${i})`:""),F;if(w){let x=w.x*T,C=t.width*T,L=`clamp(${(4-x).toFixed(1)}px, -50%, calc(${(C-x-4).toFixed(1)}px - 100%))`,j=w.y<64;F={position:"absolute",left:x,top:w.y*T,transform:`translate(${L}, ${j?"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 D=x=>{d.current=null,x.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},O=x=>x?C=>{let L=d.current??(d.current=C.currentTarget.getBoundingClientRect());L.width&&x((C.clientX-L.left)/L.width*t.width,(C.clientY-L.top)/L.height*t.height,C)}:void 0,E=O(e.onPointerMove),I=O(e.onPointerDown),P=E||I?x=>{x.pointerType==="touch"&&E?.(x),I?.(x)}:void 0,R=O(e.onPointerUp),M=Qr(e.theme);return(0,W.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?h:void 0,onBlur:x=>{t.via==="keyboard"&&!x.currentTarget.contains(x.relatedTarget)&&t.setActive(null)},onPointerLeave: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,W.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${a}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:E,onPointerDown:P,onPointerUp:R,onPointerCancel:R,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,W.jsx)("title",{id:o,children:c}),(0,W.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,W.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,w?(0,W.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:F,children:S??(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:w.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:w.title}),w.rows.map((x,C)=>(0,W.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,W.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(x.strong?"ink":"muted")},children:[x.color?(0,W.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:x.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,x.label]}),(0,W.jsx)("span",{style:{fontWeight:x.strong===!1?500:700},children:x.value})]},C))]})}):null,(0,W.jsx)("span",{className:"ztd-sr",style:Jt,"aria-live":"polite","aria-atomic":"true",children:g}),s&&!t.pending?u:null]})}function $i({label:e,events:t,t:n}){return(0,W.jsx)("div",{className:"ztd-sr",style:Jt,children:(0,W.jsxs)("table",{children:[(0,W.jsx)("caption",{children:n.table(e)}),(0,W.jsxs)("tbody",{children:[t.slice(0,qt).map((r,o)=>(0,W.jsxs)("tr",{children:[(0,W.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,W.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>qt?(0,W.jsx)("tr",{children:(0,W.jsx)("td",{colSpan:2,children:n.more(t.length-qt)})}):null]})]})})}function Ge(e){let t=e.baseline??"central";return(0,W.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 p=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),ke=p("label","string",!0,"Item name field"),oe=p("value","number",!0,"Value field"),Ti=[ke,oe],Mi=[ke,oe],Ci=[p("label","string",!0,"Stage name"),p("value","number",!0,"Users at the stage")],Si=[ke,oe],Ai=[p("label","string",!0,"Leaf (lowest level) name"),oe,p("group","string",!1,"Parent group field")],Ni=[p("label","string",!0,"Leaf name"),oe,p("group","string",!1,"Parent group field")],Ri=[ke,p("value","number",!0,"Change (total rows may omit it)"),p("type","string",!1,'"total" makes a total bar')],Fi=[ke,oe],Pi=[p("x","string",!0,"Column field"),p("series","string",!0,"Stacked series field"),oe],_i=[p("x","string",!0,"Column field"),p("y","string",!0,"Row field"),oe],Li=[p("axis","string",!0,"Metric (axis) field"),p("value","number",!0,"Value field",{multi:!0}),p("series","string",!1,"Series field")],Di=[p("x","number",!0,"x value"),p("y","number",!0,"y value"),p("size","number",!1,"Circle size"),p("label","string",!1,"Name")],oo=p("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),Ei=[p("x","any",!0,"x field (date, number or category)"),p("y","number",!0,"y field. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field (long tables)"),p("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),oo],Oi=[p("x","any",!0,"x field"),p("y","number",!0,"y field. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field"),p("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}),oo],Ii=[p("x","any",!0,"x field"),p("y","number",!0,"y field",{multi:!0}),p("series","string",!1,"Series field")],zi=[p("x","string",!0,"Category field"),p("y","number",!0,"Value field. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field"),p("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})],Bi=[ke,oe],Hi=[p("value","number",!0,"Value field",{prop:"valueKey"}),p("target","number",!1,"Target field",{prop:"targetKey"})],ji=[ke,p("value","number",!0,"Actual value field"),p("target","number",!1,"Target field")],Gi=[p("x","any",!1,"x field"),p("y","number",!0,"y field")],Vi=[ke,p("x","string",!1,"Period field (long tables)"),p("value","number",!1,"Value field (long tables)")],Wi=[ke,p("start","number",!0,"Before value"),p("end","number",!0,"After value")],Ki=[ke,oe],Xi=[p("value","number",!0,"Value field"),p("group","string",!1,"Group (row) field"),p("label","string",!1,"Dot name")],Ui=[p("group","string",!0,"Group field"),p("value","number",!0,"Value field")],Yi=[p("source","string",!0,"Source node"),p("target","string",!0,"Target node"),oe],qi=[p("source","string",!0,"Sending group"),p("target","string",!0,"Receiving group"),oe],Ji=[p("date","date",!0,"Date field"),oe],Zi=[p("x","any",!0,"Period field"),p("series","string",!0,"Item field"),p("rank","number",!1,"Rank field (1 is first)"),p("value","number",!1,"Value field (instead of rank, largest is first)")],Qi=[p("group","string",!0,"Group field"),p("value","number",!0,"Value field")],es=[p("label","string",!1,"Row name field")],ts=[p("x","date",!0,"Date (period) field"),p("open","number",!0,"Open price field"),p("high","number",!0,"High price field"),p("low","number",!0,"Low price field"),p("close","number",!0,"Close price field"),p("volume","number",!1,"Volume field")],ns=[ke,oe],rs=[p("x","any",!0,"Period field (date or category)"),p("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field (long tables, back row only)"),p("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],os=[p("value","number",!1,"Sample value field (raw rows)"),p("group","string",!1,"Group field. Up to 2 groups overlap"),p("x0","number",!1,"Bin start (pre-binned rows)"),p("x1","number",!1,"Bin end (pre-binned rows)"),p("count","number",!1,"Samples in the bin (pre-binned rows)")],as=[p("region","string",!0,"Region name or code, matched to a tile of options.map"),oe],is=[ke,oe,p("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],ss=[p("source","string",!0,"Source node"),p("target","string",!0,"Target node"),p("value","number",!1,"Link weight. Without it every row counts 1")],ls=[p("label","string",!0,"Row name. Items with the same name share a row"),p("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),p("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),p("group","string",!1,"Group field (one color per group, and the legend)"),p("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],cs=[p("label","string",!0,"Node name field"),p("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),p("group","string",!1,"Parent group field (flat rows, as in the treemap)"),p("id","string",!1,"Row id for id/parent rows. Defaults to the label"),p("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],us=[p("region","string",!0,"Region name or code, matched to a region of options.map"),oe],ms=[p("lon","number",!1,"Longitude (degrees)"),p("lat","number",!1,"Latitude (degrees)"),p("size","number",!1,"Value (circle area). Without it all circles match"),p("label","string",!1,"Place name"),p("region","string",!1,"Region of options.map, for rows without lon and lat"),p("group","string",!1,"Group field (one color per group)")],ds=[p("source","string",!0,"Start: a name in options.places or a region"),p("target","string",!0,"End"),p("value","number",!1,"Amount. Without it each row counts 1")],fs=[p("x","number",!0,"x value"),p("y","number",!0,"y value"),p("series","string",!1,"Series field (one color per series)"),p("label","string",!1,"Name")],ro={pie:Ti,donut:Mi,funnel:Ci,waffle:Si,treemap:Ai,sunburst:Ni,waterfall:Ri,pareto:Fi,marimekko:Pi,heatmap:_i,radar:Li,bubble:Di,line:Ei,area:Oi,stream:Ii,bar:zi,radialBar:Bi,gauge:Hi,bullet:ji,sparkline:Gi,slope:Vi,dumbbell:Wi,lollipop:Ki,beeswarm:Xi,ridgeline:Ui,sankey:Yi,chord:qi,calendar:Ji,bump:Zi,box:Qi,parallel:es,candlestick:ts,segmented:ns,skyline:rs,histogram:os,scatter:fs,tileMap:as,barRace:is,network:ss,timeline:ls,tree:cs,choropleth:us,symbolMap:ms,flowMap:ds},ot={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:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"}};function ao(e,t){return t==="ko"?e.nameKo:e.name}function io(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var so=["line","area","bar","scatter"],lo=24,Vn=["line","area","bar","scatter","timeline"];function Wn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function co(e,t,n){return Vn.includes(e)&&!Wn(e,t,n).length&&!(e==="scatter"&&Zt(n))}function Zt(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function uo(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var hs={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",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap"};function Qt(e){let t=ro[e]?e:hs[e]??Object.keys(ot).find(n=>n.toLowerCase()===e.toLowerCase()||ot[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!ot[t]))return{type:t,component:ot[t].component,name:ot[t].name,nameKo:ot[t].nameKo,encoding:ro[t]}}function mo(e){let t=new Set,n=a=>{Array.isArray(a)?a.forEach(n):typeof a=="string"&&a&&t.add(a)},r=e.encoding??{};for(let a of Qt(e.type)?.encoding.map(i=>i.name)??Object.keys(r))n(r[a]);let o=e.options??{};for(let a of["dimensions","start","end","ranges"])n(o[a]);return[...t]}function fo(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function gs(e,t){if(e==null||typeof e!="object")return;let n=e;if(fo(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!fo(r,o))return;r=r[o]}return r}}function Pe(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 qe(e,t){if(typeof e=="function")return e;let n=e??t;return r=>gs(r,n)}function _e(e,t){let n=qe(e,t);return(r,o)=>Pe(n(r,o))}function we(e,t){let n=qe(e,t);return(r,o)=>{let a=n(r,o);return a==null?"":a instanceof Date?new Date(a.getTime()-a.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(a)}}function Se(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function ps(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
23
- `||c==="\r"))break;t.push(n?"":c)}let r=t.join(""),o=l=>r.split(l).length-1,a=[","," ",";","|"],i=",",s=0;for(let l of a){let c=o(l);c>s&&(s=c,i=l)}return i}var bs=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function ho(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(bs.test(t)||/^[-+]?\.\d+$/.test(t)){let n=Pe(t);if(Number.isFinite(n))return n}return t}function Je(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??ps(o),i=[],s=[],l="",c=!1;for(let f=0;f<o.length;f++){let b=o[f];c?b==='"'?o[f+1]==='"'?(l+='"',f++):c=!1:l+=b:b==='"'&&!l.trim()?(c=!0,l=""):b===a?(s.push(l),l=""):b===`
24
- `||b==="\r"?(b==="\r"&&o[f+1]===`
25
- `&&f++,s.push(l),i.push(s),s=[],l=""):l+=b}(l!==""||s.length)&&(s.push(l),i.push(s));let m=i.filter(f=>!(f.length===1&&f[0].trim()===""));if(!m.length)return[];let u=f=>n?ho(f):f;if(!r)return m.map(f=>Object.fromEntries(f.map((b,$)=>[String($),u(b)])));let d=[],h=new Set;return m[0].forEach((f,b)=>{let $=f.trim()||`col${b+1}`,k=$;for(let w=2;h.has(k);w++)k=`${$}_${w}`;h.add(k),d.push(k)}),m.slice(1).map(f=>Object.fromEntries(d.map((b,$)=>[b,u(f[$]??"")])))}function Kn(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((i,s)=>String(i??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(i=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof i[l]=="string"?ho(i[l]):i[l]??null])))}function ys(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,l)=>Object.fromEntries(a.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function go(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 Ve(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Ve(JSON.parse(t))}catch{}return Je(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Kn(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)?Ve(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Kn(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)?Ve(t.rows):Array.isArray(t.values)?Kn(t.values):Array.isArray(t.items)?Ve(t.items):Array.isArray(t.results)?Ve(t.results):ys(t)}return[]}function en(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=a=>{try{return JSON.stringify(a)}catch{return String(a)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let a=0;a<t;a+=r)o.push(e[a]);return o.push(e[t-1]),`${t}:${n(o)}`}function Xn(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(l,c)=>{let m=e[l][c];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let m=0,u=0;for(let d=0;d<n;d++){let h=i(d,c),f=h-i(d,c-1),b=0;for(let $=0;$<d;$++)b+=i($,c)-i($,c-1);m+=h,u+=(f/2+b)*h}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,d=0;for(let h=0;h<n;h++){let f=e[h][l],b=Number.isFinite(f)?f:0;b>=0?(o[h][l]=u,u+=b,a[h][l]=u):(o[h][l]=d,d+=b,a[h][l]=d)}continue}let c=0;for(let u=0;u<n;u++)c+=i(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let d=i(u,l);t==="expand"&&(d=c?d/c*100:0),o[u][l]=m,m+=d,a[u][l]=m}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,a[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let d=0;d<r;d++)o[u][d]-=m,a[u][d]-=m}return{y0:o,y1:a}}function po(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 bo(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((d,h)=>{d>u&&(u=d,m=h)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),a=[],i=[],s=0,l=0;for(let c of o)s<l?(a.push(c),s+=r[c]):(i.push(c),l+=r[c]);return[...i.reverse(),...a]}var xs=Math.PI*2;function yo(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function xo(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function ks(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function ko(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 tn=new Map;function at(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=tn.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);ks(c)?i+=ko(c):s+=ko(c)}a=i+s*(n>=600?1.07:1),tn.size>5e3&&tn.clear(),tn.set(o,a)}return a*t}function wo(e,t,n=0){return e.x<t.x+t.w+n&&t.x<e.x+e.w+n&&e.y<t.y+t.h+n&&t.y<e.y+e.h+n}function Un(e,t,n,r,o="start",a=400){let i=at(e,r,a);return{x:o==="start"?t:o==="middle"?t-i/2:t-i,y:n-r*.6,w:i,h:r*1.2}}var $o=A(z(),1),ws=e=>Array.isArray(e)&&e.length===2;function vo(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&ws(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var it=A(z(),1),st=10.5;function To(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let i=1;i<e.length;i++)o=Math.min(o,Math.abs(e[i]-e[i-1]));let a=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(i=>rt(i,{locale:n,maximumFractionDigits:a}))}function nn(e,t,n){let r=18;for(let o of To(e,t,n))r=Math.max(r,at(o,st));return Math.ceil(r+8)}function Mo(e){let{p:t,ticks:n,y:r,x0:o,x1:a,fmt:i}=e,s=e.side==="right",l=e.labels===!1?null:To(n,i,e.locale);return(0,it.jsx)("g",{"aria-hidden":"true",opacity:e.opacity,children:n.map((c,m)=>{let u=Math.round(r(c))+.5,d=c===0&&e.zero!==!1;return(0,it.jsxs)("g",{children:[(0,it.jsx)("line",{x1:o,x2:a,y1:u,y2:u,stroke:t.paint(d?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:d?.7:1}),l?(0,it.jsx)(Ge,{x:s?a+6:o-6,y:u,anchor:s?"start":"end",size:st,fill:t.paint("muted"),children:l[m]}):null]},c)})})}function Yn(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 Oe(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,l=Yn(i,n),c=[o,a];for(let m=0;m<4;m++){let u=Math.ceil(a/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-d<=l*.3?d:o-i*s,a===0?0:u-a<=l*.3?u:a+i*s];let h=Yn(c[1]-c[0],n);if(h===l)break;l=h}return c}function Co(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=Yn(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let l=s,c=0;l<=o+a*1e-9&&c<200;l+=a,c++)i.push(Number((Math.round(l/a)*a).toPrecision(12)));return i}function lt(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(l=>o+(l-n)*i);return s.domain=e,s.range=t,s.invert=l=>i===0?n:n+(l-o)/i,s.ticks=(l=4)=>Co(n,r,l),s}function wt(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[a,i]=Oe(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function vs(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(c,m=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let h of c){let f=Number((h*10**d).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&u.push(f)}return u},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let l=i([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:Co(e,t,3)}function rn(e,t){let n=lt([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=()=>vs(e[0],e[1],Math.abs(t[1]-t[0])),r}function So(e,t){let[n,r]=e,[o,a]=t,i=Math.sqrt(Math.max(0,n)),s=Math.sqrt(Math.max(0,r));return l=>s===i?a:o+(Math.sqrt(Math.max(0,l))-i)/(s-i)*(a-o)}function Ae(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 $s=864e5;function Ao(e,t,n,r=ue){let o=t-e;if(!(o>0))return[{t:e,label:kt(e,{locale:r,month:"short",day:"numeric"})}];let a=o/$s,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,d,h=!1)=>{let f=new Date(m),b=-1,$=0;for(;f.getTime()<=t&&$++<500;){if(f.getTime()>=e){let k=f.getFullYear(),w=h&&!l&&k!==b;i.push({t:f.getTime(),label:kt(f,{locale:r,...d,...w?{year:"numeric"}:{}})}),b=k}u(f)}};if(a<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(h=>h>=m)??12,d=new Date(s);d.setMinutes(0,0,0),c(d,h=>h.setHours(h.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=a/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(h=>h>=u)??120;if(d>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(h,f=>f.setFullYear(f.getFullYear()+d/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%d;f&&h.setMonth(h.getMonth()+(d-f)),c(h,b=>b.setMonth(b.getMonth()+d),{month:"short"},!0)}}return i}function on(e,t){let n=new Array(e),r=new Uint8Array(e),o=a=>{if(typeof a!="string"||a.length===0||a.length>9)return-1;let i=Number(a);return Number.isInteger(i)&&i>=0&&i<e&&String(i)===a?i:-1};return new Proxy(n,{get(a,i,s){let l=o(i);return l>=0?(r[l]||(a[l]=t(l),r[l]=1),a[l]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var Ts=(e,t,n)=>e==="date"?Wt(t,n)?.getTime()??NaN:Pe(t);function Ms(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&Yr(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function vt(e,t,n,r,o={}){let a=qe(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:qe(n,"y"),c=!i&&r!==void 0?qe(r,"series"):null,m=e.map((M,x)=>a(M,x)),u=o.xType??Ms(m),d=o.locale??ue,h,f,b;if(u==="band"){let M=m.map(C=>String(C??""));h=Se(M);let x=new Map(h.map((C,L)=>[C,L]));f=h.map((C,L)=>L),b=Int32Array.from(M,C=>x.get(C)??-1)}else{let M=u==="date"?o.dayFirst??qr(m):void 0,x=m.map(j=>Ts(u,j,M)),C=Array.from(new Set(x.filter(j=>Number.isFinite(j)))).sort((j,se)=>j-se),L=new Map(C.map((j,se)=>[j,se]));f=C,h=C.map(String),b=Int32Array.from(x,j=>L.get(j)??-1)}let $=o.dateFormat,k=M=>typeof M=="string"?Vt(M.trim())?.[3]:void 0,w=u==="date"&&m.length<5e3?k(m[0]):void 0,T=(w===2||w===3)&&m.every(M=>k(M)===w),S=T&&w===3;if(u==="date"&&!$){let M=f.length>1?f[f.length-1]-f[0]:0;$=T&&w===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&&($={year:"numeric",month:"short"})}let g;if(u==="band")g=h;else if(S&&!o.dateFormat){let M=Y(d)==="ko";g=f.map(x=>{let C=new Date(x),L=Math.floor(C.getMonth()/3)+1;return M?`${C.getFullYear()}년 ${L}분기`:`Q${L} ${C.getFullYear()}`})}else{let M=f.every(In),x=u==="date"?new Intl.DateTimeFormat(d,$):new Intl.NumberFormat(d,M?{useGrouping:!1}:{maximumFractionDigits:6});g=f.length>1e3?on(f.length,C=>x.format(f[C])):f.map(C=>x.format(C))}let F=s?[...s]:c?Se(e.map((M,x)=>String(c(M,x)??""))):[""],D=new Map(F.map((M,x)=>[M,x])),O=F.map(()=>new Array(h.length).fill(NaN)),E=F.map(()=>new Array(h.length).fill(null)),I=o.aggregate??"sum",P=I==="mean"?F.map(()=>new Uint32Array(h.length)):null,R=(M,x,C,L)=>{let j=O[M][x];I==="last"?O[M][x]=C:I==="count"?O[M][x]=(Number.isFinite(j)?j:0)+1:I==="mean"?Number.isFinite(C)&&(O[M][x]=(Number.isFinite(j)?j:0)+C,P[M][x]++):O[M][x]=Number.isFinite(j)?j+(Number.isFinite(C)?C:0):C,E[M][x]=L};for(let M=0;M<e.length;M++){let x=b[M];if(x<0)continue;let C=e[M];if(s)for(let L=0;L<s.length;L++)R(L,x,Pe(C[s[L]]),C);else{let L=c?D.get(String(c(C,M)??""))??0:0;R(L,x,Pe(l(C,M)),C)}}if(P)for(let M=0;M<O.length;M++)for(let x=0;x<h.length;x++)P[M][x]>1&&(O[M][x]/=P[M][x]);return{type:u,keys:h,xnum:f,labels:g,series:F,values:O,rows:E}}var Cs=140,Tt=12,No=14,qn=20,Ro=12.5;function Ss(e,t,n=lo){let r=we(t,t),o=new Map;e.forEach((i,s)=>{let l=r(i,s),c=o.get(l);c?c.push(i):o.set(l,[i])});let a=[...o.keys()].slice(0,n);return{values:a,groups:a.map(i=>o.get(i)),dropped:Math.max(0,o.size-n)}}function As(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+Tt)/(Cs+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 Ns(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 $t=e=>e.filter(Number.isFinite);function an(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=_e(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return $t(n)}function Fo(e,t,n,r,o,a){return vt(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function Rs(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let g=t.flat(),F=r.refLines??{},[D,O]=Ae([...an(g,r.x??"x"),...$t([Number(F.x)])]),[E,I]=Ae([...an(g,r.y??"y"),...$t([Number(F.y)])].filter(R=>!s||R>0)),P=r.zero??!1;return{y:c??(s?wt(E,I,i):Oe(E,I,i,{zero:P,pad:.08})),x:r.xDomain??Oe(D,O,Math.max(2,Math.round(o/110)),{zero:P,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",d=n[0]?.keys.join(""),h=n.every(g=>g.keys.join("")===d),f=n.length>0&&n.every(g=>g.type!=="band"&&g.type===n[0].type),b=r.xDomain??(!m&&f?Ae(n.flatMap(g=>$t(g.xnum))):void 0),$=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if($==="percent")return{x:b,sameKeys:h};if(c)return{y:c,x:b,sameKeys:h};let k=[];t.forEach((g,F)=>{let D=n[F];if($==="stacked"||$==="auto"&&D.series.length>1){let E=Xn(D.values,"zero");E.y0.forEach(I=>k.push(...I)),E.y1.forEach(I=>k.push(...I))}else D.values.forEach(E=>k.push(...E));m&&!u&&r.line!==void 0&&Fo(e,g,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(E=>k.push(...E)),m||k.push(...an(g,r.lower),...an(g,r.upper))}),m&&k.push(0),u||k.push(...vo(r.annotations));for(let g of r.referenceLines??[])k.push(g.y);r.signColors&&k.push(Number(r.baseline??0));let[w,T]=Ae($t(k).filter(g=>!s||g>0));return{y:s?wt(w,T,i):m?Oe(w,T,u?Math.max(2,Math.round(o/120)):i):Oe(w,T,i,{zero:r.zero??e==="area"}),x:b,sameKeys:h}}function Fs(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=vt(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?rn:lt)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),m=nn(c,xt(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(g=>g.series),d=r.endLabels??n.some(g=>g.series.length>1),h=m+6,f=a-(d?Math.min(a*.28,Math.max(...u.map(g=>at(g,11,700)),20)+14):10),b=l.keys.length,[$,k]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,w=l.type==="number"?b>12:b>Ao($,k,Math.max(2,Math.floor((f-h)/64)),s).length;if(l.type==="band"||!b||w)return;let T=g=>h+(l.xnum[g]-$)/(k-$)*(f-h),S=g=>at(l.labels[g],st);for(let g=1;;g++){let F=Array.from({length:Math.ceil(b/g)},(D,O)=>O*g);if(g>=b||F.every((D,O)=>!O||T(D)-T(F[O-1])>=(S(D)+S(F[O-1]))/2+8))return F.map(D=>({value:l.xnum[D],label:l.labels[D]}))}}function Ps(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 _s(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${Ps(`${e}|${t}|${o}|${en(r)}`)}`}function Ls(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 Ds={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:"(빈 값)"}},Jn=18;function Po(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=Ss(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=As(s,i,e.columns),{pw:c,ph:m}=Ns(s,l,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(P=>Fo(t,P,n,n.y,n.series,n.aggregate)),h=u?Rs(t,o,d,n,c,m):{sameKeys:!1},f=u?Fs(t,o,d,n,h,c,m,e.locale):void 0,b=t==="bar"&&n.orientation==="horizontal",$=u&&(!b||h.sameKeys),k=u&&(b||h.x!==void 0||h.sameKeys),w=new Set(Ls(e.highlight,r)?[e.highlight].flat():[]),T=w.size>0,S=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,g=e.syncId??_s(t,e.by,n,e.data),F=Gt(Ye(n.format,e.locale),n.unit),D=Ds[e.lang],O=[],E=r.map(P=>P===""?D.blank:P);return{panels:r.map((P,R)=>{let M=o[R],x=E[R],C=R%l,L;if(t!=="scatter"){let se=d[R],ne=be=>se.values.reduce((ye,me)=>ye+(Number.isFinite(me[be])?me[be]:0),0),H=se.keys.map((be,ye)=>ye).filter(be=>se.values.some(ye=>Number.isFinite(ye[be]))),le=H[H.length-1];O.push({first:H.length?ne(H[0]):NaN,last:H.length?ne(le):NaN,total:H.reduce((be,ye)=>be+ne(ye),0)}),t!=="bar"&&se.series.length===1&&le!==void 0&&(L=F(se.values[0][le]))}else O.push({first:NaN,last:NaN,total:M.length});let j={data:M,width:c,height:m,ariaLabel:e.title?`${e.title}, ${x}`:x,syncId:g,highlight:T?w.has(P)?S?()=>!0:void 0:"none":e.highlight,showYAxis:!$||C===0,showXAxis:!k||R+l>=i};return h.y&&(j.yDomain=h.y),h.x&&(j.xDomain=h.x),f&&(j.xTicks=f),{value:P,label:x,props:j,last:L,isPicked:w.has(P)}}),cols:l,pw:c,ph:m,isPanelPick:T,description:Es(t,e.by,E,O,a,F,D)}}function Es(e,t,n,r,o,a,i){let s=i.intro(n.length,t),l=c=>xo(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=i.endHigh(n[c],a(r[c].last)));let m=n.filter((u,d)=>r[d].last<r[d].first);s+=m.length?i.falling(`${m.slice(0,5).join(", ")}${m.length>5?i.more:""}`):i.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?i.total(n[c],a(r[c].total)):i.points(n[c],r[c].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var pe=A(U(),1);function Os(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Is(e,t,n=1/0){let r=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=Math.min(r*.5,n))}var sn={threshold:.25,enoughPx:96,rootMargin:"0px"};function Do(e,t=!0){let[n,r]=(0,pe.useState)({visible:!t,near:!t});return(0,pe.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(i=>{let s=Is(i[i.length-1],sn.threshold,sn.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:Os(sn.threshold),rootMargin:sn.rootMargin}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),a.observe(e),()=>{o.disconnect(),a.disconnect()}},[e,t]),n}function _o(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function ln(e){let[t,n]=(0,pe.useState)(null),[r,o]=(0,pe.useState)(e??null),a=(0,pe.useCallback)(i=>{n(i),i&&e===void 0&&o(_o(i))},[e]);return Fe(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>i(_o(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?i(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var zs=()=>()=>{};function ct(){return(0,pe.useSyncExternalStore)(zs,()=>!0,()=>!1)}var Lo="(prefers-reduced-motion: reduce)";function cn(e="auto"){let[t,n]=(0,pe.useState)(()=>$e&&typeof window.matchMedia=="function"?window.matchMedia(Lo).matches:!1);return(0,pe.useEffect)(()=>{if(e!=="auto"||!$e||typeof window.matchMedia!="function")return;let r=window.matchMedia(Lo),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Ne=A(z(),1),Bs=60,Hs=420;function Eo(e){let t=Ce(),n=e.chartProps??{},[,r,o]=ln(e.width),a=e.width??(o||480),i=he(e.locale??n.locale),s=Y(i),l=(0,ut.useContext)(et),c=e.title??l,m=e.chart.facetPlan,u=(0,ut.useMemo)(()=>{let k=Po({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:a,height:e.height,title:c,locale:i,lang:s});return m?m(k,n,i):k},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(k,w)=>typeof w=="function"?String(w):w),e.highlight,e.syncId,a,e.height,c,i,s,m]),d=`${(0,ut.useId)().replace(/:/g,"")}fd`,h=cn(n.reducedMotion??"auto"),f=ct(),b=Rr({motion:{enabled:n.animate!==!1&&!h&&$e},hydrated:f},{waiting:!1,generation:0}),$=e.chart;return(0,Ne.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Ne.jsx)("p",{id:d,style:Jt,children:e.description??u.description}),(0,Ne.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:Tt,rowGap:No,...u.legend?{marginTop:Jn}:null},children:u.panels.map((k,w)=>{let T=t.paint(k.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,Ne.jsxs)("div",{"data-facet":k.value,style:{minWidth:0,...Nr(b,!1,"fade",w*Bs,Hs)},children:[(0,Ne.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:qn,fontSize:Ro,fontWeight:700,lineHeight:`${qn}px`,color:T},children:[(0,Ne.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.label}),k.last!==void 0?(0,Ne.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:k.last}):null]}),(0,Ne.jsx)($,{...n,...k.props})]},k.value)})}),u.legend?(0,Ne.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Jn},children:u.legend}):null]})}var Oo=["max","min","first","last","none"];function Re(e,t,n,r,o="max"){let a=new Set,i=n.length,s=c=>{if(i&&c!=="none"){if(c==="first")a.add(0);else if(c==="last")a.add(i-1);else if(c==="max"||c==="min"){let m=-1,u=c==="max"?-1/0:1/0;r.forEach((d,h)=>{Number.isFinite(d)&&(c==="max"?d>u:d<u)&&(u=d,m=h)}),m>=0&&a.add(m)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((c,m)=>{m<i&&c!==null&&c!==void 0&&e(c,m)&&a.add(m)}),a;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<i&&a.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&a.add(u)});return a}var ve=A(U(),1);async function js(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",a=await e.text();if(t==="text")return a;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(a))throw new Error(Y(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Je(a);if(t==="json"||o.includes("json"))return JSON.parse(a);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return Je(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):Je(a)}async function Gs(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),a=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!a.ok)throw new Error(`HTTP ${a.status}${a.statusText?` ${a.statusText}`:""}`);r=await js(a,t.parse,o,t.locale)}return t.select&&(r=go(r,t.select)),t.transform?t.transform(r):Ve(r)}function Io(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,ve.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,ve.useState)(0),c=he(t.locale),m=(0,ve.useRef)(t);m.current={...t,locale:c};let u=(0,ve.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],f=JSON.stringify(h.map(k=>typeof k=="object"?JSON.stringify(k):String(k))),b=(0,ve.useRef)(!1);(0,ve.useEffect)(()=>{let k=u.current;if(!k||!r){i(S=>S.status==="loading"?{...S,status:"idle"}:S);return}let w=new AbortController,T=!0;return b.current=!0,i(S=>({...S,data:o?S.data:[],status:"loading",error:null})),Gs(k,{...m.current,signal:w.signal}).then(S=>{T&&i({data:S,status:"success",error:null,updatedAt:Date.now()})}).catch(S=>{!T||w.signal.aborted||i(g=>({...g,status:"error",error:S instanceof Error?S:new Error(String(S))}))}).finally(()=>{T&&(b.current=!1)}),()=>{T=!1,b.current=!1,w.abort()}},[d,r,s,f,o]),(0,ve.useEffect)(()=>{if(!n||!r)return;let k=setInterval(()=>{b.current||l(w=>w+1)},n);return()=>clearInterval(k)},[n,r]);let $=(0,ve.useCallback)(()=>l(k=>k+1),[]);return{data:a.data,status:a.status,loading:a.status==="loading",error:a.error,empty:a.status==="success"&&a.data.length===0,updatedAt:a.updatedAt,reload:$}}var Qn=A(z(),1),Vs=["csv","svg","png"],Ws=/^[=+\-@\t\r\n=+-@]/,Ks=/var\(|color-mix\(/;function zo(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?Kr(e.getTime()):String(e);return`"${(Ws.test(t)&&!Number.isFinite(Pe(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Xs(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Us(e,t){return`\uFEFF${[t.map(zo),...e.map(r=>t.map(o=>zo(r[o])))].map(r=>r.join(",")).join(`\r
22
+ `;function Nr(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 Fr(e,t){let[n]=(0,Rr.useState)(!e.motion.enabled);return e.motion.enabled&&e.hydrated&&(!n||t.waiting||t.generation>0)}var Ar=!1;function yt(){if(Ar||typeof document>"u"||(Ar=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=ni,document.head.appendChild(e)}var zt=R(U(),1),ke=typeof window<"u"&&typeof document<"u",Ne=ke?zt.useLayoutEffect:zt.useEffect;function Bt(){return typeof performance<"u"?performance.now():Date.now()}function q(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function Oe(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var _r={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},Pr={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var ri=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],oi={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function ai(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function ii(e){return ai(ri,e)}function Lr(e,t){let n=ii(e);return{text:n?n[t]:e,...oi[n?.id??"basic"]}}var Dr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function nt(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),Dr[t.toLowerCase()]&&(t=Dr[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(i=>i+i).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let a=parseInt(o,16);return o.length===6?[a>>16&255,a>>8&255,a&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let a=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),i=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return a.some(s=>Number.isNaN(s))?null:[a[0],a[1],a[2],Number.isNaN(i)?1:i]}return null}function Ir(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 Fn(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 rt(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Er(e){return .2126*rt(e[0])+.7152*rt(e[1])+.0722*rt(e[2])}function _n(e,t,n){let r=typeof e=="string"?nt(e):e,o=typeof t=="string"?nt(t):t;if(!r||!o)return 0;let a=n?typeof n=="string"?nt(n):n:null;o[3]<1&&a&&(o=Fn(o,a));let i=r[3]<1?Fn(r,o):r,s=Er(i),l=Er(o);return(Math.max(s,l)+.05)/(Math.min(s,l)+.05)}function si(e){return[rt(e[0]),rt(e[1]),rt(e[2])]}function Nn(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 Or(e){let[t,n,r]=si(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),i=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*a-.0040720468*i,1.9779984951*o-2.428592205*a+.4505937099*i,.0259040371*o+.7827717662*a-.808675766*i]}function li([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,a=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[Nn(4.0767416621*o-3.3077115913*a+.2309699292*i),Nn(-1.2684380046*o+2.6097574011*a-.3413193965*i),Nn(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function Ht(e,t,n){let r=nt(e),o=nt(t);if(!r||!o)return e;let a=Or(r),i=Or(o),s=Math.max(0,Math.min(1,n));return Ir(li([a[0]*s+i[0]*(1-s),a[1]*s+i[1]*(1-s),a[2]*s+i[2]*(1-s)],r[3]*s+o[3]*(1-s)))}function Pn(e,t,n){let r=t[0],o=-1;for(let a of t){let i=_n(a,e,n);i>o&&(o=i,r=a)}return r}function Z(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 ci(e,t){let n=Pn(t,[e.theme.ink,e.theme.onAccent,e.theme.onNeutralStrong]);return _n(n,t)>=4.5?n===e.theme.ink?e.paint("ink"):n===e.theme.onAccent?e.paint("onAccent"):e.paint("onNeutralStrong"):Pn(t,["#FFFFFF","#000000"])}function jt(e,t){let n=Ht(e.theme.neutralStrong,e.theme.neutral,t);return{role:"mix",fill:e.mix("neutralStrong","neutral",t),text:ci(e,n),raw:n}}function we(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=Z(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{if(a===1)r[i]=Z(e,"neutral");else if(s===0)r[i]=Z(e,"ink");else if(s===a-1)r[i]=Z(e,"neutral");else if(a===3)r[i]=Z(e,"strong");else{let l=(s-1)/Math.max(1,a-2);r[i]=l<=.001?Z(e,"strong"):jt(e,1-l)}}),r}var Ln="mix:";function je(e){return e({theme:Cn,cssVars:!1,paint:n=>n,color:n=>n??"neutral",raw:n=>n??"neutral",mix:(n,r,o)=>`${Ln}${o}`}).map(n=>n.fill)}function zr(e,t){return t?.startsWith(Ln)?e.mix("neutralStrong","neutral",Number(t.slice(Ln.length))):e.color(t)}function xt(e,t,n){return we(e,t+1,n).slice(0,t)}function Br(e,t,n,r="neutral"){let o=Z(e,"accent"),a=Z(e,r);return Array.from({length:t},(i,s)=>n.has(s)?o:a)}function Hr(e,t,n){let r=new Array(t),o=[];for(let i=0;i<t;i++)n.has(i)?r[i]=Z(e,"accent"):o.push(i);let a=o.length;return o.forEach((i,s)=>{a===1?r[i]=Z(e,"neutral"):s===0?r[i]=Z(e,"strong"):s===a-1?r[i]=Z(e,"neutral"):r[i]=jt(e,1-s/(a-1))}),r}var ve=R(U(),1);var Vt=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),ce="en-US",jr=new Map;function Dn(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=jr.get(r);return o||(o=new Intl.NumberFormat(e,n),jr.set(r,o)),o}function En(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function ot(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ce,...r}=t;return En(Dn(n,r).format(e))}var On=e=>e!==0&&Math.abs(e)<.05,In=(e,t,n="")=>`${ot(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function Gt(e,t={}){if(!Number.isFinite(e))return"-";if(On(e)&&t.maximumFractionDigits===void 0)return In(e,t.locale??ce,"%");let n=Math.abs(e);return`${ot(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function Wr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=ce,...r}=t;if(q(n)==="ko"){let o=Math.abs(e),a=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],i=a.findIndex(([s])=>o>=s);for(i<0&&(i=a.length-1);;){let[s,l]=a[i],c=o/s,m=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||c<100?1:0)),u=Math.round(c*10**m)/10**m;if(i>0&&u>=a[i-1][0]/s){i--;continue}return(e<0&&u!==0?"-":"")+ot(u,{locale:n,...r,maximumFractionDigits:m})+l}}return En(Dn(n,{notation:"compact",...r}).format(e))}var ui=(e,t=q(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function qe(e,t=ce,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=Dn(t,o);return l=>Number.isFinite(l)?`${i}${En(s.format(l))}${a}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:a="",...i}=e;return r(i,o,a)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>Gt(o,{locale:t});case"ratio":return o=>Gt(o*100,{locale:t});case"compact":return o=>Wr(o,{locale:t});case"currency":return r(ui(t));default:{let o=r({maximumFractionDigits:1});return a=>On(a)?In(a,t):o(a)}}}function kt(e,t=ce,n=0){return e!==void 0?qe(e,t):n>=1e5?r=>On(r)?In(r,t):Wr(r,{locale:t}):r=>ot(r,{locale:t})}function mi(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var zn=e=>Number.isInteger(e)&&e>=1e3&&e<=9999,di=/^\d{4}-\d{1,2}(-\d{1,2})?([T ][\d:.]+(Z|[+-]\d{2}:?\d{2})?)?$/,fi=["january","february","march","april","may","june","july","august","september","october","november","december"],Gr=e=>{let t=e.toLowerCase();return t.length<3?0:fi.findIndex(n=>n.startsWith(t))+1},Vr=e=>+e+(+e<30?2e3:1900);function Xr(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var hi=[/^(\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})일)?$/],Ur=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,Yr=/\{([^{}]+)\}/g;function Kt(e,t){let n;for(let r of hi)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?[Vr(n[3]),+n[2],+n[1],1]:[Vr(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=Ur.exec(e)){let r=+n[1],o=+n[3],a=r>12||o<=12&&t===!0;return[+n[4],a?o:r,a?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=Gr(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=Gr(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}var qr=e=>di.test(e)||Kt(e)!==null;function Jr(e){let t;for(let n of e){let r=typeof n=="string"?Ur.exec(n.trim()):null;if(r){if(+r[1]>12)return!0;+r[3]>12&&(t=!1)}}return t}function Wt(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(zn(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return Wt(`${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=Kt(n,t);if(r)return mi(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 Kr=new Map;function wt(e,t={month:"short",day:"numeric"}){let n=Wt(e);if(!n)return"-";let{locale:r=ce,...o}=t,a=r+JSON.stringify(o),i=Kr.get(a);return i||(i=new Intl.DateTimeFormat(r,o),Kr.set(a,i)),i.format(n)}var Bn=R(O(),1),Xt=(0,ve.createContext)({theme:He,cssVars:!0});function gi(e,t=He){return e?typeof e=="string"?Sn[e]??t:Rn(t,e):t}function Ut(e){let t=(0,ve.useContext)(Xt),n=e.base?Sn[e.base]:t.theme,r=(0,ve.useMemo)(()=>gi(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,ve.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,ve.useMemo)(()=>An(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,Bn.jsx)(Xt.Provider,{value:i,children:(0,Bn.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var pi=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","accent2","accent3","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function Qr(e){return pi.has(e)}function bi(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?Qr(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?Qr(r)?e[r]:r:e[o],mix:(r,o,a)=>{let i=Math.round(Math.max(0,Math.min(1,a))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${i}%, ${n(o)})`:Ht(e[r],e[o],a)}}}function $e(e){let t=(0,ve.useContext)(Xt);return(0,ve.useMemo)(()=>{let n=Rn(t.theme,e);return bi(n,t.cssVars)},[t.theme,t.cssVars,e])}function de(e){let t=(0,ve.useContext)(Xt);return e??t.locale??ce}function eo(e){return e?An(e):{}}var Yt=R(U(),1),Hn=(0,Yt.createContext)(void 0);function to(e){let t=(0,Yt.useContext)(Hn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var N=R(O(),1),yi={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`},xi={en:yi,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var ki={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},jn=e=>xi[q(de(e))];function Gn(e){let t=$e(e.theme),n=jn(e.locale),[r,o]=(0,qt.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(m=>!s.has(m.label)).length,c=(0,N.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((m,u)=>{let d=!s.has(m.label),h=d&&l===1,f=(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(wi,{p:t,item:m,off:!d}),(0,N.jsx)("span",{style:d?void 0:{textDecoration:"line-through"},children:m.label})]});return(0,N.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,N.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":d,"aria-disabled":h||void 0,onClick:()=>{h||(i(m.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:h?"default":void 0},children:f}):f},u)})});return i?(0,N.jsxs)(N.Fragment,{children:[c,(0,N.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:ki,children:r?n.shown(l,e.items.length):""})]}):c}function wi({p:e,item:t,off:n}){let r=zr(e,t.color),o=t.shape??"square";return o==="line"||o==="dash"?(0,N.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,N.jsx)("line",{x1:1,x2:13,y1:4,y2:4,stroke:r,strokeWidth:2,strokeDasharray:o==="dash"?"3 2":void 0,strokeLinecap:"round"}),o==="line"?(0,N.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,N.jsx)("span",{"aria-hidden":"true",style:{width:9,height:9,flex:"none",borderRadius:o==="circle"?9:2.5,background:r,boxShadow:t.color==="neutral"||t.color==="neutralSoft"||!t.color?`inset 0 0 0 1px ${e.paint("line2")}`:void 0,opacity:n?.35:void 0}})}function vi(e){let t=$e(e.theme),n=Lr(e.level,q(de(e.locale)));return(0,N.jsx)("span",{style:{background:t.paint(n.bg),color:t.paint(n.fg),borderRadius:8,padding:"3px 9px",fontSize:12.5,fontWeight:700,lineHeight:"18px",whiteSpace:"nowrap",flex:"none"},children:n.text})}function $i(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,N.jsxs)(N.Fragment,{children:[e.slice(0,r),(0,N.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function no(e){let t=$e(e.theme),n=jn(e.locale),[r,o]=(0,qt.useState)(0);Ne(()=>yt(),[]);let a=()=>{o(d=>d+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,N.jsx)(Gn,{items:e.legend,theme:e.theme,locale:e.locale}):e.legend,s=e.as??"h3",l=e.number===void 0?null:typeof e.number=="number"?String(e.number).padStart(2,"0"):e.number,c=e.replay||e.onReplay,m=e.source!==void 0||e.note!==void 0?(0,N.jsxs)("p",{style:{margin:0,fontSize:12,color:t.paint("muted"),lineHeight:1.4},children:[e.source!==void 0?`${n.source}: `:null,e.source,e.source!==void 0&&e.note!==void 0?" · ":null,e.note]}):null,u=e.takeaway!==void 0||e.level||e.sample?(0,N.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,N.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,N.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,N.jsx)("span",{style:{fontSize:11.5,color:t.paint("muted"),whiteSpace:"nowrap"},children:typeof e.sample=="string"?e.sample:n.sample}):null,e.level?(0,N.jsx)(vi,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,N.jsxs)("section",{id:e.id,className:`ztd-card${e.className?` ${e.className}`:""}`,style:{background:t.paint("panel"),color:t.paint("ink"),border:`1px solid ${t.paint("line")}`,borderRadius:`var(--ztd-radius, ${t.theme.radius}px)`,padding:"20px 20px 16px",display:"flex",flexDirection:"column",gap:12,minWidth:0,boxSizing:"border-box",fontFamily:t.cssVars?`var(--ztd-font, ${t.theme.fontFamily})`:t.theme.fontFamily,wordBreak:"keep-all",textWrap:"balance",...e.style},children:[(0,N.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,N.jsx)("span",{style:{fontFamily:t.cssVars?`var(--ztd-mono, ${t.theme.monoFamily})`:t.theme.monoFamily,fontSize:17,fontWeight:700,color:t.paint("accentText"),letterSpacing:-.2,flex:"none"},children:l}):null,(0,N.jsx)(s,{style:{margin:0,fontSize:22,fontWeight:800,color:t.paint("ink"),letterSpacing:-.5,lineHeight:1.25,minWidth:0,flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:$i(e.title,e.accent,t.paint("accentText"))}),e.actions,c?(0,N.jsx)("button",{type:"button",className:"ztd-btn",onClick:a,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,N.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24","aria-hidden":"true",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,N.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,N.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,N.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,N.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,N.jsx)("span",{}),i]}):null]}),(0,N.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,N.jsx)(Hn.Provider,{value:r,children:(0,N.jsx)(tt.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),m?(0,N.jsxs)(N.Fragment,{children:[m,u]}):u]})}function Vn(e){let t=$e(e.theme),n=jn(e.locale),r=e.height??220;if(Ne(()=>yt(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,N.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,N.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,N.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,N.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,N.jsx)("button",{type:"button",className:"ztd-btn",onClick:e.onRetry,style:{marginTop:4,background:t.paint("ink"),color:t.paint("onInk"),border:"none",borderRadius:14,padding:"5px 14px",fontSize:12.5,fontWeight:700},children:n.retry}):null]})})}return e.loading?(0,N.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,a)=>(0,N.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${a*90}ms`}},a))}):e.empty?(0,N.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,N.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,N.jsx)(N.Fragment,{children:e.children})}var mt=R(U(),1);var fe=R(U(),1);var V=R(O(),1),Jt=60;var Zt={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function ro(e){let{c:t,events:n}=e,r=(0,fe.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,Ne(()=>{yt()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,fe.useContext)(tt),c=e.ariaLabel??l??e.kind,m=(0,fe.useMemo)(()=>s?`${n.length}${n.slice(0,Jt).map(x=>`${x.label}${x.series??""}${x.formatted??x.value??""}`).join("")}`:"",[n,s]),u=(0,fe.useMemo)(()=>(0,V.jsx)(Ti,{label:c,events:n,t:t.t}),[c,m,t.t]),d=(0,fe.useRef)(null);(0,fe.useEffect)(()=>{let x=()=>{d.current=null};return window.addEventListener("scroll",x,{capture:!0,passive:!0}),window.addEventListener("resize",x,{passive:!0}),()=>{window.removeEventListener("scroll",x,{capture:!0}),window.removeEventListener("resize",x)}},[]),(0,fe.useEffect)(()=>{d.current=null},[t.width,t.height]);let h=x=>{if(x.target!==x.currentTarget)return;if(e.onKey?.(x)){x.preventDefault();return}let S=t.active,D;switch(x.key){case"ArrowRight":case"ArrowDown":D=S===null?0:(S+1)%i;break;case"ArrowLeft":case"ArrowUp":D=S===null?i-1:(S-1+i)%i;break;case"Home":D=0;break;case"End":D=i-1;break;case"Escape":if(S===null)return;D=null;break;case"Enter":case" ":S!==null&&(x.preventDefault(),t.click(S));return;default:return}x.preventDefault(),t.setActive(D,"keyboard")},{via:f,node:p,setActive:v}=t;(0,fe.useEffect)(()=>{if(f!=="touch"||!p)return;let x=S=>{p.contains(S.target)||v(null)};return document.addEventListener("pointerdown",x),()=>document.removeEventListener("pointerdown",x)},[f,p,v]);let k=t.active!==null?n[t.active]:null,w=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,M=w&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,A=typeof e.renderTip=="function"&&k?e.renderTip(k):null,b=e.announce??(t.via==="keyboard"&&k?`${k.label}${k.series?` ${k.series}`:""}: ${k.formatted??k.value??""} (${(t.active??0)+1}/${i})`:""),T;if(w){let x=w.x*M,S=t.width*M,D=`clamp(${(4-x).toFixed(1)}px, -50%, calc(${(S-x-4).toFixed(1)}px - 100%))`,j=w.y<64;T={position:"absolute",left:x,top:w.y*M,transform:`translate(${D}, ${j?"16px":"calc(-100% - 14px)"})`,background:t.p.paint("panel"),color:t.p.paint("ink"),border:`1px solid ${t.p.paint("line")}`,borderRadius:12,padding:"8px 11px",pointerEvents:"none",whiteSpace:"nowrap",fontSize:12,lineHeight:"18px",zIndex:5,boxShadow:"0 10px 28px -8px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.08)",fontVariantNumeric:"tabular-nums",minWidth:112,maxWidth:Math.max(160,t.width*M-8)}}let I=x=>{d.current=null,x.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},E=x=>x?S=>{let D=d.current??(d.current=S.currentTarget.getBoundingClientRect());D.width&&x((S.clientX-D.left)/D.width*t.width,(S.clientY-D.top)/D.height*t.height,S)}:void 0,z=E(e.onPointerMove),L=E(e.onPointerDown),_=z||L?x=>{x.pointerType==="touch"&&z?.(x),L?.(x)}:void 0,F=E(e.onPointerUp),C=eo(e.theme);return(0,V.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":c,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?h:void 0,onBlur:x=>{t.via==="keyboard"&&!x.currentTarget.contains(x.relatedTarget)&&t.setActive(null)},onPointerLeave:I,style:{width:"100%",maxWidth:t.measured?void 0:"100%",fontFamily:t.p.cssVars?`var(--ztd-font, ${t.p.theme.fontFamily})`:t.p.theme.fontFamily,color:t.p.paint("ink"),...C,...e.style},children:[t.pending?null:e.underlay,(0,V.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${a}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:z,onPointerDown:_,onPointerUp:F,onPointerCancel:F,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,V.jsx)("title",{id:o,children:c}),(0,V.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,V.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,w?(0,V.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:T,children:A??(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:w.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:w.title}),w.rows.map((x,S)=>(0,V.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,V.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(x.strong?"ink":"muted")},children:[x.color?(0,V.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:x.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,x.label]}),(0,V.jsx)("span",{style:{fontWeight:x.strong===!1?500:700},children:x.value})]},S))]})}):null,(0,V.jsx)("span",{className:"ztd-sr",style:Zt,"aria-live":"polite","aria-atomic":"true",children:b}),s&&!t.pending?u:null]})}function Ti({label:e,events:t,t:n}){return(0,V.jsx)("div",{className:"ztd-sr",style:Zt,children:(0,V.jsxs)("table",{children:[(0,V.jsx)("caption",{children:n.table(e)}),(0,V.jsxs)("tbody",{children:[t.slice(0,Jt).map((r,o)=>(0,V.jsxs)("tr",{children:[(0,V.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,V.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Jt?(0,V.jsx)("tr",{children:(0,V.jsx)("td",{colSpan:2,children:n.more(t.length-Jt)})}):null]})]})})}function Ge(e){let t=e.baseline??"central";return(0,V.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 g=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),be=g("label","string",!0,"Item name field"),oe=g("value","number",!0,"Value field"),Mi=[be,oe],Ci=[be,oe],Si=[g("label","string",!0,"Stage name"),g("value","number",!0,"Users at the stage")],Ai=[be,oe],Ri=[g("label","string",!0,"Leaf (lowest level) name"),oe,g("group","string",!1,"Parent group field")],Ni=[g("label","string",!0,"Leaf name"),oe,g("group","string",!1,"Parent group field")],Fi=[be,g("value","number",!0,"Change (total rows may omit it)"),g("type","string",!1,'"total" makes a total bar')],_i=[be,oe],Pi=[g("x","string",!0,"Column field"),g("series","string",!0,"Stacked series field"),oe],Li=[g("x","string",!0,"Column field"),g("y","string",!0,"Row field"),oe],Di=[g("axis","string",!0,"Metric (axis) field"),g("value","number",!0,"Value field",{multi:!0}),g("series","string",!1,"Series field")],Ei=[g("x","number",!0,"x value"),g("y","number",!0,"y value"),g("size","number",!1,"Circle size"),g("label","string",!1,"Name")],ao=g("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),Oi=[g("x","any",!0,"x field (date, number or category)"),g("y","number",!0,"y field. An array for wide tables",{multi:!0}),g("series","string",!1,"Series field (long tables)"),g("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),ao],Ii=[g("x","any",!0,"x field"),g("y","number",!0,"y field. An array for wide tables",{multi:!0}),g("series","string",!1,"Series field"),g("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}),ao],zi=[g("x","any",!0,"x field"),g("y","number",!0,"y field",{multi:!0}),g("series","string",!1,"Series field")],Bi=[g("x","string",!0,"Category field"),g("y","number",!0,"Value field. An array for wide tables",{multi:!0}),g("series","string",!1,"Series field"),g("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})],Hi=[be,oe],ji=[g("value","number",!0,"Value field",{prop:"valueKey"}),g("target","number",!1,"Target field",{prop:"targetKey"})],Gi=[be,g("value","number",!0,"Actual value field"),g("target","number",!1,"Target field")],Vi=[g("x","any",!1,"x field"),g("y","number",!0,"y field")],Ki=[be,g("x","string",!1,"Period field (long tables)"),g("value","number",!1,"Value field (long tables)")],Wi=[be,g("start","number",!0,"Before value"),g("end","number",!0,"After value")],Xi=[be,oe],Ui=[g("value","number",!0,"Value field"),g("group","string",!1,"Group (row) field"),g("label","string",!1,"Dot name")],Yi=[g("group","string",!0,"Group field"),g("value","number",!0,"Value field")],qi=[g("source","string",!1,"Source node"),g("target","string",!1,"Target node"),g("dimensions","string",!1,"Stage columns of a wide table, left to right (2 to 6). Each row is one path, so source and target are not used. Without value, each row counts 1",{multi:!0}),g("value","number",!1,"Value field")],Ji=[g("source","string",!0,"Sending group"),g("target","string",!0,"Receiving group"),oe],Zi=[g("date","date",!0,"Date field"),oe],Qi=[g("x","any",!0,"Period field"),g("series","string",!0,"Item field"),g("rank","number",!1,"Rank field (1 is first)"),g("value","number",!1,"Value field (instead of rank, largest is first)")],es=[g("group","string",!0,"Group field"),g("value","number",!0,"Value field")],ts=[g("label","string",!1,"Row name field")],ns=[g("x","date",!0,"Date (period) field"),g("open","number",!0,"Open price field"),g("high","number",!0,"High price field"),g("low","number",!0,"Low price field"),g("close","number",!0,"Close price field"),g("volume","number",!1,"Volume field")],rs=[be,oe],os=[g("x","any",!0,"Period field (date or category)"),g("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),g("series","string",!1,"Series field (long tables, back row only)"),g("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],as=[g("value","number",!1,"Sample value field (raw rows)"),g("group","string",!1,"Group field. Up to 2 groups overlap"),g("x0","number",!1,"Bin start (pre-binned rows)"),g("x1","number",!1,"Bin end (pre-binned rows)"),g("count","number",!1,"Samples in the bin (pre-binned rows)")],is=[g("region","string",!0,"Region name or code, matched to a tile of options.map"),oe],ss=[be,oe,g("frame","any",!0,"Time step field: a year, a date or any ordered key. Numbers and dates play in order, other text in the order it first appears. An item with no value in a step leaves the bars for that step")],ls=[g("source","string",!0,"Source node"),g("target","string",!0,"Target node"),g("value","number",!1,"Link weight. Without it every row counts 1")],cs=[g("label","string",!0,"Row name. Items with the same name share a row"),g("start","any",!0,"Start: a number (minutes, seconds, any unit) or a date or date-time"),g("end","any",!0,"End, same kind as start. Equal to start draws a point event; empty means still open"),g("group","string",!1,"Group field (one color per group, and the legend)"),g("status","string",!1,"State of the item, written inside the bar and in the tooltip. Without group it also colors the bars and makes the legend, so a row of consecutive states reads as a status strip")],us=[g("label","string",!0,"Node name field"),g("value","number",!1,"Value field. Sizes the dots; values add up from the leaves"),g("group","string",!1,"Parent group field (flat rows, as in the treemap)"),g("id","string",!1,"Row id for id/parent rows. Defaults to the label"),g("parent","string",!1,"Parent id field. Each row is one node, and rows with an empty parent hang under the root")],ms=[g("region","string",!0,"Region name or code, matched to a region of options.map"),oe],ds=[g("lon","number",!1,"Longitude (degrees)"),g("lat","number",!1,"Latitude (degrees)"),g("size","number",!1,"Value (circle area). Without it all circles match"),g("label","string",!1,"Place name"),g("region","string",!1,"Region of options.map, for rows without lon and lat"),g("group","string",!1,"Group field (one color per group)")],fs=[g("source","string",!0,"Start: a name in options.places or a region"),g("target","string",!0,"End"),g("value","number",!1,"Amount. Without it each row counts 1")],hs=[g("cohort","any",!0,"Cohort: a name or a start date. Cohorts go in date order when all read as dates, otherwise in order of first appearance"),g("period","any",!0,"Periods since the cohort started: 0, 1, 2 ... In number order when all are numbers"),g("value","number",!0,"People still active, or the share still active (see options.valueType)"),g("size","number",!1,"Cohort size. The first value of each cohort counts")],gs=[g("x","any",!0,"x field (date, number or category)"),g("y","number",!0,"y field. An array for wide tables",{multi:!0}),g("series","string",!1,"Series field (long tables)")],ps=[g("x","number",!0,"x value"),g("y","number",!0,"y value"),g("series","string",!1,"Series field (one color per series)"),g("label","string",!1,"Name")],bs=[g("label","string",!0,"Row name field (one row per metric)"),g("x","any",!0,"Period field (date, number or category). Every row shares the same period axis"),oe,g("target","number",!1,"Target field. Each row uses its last filled value")],oo={pie:Mi,donut:Ci,funnel:Si,waffle:Ai,treemap:Ri,sunburst:Ni,waterfall:Fi,pareto:_i,marimekko:Pi,heatmap:Li,radar:Di,bubble:Ei,line:Oi,area:Ii,stream:zi,bar:Bi,radialBar:Hi,gauge:ji,bullet:Gi,sparkline:Vi,slope:Ki,dumbbell:Wi,lollipop:Xi,beeswarm:Ui,ridgeline:Yi,sankey:qi,chord:Ji,calendar:Zi,bump:Qi,box:es,parallel:ts,candlestick:ns,segmented:rs,skyline:os,histogram:as,scatter:ps,tileMap:is,barRace:ss,network:ls,timeline:cs,tree:us,choropleth:ms,symbolMap:ds,flowMap:fs,sparkTable:bs,cohort:hs,horizon:gs},at={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:"타일 격자 지도"},barRace:{component:"BarRace",name:"Bar race",nameKo:"막대 레이스"},network:{component:"NetworkChart",name:"Network",nameKo:"네트워크"},timeline:{component:"Timeline",name:"Timeline",nameKo:"타임라인"},tree:{component:"Tree",name:"Tree",nameKo:"트리"},choropleth:{component:"Choropleth",name:"Choropleth map",nameKo:"단계구분도"},symbolMap:{component:"SymbolMap",name:"Symbol map",nameKo:"기호 지도"},flowMap:{component:"FlowMap",name:"Flow map",nameKo:"흐름 지도"},sparkTable:{component:"SparkTable",name:"KPI table",nameKo:"지표 표"},cohort:{component:"CohortChart",name:"Cohort chart",nameKo:"코호트 차트"},horizon:{component:"HorizonChart",name:"Horizon chart",nameKo:"호라이즌 차트"}};function io(e,t){return t==="ko"?e.nameKo:e.name}function so(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var lo=["line","area","bar","scatter"],co=24;var Kn=["line","area","bar","scatter","timeline"];function Wn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"&&n.layout!=="diverging"?[].concat(t.line??[]).map(String):[]}function uo(e,t,n){return Kn.includes(e)&&!Wn(e,t,n).length&&!(e==="scatter"&&Qt(n))}function Qt(e){return!!e&&typeof e=="object"&&e.bin==="hex"}function mo(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var ys={doughnut:"donut",column:"bar",stackedBar:"bar",groupedBar:"bar",butterfly:"bar",pyramid:"bar",populationPyramid:"bar",stacked:"area",streamgraph:"stream",radial:"radialBar",radialbar:"radialBar",progress:"gauge",progressRing:"gauge",kpi:"gauge",violin:"box",boxplot:"box",raincloud:"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",barChartRace:"barRace",racingBar:"barRace",racingBars:"barRace",raceBar:"barRace",arcDiagram:"network",graph:"network",nodeLink:"network",gantt:"timeline",ganttChart:"timeline",schedule:"timeline",dendrogram:"tree",orgChart:"tree",treeChart:"tree",choroplethMap:"choropleth",filledMap:"choropleth",map:"choropleth",bubbleMap:"symbolMap",proportionalSymbolMap:"symbolMap",pointMap:"symbolMap",originDestination:"flowMap",odMap:"flowMap",alluvial:"sankey",parallelSets:"sankey",kpiTable:"sparkTable",metricTable:"sparkTable",sparklineTable:"sparkTable",retention:"cohort",cohortTable:"cohort",retentionTable:"cohort",horizonChart:"horizon",horizonGraph:"horizon"};function en(e){let t=oo[e]?e:ys[e]??Object.keys(at).find(n=>n.toLowerCase()===e.toLowerCase()||at[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!at[t]))return{type:t,component:at[t].component,name:at[t].name,nameKo:at[t].nameKo,encoding:oo[t]}}function fo(e){let t=new Set,n=a=>{Array.isArray(a)?a.forEach(n):typeof a=="string"&&a&&t.add(a)},r=e.encoding??{};for(let a of en(e.type)?.encoding.map(i=>i.name)??Object.keys(r))n(r[a]);let o=e.options??{};for(let a of["dimensions","start","end","ranges"])n(o[a]);return[...t]}function ho(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function xs(e,t){if(e==null||typeof e!="object")return;let n=e;if(ho(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!ho(r,o))return;r=r[o]}return r}}function Fe(e){if(typeof e=="number")return Number.isFinite(e)?e:NaN;if(typeof e=="bigint")return Number(e);if(typeof e=="string"){let t=e.trim(),n=/^\(.*\)$/.test(t),r=t.replace(/[()\s%₩$€£¥원명건개회]/g,"").replace(/^\+/,"");if(!r||r.includes(",")&&!/^-?\d{1,3}(,\d{3})*(\.\d+)?$/.test(r))return NaN;let o=Number(r.replace(/,/g,""));return Number.isFinite(o)?n?-o:o:NaN}return e instanceof Date?e.getTime():typeof e=="boolean"?e?1:0:NaN}function Je(e,t){if(typeof e=="function")return e;let n=e??t;return r=>xs(r,n)}function _e(e,t){let n=Je(e,t);return(r,o)=>Fe(n(r,o))}function ye(e,t){let n=Je(e,t);return(r,o)=>{let a=n(r,o);return a==null?"":a instanceof Date?new Date(a.getTime()-a.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(a)}}function Te(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function ks(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let c=e[l];if(c==='"')n=!n;else if(!n&&(c===`
23
+ `||c==="\r"))break;t.push(n?"":c)}let r=t.join(""),o=l=>r.split(l).length-1,a=[","," ",";","|"],i=",",s=0;for(let l of a){let c=o(l);c>s&&(s=c,i=l)}return i}var ws=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function go(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(ws.test(t)||/^[-+]?\.\d+$/.test(t)){let n=Fe(t);if(Number.isFinite(n))return n}return t}function Ze(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??ks(o),i=[],s=[],l="",c=!1;for(let f=0;f<o.length;f++){let p=o[f];c?p==='"'?o[f+1]==='"'?(l+='"',f++):c=!1:l+=p:p==='"'&&!l.trim()?(c=!0,l=""):p===a?(s.push(l),l=""):p===`
24
+ `||p==="\r"?(p==="\r"&&o[f+1]===`
25
+ `&&f++,s.push(l),i.push(s),s=[],l=""):l+=p}(l!==""||s.length)&&(s.push(l),i.push(s));let m=i.filter(f=>!(f.length===1&&f[0].trim()===""));if(!m.length)return[];let u=f=>n?go(f):f;if(!r)return m.map(f=>Object.fromEntries(f.map((p,v)=>[String(v),u(p)])));let d=[],h=new Set;return m[0].forEach((f,p)=>{let v=f.trim()||`col${p+1}`,k=v;for(let w=2;h.has(k);w++)k=`${v}_${w}`;h.add(k),d.push(k)}),m.slice(1).map(f=>Object.fromEntries(d.map((p,v)=>[p,u(f[v]??"")])))}function Xn(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((i,s)=>String(i??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(i=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof i[l]=="string"?go(i[l]):i[l]??null])))}function vs(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,l)=>Object.fromEntries(a.map(c=>[c,e[c][l]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function po(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 Ve(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return Ve(JSON.parse(t))}catch{}return Ze(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?Xn(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)?Ve(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?Xn(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)?Ve(t.rows):Array.isArray(t.values)?Xn(t.values):Array.isArray(t.items)?Ve(t.items):Array.isArray(t.results)?Ve(t.results):vs(t)}return[]}function tn(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=a=>{try{return JSON.stringify(a)}catch{return String(a)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let a=0;a<t;a+=r)o.push(e[a]);return o.push(e[t-1]),`${t}:${n(o)}`}function Un(e,t="zero"){let n=e.length,r=n?e[0].length:0,o=e.map(()=>new Array(r).fill(0)),a=e.map(()=>new Array(r).fill(0)),i=(l,c)=>{let m=e[l][c];return Number.isFinite(m)&&m>0?m:0},s=new Array(r).fill(0);if(t==="wiggle"&&n>0&&r>1){let l=0;for(let c=1;c<r;c++){let m=0,u=0;for(let d=0;d<n;d++){let h=i(d,c),f=h-i(d,c-1),p=0;for(let v=0;v<d;v++)p+=i(v,c)-i(v,c-1);m+=h,u+=(f/2+p)*h}m&&(l-=u/m),s[c]=l}}for(let l=0;l<r;l++){if(t==="zero"){let u=0,d=0;for(let h=0;h<n;h++){let f=e[h][l],p=Number.isFinite(f)?f:0;p>=0?(o[h][l]=u,u+=p,a[h][l]=u):(o[h][l]=d,d+=p,a[h][l]=d)}continue}let c=0;for(let u=0;u<n;u++)c+=i(u,l);let m=t==="silhouette"?-c/2:s[l];for(let u=0;u<n;u++){let d=i(u,l);t==="expand"&&(d=c?d/c*100:0),o[u][l]=m,m+=d,a[u][l]=m}}if(t==="wiggle"&&r){let l=1/0,c=-1/0;for(let u=0;u<r;u++)l=Math.min(l,o[0]?.[u]??0),c=Math.max(c,a[n-1]?.[u]??0);let m=0;for(let u=0;u<r;u++)m+=((o[0]?.[u]??0)+(a[n-1]?.[u]??0))/2;m/=r;for(let u=0;u<n;u++)for(let d=0;d<r;d++)o[u][d]-=m,a[u][d]-=m}return{y0:o,y1:a}}function bo(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 yo(e){let t=e.length,n=e.map(c=>{let m=0,u=-1/0;return c.forEach((d,h)=>{d>u&&(u=d,m=h)}),m}),r=e.map(c=>c.reduce((m,u)=>m+(Number.isFinite(u)?u:0),0)),o=Array.from({length:t},(c,m)=>m).sort((c,m)=>n[c]-n[m]),a=[],i=[],s=0,l=0;for(let c of o)s<l?(a.push(c),s+=r[c]):(i.push(c),l+=r[c]);return[...i.reverse(),...a]}var $s=Math.PI*2;function xo(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function ko(e){let t=-1,n=-1/0;return e.forEach((r,o)=>{r>n&&(n=r,t=o)}),t}function Ts(e){return e>=44032&&e<=55203||e>=4352&&e<=4607||e>=12592&&e<=12687||e>=19968&&e<=40959}function wo(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 nn=new Map;function it(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=nn.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let c=r.charCodeAt(l);Ts(c)?i+=wo(c):s+=wo(c)}a=i+s*(n>=600?1.07:1),nn.size>5e3&&nn.clear(),nn.set(o,a)}return a*t}function vo(e,t,n=0){return e.x<t.x+t.w+n&&t.x<e.x+e.w+n&&e.y<t.y+t.h+n&&t.y<e.y+e.h+n}function Yn(e,t,n,r,o="start",a=400){let i=it(e,r,a);return{x:o==="start"?t:o==="middle"?t-i/2:t-i,y:n-r*.6,w:i,h:r*1.2}}var To=R(O(),1),Ms=e=>Array.isArray(e)&&e.length===2;function $o(e){let t=[];for(let n of e??[])n.type==="line"&&typeof n.y=="number"?t.push(n.y):n.type==="band"&&Ms(n.y)&&t.push(Number(n.y[0]),Number(n.y[1]));return t.filter(Number.isFinite)}var st=R(O(),1),lt=10.5;function Mo(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let i=1;i<e.length;i++)o=Math.min(o,Math.abs(e[i]-e[i-1]));let a=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(i=>ot(i,{locale:n,maximumFractionDigits:a}))}function rn(e,t,n){let r=18;for(let o of Mo(e,t,n))r=Math.max(r,it(o,lt));return Math.ceil(r+8)}function Co(e){let{p:t,ticks:n,y:r,x0:o,x1:a,fmt:i}=e,s=e.side==="right",l=e.labels===!1?null:Mo(n,i,e.locale);return(0,st.jsx)("g",{"aria-hidden":"true",opacity:e.opacity,children:n.map((c,m)=>{let u=Math.round(r(c))+.5,d=c===0&&e.zero!==!1;return(0,st.jsxs)("g",{children:[(0,st.jsx)("line",{x1:o,x2:a,y1:u,y2:u,stroke:t.paint(d?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:d?.7:1}),l?(0,st.jsx)(Ge,{x:s?a+6:o-6,y:u,anchor:s?"start":"end",size:lt,fill:t.paint("muted"),children:l[m]}):null]},c)})})}function qn(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 Ie(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,l=qn(i,n),c=[o,a];for(let m=0;m<4;m++){let u=Math.ceil(a/l-1e-9)*l,d=Math.floor(o/l+1e-9)*l;c=[o===0?0:o-d<=l*.3?d:o-i*s,a===0?0:u-a<=l*.3?u:a+i*s];let h=qn(c[1]-c[0],n);if(h===l)break;l=h}return c}function So(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=qn(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let l=s,c=0;l<=o+a*1e-9&&c<200;l+=a,c++)i.push(Number((Math.round(l/a)*a).toPrecision(12)));return i}function ct(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(l=>o+(l-n)*i);return s.domain=e,s.range=t,s.invert=l=>i===0?n:n+(l-o)/i,s.ticks=(l=4)=>So(n,r,l),s}function vt(e,t,n=4){if(!(e>0)||!(t>0)||!Number.isFinite(e)||!Number.isFinite(t))return[1,10];let r=Math.log10(e),o=Math.log10(t);if(r===o)return[10**(r-.5),10**(r+.5)];let[a,i]=Ie(r,o,Math.max(n,Math.ceil(o-r)),{zero:!1});return[10**a,10**i]}function Cs(e,t,n){let r=Math.log10(e),o=Math.log10(t),a=n/Math.max(1e-9,o-r),i=(c,m=1)=>{let u=[];for(let d=Math.floor(r);d<=Math.ceil(o);d++)if(!(d%m))for(let h of c){let f=Number((h*10**d).toPrecision(12));f>=e*(1-1e-9)&&f<=t*(1+1e-9)&&u.push(f)}return u},s=a>=110?i([1,2,5]):i([1],Math.max(1,Math.ceil(24/a)));if(s.length>=2)return s;let l=i([1,2,3,4,5,6,7,8,9]);return l.length>=2?l:So(e,t,3)}function on(e,t){let n=ct([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=()=>Cs(e[0],e[1],Math.abs(t[1]-t[0])),r}function Ao(e,t){let[n,r]=e,[o,a]=t,i=Math.sqrt(Math.max(0,n)),s=Math.sqrt(Math.max(0,r));return l=>s===i?a:o+(Math.sqrt(Math.max(0,l))-i)/(s-i)*(a-o)}function Me(e){let t=1/0,n=-1/0;for(let r of e)Number.isFinite(r)&&(r<t&&(t=r),r>n&&(n=r));return t===1/0?[0,1]:[t,n]}var Ss=864e5;function Ro(e,t,n,r=ce){let o=t-e;if(!(o>0))return[{t:e,label:wt(e,{locale:r,month:"short",day:"numeric"})}];let a=o/Ss,i=[],s=new Date(e),l=new Date(e).getFullYear()===new Date(t).getFullYear(),c=(m,u,d,h=!1)=>{let f=new Date(m),p=-1,v=0;for(;f.getTime()<=t&&v++<500;){if(f.getTime()>=e){let k=f.getFullYear(),w=h&&!l&&k!==p;i.push({t:f.getTime(),label:wt(f,{locale:r,...d,...w?{year:"numeric"}:{}})}),p=k}u(f)}};if(a<=1.5){let m=Math.max(1,Math.ceil(o/36e5/Math.max(1,n))),u=[1,2,3,4,6,12].find(h=>h>=m)??12,d=new Date(s);d.setMinutes(0,0,0),c(d,h=>h.setHours(h.getHours()+u),{hour:"numeric"})}else if(a<=n*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());c(m,u=>u.setDate(u.getDate()+1),{month:"numeric",day:"numeric"})}else if(a<=n*7*1.2){let m=new Date(s.getFullYear(),s.getMonth(),s.getDate());m.setDate(m.getDate()+(8-m.getDay())%7),c(m,u=>u.setDate(u.getDate()+7),{month:"numeric",day:"numeric"})}else{let m=a/30.44,u=Math.max(1,Math.ceil(m/Math.max(1,n))),d=[1,2,3,6,12,24,60].find(h=>h>=u)??120;if(d>=12){let h=new Date(s.getFullYear()+(s.getMonth()>0||s.getDate()>1?1:0),0,1);c(h,f=>f.setFullYear(f.getFullYear()+d/12),{year:"numeric"})}else{let h=new Date(s.getFullYear(),s.getMonth()+(s.getDate()>1?1:0),1),f=h.getMonth()%d;f&&h.setMonth(h.getMonth()+(d-f)),c(h,p=>p.setMonth(p.getMonth()+d),{month:"short"},!0)}}return i}function an(e,t){let n=new Array(e),r=new Uint8Array(e),o=a=>{if(typeof a!="string"||a.length===0||a.length>9)return-1;let i=Number(a);return Number.isInteger(i)&&i>=0&&i<e&&String(i)===a?i:-1};return new Proxy(n,{get(a,i,s){let l=o(i);return l>=0?(r[l]||(a[l]=t(l),r[l]=1),a[l]):Reflect.get(a,i,s)},has(a,i){return o(i)>=0||Reflect.has(a,i)}})}var As=(e,t,n)=>e==="date"?Wt(t,n)?.getTime()??NaN:Fe(t);function Rs(e){let t=e.filter(n=>n!=null&&n!=="");return t.length?t.every(n=>n instanceof Date)||t.every(n=>typeof n=="string"&&qr(n.trim()))?"date":t.every(n=>typeof n=="number"||typeof n=="string"&&/^-?\d+(\.\d+)?$/.test(n.trim()))?"number":"band":"band"}function $t(e,t,n,r,o={}){let a=Je(t,"x"),i=Array.isArray(n),s=i?n:null,l=i?null:Je(n,"y"),c=!i&&r!==void 0?Je(r,"series"):null,m=e.map((C,x)=>a(C,x)),u=o.xType??Rs(m),d=o.locale??ce,h,f,p;if(u==="band"){let C=m.map(S=>String(S??""));h=Te(C);let x=new Map(h.map((S,D)=>[S,D]));f=h.map((S,D)=>D),p=Int32Array.from(C,S=>x.get(S)??-1)}else{let C=u==="date"?o.dayFirst??Jr(m):void 0,x=m.map(j=>As(u,j,C)),S=Array.from(new Set(x.filter(j=>Number.isFinite(j)))).sort((j,se)=>j-se),D=new Map(S.map((j,se)=>[j,se]));f=S,h=S.map(String),p=Int32Array.from(x,j=>D.get(j)??-1)}let v=o.dateFormat,k=C=>typeof C=="string"?Kt(C.trim())?.[3]:void 0,w=u==="date"&&m.length<5e3?k(m[0]):void 0,M=(w===2||w===3)&&m.every(C=>k(C)===w),A=M&&w===3;if(u==="date"&&!v){let C=f.length>1?f[f.length-1]-f[0]:0;v=M&&w===2||C>864e5*120?{month:"short"}:C<864e5*2?{month:"numeric",day:"numeric",hour:"numeric",minute:"2-digit"}:{month:"numeric",day:"numeric"},C>864e5*800&&(v={year:"numeric",month:"short"})}let b;if(u==="band")b=h;else if(A&&!o.dateFormat){let C=q(d)==="ko";b=f.map(x=>{let S=new Date(x),D=Math.floor(S.getMonth()/3)+1;return C?`${S.getFullYear()}년 ${D}분기`:`Q${D} ${S.getFullYear()}`})}else{let C=f.every(zn),x=u==="date"?new Intl.DateTimeFormat(d,v):new Intl.NumberFormat(d,C?{useGrouping:!1}:{maximumFractionDigits:6});b=f.length>1e3?an(f.length,S=>x.format(f[S])):f.map(S=>x.format(S))}let T=s?[...s]:c?Te(e.map((C,x)=>String(c(C,x)??""))):[""],I=new Map(T.map((C,x)=>[C,x])),E=T.map(()=>new Array(h.length).fill(NaN)),z=T.map(()=>new Array(h.length).fill(null)),L=o.aggregate??"sum",_=L==="mean"?T.map(()=>new Uint32Array(h.length)):null,F=(C,x,S,D)=>{let j=E[C][x];L==="last"?E[C][x]=S:L==="count"?E[C][x]=(Number.isFinite(j)?j:0)+1:L==="mean"?Number.isFinite(S)&&(E[C][x]=(Number.isFinite(j)?j:0)+S,_[C][x]++):E[C][x]=Number.isFinite(j)?j+(Number.isFinite(S)?S:0):S,z[C][x]=D};for(let C=0;C<e.length;C++){let x=p[C];if(x<0)continue;let S=e[C];if(s)for(let D=0;D<s.length;D++)F(D,x,Fe(S[s[D]]),S);else{let D=c?I.get(String(c(S,C)??""))??0:0;F(D,x,Fe(l(S,C)),S)}}if(_)for(let C=0;C<E.length;C++)for(let x=0;x<h.length;x++)_[C][x]>1&&(E[C][x]/=_[C][x]);return{type:u,keys:h,xnum:f,labels:b,series:T,values:E,rows:z}}var Ns=140,Mt=12,No=14,Jn=20,Fo=12.5;function Fs(e,t,n=co){let r=ye(t,t),o=new Map;e.forEach((i,s)=>{let l=r(i,s),c=o.get(l);c?c.push(i):o.set(l,[i])});let a=[...o.keys()].slice(0,n);return{values:a,groups:a.map(i=>o.get(i)),dropped:Math.max(0,o.size-n)}}function _s(e,t,n){if(t<1)return 1;let r=Math.max(1,Math.floor((e+Mt)/(Ns+Mt))),o=Math.max(1,Math.min(r,Number.isInteger(n)&&n>=1?n:r,t));return Math.ceil(t/Math.ceil(t/o))}function Ps(e,t,n){let r=Math.max(40,Math.floor((e-(t-1)*Mt)/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 Tt=e=>e.filter(Number.isFinite);function sn(e,t){let n=[];for(let r of Array.isArray(t)?t:t===void 0?[]:[t]){let o=_e(r,String(r));e.forEach((a,i)=>n.push(o(a,i)))}return Tt(n)}function _o(e,t,n,r,o,a){return $t(t,n.x,r,o,{xType:e==="bar"?"band":n.xType,aggregate:a,dayFirst:n.dayFirst})}function Ls(e,t,n,r,o,a){let i=Math.max(2,Math.round(a/70)),s=r.yScale==="log"&&(e==="line"||e==="scatter"),l=r.yDomain,c=l&&(!s||l[0]>0&&l[1]>0)?l:void 0;if(e==="scatter"){let b=t.flat(),T=r.refLines??{},[I,E]=Me([...sn(b,r.x??"x"),...Tt([Number(T.x)])]),[z,L]=Me([...sn(b,r.y??"y"),...Tt([Number(T.y)])].filter(F=>!s||F>0)),_=r.zero??!1;return{y:c??(s?vt(z,L,i):Ie(z,L,i,{zero:_,pad:.08})),x:r.xDomain??Ie(I,E,Math.max(2,Math.round(o/110)),{zero:_,pad:.06}),sameKeys:!0}}let m=e==="bar",u=m&&r.orientation==="horizontal",d=n[0]?.keys.join(""),h=n.every(b=>b.keys.join("")===d),f=n.length>0&&n.every(b=>b.type!=="band"&&b.type===n[0].type),p=r.xDomain??(!m&&f?Me(n.flatMap(b=>Tt(b.xnum))):void 0),v=m?r.layout??"grouped":e==="area"?r.stack??"auto":"none";if(v==="percent")return{x:p,sameKeys:h};if(c)return{y:c,x:p,sameKeys:h};let k=[];t.forEach((b,T)=>{let I=n[T];if(v==="stacked"||v==="auto"&&I.series.length>1){let z=Un(I.values,"zero");z.y0.forEach(L=>k.push(...L)),z.y1.forEach(L=>k.push(...L))}else I.values.forEach(z=>k.push(...z));m&&!u&&r.line!==void 0&&_o(e,b,r,[].concat(r.line),void 0,r.series===void 0?r.aggregate:"mean").values.forEach(z=>k.push(...z)),m||k.push(...sn(b,r.lower),...sn(b,r.upper))}),m&&k.push(0),u||k.push(...$o(r.annotations));for(let b of r.referenceLines??[])k.push(b.y);r.signColors&&k.push(Number(r.baseline??0));let[w,M]=Me(Tt(k).filter(b=>!s||b>0));return{y:s?vt(w,M,i):m?Ie(w,M,u?Math.max(2,Math.round(o/120)):i):Ie(w,M,i,{zero:r.zero??e==="area"}),x:p,sameKeys:h}}function Ds(e,t,n,r,o,a,i,s){if(e!=="line"&&e!=="area"||!o.x||!o.y)return;let l=$t(t.flat(),r.x,r.y,void 0,{xType:r.xType,locale:s,dayFirst:r.dayFirst}),c=(r.yScale==="log"&&e==="line"?on:ct)(o.y,[i-22,10]).ticks(Math.max(2,Math.round(i/70))),m=rn(c,kt(r.format,s,Math.max(Math.abs(o.y[0]),Math.abs(o.y[1]))),s),u=n.flatMap(b=>b.series),d=r.endLabels??n.some(b=>b.series.length>1),h=m+6,f=a-(d?Math.min(a*.28,Math.max(...u.map(b=>it(b,11,700)),20)+14):10),p=l.keys.length,[v,k]=o.x[1]===o.x[0]?[o.x[0],o.x[0]+1]:o.x,w=l.type==="number"?p>12:p>Ro(v,k,Math.max(2,Math.floor((f-h)/64)),s).length;if(l.type==="band"||!p||w)return;let M=b=>h+(l.xnum[b]-v)/(k-v)*(f-h),A=b=>it(l.labels[b],lt);for(let b=1;;b++){let T=Array.from({length:Math.ceil(p/b)},(I,E)=>E*b);if(b>=p||T.every((I,E)=>!E||M(I)-M(T[E-1])>=(A(I)+A(T[E-1]))/2+8))return T.map(I=>({value:l.xnum[I],label:l.labels[I]}))}}function Es(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 Os(e,t,n,r){let o=[n.x,n.y,n.series].map(a=>JSON.stringify(a??null)).join("|");return`ztd-facet-${Es(`${e}|${t}|${o}|${tn(r)}`)}`}function Is(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 zs={en:{intro:(e,t)=>`${Oe(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:"(빈 값)"}},Zn=18;function Po(e){let{type:t,chartProps:n}=e,{values:r,groups:o,dropped:a}=Fs(e.data,e.by),i=r.length,s=typeof e.width=="number"&&Number.isFinite(e.width)&&e.width>0?e.width:480,l=_s(s,i,e.columns),{pw:c,ph:m}=Ps(s,l,e.height),u=e.scale!=="free",d=t==="scatter"?[]:o.map(_=>_o(t,_,n,n.y,n.series,n.aggregate)),h=u?Ls(t,o,d,n,c,m):{sameKeys:!1},f=u?Ds(t,o,d,n,h,c,m,e.locale):void 0,p=t==="bar"&&n.orientation==="horizontal",v=u&&(!p||h.sameKeys),k=u&&(p||h.x!==void 0||h.sameKeys),w=new Set(Is(e.highlight,r)?[e.highlight].flat():[]),M=w.size>0,A=t==="bar"&&!Array.isArray(n.y)&&n.series===void 0||t==="scatter"&&n.series===void 0,b=e.syncId??Os(t,e.by,n,e.data),T=Vt(qe(n.format,e.locale),n.unit),I=zs[e.lang],E=[],z=r.map(_=>_===""?I.blank:_);return{panels:r.map((_,F)=>{let C=o[F],x=z[F],S=F%l,D;if(t!=="scatter"){let se=d[F],Pe=ge=>se.values.reduce((Ae,Xe)=>Ae+(Number.isFinite(Xe[ge])?Xe[ge]:0),0),B=se.keys.map((ge,Ae)=>Ae).filter(ge=>se.values.some(Ae=>Number.isFinite(Ae[ge]))),Y=B[B.length-1];E.push({first:B.length?Pe(B[0]):NaN,last:B.length?Pe(Y):NaN,total:B.reduce((ge,Ae)=>ge+Pe(Ae),0)}),t!=="bar"&&se.series.length===1&&Y!==void 0&&(D=T(se.values[0][Y]))}else E.push({first:NaN,last:NaN,total:C.length});let j={data:C,width:c,height:m,ariaLabel:e.title?`${e.title}, ${x}`:x,syncId:b,highlight:M?w.has(_)?A?()=>!0:void 0:"none":e.highlight,showYAxis:!v||S===0,showXAxis:!k||F+l>=i};return h.y&&(j.yDomain=h.y),h.x&&(j.xDomain=h.x),f&&(j.xTicks=f),{value:_,label:x,props:j,last:D,isPicked:w.has(_)}}),cols:l,pw:c,ph:m,isPanelPick:M,description:Bs(t,e.by,z,E,a,T,I)}}function Bs(e,t,n,r,o,a,i){let s=i.intro(n.length,t),l=c=>ko(r.map(m=>m[c]));if(e==="line"||e==="area"){let c=l("last");c>=0&&(s+=i.endHigh(n[c],a(r[c].last)));let m=n.filter((u,d)=>r[d].last<r[d].first);s+=m.length?i.falling(`${m.slice(0,5).join(", ")}${m.length>5?i.more:""}`):i.noneFalling}else{let c=l("total");c>=0&&(s+=e==="bar"?i.total(n[c],a(r[c].total)):i.points(n[c],r[c].total))}return o&&(s+=i.dropped(n.length,n.length+o)),s}var he=R(U(),1);function Hs(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function js(e,t,n=1/0){let r=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=Math.min(r*.5,n))}var ln={threshold:.25,enoughPx:96,rootMargin:"0px"};function Eo(e,t=!0){let[n,r]=(0,he.useState)({visible:!t,near:!t});return(0,he.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(i=>{let s=js(i[i.length-1],ln.threshold,ln.enoughPx);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:Hs(ln.threshold),rootMargin:ln.rootMargin}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),a.observe(e),()=>{o.disconnect(),a.disconnect()}},[e,t]),n}function Lo(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function cn(e){let[t,n]=(0,he.useState)(null),[r,o]=(0,he.useState)(e??null),a=(0,he.useCallback)(i=>{n(i),i&&e===void 0&&o(Lo(i))},[e]);return Ne(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=c=>o(m=>m!==null&&Math.abs(m-c)<.5?m:c),s=()=>i(Lo(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(c=>{let m=c[c.length-1]?.contentRect;m?i(m.width>0?Math.round(m.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var Gs=()=>()=>{};function ut(){return(0,he.useSyncExternalStore)(Gs,()=>!0,()=>!1)}var Do="(prefers-reduced-motion: reduce)";function un(e="auto"){let[t,n]=(0,he.useState)(()=>ke&&typeof window.matchMedia=="function"?window.matchMedia(Do).matches:!1);return(0,he.useEffect)(()=>{if(e!=="auto"||!ke||typeof window.matchMedia!="function")return;let r=window.matchMedia(Do),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}var Ce=R(O(),1),Vs=60,Ks=420;function Oo(e){let t=$e(),n=e.chartProps??{},[,r,o]=cn(e.width),a=e.width??(o||480),i=de(e.locale??n.locale),s=q(i),l=(0,mt.useContext)(tt),c=e.title??l,m=e.chart.facetPlan,u=(0,mt.useMemo)(()=>{let k=Po({type:e.type,data:e.data,by:e.by,columns:e.columns,scale:e.scale,chartProps:n,highlight:e.highlight,syncId:e.syncId,width:a,height:e.height,title:c,locale:i,lang:s});return m?m(k,n,i):k},[e.type,e.data,e.by,e.columns,e.scale,JSON.stringify(n,(k,w)=>typeof w=="function"?String(w):w),e.highlight,e.syncId,a,e.height,c,i,s,m]),d=`${(0,mt.useId)().replace(/:/g,"")}fd`,h=un(n.reducedMotion??"auto"),f=ut(),p=Fr({motion:{enabled:n.animate!==!1&&!h&&ke},hydrated:f},{waiting:!1,generation:0}),v=e.chart;return(0,Ce.jsxs)("div",{ref:r,role:"group","aria-label":c,"aria-describedby":d,className:e.className,style:{position:"relative",width:"100%",...e.style},children:[(0,Ce.jsx)("p",{id:d,style:Zt,children:e.description??u.description}),(0,Ce.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u.cols}, minmax(0, 1fr))`,columnGap:Mt,rowGap:No,...u.legend?{marginTop:Zn}:null},children:u.panels.map((k,w)=>{let M=t.paint(k.isPicked?"accentText":u.isPanelPick?"muted":"ink");return(0,Ce.jsxs)("div",{"data-facet":k.value,style:{minWidth:0,...Nr(p,!1,"fade",w*Vs,Ks)},children:[(0,Ce.jsxs)("div",{"aria-hidden":"true",style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,height:Jn,fontSize:Fo,fontWeight:700,lineHeight:`${Jn}px`,color:M},children:[(0,Ce.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k.label}),k.last!==void 0?(0,Ce.jsx)("span",{style:{flex:"none",fontVariantNumeric:"tabular-nums"},children:k.last}):null]}),(0,Ce.jsx)(v,{...n,...k.props})]},k.value)})}),u.legend?(0,Ce.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,height:Zn},children:u.legend}):null]})}var Io=["max","min","first","last","none"];function Se(e,t,n,r,o="max"){let a=new Set,i=n.length,s=c=>{if(i&&c!=="none"){if(c==="first")a.add(0);else if(c==="last")a.add(i-1);else if(c==="max"||c==="min"){let m=-1,u=c==="max"?-1/0:1/0;r.forEach((d,h)=>{Number.isFinite(d)&&(c==="max"?d>u:d<u)&&(u=d,m=h)}),m>=0&&a.add(m)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((c,m)=>{m<i&&c!==null&&c!==void 0&&e(c,m)&&a.add(m)}),a;let l=Array.isArray(e)?e:[e];for(let c of l)typeof c=="number"?c>=0&&c<i&&a.add(c):c==="max"||c==="min"||c==="first"||c==="last"||c==="none"?s(c):n.forEach((m,u)=>{m===c&&a.add(u)});return a}var xe=R(U(),1);async function Ws(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",a=await e.text();if(t==="text")return a;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(a))throw new Error(q(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return Ze(a);if(t==="json"||o.includes("json"))return JSON.parse(a);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return Ze(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):Ze(a)}async function Xs(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),a=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!a.ok)throw new Error(`HTTP ${a.status}${a.statusText?` ${a.statusText}`:""}`);r=await Ws(a,t.parse,o,t.locale)}return t.select&&(r=po(r,t.select)),t.transform?t.transform(r):Ve(r)}function zo(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,xe.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,xe.useState)(0),c=de(t.locale),m=(0,xe.useRef)(t);m.current={...t,locale:c};let u=(0,xe.useRef)(e);u.current=e;let d=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",h=t.deps??[],f=JSON.stringify(h.map(k=>typeof k=="object"?JSON.stringify(k):String(k))),p=(0,xe.useRef)(!1);(0,xe.useEffect)(()=>{let k=u.current;if(!k||!r){i(A=>A.status==="loading"?{...A,status:"idle"}:A);return}let w=new AbortController,M=!0;return p.current=!0,i(A=>({...A,data:o?A.data:[],status:"loading",error:null})),Xs(k,{...m.current,signal:w.signal}).then(A=>{M&&i({data:A,status:"success",error:null,updatedAt:Date.now()})}).catch(A=>{!M||w.signal.aborted||i(b=>({...b,status:"error",error:A instanceof Error?A:new Error(String(A))}))}).finally(()=>{M&&(p.current=!1)}),()=>{M=!1,p.current=!1,w.abort()}},[d,r,s,f,o]),(0,xe.useEffect)(()=>{if(!n||!r)return;let k=setInterval(()=>{p.current||l(w=>w+1)},n);return()=>clearInterval(k)},[n,r]);let v=(0,xe.useCallback)(()=>l(k=>k+1),[]);return{data:a.data,status:a.status,loading:a.status==="loading",error:a.error,empty:a.status==="success"&&a.data.length===0,updatedAt:a.updatedAt,reload:v}}var er=R(O(),1),Us=["csv","svg","png"],Ys=/^[=+\-@\t\r\n=+-@]/,qs=/var\(|color-mix\(/;function Bo(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?Xr(e.getTime()):String(e);return`"${(Ys.test(t)&&!Number.isFinite(Fe(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Js(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Zs(e,t){return`\uFEFF${[t.map(Bo),...e.map(r=>t.map(o=>Bo(r[o])))].map(r=>r.join(",")).join(`\r
26
26
  `)}\r
27
- `}function Ys(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Zn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Bo=2,We=16;function Ho(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,a,i,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${a}, ${i})`:`rgba(${o}, ${a}, ${i}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function jo(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 Go(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:a,height:i}=o.viewBox.baseVal,[s,l]=[a+We*2,i+We*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((f,b)=>{let $;for(let k of Array.from(f.attributes)){if(!Ks.test(k.value))continue;let w=($??($=getComputedStyle(f))).getPropertyValue(k.name);w&&m[b].setAttribute(k.name,Ho(w,u))}}),c.removeAttribute("style");for(let[f,b]of Object.entries({viewBox:`${-We} ${-We} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(f,String(b));let d=Ho(getComputedStyle(r).backgroundColor,u),h=o.parentElement?.querySelector("canvas")??null;if(n){let f=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(jo("rect",{x:-We,y:-We,width:s,height:l,fill:d}),f),h&&c.insertBefore(jo("image",{href:h.toDataURL(),width:a,height:i}),f)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:a,vh:i,bg:d,canvas:h}}function qs(e,t){let n=Go(e,Bo,!1);if(!n)return;let r=Bo,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let a=o.getContext("2d");if(!a)return;a.fillStyle=n.bg,a.fillRect(0,0,o.width,o.height),n.canvas&&a.drawImage(n.canvas,We*r,We*r,n.vw*r,n.vh*r);let i=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{a.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(i),o.toBlob(l=>l&&Zn(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Vo(e){let t=Ce(e.theme),n=Y(he(e.locale))==="ko",r=Ys(e.filename),o=(a,i)=>{if(a==="csv")return Zn(new Blob([Us(e.data,e.columns?.length?e.columns:Xs(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return qs(i,r);let s=Go(i,1,!0);s&&Zn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,Qn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:Vs.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,Qn.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(a,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:i},a)})})}var Ko=A(z(),1);function Wo(e,t=ue){let n=Ye(void 0,t),r=e.split(`
28
- `),o=(a,i)=>{if(i==="label")return a.label;if(i==="value")return a.formatted??(a.value===null?null:n(a.value));if(i==="series")return a.series??null;let s=a.datum&&typeof a.datum=="object"?a.datum[i]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?kt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,c=s.replace(Ur,(m,u)=>o(a,u.trim())??(l=!0,""));l||i.push(c)}return i.length?i.map((s,l)=>(0,Ko.jsx)("div",{children:s},l)):null}}function Xo(e,t,n=!1){let r=we(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),a=Se(o);if(!n)return a;let i=new Map;for(let s of o)i.set(s,(i.get(s)??0)+1);return a.map((s,l)=>[s,l]).sort((s,l)=>i.get(s[0])-i.get(l[0])||s[1]-l[1]).map(([s])=>s)}function Uo(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 Je(t.csv)}return null}var ta=A(U(),1);var Z=A(U(),1);function Yo(e,t){let n=Ce(e.theme),[r,o,a]=ln(e.width),i=ct(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=cn(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&$e,d=Do(r,e.animateOnView!==!1&&u),h=he(e.locale),f=Y(h),b=(0,Z.useMemo)(()=>Ye(e.format,h,t.format),[e.format,h,t.format]),$=(0,Z.useCallback)(H=>jt(H,{locale:h}),[h]),k=(0,Z.useMemo)(()=>Gt(b,e.unit),[b,e.unit]),w=(0,Z.useMemo)(()=>en(e.data),[e.data]),[T,S]=(0,Z.useState)(null),[g,F]=(0,Z.useState)(null),D=(0,Z.useRef)([]),O=(0,Z.useRef)(e.onHover);O.current=e.onHover;let E=(0,Z.useRef)(e.onClick);E.current=e.onClick;let I=(0,Z.useRef)(null),P=(0,Z.useRef)(null),R=(0,Z.useRef)(null),M=(0,Z.useCallback)((H,le="pointer")=>{if(R.current!==H){R.current=H;let be=H===null?null:D.current[H]??null;queueMicrotask(()=>O.current?.(be)),P.current?.(H)}I.current=H===null?null:le,S(H),F(I.current)},[]),x=(0,Z.useCallback)(H=>{I.current!=="keyboard"&&(I.current=H===null?null:"sync",S(H),F(I.current))},[]),C=(0,Z.useCallback)(H=>{let le=D.current[H];le&&E.current?.(le)},[]),L=eo(e.replayKey),j=e.width!==void 0||(a??0)>0,se={enabled:u,active:d.visible&&j,near:d.near,replayKey:L,dataKey:w,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},ne=(0,Z.useCallback)((H,le=1)=>T===null||T===H?le:le*.38,[T]);return{p:n,width:s,height:c,measured:j,responsive:e.width===void 0,pending:$e&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:se,fv:k,fmt:b,pct:$,locale:h,lang:f,t:f==="ko"?Pr:Fr,active:T,via:g,setActive:M,click:C,events:D,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:ne,sig:w,description:e.description,reduced:m,publish:P,applySync:x}}var q=A(U(),1);function Js(e){return 1-Math.pow(1-e,3)}function Zs(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Qs(e){return e==="easeInOut"?Zs:e==="linear"?t=>t:Js}function el(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 mt(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),a=Math.floor(o),i=Math.min(e.length-1,a+1);n[r]=e[a]+(e[i]-e[a])*(o-a)}return n}function un(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 qo(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 Jo(e,t,n,r){if(!t||!n||t.length!==n.length)return mt(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let l of mt(s,n[i]))o.push(l)}return o.length===r?o:mt(e,r)}var mn=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||!un(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let a=t.from??t.to,i=t.enter??a;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:a.slice(),enter:i.slice(),exit:(t.exit??i).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),a=this.make(r,r.to,0,0);o&&(a.order=o.order),a.done=!0,a.progress=1,n.set(r.key,a)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let a=this.tracks.get(o.key),i=this.make(o,o.from??o.to,1/0,o.delay??0);a&&(i.order=a.order),r=Math.max(r,o.delay??0),n.set(o.key,i)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),qo(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=un(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),l=r>0?Math.min(a*r,240):0;if(s){let c=i.to.length;s.from=Jo(s.cur,s.parts,i.parts,c),s.vel=Jo(s.curVel,s.parts,i.parts,c),s.parts=i.parts,s.to=i.to.slice(),qo(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=un(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(i,i.enter??i.from??i.to,n+l,0);c.done=un(c.from,c.to),this.tracks.set(i.key,c)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=mt(i.exit,i.cur.length),i.t0=n,i.exiting=!0,i.done=!1,i.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=Qs(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=mt(s.from,c)),s.vel.length!==c&&(s.vel=mt(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-a*l),d=a*l>=8&&a*l<20,h=0;for(let f=0;f<c;f++){let b=s.from[f]-s.to[f],$=s.vel[f]+a*b;s.cur[f]=s.to[f]+(b+$*l)*u,s.curVel[f]=(s.vel[f]-a*$*l)*u,d&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/a)))}m=a*l>=20||d&&h<.15,s.progress=Math.min(1,1-(1+a*l)*u)}else{let u=Math.min(1,l/o),d=r(u),h=el(this.easing,u)/o;for(let f=0;f<c;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*h;m=u>=1,s.progress=d}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&i.push(s.key)}else n=!0}for(let s of i)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Mt=new Set,dn=0;function Zo(e){dn=0;let t=Array.from(Mt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Mt.delete(n)}Mt.size&&typeof requestAnimationFrame<"u"&&(dn=requestAnimationFrame(Zo))}function Qo(e){return Mt.add(e),!dn&&typeof requestAnimationFrame<"u"&&(dn=requestAnimationFrame(Zo)),()=>{Mt.delete(e)}}function tl(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 ea(e,t){let n=(0,q.useMemo)(()=>tl(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,q.useRef)(null),d=(0,q.useRef)("init"),h=(0,q.useRef)(null),f=(0,q.useRef)(s),b=(0,q.useRef)(i),$=(0,q.useRef)(!1),k=(0,q.useRef)(0),[,w]=(0,q.useState)(0),T=(0,q.useRef)(null),S=(0,q.useRef)(!0);u.current||(u.current=new mn,u.current.configure(l,c),u.current.snap(n),h.current=n);let g=u.current;if(g.configure(l,c),h.current!==n){let P=d.current,R=!Object.is(f.current,s);g.sameTargets(n)?g.refreshData(n):!r||P==="init"?g.snap(n):P==="idle"?g.hold(n):P==="running"||R?g.update(n,zt(),m):g.snap(n),h.current=n,f.current=s}let F=(0,q.useRef)(()=>!1);F.current=P=>{if(!S.current)return!1;let R=g.step(P);return!R&&d.current==="running"&&(d.current="done"),w(M=>(M+1)%1e9),R||(T.current=null),R};let D=(0,q.useCallback)(()=>{if(!$e||T.current||!g.animating)return;let P=R=>F.current(R);T.current=Qo(P)},[g]);Fe(()=>{let P=!Object.is(b.current,i);if(b.current=i,!r){(d.current!=="done"||g.animating)&&(g.snap(h.current??n),d.current="done",w(R=>R+1));return}d.current==="init"||P&&a?(g.hold(h.current??n),d.current="idle",$.current=!1,w(R=>R+1)):P&&($.current=!0)},[r,i]),Fe(()=>{!r||!a||!$.current||($.current=!1,g.hold(h.current??n),d.current="idle",w(P=>P+1))},[a,r]),(0,q.useEffect)(()=>{r&&o&&d.current==="idle"&&(g.start(zt()),k.current+=1,d.current="running",D(),w(P=>P+1))},[r,o,i,g,D]),(0,q.useEffect)(()=>{g.animating&&D()}),(0,q.useEffect)(()=>(S.current=!0,()=>{S.current=!1,T.current?.(),T.current=null}),[]);let O=zt(),E=g.elapsed(O),I=r&&d.current==="idle";return{items:g.items(),get:P=>g.get(P),elapsed:I?0:E,fade:(P,R=320)=>I?0:Number.isFinite(E)?Math.max(0,Math.min(1,(E-P)/R)):1,waiting:I,animating:g.animating,generation:k.current}}var er=A(z(),1);function na(e,t,n,r,o){if(r)return o==="categorical"?Te(e,t,n):Br(e,t,n);if(o==="categorical")return Te(e,t,n);let a=J(e,"strong"),i=J(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?i:a)}var nl=A(U(),1);var tr=A(z(),1);var ra=e=>e?"neutralStrong":"accent";var Ke=A(U(),1),aa=A(z(),1);function oa(e){let t=(0,Ke.useRef)(null),n=(0,Ke.useRef)(new Map),[r,o]=(0,Ke.useState)(0),{width:a,height:i,draw:s,progress:l,version:c,clipRight:m,manualClear:u}=e;return(0,Ke.useEffect)(()=>{let d=t.current;if(!d)return;let h=Math.min(2,window.devicePixelRatio||1),f=Math.max(1,Math.round(a*h)),b=Math.max(1,Math.round(i*h));d.width!==f&&(d.width=f),d.height!==b&&(d.height=b);let $=d.getContext("2d");if(!$)return;$.setTransform(h,0,0,h,0,0),u||$.clearRect(0,0,a,i);let k=getComputedStyle(d),w=new Map;s($,l,(S,g)=>{let F=w.get(S);return F===void 0&&(F=k.getPropertyValue(S).trim(),w.set(S,F)),F||g}),n.current=w},[a,i,s,l,c,u,r]),(0,Ke.useEffect)(()=>{let d=t.current;if(!d||typeof matchMedia!="function")return;let h=new AbortController,f=()=>o(w=>w+1),b=()=>{let w=getComputedStyle(d);for(let[T,S]of n.current)if(w.getPropertyValue(T).trim()!==S)return f()},$=()=>{matchMedia(`(resolution: ${devicePixelRatio}dppx)`).addEventListener?.("change",()=>{$(),f()},{once:!0,signal:h.signal})};$(),matchMedia("(prefers-color-scheme: dark)").addEventListener?.("change",b,{signal:h.signal});let k=new MutationObserver(b);for(let w=d.parentElement;w;w=w.parentElement)k.observe(w,{attributes:!0});return()=>{h.abort(),k.disconnect()}},[]),(0,aa.jsx)("canvas",{ref:t,"aria-hidden":"true",style:{position:"absolute",left:0,top:0,width:"100%",height:"auto",aspectRatio:`${a} / ${i}`,pointerEvents:"none",clipPath:m?`inset(0 ${(m/Math.max(1,a)*100).toFixed(3)}% 0 0)`:void 0}})}var G=A(U(),1);var ia=20,sa=24,la=4;var Au=new Int32Array(2);var nr=A(z(),1);function ca(e,t,n,r){if(typeof e!="function")return Re(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let l=o.get(r(i,s));l!==void 0&&e(i,s)&&a.add(l)}),a}var ae=A(z(),1),rl={bubble:"Bubble chart",scatter:"Scatter plot",size:"Size",sizeWord:"size",nth:e=>`#${e}`,desc:(e,t,n)=>`${e?"Bubble chart":"Scatter plot"}. ${Ee(t,"point")}. x from ${n[0]} to ${n[1]}, y from ${n[2]} to ${n[3]}.`,logDropped:e=>` ${Ee(e,"point")} with y at or below 0 ${e===1?"is":"are"} not shown on the log scale.`},ol={en:rl,ko:{bubble:"버블 차트",scatter:"산점도",size:"크기",sizeWord:"크기",nth:e=>`${e}번`,desc:(e,t,n)=>`${e?"버블 차트":"산점도"}. 점 ${t}개. x ${n[0]}~${n[1]}, y ${n[2]}~${n[3]}.`,logDropped:e=>` 로그 눈금이라 y가 0 이하인 점 ${e}개는 뺐어요.`}},al=[],il=[],sl=[],ll=[],ua=[],ma=e=>({x:e.x1-2,y:e.y1-8});function da(e,t){return Number(e.hi)-Number(t.hi)||t.r-e.r}function rr(e){return(0,ae.jsx)(cl,{...e,kit:void 0})}var fa=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,ha=e=>Array.isArray(e)&&e.length===2&&Number.isFinite(e[0])&&Number.isFinite(e[1])&&e[0]<e[1]?e:void 0;function cl(e){let t=Yo(e,{height:y=>Math.max(220,Math.min(320,y*.6)),duration:800,stagger:0}),{p:n,width:r,height:o}=t,a=e.kit,i=a&&e.bin==="hex"?a.hex:null,s=a?i?{fit:e.fit,refLines:e.refLines,quadrants:e.quadrants}:e:{},l=!a&&e.size!==void 0,c=e.yScale==="log",m=(0,G.useMemo)(()=>{if(s.series===void 0)return null;let y=we(s.series,"series");return e.data.map((v,B)=>y(v,B))},[e.data,s.series]),u=(0,G.useMemo)(()=>a&&m?a.uniq(m):ua,[a,m]),d=s.hidden?.join("")??"",h=s.quadrants?.join("")??"",f=s.jitter?Math.max(0,s.jitter.amount??.4):0,b=s.jitter?.seed??1,$=fa(s.refLines?.x),k=fa(s.refLines?.y),w=c&&k!==void 0&&k<=0?void 0:k,T=s.fit==="linear"&&!c,S=m!==null||T||$!==void 0||w!==void 0||f>0,g=(0,G.useMemo)(()=>{let y=_e(e.x,"x"),v=_e(e.y,"y"),B=l?_e(e.size,"size"):null,K=we(e.label,"label"),_=e.data.map((X,ce)=>{let Qe=y(X,ce);return{d:X,i:ce,x:Qe,y:v(X,ce),s:B?Math.max(0,B(X,ce)||0):1,label:K(X,ce),si:-1,px:Qe}}).filter(X=>Number.isFinite(X.x)&&Number.isFinite(X.y)&&(!c||X.y>0));if(!a||f<=0&&!m)return _;let te=f>0?a.smallestGap(_.map(X=>X.x)):0,re=new Map(u.map((X,ce)=>[X,ce])),ee=new Set(d?d.split(""):[]),xe=[];for(let X of _){if(te&&(X.px=X.x+(a.seededUnit(b,X.i)*2-1)*f*te),m){let ce=m[X.i];if(ee.has(ce))continue;X.si=re.get(ce)??-1}xe.push(X)}return xe},[e.data,e.x,e.y,e.size,e.label,l,a,m,u,d,f,b,c]),F=(0,G.useMemo)(()=>{if(!c)return 0;let y=_e(e.x,"x"),v=_e(e.y,"y");return e.data.filter((B,K)=>Number.isFinite(y(B,K))&&v(B,K)<=0).length},[c,e.data,e.x,e.y]),D=g.length,O=!i&&t.hydrated&&D>(e.canvasThreshold??1500),E=(0,G.useMemo)(()=>({x:Ae(g.map(y=>y.x)),y:Ae(g.map(y=>y.y)),s:Ae(g.map(y=>y.s))}),[g]),I=(0,G.useMemo)(()=>!f&&$===void 0&&w===void 0?E:{...E,x:Ae($===void 0?g.map(y=>y.px):[...g.map(y=>y.px),$]),y:w===void 0?E.y:Ae([E.y[0],E.y[1],w])},[E,g,f,$,w]),[P,R]=E.x,[M,x]=E.y,C=Math.max(2,Math.round(o/70)),L=ha(e.xDomain),j=ha(e.yDomain),se=j&&(!c||j[0]>0)?j:void 0,ne=se??(c?wt(I.y[0],I.y[1],C):Oe(I.y[0],I.y[1],C,{zero:e.zero??!1,pad:.08})),H=L??Oe(I.x[0],I.x[1],Math.max(2,Math.round(r/110)),{zero:e.zero??!1,pad:.06}),le=Math.max(Math.abs(ne[0]),Math.abs(ne[1])),be=Math.max(Math.abs(H[0]),Math.abs(H[1])),ye=(0,G.useMemo)(()=>xt(e.format,t.locale,le),[e.format,t.locale,le]),me=(0,G.useMemo)(()=>xt(e.xFormat,t.locale,be),[e.xFormat,t.locale,be]),fn=i&&e.binLegend!==!1?ia:e.yLabel?20:10,Ze=sa,[hn,St]=e.sizeRange??(l?[4,Math.max(10,Math.min(28,r/22))]:[D>2e3?1.6:D>300?2.6:4,0]),At=l?St*.6:la,Xe=(c?rn:lt)(ne,[o-Ze-At,fn+At]),sr=Xe.ticks(C),gn=e.showYAxis!==!1,Le=gn?nn(sr,ye,t.locale):0,Ue=lt(H,[Le+6+At,r-8-At]),[La,Da]=E.s,Ea=l?So([Math.min(0,La),Da||1],[hn,St]):()=>hn,ie=(0,G.useMemo)(()=>({x0:Le,x1:r,y0:fn,y1:o-Ze}),[Le,r,fn,o,Ze]),de=(0,G.useMemo)(()=>a&&m?a.seriesHighlight(e.highlight,e.data,u,(y,v)=>m[v]):null,[a,m,e.highlight,e.data,u]),ze=(0,G.useMemo)(()=>a&&de?a.colors(n,u.length,de):null,[a,n,u.length,de]),lr=(0,G.useMemo)(()=>{if(i)return new Set;if(de){let y=new Set;return g.forEach((v,B)=>{de.has(v.si)&&y.add(B)}),y}return Re(e.highlight,g.map(y=>y.d),g.map(y=>y.label),g.map(y=>l?y.s:y.y),l?"max":"none")},[g,e.highlight,l,de,i]),V=(0,G.useMemo)(()=>i?al:g.map((y,v)=>({i:v,x:Ue(y.px),y:Xe(y.y),r:Ea(y.s),vx:y.x,vy:y.y,vs:y.s,label:y.label,hi:lr.has(v),datum:y.d,si:y.si})),[g,lr,r,o,H[0],H[1],ne[0],ne[1],hn,St,i]),Q=(0,G.useMemo)(()=>i&&i.view(e,{raw:g,x:Ue,y:Xe,box:ie,left:Le,c:t,xFmt:me}),[i,g,ie,Le,H[0],H[1],ne[0],ne[1],t.lang,t.locale,me,t.fmt,e.binSize,e.colorSteps,e.binDomain?.[0],e.binDomain?.[1],e.binLegend,e.xFormat,e.format,e.unit,e.xLabel,e.yLabel]),cr=(0,G.useMemo)(()=>[...V].sort(da),[V]),Nt=t.motion.duration??800,Oa=(0,G.useMemo)(()=>{if(O)return[{key:"__p",to:[1],from:[0],data:null}];let y=r||1;return cr.map(v=>({key:`b${v.i}:${v.label}`,to:[v.x,v.y,v.r],from:[v.x,v.y,0],enter:[v.x,v.y,0],delay:v.x/y*Nt*.55,data:v}))},[cr,O,r,Nt]),dt=ea(Oa,t.motion),pn=(0,G.useMemo)(()=>{let v=new Map;return V.forEach((B,K)=>{let _=`${Math.floor(B.x/24)},${Math.floor(B.y/24)}`,te=v.get(_);te?te.push(K):v.set(_,[K])}),{g:v,cell:24}},[V]),Ia=(y,v)=>{let{g:B,cell:K}=pn,_=Math.floor(y/K),te=Math.floor(v/K),re=-1,ee=1/0,xe=-1,X=l?Math.ceil(St/K)+1:1;for(let ce=-X;ce<=X;ce++)for(let Qe=-X;Qe<=X;Qe++){let xr=B.get(`${_+ce},${te+Qe}`);if(xr)for(let vn of xr){let Et=V[vn],$n=Math.hypot(Et.x-y,Et.y-v)-Et.r;$n<=0&&(xe<0||da(Et,V[xe])>0)&&(xe=vn),$n<ee&&(ee=$n,re=vn)}}return xe>=0?xe:ee<=10?re:null},De=ol[t.lang],fe=a?.text[t.lang],Be=(0,G.useMemo)(()=>a&&S&&g.length>=2?a.linearFit(g):null,[a,S,g]),ft=a&&Be&&T?a.fitSegment(Be,P,R,ne):null,Rt=ft?{x1:Ue(ft[0]),y1:Xe(ft[1]),x2:Ue(ft[2]),y2:Xe(ft[3])}:null,ht=(0,G.useMemo)(()=>h?h.split("").map(y=>y.trim()):ua,[h]),gt=$===void 0?null:Ue($),pt=w===void 0?null:Xe(w),Ft=(0,G.useMemo)(()=>a&&ht.length&&gt!==null&&pt!==null?a.quadrantTags(ht,gt,pt,ie):ll,[a,ht,gt,pt,ie]),Pt=a&&fe&&Rt?a.fitTagSpot(Rt,fe.trendTag,Ft.map(y=>y.box),ie):null,bn=Pt?.x,yn=Pt?.y,xn=Pt?.anchor,kn=fe?.trendTag,_t=(0,G.useMemo)(()=>{if(!a||!S)return il;let y=Ft.map(v=>v.box);if(e.xLabel){let v=ma(ie);y.push(Un(e.xLabel,v.x,v.y,10.5,"end"))}return kn&&bn!==void 0&&yn!==void 0&&xn&&y.push(a.tagBox(kn,bn,yn,xn)),y},[a,S,Ft,e.xLabel,ie,bn,yn,xn,kn]),wn=(0,G.useMemo)(()=>a&&t.showLabels&&de?a.placeSeriesLabels(V,u,de,{box:ie,reserved:_t,grid:pn}):sl,[a,t.showLabels,de,V,u,pn,_t,ie]),za=(0,G.useMemo)(()=>{let y=e.maxLabels??(m?0:6);if(!t.showLabels||D>400||y<=0)return[];let v=[...V].sort((_,te)=>Number(te.hi)-Number(_.hi)||te.r-_.r).filter(_=>_.label),B=[...V.map(_=>({x:_.x-_.r*.7,y:_.y-_.r*.7,w:_.r*1.4,h:_.r*1.4})),..._t,...wn.map(_=>_.box)],K=[];for(let _ of v){if(K.length>=y)break;let te=[{x:_.x+_.r+5,y:_.y,anchor:"start"},{x:_.x-_.r-5,y:_.y,anchor:"end"},{x:_.x,y:_.y-_.r-9,anchor:"middle"},{x:_.x,y:_.y+_.r+10,anchor:"middle"}];for(let re of te){let ee=Un(_.label,re.x,re.y,11,re.anchor,_.hi?800:500);if(!(ee.x<Le||ee.x+ee.w>r-2||ee.y<0||ee.y+ee.h>o-Ze)&&!B.some(xe=>wo(xe,ee,1))){B.push(ee),K.push({d:_,...re});break}}}return K},[V,t.showLabels,D,e.maxLabels,m,_t,wn,Le,r,o,Ze]),ur=J(n,"accent"),mr=t.fmt,Lt=t.fv,Ba=(0,G.useMemo)(()=>Q?Q.events:on(V.length,y=>{let v=V[y],B={datum:v.datum,index:v.i,key:`${v.i}`,label:v.label||De.nth(v.i+1),value:l?v.vs:v.vy,formatted:`x ${me(v.vx)}, y ${Lt(v.vy)}${l?`, ${De.sizeWord} ${mr(v.vs)}`:""}`};return v.si>=0&&(B.series=u[v.si]),B}),[V,l,me,Lt,mr,De,u,Q]),dr=Q?Q.tip(t.active):null;if(t.active!==null&&V[t.active]){let y=V[t.active],v=[{label:e.xLabel??"x",value:me(y.vx)},{label:e.yLabel??"y",value:t.fv(y.vy)},...l?[{label:De.size,value:t.fmt(y.vs),color:y.hi?ur.fill:n.paint("neutral")}]:[]];ze&&y.si>=0&&v.unshift({label:u[y.si],value:"",color:ze[y.si].fill,strong:!0}),fe&&Be&&Rt&&v.push({label:fe.slope,value:`${Be.slope>0?"+":""}${t.fv(Be.slope)}`,strong:!1},{label:"R²",value:Be.r2.toFixed(2),strong:!1}),dr={x:y.x,y:y.y-y.r,title:y.label||De.nth(y.i+1),rows:v}}let Ha=O?dt.get("__p")?.[0]??1:1,fr=n.theme.neutralStrong,hr=n.theme.accent,gr=(0,G.useMemo)(()=>{if(a&&ze&&de)return a.canvasGroups(V,ze,de);let y=[],v=[];return V.forEach((B,K)=>(B.hi?v:y).push(K)),[{ks:y,isHi:!1,fill:B=>B("--ztd-neutral-strong",fr)},{ks:v,isHi:!0,fill:B=>B("--ztd-accent",hr)}]},[a,V,ze,de,fr,hr]),ja=(0,G.useCallback)((y,v,B)=>{let K=r||1;for(let _ of gr){y.globalAlpha=_.isHi?1:.55,y.fillStyle=_.fill(B);for(let te of _.ks){let re=V[te],ee=_.isHi?Math.min(1,v*1.2):Math.max(0,Math.min(1,(v*1.4-re.x/K*.4)*2.5));ee<=0||(y.beginPath(),y.arc(re.x,re.y,re.r*ee,0,Math.PI*2),y.fill())}}y.globalAlpha=1},[gr,V,r]),Ga=Q?y=>{let v=Q.step(a?a.arrowStep(y.key):null,t.active);return v!==null&&v>=0&&t.setActive(v,"keyboard"),v!==null}:a?y=>{let v=a.arrowStep(y.key);if(!v||!V.length)return!1;let B=t.active!==null&&V[t.active]?t.active:null,K=B===null?a.entryPoint(V,v):a.nearestInDirection(V,B,v);return K!==null&&t.setActive(K,"keyboard"),!0}:void 0,Va=Ue.ticks(Math.max(2,Math.round(r/110))),pr=ma(ie),Wa=De.desc(l,D,[me(P),me(R),ye(M),ye(x)]),Ka=(0,G.useMemo)(()=>{if(!a||!fe||!S)return"";let y=[...$===void 0?[]:[`x ${me($)}`],...w===void 0?[]:[`y ${Lt(w)}`]];return a.describe(fe,{points:g,seriesNames:u,fit:Be,xName:e.xLabel??"x",yName:e.yLabel??"y",refs:y,refX:$,refY:w,quadrants:ht})},[a,fe,S,$,w,me,Lt,g,u,Be,e.xLabel,e.yLabel,ht]),Dt=(0,G.useMemo)(()=>a&&fe&&(L||se)&&a.noneInside(g,H,ne)?fe.outOfRange:"",[a,fe,g,H[0],H[1],ne[0],ne[1],L,se]),Xa=e.description??(Dt||Wa+(Q?Q.desc:"")+Ka+(F?De.logDropped(F):"")),br=Q?Q.yTitle:e.yLabel,yr=a&&(gt!==null||pt!==null)?(0,ae.jsx)(a.RefLines,{p:n,x:gt,y:pt,box:ie}):null;return(0,ae.jsxs)(no,{c:t,kind:l?De.bubble:De.scatter,ariaLabel:e.ariaLabel,description:Xa,emptyText:Dt||void 0,events:Ba,tip:dr,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,onPointerMove:(y,v,B)=>{let K=Q?Q.at(y,v):Ia(y,v);K!==t.active&&t.setActive(K,B.pointerType==="touch"?"touch":"pointer")},onKey:Ga,announce:Q&&t.via==="keyboard"?Q.say(t.active):void 0,underlay:O?(0,ae.jsx)(oa,{width:r,height:o,draw:ja,progress:Ha,version:t.sig}):void 0,children:[br&&gn?(0,ae.jsx)(Ge,{x:Le,y:6,size:10.5,fill:n.paint("muted"),children:br}):null,(0,ae.jsx)(Mo,{p:n,ticks:sr,y:Xe,x0:Le,x1:r,fmt:ye,locale:t.locale,zero:!1,labels:gn}),(0,ae.jsxs)("g",{"aria-hidden":"true",children:[(e.showXAxis===!1?[]:Va).map(y=>(0,ae.jsx)(Ge,{x:Ue(y),y:o-Ze+13,anchor:"middle",size:st,fill:n.paint("muted"),children:me(y)},y)),e.xLabel?(0,ae.jsx)(Ge,{x:pr.x,y:pr.y,anchor:"end",size:10.5,fill:n.paint("muted"),children:e.xLabel}):null]}),Q?null:yr,i&&Q?(0,ae.jsx)(i.Layer,{p:n,v:Q,box:ie,active:t.active,c:t,m:dt,onPick:t.click}):null,Q?yr:null,O?t.active!==null&&V[t.active]?(0,ae.jsx)("circle",{cx:V[t.active].x,cy:V[t.active].y,r:V[t.active].r+2,fill:"none",stroke:n.paint("ink"),strokeWidth:1.6,pointerEvents:"none"}):null:dt.items.map(y=>{let v=y.data;if(!v)return null;let[B,K,_]=y.v,te=t.active===v.i,re=ze&&v.si>=0?ze[v.si]:void 0,ee=re?re.fill:v.hi?ur.fill:n.paint(l?"neutral":"neutralStrong");return(0,ae.jsx)("circle",{className:"ztd-mark",cx:B,cy:K,r:Math.max(0,_),fill:ee,fillOpacity:v.hi?.92:l?.85:.7,stroke:te?n.paint("ink"):n.paint("panel"),strokeWidth:te?2:l?1.2:.6,opacity:y.exiting?.3:t.active===null||te?1:.55,onPointerEnter:xe=>t.setActive(v.i,xe.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(v.i)},y.key)}),a&&fe?(0,ae.jsx)(a.Overlay,{p:n,fade:dt.fade(Nt*.6,300),trendTag:fe.trendTag,fitLine:Rt,fitTag:Pt,quads:Ft,seriesLabels:wn,seriesNames:u,colors:ze,hiSeries:de}):null,za.map(y=>(0,ae.jsx)(Ge,{x:y.x,y:y.y,anchor:y.anchor,size:11,weight:y.d.hi?800:500,fill:n.paint(y.d.hi?"ink":"muted"),opacity:dt.fade(Nt*.6,300),children:y.d.label},y.d.i)),Dt?(0,ae.jsx)(Ge,{x:(ie.x0+ie.x1)/2,y:(ie.y0+ie.y1)/2,anchor:"middle",size:12,fill:n.paint("muted"),children:Dt}):null]})}var ul=A(U(),1);var ar=A(z(),1),ml={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`},ga={en:ml,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}일 이동평균`}},or=["ink","muted","dim"];function pa(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,or.length)}var dl=A(U(),1);var wa=A(z(),1),fl={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Ee(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},hl={en:fl,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},ba=(e,t)=>hl[e].other(t);function ya(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((a,i)=>({v:a.value,i})).sort((a,i)=>i.v-a.v).slice(0,Math.floor(t)).map(a=>a.i)),o=e.filter((a,i)=>!r.has(i));return{kept:e.filter((a,i)=>r.has(i)),other:n(o.length,yo(o.map(a=>a.value)))}}var xa=e=>Number.isFinite(e)&&e>0?e:0;function ka(e,t,n,r){return r==="emphasis"?zr(e,t,n):Te(e,t,n)}var gl=A(U(),1);var Ma=A(z(),1);function va(e,t){return t===!1?e.map((n,r)=>r):bo(e)}function $a(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return Re(e,t,t,r,"max")}function Ta(e,t,n){let r=new Array(t.length),o=t.filter(a=>!n.has(a));for(let a of t)n.has(a)&&(r[a]=J(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?J(e,"neutral"):Ht(e,1-i/Math.max(1,o.length-1))),r}function Ca(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Se(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function Sa(e,t){return yt(e,t+1,new Set)}var pl=A(U(),1);var Na=A(z(),1);var bl=26;var cm=bl*.62;function Aa(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Oo.includes(o)&&t.forEach((a,i)=>a===o&&r.add(i));return r}var Ie=A(z(),1);function Ra(e,t,n){let r=Qt(e);return r?.type==="scatter"&&t?.size!==void 0&&!Zt(n)?Qt("bubble"):r}function yl(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 xl(e,t,n,r=!1){let o=Ra(e.type,e.encoding,e.options);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&Vn.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(m.includes(o.type)){let u=we(a.label,"label"),d=_e(a.value,"value"),h=o.type==="waffle",f=t.map((g,F)=>({r:g,label:u(g,F),value:h?d(g,F):xa(d(g,F))})),{kept:b,other:$}=h?{kept:f,other:null}:ya(f,i.other,(g,F)=>({r:{},label:ba(Y(n),g),value:F})),k=Re(s,b.map(g=>g.r),b.map(g=>g.label),b.map(g=>g.value),h?"first":"max"),w=$?[...b,$]:b,T=je(g=>h?Te(g,w.length,k):ka(g,w.length,k,i.colorMode)),S=h&&i.shape==="arc";return w.map((g,F)=>({label:g.label,color:T[F],...S&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=pa(Array.isArray(i.ma)?i.ma:void 0,t.length),d=ga[Y(n)];return[{label:d.up,color:i.upColor??"accent"},{label:d.down,color:i.downColor??"neutralStrong"},...u.map((h,f)=>({label:d.maLegend(h),color:or[f],shape:"line"}))]}if(o.type==="network"){let u=Ca(i.groups);if(u.length<2)return[];let d=je(h=>Sa(h,u.length));return u.map((h,f)=>({label:h,color:d[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof a.group!="string")return[];let u=we(a.group,"group"),d=Se(t.map((f,b)=>u(f,b)).filter(Boolean));if(d.length<2)return[];let h=je(f=>yt(f,d.length,new Set));return d.map((f,b)=>({label:f,color:h[b],shape:"circle"}))}if(o.type==="scatter"){if(typeof a.series!="string"||Zt(i))return[];let u=we(a.series,"series"),d=Se(t.map((b,$)=>u(b,$)));if(d.length<2)return[];let h=ca(s,t,d,u),f=je(b=>yt(b,d.length,h));return c(d.map((b,$)=>({label:b,color:f[$],shape:"circle"})))}if(o.type==="timeline"){let u=typeof a.group!="string",d=u?a.status:a.group;if(typeof d!="string")return[];let h=Xo(t,d,u),f=je(b=>Te(b,h.length,Aa(s,h)));return c(h.map((b,$)=>({label:b,color:f[$],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(a.y))u=a.y;else if(typeof a.series=="string"){let T=we(a.series,"series");u=Se(t.map((S,g)=>T(S,g)))}let d=Wn(o.type,a,i);if(d.length){let T=Re(s,u,u,u.map(()=>0),"none"),S=je(F=>Te(F,u.length,T)),g=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((F,D)=>({label:F,color:S[D]}));return[...c(g),...d.map((F,D)=>({label:F,color:ra(D),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&i.layout==="diverging"&&s===void 0?po(u.length,Array.isArray(i.negative)?i.negative.map(T=>u.indexOf(String(T))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,b=f>=0?new Set([f]):Re(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((T,S)=>({label:T,color:b.has(S)?"accent":"neutralStrong",shape:"square"})));let $=i.colorMode,k=T=>Te(T,u.length,b);if((o.type==="line"||o.type==="area")&&(k=T=>na(T,u.length,b,o.type==="area",$)),o.type==="stream"){let T=vt(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),S=va(T.values,i.reorder),g=$a(s,T.series,T.values);k=F=>Ta(F,S,g)}let w=je(k);return c(u.map((T,S)=>({label:T,color:w[S],...o.type==="line"&&{shape:"line"}})))}return[]}function kl(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&so.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function wl(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:a,highlight:i,syncId:s,title:l,description:c}}function Fa(e,t){let{spec:n}=e,r=Ra(n.type,n.encoding,n.options),o=(0,Ct.useMemo)(()=>Uo(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=io(n,e.locale),s=he(i),l=Y(s),c=Io(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),m=uo(n),u=(0,Ct.useMemo)(()=>m?Wo(m,s):void 0,[m,s]),d=n.options?.hidden,h=Array.isArray(d)?d.map(String):[],f=h.join(""),[b,$]=(0,Ct.useState)(null);if(!r)return(0,Ie.jsx)(Gn,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let k=o??c.data,w=t[r.type],T={...n.options??{}},S={...yl(r,n.encoding),...T,...u?{tooltip:u}:{},data:k,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:i},g=n.card?.legend==="toggle"&&co(r.type,n.encoding??{},T),F=b&&b.base===f?b.hidden:h;g&&(S.hidden=F);let D=R=>$(M=>{let x=M&&M.base===f?M.hidden:h;return{base:f,hidden:x.includes(R)?x.filter(C=>C!==R):[...x,R]}}),O=S.height??220,E=kl(n,r.type),I=a&&!k.length&&(c.loading||c.error||c.empty)?(0,Ie.jsx)(Gn,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:O,locale:i}):E?(0,Ie.jsx)(Eo,{chart:w,...wl(r.type,E,S)}):(0,Ie.jsx)(w,{...S});if(n.card){let R=n.card,M=R.legend==="auto"||R.legend==="toggle"?xl(n,k,s,g):R.legend,x=M?.length?g?(0,Ie.jsx)(jn,{items:M,hidden:F,onToggle:D,locale:i}):M:void 0,C=R.download?(0,Ie.jsx)(Vo,{data:k,columns:mo(n),filename:R.title??r.type,formats:Array.isArray(R.download)?R.download:void 0,locale:i}):void 0;I=(0,Ie.jsx)(to,{number:R.number,title:R.title??ao(r,l),subtitle:R.subtitle,legend:x,actions:C,source:R.source||void 0,note:R.note||void 0,accent:R.accent,takeaway:R.takeaway,level:R.level,sample:R.sample,replay:R.replay!==!1,className:e.className,locale:i,children:I})}let P=e.theme??n.theme;return P&&(I=(0,Ie.jsx)(Xt,{theme:P,children:I})),I}function vl({cfg:e,components:t}){let n=ct();return Fa({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function _a(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,Pa.hydrateRoot)(r,(0,ir.createElement)(Xt,{theme:o.theme,cssVars:!0},(0,ir.createElement)(vl,{cfg:o,components:{[e]:t}})))}_a("bubble",rr);})();
27
+ `}function Qs(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function Qn(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Ho=2,Ke=16;function jo(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,a,i,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${a}, ${i})`:`rgba(${o}, ${a}, ${i}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function Go(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 Vo(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:a,height:i}=o.viewBox.baseVal,[s,l]=[a+Ke*2,i+Ke*2],c=o.cloneNode(!0),m=c.querySelectorAll("*"),u=new Map;o.querySelectorAll("*").forEach((f,p)=>{let v;for(let k of Array.from(f.attributes)){if(!qs.test(k.value))continue;let w=(v??(v=getComputedStyle(f))).getPropertyValue(k.name);w&&m[p].setAttribute(k.name,jo(w,u))}}),c.removeAttribute("style");for(let[f,p]of Object.entries({viewBox:`${-Ke} ${-Ke} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))c.setAttribute(f,String(p));let d=jo(getComputedStyle(r).backgroundColor,u),h=o.parentElement?.querySelector("canvas")??null;if(n){let f=c.querySelector("desc")?.nextSibling??c.firstChild;c.insertBefore(Go("rect",{x:-Ke,y:-Ke,width:s,height:l,fill:d}),f),h&&c.insertBefore(Go("image",{href:h.toDataURL(),width:a,height:i}),f)}return{svg:new XMLSerializer().serializeToString(c),w:s,h:l,vw:a,vh:i,bg:d,canvas:h}}function el(e,t){let n=Vo(e,Ho,!1);if(!n)return;let r=Ho,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let a=o.getContext("2d");if(!a)return;a.fillStyle=n.bg,a.fillRect(0,0,o.width,o.height),n.canvas&&a.drawImage(n.canvas,Ke*r,Ke*r,n.vw*r,n.vh*r);let i=URL.createObjectURL(new Blob([n.svg],{type:"image/svg+xml"})),s=new Image;s.onload=()=>{a.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(i),o.toBlob(l=>l&&Qn(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Ko(e){let t=$e(e.theme),n=q(de(e.locale))==="ko",r=Qs(e.filename),o=(a,i)=>{if(a==="csv")return Qn(new Blob([Zs(e.data,e.columns?.length?e.columns:Js(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return el(i,r);let s=Vo(i,1,!0);s&&Qn(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,er.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:Us.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,er.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(a,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:i},a)})})}var Xo=R(O(),1);function Wo(e,t=ce){let n=qe(void 0,t),r=e.split(`
28
+ `),o=(a,i)=>{if(i==="label")return a.label;if(i==="value")return a.formatted??(a.value===null?null:n(a.value));if(i==="series")return a.series??null;let s=a.datum&&typeof a.datum=="object"?a.datum[i]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?wt(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,c=s.replace(Yr,(m,u)=>o(a,u.trim())??(l=!0,""));l||i.push(c)}return i.length?i.map((s,l)=>(0,Xo.jsx)("div",{children:s},l)):null}}function Uo(e,t,n=!1){let r=ye(t,"group"),o=e.map((s,l)=>r(s,l)).filter(Boolean),a=Te(o);if(!n)return a;let i=new Map;for(let s of o)i.set(s,(i.get(s)??0)+1);return a.map((s,l)=>[s,l]).sort((s,l)=>i.get(s[0])-i.get(l[0])||s[1]-l[1]).map(([s])=>s)}function Yo(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 Ze(t.csv)}return null}var na=R(U(),1);var Q=R(U(),1);function qo(e,t){let n=$e(e.theme),[r,o,a]=cn(e.width),i=ut(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,c=e.height??l,m=un(e.reducedMotion??"auto"),u=e.animate!==!1&&!m&&ke,d=Eo(r,e.animateOnView!==!1&&u),h=de(e.locale),f=q(h),p=(0,Q.useMemo)(()=>qe(e.format,h,t.format),[e.format,h,t.format]),v=(0,Q.useCallback)(B=>Gt(B,{locale:h}),[h]),k=(0,Q.useMemo)(()=>Vt(p,e.unit),[p,e.unit]),w=(0,Q.useMemo)(()=>tn(e.data),[e.data]),[M,A]=(0,Q.useState)(null),[b,T]=(0,Q.useState)(null),I=(0,Q.useRef)([]),E=(0,Q.useRef)(e.onHover);E.current=e.onHover;let z=(0,Q.useRef)(e.onClick);z.current=e.onClick;let L=(0,Q.useRef)(null),_=(0,Q.useRef)(null),F=(0,Q.useRef)(null),C=(0,Q.useCallback)((B,Y="pointer")=>{if(F.current!==B){F.current=B;let ge=B===null?null:I.current[B]??null;queueMicrotask(()=>E.current?.(ge)),_.current?.(B)}L.current=B===null?null:Y,A(B),T(L.current)},[]),x=(0,Q.useCallback)(B=>{L.current!=="keyboard"&&(L.current=B===null?null:"sync",A(B),T(L.current))},[]),S=(0,Q.useCallback)(B=>{let Y=I.current[B];Y&&z.current?.(Y)},[]),D=to(e.replayKey),j=e.width!==void 0||(a??0)>0,se={enabled:u,active:d.visible&&j,near:d.near,replayKey:D,dataKey:w,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Pe=(0,Q.useCallback)((B,Y=1)=>M===null||M===B?Y:Y*.38,[M]);return{p:n,width:s,height:c,measured:j,responsive:e.width===void 0,pending:ke&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:se,fv:k,fmt:p,pct:v,locale:h,lang:f,t:f==="ko"?Pr:_r,active:M,via:b,setActive:C,click:S,events:I,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Pe,sig:w,description:e.description,reduced:m,publish:_,applySync:x}}var J=R(U(),1);function tl(e){return 1-Math.pow(1-e,3)}function nl(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function rl(e){return e==="easeInOut"?nl:e==="linear"?t=>t:tl}function ol(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 dt(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),a=Math.floor(o),i=Math.min(e.length-1,a+1);n[r]=e[a]+(e[i]-e[a])*(o-a)}return n}function mn(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 Jo(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 Zo(e,t,n,r){if(!t||!n||t.length!==n.length)return dt(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let l of dt(s,n[i]))o.push(l)}return o.length===r?o:dt(e,r)}var dn=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||!mn(o.to,r.to))return!1}return!0}refreshData(t){for(let n of t){let r=this.tracks.get(n.key);r&&(r.data=n.data)}}make(t,n,r,o){let a=t.from??t.to,i=t.enter??a;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:a.slice(),enter:i.slice(),exit:(t.exit??i).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),a=this.make(r,r.to,0,0);o&&(a.order=o.order),a.done=!0,a.progress=1,n.set(r.key,a)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let a=this.tracks.get(o.key),i=this.make(o,o.from??o.to,1/0,o.delay??0);a&&(i.order=a.order),r=Math.max(r,o.delay??0),n.set(o.key,i)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),Jo(n.from,n.vel,n.to),n.cur=n.from.slice(),n.curVel=n.vel.slice(),n.done=mn(n.from,n.to),n.done&&(n.progress=1);this.entranceStart=t,this.animating=!0}update(t,n,r=0){this.step(n);let o=new Set,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),l=r>0?Math.min(a*r,240):0;if(s){let c=i.to.length;s.from=Zo(s.cur,s.parts,i.parts,c),s.vel=Zo(s.curVel,s.parts,i.parts,c),s.parts=i.parts,s.to=i.to.slice(),Jo(s.from,s.vel,s.to),s.cur=s.from.slice(),s.curVel=s.vel.slice(),s.appear=(i.from??i.to).slice(),s.enter=(i.enter??s.appear).slice(),s.exit=(i.exit??s.enter).slice(),s.data=i.data,s.exiting=!1,s.t0=n+(s.t0>n?Math.max(0,s.t0-n):l),s.done=mn(s.from,s.to)&&s.vel.every(m=>Math.abs(m)<1e-6),s.progress=s.done?1:0}else{let c=this.make(i,i.enter??i.from??i.to,n+l,0);c.done=mn(c.from,c.to),this.tracks.set(i.key,c)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=dt(i.exit,i.cur.length),i.t0=n,i.exiting=!0,i.done=!1,i.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=rl(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,c=s.to.length;if(s.from.length!==c&&(s.from=dt(s.from,c)),s.vel.length!==c&&(s.vel=dt(s.vel,c)),s.cur.length!==c&&(s.cur=new Array(c).fill(0),s.curVel=new Array(c).fill(0)),!(l>0)){for(let u=0;u<c;u++)s.cur[u]=s.from[u],s.curVel[u]=0;s.progress=0,n=!0;continue}let m;if(this.easing==="spring"){let u=Math.exp(-a*l),d=a*l>=8&&a*l<20,h=0;for(let f=0;f<c;f++){let p=s.from[f]-s.to[f],v=s.vel[f]+a*p;s.cur[f]=s.to[f]+(p+v*l)*u,s.curVel[f]=(s.vel[f]-a*v*l)*u,d&&h<.15&&(h=Math.max(h,Math.abs(s.cur[f]-s.to[f]),Math.abs(s.curVel[f]/a)))}m=a*l>=20||d&&h<.15,s.progress=Math.min(1,1-(1+a*l)*u)}else{let u=Math.min(1,l/o),d=r(u),h=ol(this.easing,u)/o;for(let f=0;f<c;f++)s.cur[f]=s.from[f]+(s.to[f]-s.from[f])*d,s.curVel[f]=(s.to[f]-s.from[f])*h;m=u>=1,s.progress=d}if(m){for(let u=0;u<c;u++)s.cur[u]=s.to[u],s.curVel[u]=0;s.done=!0,s.progress=1,s.exiting&&i.push(s.key)}else n=!0}for(let s of i)this.tracks.delete(s);return this.animating=n,n||(this.entranceStart=-1),n}elapsed(t){return this.entranceStart<0?1/0:t-this.entranceStart}get entranceLength(){return this.duration+this.maxDelay}get(t){return this.tracks.get(t)?.cur}items(){return[...this.tracks.values()].sort((t,n)=>t.order-n.order).map(t=>({key:t.key,v:t.cur,data:t.data,exiting:t.exiting,progress:t.progress}))}get size(){return this.tracks.size}},Ct=new Set,fn=0;function Qo(e){fn=0;let t=Array.from(Ct);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||Ct.delete(n)}Ct.size&&typeof requestAnimationFrame<"u"&&(fn=requestAnimationFrame(Qo))}function ea(e){return Ct.add(e),!fn&&typeof requestAnimationFrame<"u"&&(fn=requestAnimationFrame(Qo)),()=>{Ct.delete(e)}}function al(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 ta(e,t){let n=(0,J.useMemo)(()=>al(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:c=900,stagger:m=0}=t,u=(0,J.useRef)(null),d=(0,J.useRef)("init"),h=(0,J.useRef)(null),f=(0,J.useRef)(s),p=(0,J.useRef)(i),v=(0,J.useRef)(!1),k=(0,J.useRef)(0),[,w]=(0,J.useState)(0),M=(0,J.useRef)(null),A=(0,J.useRef)(!0);u.current||(u.current=new dn,u.current.configure(l,c),u.current.snap(n),h.current=n);let b=u.current;if(b.configure(l,c),h.current!==n){let _=d.current,F=!Object.is(f.current,s);b.sameTargets(n)?b.refreshData(n):!r||_==="init"?b.snap(n):_==="idle"?b.hold(n):_==="running"||F?b.update(n,Bt(),m):b.snap(n),h.current=n,f.current=s}let T=(0,J.useRef)(()=>!1);T.current=_=>{if(!A.current)return!1;let F=b.step(_);return!F&&d.current==="running"&&(d.current="done"),w(C=>(C+1)%1e9),F||(M.current=null),F};let I=(0,J.useCallback)(()=>{if(!ke||M.current||!b.animating)return;let _=F=>T.current(F);M.current=ea(_)},[b]);Ne(()=>{let _=!Object.is(p.current,i);if(p.current=i,!r){(d.current!=="done"||b.animating)&&(b.snap(h.current??n),d.current="done",w(F=>F+1));return}d.current==="init"||_&&a?(b.hold(h.current??n),d.current="idle",v.current=!1,w(F=>F+1)):_&&(v.current=!0)},[r,i]),Ne(()=>{!r||!a||!v.current||(v.current=!1,b.hold(h.current??n),d.current="idle",w(_=>_+1))},[a,r]),(0,J.useEffect)(()=>{r&&o&&d.current==="idle"&&(b.start(Bt()),k.current+=1,d.current="running",I(),w(_=>_+1))},[r,o,i,b,I]),(0,J.useEffect)(()=>{b.animating&&I()}),(0,J.useEffect)(()=>(A.current=!0,()=>{A.current=!1,M.current?.(),M.current=null}),[]);let E=Bt(),z=b.elapsed(E),L=r&&d.current==="idle";return{items:b.items(),get:_=>b.get(_),elapsed:L?0:z,fade:(_,F=320)=>L?0:Number.isFinite(z)?Math.max(0,Math.min(1,(z-_)/F)):1,waiting:L,animating:b.animating,generation:k.current}}var tr=R(O(),1);function ra(e,t,n,r,o){if(r)return o==="categorical"?we(e,t,n):Hr(e,t,n);if(o==="categorical")return we(e,t,n);let a=Z(e,"strong"),i=Z(e,"accent");return Array.from({length:t},(s,l)=>n.has(l)?i:a)}var il=R(U(),1);var nr=R(O(),1);var oa=e=>e?"neutralStrong":"accent";var We=R(U(),1),ia=R(O(),1);function aa(e){let t=(0,We.useRef)(null),n=(0,We.useRef)(new Map),[r,o]=(0,We.useState)(0),{width:a,height:i,draw:s,progress:l,version:c,clipRight:m,manualClear:u}=e;return(0,We.useEffect)(()=>{let d=t.current;if(!d)return;let h=Math.min(2,window.devicePixelRatio||1),f=Math.max(1,Math.round(a*h)),p=Math.max(1,Math.round(i*h));d.width!==f&&(d.width=f),d.height!==p&&(d.height=p);let v=d.getContext("2d");if(!v)return;v.setTransform(h,0,0,h,0,0),u||v.clearRect(0,0,a,i);let k=getComputedStyle(d),w=new Map;s(v,l,(A,b)=>{let T=w.get(A);return T===void 0&&(T=k.getPropertyValue(A).trim(),w.set(A,T)),T||b}),n.current=w},[a,i,s,l,c,u,r]),(0,We.useEffect)(()=>{let d=t.current;if(!d||typeof matchMedia!="function")return;let h=new AbortController,f=()=>o(w=>w+1),p=()=>{let w=getComputedStyle(d);for(let[M,A]of n.current)if(w.getPropertyValue(M).trim()!==A)return f()},v=()=>{matchMedia(`(resolution: ${devicePixelRatio}dppx)`).addEventListener?.("change",()=>{v(),f()},{once:!0,signal:h.signal})};v(),matchMedia("(prefers-color-scheme: dark)").addEventListener?.("change",p,{signal:h.signal});let k=new MutationObserver(p);for(let w=d.parentElement;w;w=w.parentElement)k.observe(w,{attributes:!0});return()=>{h.abort(),k.disconnect()}},[]),(0,ia.jsx)("canvas",{ref:t,"aria-hidden":"true",style:{position:"absolute",left:0,top:0,width:"100%",height:"auto",aspectRatio:`${a} / ${i}`,pointerEvents:"none",clipPath:m?`inset(0 ${(m/Math.max(1,a)*100).toFixed(3)}% 0 0)`:void 0}})}var G=R(U(),1);var sa=20,la=24,ca=4;var _u=new Int32Array(2);var rr=R(O(),1);function ua(e,t,n,r){if(typeof e!="function")return Se(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let l=o.get(r(i,s));l!==void 0&&e(i,s)&&a.add(l)}),a}var ae=R(O(),1),sl={bubble:"Bubble chart",scatter:"Scatter plot",size:"Size",sizeWord:"size",nth:e=>`#${e}`,desc:(e,t,n)=>`${e?"Bubble chart":"Scatter plot"}. ${Oe(t,"point")}. x from ${n[0]} to ${n[1]}, y from ${n[2]} to ${n[3]}.`,logDropped:e=>` ${Oe(e,"point")} with y at or below 0 ${e===1?"is":"are"} not shown on the log scale.`},ll={en:sl,ko:{bubble:"버블 차트",scatter:"산점도",size:"크기",sizeWord:"크기",nth:e=>`${e}번`,desc:(e,t,n)=>`${e?"버블 차트":"산점도"}. 점 ${t}개. x ${n[0]}~${n[1]}, y ${n[2]}~${n[3]}.`,logDropped:e=>` 로그 눈금이라 y가 0 이하인 점 ${e}개는 뺐어요.`}},cl=[],ul=[],ml=[],dl=[],ma=[],da=e=>({x:e.x1-2,y:e.y1-8});function fa(e,t){return Number(e.hi)-Number(t.hi)||t.r-e.r}function or(e){return(0,ae.jsx)(fl,{...e,kit:void 0})}var ha=e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,ga=e=>Array.isArray(e)&&e.length===2&&Number.isFinite(e[0])&&Number.isFinite(e[1])&&e[0]<e[1]?e:void 0;function fl(e){let t=qo(e,{height:y=>Math.max(220,Math.min(320,y*.6)),duration:800,stagger:0}),{p:n,width:r,height:o}=t,a=e.kit,i=a&&e.bin==="hex"?a.hex:null,s=a?i?{fit:e.fit,refLines:e.refLines,quadrants:e.quadrants}:e:{},l=!a&&e.size!==void 0,c=e.yScale==="log",m=(0,G.useMemo)(()=>{if(s.series===void 0)return null;let y=ye(s.series,"series");return e.data.map(($,H)=>y($,H))},[e.data,s.series]),u=(0,G.useMemo)(()=>a&&m?a.uniq(m):ma,[a,m]),d=s.hidden?.join("")??"",h=s.quadrants?.join("")??"",f=s.jitter?Math.max(0,s.jitter.amount??.4):0,p=s.jitter?.seed??1,v=ha(s.refLines?.x),k=ha(s.refLines?.y),w=c&&k!==void 0&&k<=0?void 0:k,M=s.fit==="linear"&&!c,A=s.hull,b=m!==null||M||v!==void 0||w!==void 0||f>0||A,T=(0,G.useMemo)(()=>{let y=_e(e.x,"x"),$=_e(e.y,"y"),H=l?_e(e.size,"size"):null,X=ye(e.label,"label"),P=e.data.map((W,le)=>{let et=y(W,le);return{d:W,i:le,x:et,y:$(W,le),s:H?Math.max(0,H(W,le)||0):1,label:X(W,le),si:-1,px:et}}).filter(W=>Number.isFinite(W.x)&&Number.isFinite(W.y)&&(!c||W.y>0));if(!a||f<=0&&!m)return P;let ne=f>0?a.smallestGap(P.map(W=>W.x)):0,re=new Map(u.map((W,le)=>[W,le])),te=new Set(d?d.split(""):[]),pe=[];for(let W of P){if(ne&&(W.px=W.x+(a.seededUnit(p,W.i)*2-1)*f*ne),m){let le=m[W.i];if(te.has(le))continue;W.si=re.get(le)??-1}pe.push(W)}return pe},[e.data,e.x,e.y,e.size,e.label,l,a,m,u,d,f,p,c]),I=(0,G.useMemo)(()=>{if(!c)return 0;let y=_e(e.x,"x"),$=_e(e.y,"y");return e.data.filter((H,X)=>Number.isFinite(y(H,X))&&$(H,X)<=0).length},[c,e.data,e.x,e.y]),E=T.length,z=!i&&t.hydrated&&E>(e.canvasThreshold??1500),L=(0,G.useMemo)(()=>({x:Me(T.map(y=>y.x)),y:Me(T.map(y=>y.y)),s:Me(T.map(y=>y.s))}),[T]),_=(0,G.useMemo)(()=>!f&&v===void 0&&w===void 0?L:{...L,x:Me(v===void 0?T.map(y=>y.px):[...T.map(y=>y.px),v]),y:w===void 0?L.y:Me([L.y[0],L.y[1],w])},[L,T,f,v,w]),[F,C]=L.x,[x,S]=L.y,D=Math.max(2,Math.round(o/70)),j=ga(e.xDomain),se=ga(e.yDomain),Pe=se&&(!c||se[0]>0)?se:void 0,B=Pe??(c?vt(_.y[0],_.y[1],D):Ie(_.y[0],_.y[1],D,{zero:e.zero??!1,pad:.08})),Y=j??Ie(_.x[0],_.x[1],Math.max(2,Math.round(r/110)),{zero:e.zero??!1,pad:.06}),ge=Math.max(Math.abs(B[0]),Math.abs(B[1])),Ae=Math.max(Math.abs(Y[0]),Math.abs(Y[1])),Xe=(0,G.useMemo)(()=>kt(e.format,t.locale,ge),[e.format,t.locale,ge]),Re=(0,G.useMemo)(()=>kt(e.xFormat,t.locale,Ae),[e.xFormat,t.locale,Ae]),hn=i&&e.binLegend!==!1?sa:e.yLabel?20:10,Qe=la,[gn,At]=e.sizeRange??(l?[4,Math.max(10,Math.min(28,r/22))]:[E>2e3?1.6:E>300?2.6:4,0]),Rt=l?At*.6:ca,Ue=(c?on:ct)(B,[o-Qe-Rt,hn+Rt]),lr=Ue.ticks(D),pn=e.showYAxis!==!1,Le=pn?rn(lr,Xe,t.locale):0,Ye=ct(Y,[Le+6+Rt,r-8-Rt]),[Da,Ea]=L.s,Oa=l?Ao([Math.min(0,Da),Ea||1],[gn,At]):()=>gn,ie=(0,G.useMemo)(()=>({x0:Le,x1:r,y0:hn,y1:o-Qe}),[Le,r,hn,o,Qe]),ue=(0,G.useMemo)(()=>a&&m?a.seriesHighlight(e.highlight,e.data,u,(y,$)=>m[$]):null,[a,m,e.highlight,e.data,u]),De=(0,G.useMemo)(()=>a&&ue?a.colors(n,u.length,ue):null,[a,n,u.length,ue]),cr=(0,G.useMemo)(()=>{if(i)return new Set;if(ue){let y=new Set;return T.forEach(($,H)=>{ue.has($.si)&&y.add(H)}),y}return Se(e.highlight,T.map(y=>y.d),T.map(y=>y.label),T.map(y=>l?y.s:y.y),l?"max":"none")},[T,e.highlight,l,ue,i]),K=(0,G.useMemo)(()=>i?cl:T.map((y,$)=>({i:$,x:Ye(y.px),y:Ue(y.y),r:Oa(y.s),vx:y.x,vy:y.y,vs:y.s,label:y.label,hi:cr.has($),datum:y.d,si:y.si})),[T,cr,r,o,Y[0],Y[1],B[0],B[1],gn,At,i]),ee=(0,G.useMemo)(()=>i&&i.view(e,{raw:T,x:Ye,y:Ue,box:ie,left:Le,c:t,xFmt:Re}),[i,T,ie,Le,Y[0],Y[1],B[0],B[1],t.lang,t.locale,Re,t.fmt,e.binSize,e.colorSteps,e.binDomain?.[0],e.binDomain?.[1],e.binLegend,e.xFormat,e.format,e.unit,e.xLabel,e.yLabel]),ur=(0,G.useMemo)(()=>[...K].sort(fa),[K]),Nt=t.motion.duration??800,Ia=(0,G.useMemo)(()=>{if(z)return[{key:"__p",to:[1],from:[0],data:null}];let y=r||1;return ur.map($=>({key:`b${$.i}:${$.label}`,to:[$.x,$.y,$.r],from:[$.x,$.y,0],enter:[$.x,$.y,0],delay:$.x/y*Nt*.55,data:$}))},[ur,z,r,Nt]),ft=ta(Ia,t.motion),bn=(0,G.useMemo)(()=>{let $=new Map;return K.forEach((H,X)=>{let P=`${Math.floor(H.x/24)},${Math.floor(H.y/24)}`,ne=$.get(P);ne?ne.push(X):$.set(P,[X])}),{g:$,cell:24}},[K]),za=(y,$)=>{let{g:H,cell:X}=bn,P=Math.floor(y/X),ne=Math.floor($/X),re=-1,te=1/0,pe=-1,W=l?Math.ceil(At/X)+1:1;for(let le=-W;le<=W;le++)for(let et=-W;et<=W;et++){let kr=H.get(`${P+le},${ne+et}`);if(kr)for(let $n of kr){let Ot=K[$n],Tn=Math.hypot(Ot.x-y,Ot.y-$)-Ot.r;Tn<=0&&(pe<0||fa(Ot,K[pe])>0)&&(pe=$n),Tn<te&&(te=Tn,re=$n)}}return pe>=0?pe:te<=10?re:null},Ee=ll[t.lang],me=a?.text[t.lang],Be=(0,G.useMemo)(()=>a&&b&&T.length>=2?a.linearFit(T):null,[a,b,T]),ht=a&&Be&&M?a.fitSegment(Be,F,C,B):null,Ft=ht?{x1:Ye(ht[0]),y1:Ue(ht[1]),x2:Ye(ht[2]),y2:Ue(ht[3])}:null,gt=(0,G.useMemo)(()=>h?h.split("").map(y=>y.trim()):ma,[h]),pt=v===void 0?null:Ye(v),bt=w===void 0?null:Ue(w),_t=(0,G.useMemo)(()=>a&&gt.length&&pt!==null&&bt!==null?a.quadrantTags(gt,pt,bt,ie):dl,[a,gt,pt,bt,ie]),Pt=a&&me&&Ft?a.fitTagSpot(Ft,me.trendTag,_t.map(y=>y.box),ie):null,yn=Pt?.x,xn=Pt?.y,kn=Pt?.anchor,wn=me?.trendTag,Lt=(0,G.useMemo)(()=>{if(!a||!b)return ul;let y=_t.map($=>$.box);if(e.xLabel){let $=da(ie);y.push(Yn(e.xLabel,$.x,$.y,10.5,"end"))}return wn&&yn!==void 0&&xn!==void 0&&kn&&y.push(a.tagBox(wn,yn,xn,kn)),y},[a,b,_t,e.xLabel,ie,yn,xn,kn,wn]),vn=(0,G.useMemo)(()=>a&&t.showLabels&&ue?a.placeSeriesLabels(K,u,ue,{box:ie,reserved:Lt,grid:bn,hull:A}):ml,[a,t.showLabels,ue,K,u,bn,Lt,ie,A]),Ba=(0,G.useMemo)(()=>{let y=e.maxLabels??(m?0:6);if(!t.showLabels||E>400||y<=0)return[];let $=[...K].sort((P,ne)=>Number(ne.hi)-Number(P.hi)||ne.r-P.r).filter(P=>P.label),H=[...K.map(P=>({x:P.x-P.r*.7,y:P.y-P.r*.7,w:P.r*1.4,h:P.r*1.4})),...Lt,...vn.map(P=>P.box)],X=[];for(let P of $){if(X.length>=y)break;let ne=[{x:P.x+P.r+5,y:P.y,anchor:"start"},{x:P.x-P.r-5,y:P.y,anchor:"end"},{x:P.x,y:P.y-P.r-9,anchor:"middle"},{x:P.x,y:P.y+P.r+10,anchor:"middle"}];for(let re of ne){let te=Yn(P.label,re.x,re.y,11,re.anchor,P.hi?800:500);if(!(te.x<Le||te.x+te.w>r-2||te.y<0||te.y+te.h>o-Qe)&&!H.some(pe=>vo(pe,te,1))){H.push(te),X.push({d:P,...re});break}}}return X},[K,t.showLabels,E,e.maxLabels,m,Lt,vn,Le,r,o,Qe]),mr=Z(n,"accent"),dr=t.fmt,Dt=t.fv,Ha=(0,G.useMemo)(()=>ee?ee.events:an(K.length,y=>{let $=K[y],H={datum:$.datum,index:$.i,key:`${$.i}`,label:$.label||Ee.nth($.i+1),value:l?$.vs:$.vy,formatted:`x ${Re($.vx)}, y ${Dt($.vy)}${l?`, ${Ee.sizeWord} ${dr($.vs)}`:""}`};return $.si>=0&&(H.series=u[$.si]),H}),[K,l,Re,Dt,dr,Ee,u,ee]),fr=ee?ee.tip(t.active):null;if(t.active!==null&&K[t.active]){let y=K[t.active],$=[{label:e.xLabel??"x",value:Re(y.vx)},{label:e.yLabel??"y",value:t.fv(y.vy)},...l?[{label:Ee.size,value:t.fmt(y.vs),color:y.hi?mr.fill:n.paint("neutral")}]:[]];De&&y.si>=0&&$.unshift({label:u[y.si],value:"",color:De[y.si].fill,strong:!0}),me&&Be&&Ft&&$.push({label:me.slope,value:`${Be.slope>0?"+":""}${t.fv(Be.slope)}`,strong:!1},{label:"R²",value:Be.r2.toFixed(2),strong:!1}),fr={x:y.x,y:y.y-y.r,title:y.label||Ee.nth(y.i+1),rows:$}}let ja=z?ft.get("__p")?.[0]??1:1,hr=n.theme.neutralStrong,gr=n.theme.accent,pr=(0,G.useMemo)(()=>{if(a&&De&&ue)return a.canvasGroups(K,De,ue);let y=[],$=[];return K.forEach((H,X)=>(H.hi?$:y).push(X)),[{ks:y,isHi:!1,fill:H=>H("--ztd-neutral-strong",hr)},{ks:$,isHi:!0,fill:H=>H("--ztd-accent",gr)}]},[a,K,De,ue,hr,gr]),Ga=(0,G.useCallback)((y,$,H)=>{let X=r||1;for(let P of pr){y.globalAlpha=P.isHi?1:.55,y.fillStyle=P.fill(H);for(let ne of P.ks){let re=K[ne],te=P.isHi?Math.min(1,$*1.2):Math.max(0,Math.min(1,($*1.4-re.x/X*.4)*2.5));te<=0||(y.beginPath(),y.arc(re.x,re.y,re.r*te,0,Math.PI*2),y.fill())}}y.globalAlpha=1},[pr,K,r]),Va=ee?y=>{let $=ee.step(a?a.arrowStep(y.key):null,t.active);return $!==null&&$>=0&&t.setActive($,"keyboard"),$!==null}:a?.dotKeys(t,K),Ka=Ye.ticks(Math.max(2,Math.round(r/110))),br=da(ie),Wa=Ee.desc(l,E,[Re(F),Re(C),Xe(x),Xe(S)]),Xa=(0,G.useMemo)(()=>{if(!a||!me||!b)return"";let y=[...v===void 0?[]:[`x ${Re(v)}`],...w===void 0?[]:[`y ${Dt(w)}`]];return a.describe(me,{points:T,seriesNames:u,fit:Be,xName:e.xLabel??"x",yName:e.yLabel??"y",refs:y,refX:v,refY:w,quadrants:gt,hull:A})},[a,me,b,v,w,Re,Dt,T,u,Be,e.xLabel,e.yLabel,gt,A]),Et=(0,G.useMemo)(()=>a&&me&&(j||Pe)&&a.noneInside(T,Y,B)?me.outOfRange:"",[a,me,T,Y[0],Y[1],B[0],B[1],j,Pe]),Ua=e.description??(Et||Wa+(ee?ee.desc:"")+Xa+(I?Ee.logDropped(I):"")),yr=ee?ee.yTitle:e.yLabel,xr=a&&(pt!==null||bt!==null)?(0,ae.jsx)(a.RefLines,{p:n,x:pt,y:bt,box:ie}):null;return(0,ae.jsxs)(ro,{c:t,kind:l?Ee.bubble:Ee.scatter,ariaLabel:e.ariaLabel,description:Ua,emptyText:Et||void 0,events:Ha,tip:fr,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,onPointerMove:(y,$,H)=>{let X=ee?ee.at(y,$):za(y,$);X!==t.active&&t.setActive(X,H.pointerType==="touch"?"touch":"pointer")},onKey:Va,announce:ee&&t.via==="keyboard"?ee.say(t.active):void 0,underlay:z?(0,ae.jsx)(aa,{width:r,height:o,draw:Ga,progress:ja,version:t.sig}):void 0,children:[yr&&pn?(0,ae.jsx)(Ge,{x:Le,y:6,size:10.5,fill:n.paint("muted"),children:yr}):null,(0,ae.jsx)(Co,{p:n,ticks:lr,y:Ue,x0:Le,x1:r,fmt:Xe,locale:t.locale,zero:!1,labels:pn}),(0,ae.jsxs)("g",{"aria-hidden":"true",children:[(e.showXAxis===!1?[]:Ka).map(y=>(0,ae.jsx)(Ge,{x:Ye(y),y:o-Qe+13,anchor:"middle",size:lt,fill:n.paint("muted"),children:Re(y)},y)),e.xLabel?(0,ae.jsx)(Ge,{x:br.x,y:br.y,anchor:"end",size:10.5,fill:n.paint("muted"),children:e.xLabel}):null]}),A&&a?.hulls(n,K,De),ee?null:xr,i&&ee?(0,ae.jsx)(i.Layer,{p:n,v:ee,box:ie,active:t.active,c:t,m:ft,onPick:t.click}):null,ee?xr:null,z?t.active!==null&&K[t.active]?(0,ae.jsx)("circle",{cx:K[t.active].x,cy:K[t.active].y,r:K[t.active].r+2,fill:"none",stroke:n.paint("ink"),strokeWidth:1.6,pointerEvents:"none"}):null:ft.items.map(y=>{let $=y.data;if(!$)return null;let[H,X,P]=y.v,ne=t.active===$.i,re=De&&$.si>=0?De[$.si]:void 0,te=re?re.fill:$.hi?mr.fill:n.paint(l?"neutral":"neutralStrong");return(0,ae.jsx)("circle",{className:"ztd-mark",cx:H,cy:X,r:Math.max(0,P),fill:te,fillOpacity:$.hi?.92:l?.85:.7,stroke:ne?n.paint("ink"):n.paint("panel"),strokeWidth:ne?2:l?1.2:.6,opacity:y.exiting?.3:t.active===null||ne?1:.55,onPointerEnter:pe=>t.setActive($.i,pe.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click($.i)},y.key)}),a&&me?(0,ae.jsx)(a.Overlay,{p:n,fade:ft.fade(Nt*.6,300),trendTag:me.trendTag,fitLine:Ft,fitTag:Pt,quads:_t,seriesLabels:vn,seriesNames:u,colors:De,hiSeries:ue}):null,Ba.map(y=>(0,ae.jsx)(Ge,{x:y.x,y:y.y,anchor:y.anchor,size:11,weight:y.d.hi?800:500,fill:n.paint(y.d.hi?"ink":"muted"),opacity:ft.fade(Nt*.6,300),children:y.d.label},y.d.i)),Et?(0,ae.jsx)(Ge,{x:(ie.x0+ie.x1)/2,y:(ie.y0+ie.y1)/2,anchor:"middle",size:12,fill:n.paint("muted"),children:Et}):null]})}var hl=R(U(),1);var ir=R(O(),1),gl={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}, ${Oe(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},pa={en:gl,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}일 이동평균`}},ar=["ink","muted","dim"];function ba(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,ar.length)}var pl=R(U(),1);var va=R(O(),1),bl={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${Oe(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},yl={en:bl,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},ya=(e,t)=>yl[e].other(t);function xa(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((a,i)=>({v:a.value,i})).sort((a,i)=>i.v-a.v).slice(0,Math.floor(t)).map(a=>a.i)),o=e.filter((a,i)=>!r.has(i));return{kept:e.filter((a,i)=>r.has(i)),other:n(o.length,xo(o.map(a=>a.value)))}}var ka=e=>Number.isFinite(e)&&e>0?e:0;function wa(e,t,n,r){return r==="emphasis"?Br(e,t,n):we(e,t,n)}var xl=R(U(),1);var Ca=R(O(),1);function $a(e,t){return t===!1?e.map((n,r)=>r):yo(e)}function Ta(e,t,n){let r=n.map(o=>o.reduce((a,i)=>a+(Number.isFinite(i)?i:0),0));return Se(e,t,t,r,"max")}function Ma(e,t,n){let r=new Array(t.length),o=t.filter(a=>!n.has(a));for(let a of t)n.has(a)&&(r[a]=Z(e,"accent"));return o.forEach((a,i)=>r[a]=o.length===1?Z(e,"neutral"):jt(e,1-i/Math.max(1,o.length-1))),r}function Sa(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Te(Object.values(e).filter(t=>typeof t=="string"&&t!==""))}function Aa(e,t){return xt(e,t+1,new Set)}var kl=R(U(),1);var Na=R(O(),1);var wl=26;var fm=wl*.62;function Ra(e,t){let n=typeof e=="string"?[e]:Array.isArray(e)?e:[],r=new Set;for(let o of n)typeof o=="string"&&!Io.includes(o)&&t.forEach((a,i)=>a===o&&r.add(i));return r}var ze=R(O(),1);function Fa(e,t,n){let r=en(e);return r?.type==="scatter"&&t?.size!==void 0&&!Qt(n)?en("bubble"):r}function vl(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 $l(e,t,n,r=!1){let o=Fa(e.type,e.encoding,e.options);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&Kn.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),c=u=>u.filter(d=>!l.has(d.label)),m=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(m.includes(o.type)){let u=ye(a.label,"label"),d=_e(a.value,"value"),h=o.type==="waffle",f=t.map((b,T)=>({r:b,label:u(b,T),value:h?d(b,T):ka(d(b,T))})),{kept:p,other:v}=h?{kept:f,other:null}:xa(f,i.other,(b,T)=>({r:{},label:ya(q(n),b),value:T})),k=Se(s,p.map(b=>b.r),p.map(b=>b.label),p.map(b=>b.value),h?"first":"max"),w=v?[...p,v]:p,M=je(b=>h?we(b,w.length,k):wa(b,w.length,k,i.colorMode)),A=h&&i.shape==="arc";return w.map((b,T)=>({label:b.label,color:M[T],...A&&{shape:"circle"}}))}if(o.type==="candlestick"){let u=ba(Array.isArray(i.ma)?i.ma:void 0,t.length),d=pa[q(n)];return[{label:d.up,color:i.upColor??"accent"},{label:d.down,color:i.downColor??"neutralStrong"},...u.map((h,f)=>({label:d.maLegend(h),color:ar[f],shape:"line"}))]}if(o.type==="network"){let u=Sa(i.groups);if(u.length<2)return[];let d=je(h=>Aa(h,u.length));return u.map((h,f)=>({label:h,color:d[f],shape:"circle"}))}if(o.type==="symbolMap"){if(typeof a.group!="string")return[];let u=ye(a.group,"group"),d=Te(t.map((f,p)=>u(f,p)).filter(Boolean));if(d.length<2)return[];let h=je(f=>xt(f,d.length,new Set));return d.map((f,p)=>({label:f,color:h[p],shape:"circle"}))}if(o.type==="scatter"){if(typeof a.series!="string"||Qt(i))return[];let u=ye(a.series,"series"),d=Te(t.map((p,v)=>u(p,v)));if(d.length<2)return[];let h=ua(s,t,d,u),f=je(p=>xt(p,d.length,h));return c(d.map((p,v)=>({label:p,color:f[v],shape:"circle"})))}if(o.type==="timeline"){let u=typeof a.group!="string",d=u?a.status:a.group;if(typeof d!="string")return[];let h=Uo(t,d,u),f=je(p=>we(p,h.length,Ra(s,h)));return c(h.map((p,v)=>({label:p,color:f[v],shape:"square"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let u=[];if(Array.isArray(a.y))u=a.y;else if(typeof a.series=="string"){let M=ye(a.series,"series");u=Te(t.map((A,b)=>M(A,b)))}let d=Wn(o.type,a,i);if(d.length){let M=Se(s,u,u,u.map(()=>0),"none"),A=je(T=>we(T,u.length,M)),b=u.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:u.map((T,I)=>({label:T,color:A[I]}));return[...c(b),...d.map((T,I)=>({label:T,color:oa(I),shape:"line"}))]}if(u.length<2)return[];let f=o.type==="bar"&&i.layout==="diverging"&&s===void 0?bo(u.length,Array.isArray(i.negative)?i.negative.map(M=>u.indexOf(String(M))):[],typeof i.neutral=="string"?u.indexOf(i.neutral):-1):-1,p=f>=0?new Set([f]):Se(s,u,u,u.map(()=>0),"first");if(o.type==="radar")return c(u.map((M,A)=>({label:M,color:p.has(A)?"accent":"neutralStrong",shape:"square"})));let v=i.colorMode,k=M=>we(M,u.length,p);if((o.type==="line"||o.type==="area")&&(k=M=>ra(M,u.length,p,o.type==="area",v)),o.type==="stream"){let M=$t(t,a.x,a.y,a.series,{xType:i.xType,locale:n,aggregate:i.aggregate,dayFirst:i.dayFirst}),A=$a(M.values,i.reorder),b=Ta(s,M.series,M.values);k=T=>Ma(T,A,b)}let w=je(k);return c(u.map((M,A)=>({label:M,color:w[A],...o.type==="line"&&{shape:"line"}})))}return[]}function Tl(e,t){let n=e.facet;return n&&typeof n=="object"&&typeof n.by=="string"&&lo.includes(t)&&!(t==="bar"&&e.options?.layout==="diverging")?n:void 0}function Ml(e,t,n){let{data:r,width:o,height:a,highlight:i,syncId:s,ariaLabel:l,description:c,...m}=n;return{type:e,data:r??[],by:t.by,columns:t.columns,scale:t.scale,chartProps:m,width:o,height:a,highlight:i,syncId:s,title:l,description:c}}function _a(e,t){let{spec:n}=e,r=Fa(n.type,n.encoding,n.options),o=(0,St.useMemo)(()=>Yo(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=so(n,e.locale),s=de(i),l=q(s),c=zo(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),m=mo(n),u=(0,St.useMemo)(()=>m?Wo(m,s):void 0,[m,s]),d=n.options?.hidden,h=Array.isArray(d)?d.map(String):[],f=h.join(""),[p,v]=(0,St.useState)(null);if(!r)return(0,ze.jsx)(Vn,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let k=o??c.data,w=t[r.type],M={...n.options??{}},A={...vl(r,n.encoding),...M,...u?{tooltip:u}:{},data:k,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.animate!==void 0?{animate:e.animate}:{},...e.replayKey!==void 0?{replayKey:e.replayKey}:{},...e.onHover?{onHover:e.onHover}:{},...e.onClick?{onClick:e.onClick}:{},locale:i},b=n.card?.legend==="toggle"&&uo(r.type,n.encoding??{},M),T=p&&p.base===f?p.hidden:h;b&&(A.hidden=T);let I=F=>v(C=>{let x=C&&C.base===f?C.hidden:h;return{base:f,hidden:x.includes(F)?x.filter(S=>S!==F):[...x,F]}}),E=A.height??220,z=Tl(n,r.type),L=a&&!k.length&&(c.loading||c.error||c.empty)?(0,ze.jsx)(Vn,{loading:c.loading,error:c.error,empty:c.empty,onRetry:c.reload,height:E,locale:i}):z?(0,ze.jsx)(Oo,{chart:w,...Ml(r.type,z,A)}):(0,ze.jsx)(w,{...A});if(n.card){let F=n.card,C=F.legend==="auto"||F.legend==="toggle"?$l(n,k,s,b):F.legend,x=C?.length?b?(0,ze.jsx)(Gn,{items:C,hidden:T,onToggle:I,locale:i}):C:void 0,S=F.download?(0,ze.jsx)(Ko,{data:k,columns:fo(n),filename:F.title??r.type,formats:Array.isArray(F.download)?F.download:void 0,locale:i}):void 0;L=(0,ze.jsx)(no,{number:F.number,title:F.title??io(r,l),subtitle:F.subtitle,legend:x,actions:S,source:F.source||void 0,note:F.note||void 0,accent:F.accent,takeaway:F.takeaway,level:F.level,sample:F.sample,replay:F.replay!==!1,className:e.className,locale:i,children:L})}let _=e.theme??n.theme;return _&&(L=(0,ze.jsx)(Ut,{theme:_,children:L})),L}function Cl({cfg:e,components:t}){let n=ut();return _a({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function La(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,Pa.hydrateRoot)(r,(0,sr.createElement)(Ut,{theme:o.theme,cssVars:!0},(0,sr.createElement)(Cl,{cfg:o,components:{[e]:t}})))}La("bubble",or);})();