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