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