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