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 ta=Object.create;var Gn=Object.defineProperty;var na=Object.getOwnPropertyDescriptor;var ra=Object.getOwnPropertyNames;var oa=Object.getPrototypeOf,aa=Object.prototype.hasOwnProperty;var jt=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(n){throw t=0,n}};var ia=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ra(t))!aa.call(e,o)&&o!==n&&Gn(e,o,{get:()=>t[o],enumerable:!(r=na(t,o))||r.enumerable});return e};var R=(e,t,n)=>(n=e!=null?ta(oa(e)):{},ia(t||!e||!e.__esModule?Gn(n,"default",{value:e,enumerable:!0}):n,e));var J=jt((gs,Un)=>{Un.exports=globalThis.__ztdReact.react});var Yn=jt((ps,qn)=>{qn.exports=globalThis.__ztdReact["react-dom/client"]});var j=jt((Ss,br)=>{br.exports=globalThis.__ztdReact["react/jsx-runtime"]});var Sn=R(J(),1),_o=R(Yn(),1);var rt=R(J(),1);var kt=R(J(),1);var Xn=R(J(),1),ft=(0,Xn.createContext)(void 0);var ua=R(J(),1);var sa=["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"],Jn='"Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, -apple-system, sans-serif',Zn='"Roboto Mono", "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace',ke={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:Jn,monoFamily:Zn,radius:18,radiusCode:14,radiusMark:4},la={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:Jn,monoFamily:Zn,radius:18,radiusCode:14,radiusMark:4},Vt={dark:ke,light:la};function Wt(e){return`--ztd-${e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}`}function Kt(e){let t={};for(let n of sa){let r=e[n];typeof r=="string"&&(t[Wt(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 Gt(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 ca=`
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,${ke.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,${ke.accent});outline-offset:2px}
13
+ .ztd-card{transition:border-color .16s ease}
14
+ .ztd-card:hover{border-color:var(--ztd-dim,${ke.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 Qn=!1;function Je(){if(Qn||typeof document>"u"||(Qn=!0,document.getElementById("ztd-base")))return;let e=document.createElement("style");e.id="ztd-base",e.textContent=ca,document.head.appendChild(e)}var ht=R(J(),1),ge=typeof window<"u"&&typeof document<"u",me=ge?ht.useLayoutEffect:ht.useEffect;function gt(){return typeof performance<"u"?performance.now():Date.now()}function Z(e){return e!==void 0&&/^ko([-_]|$)/i.test(e)?"ko":"en"}function ve(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}var er={chart:"chart",table:e=>`${e} data`,more:e=>`and ${e} more`,value:"Value",empty:"No data."},tr={chart:"차트",table:e=>`${e} 데이터`,more:e=>`외 ${e}개`,value:"값",empty:"데이터가 없어요."};var ma=[{id:"basic",en:"Basic",ko:"기본"},{id:"intermediate",en:"Intermediate",ko:"중급"},{id:"advanced",en:"Advanced",ko:"심화"}],da={basic:{bg:"line2",fg:"ink"},intermediate:{bg:"tint",fg:"accentText"},advanced:{bg:"ink",fg:"onInk"}};function fa(e,t){let n=t.trim().toLowerCase();return e.find(r=>r.id===n||r.en.toLowerCase()===n||r.ko===t.trim())}function ha(e){return fa(ma,e)}function nr(e,t){let n=ha(e);return{text:n?n[t]:e,...da[n?.id??"basic"]}}var le=R(J(),1);var sr=(e,t="")=>n=>Number.isFinite(n)?`${e(n)}${t}`:e(n),de="en-US",rr=new Map;function Ut(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=rr.get(r);return o||(o=new Intl.NumberFormat(e,n),rr.set(r,o)),o}function qt(e){return/^[-\u2212]/.test(e)&&!/[1-9]/.test(e)?e.slice(1):e}function He(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=de,...r}=t;return qt(Ut(n,r).format(e))}var Yt=e=>e!==0&&Math.abs(e)<.05,Xt=(e,t,n="")=>`${He(e,{locale:t,maximumSignificantDigits:2,maximumFractionDigits:20})}${n}`;function ze(e,t={}){if(!Number.isFinite(e))return"-";if(Yt(e)&&t.maximumFractionDigits===void 0)return Xt(e,t.locale??de,"%");let n=Math.abs(e);return`${He(e,{maximumFractionDigits:n>0&&n<1?1:0,...t})}%`}function lr(e,t={}){if(!Number.isFinite(e))return"-";let{locale:n=de,...r}=t;if(Z(n)==="ko"){let o=Math.abs(e),a=[[1e12,"조"],[1e8,"억"],[1e4,"만"],[1,""]],i=a.findIndex(([s])=>o>=s);for(i<0&&(i=a.length-1);;){let[s,l]=a[i],u=o/s,h=Math.max(r.minimumFractionDigits??0,r.maximumFractionDigits??(s===1||u<100?1:0)),m=Math.round(u*10**h)/10**h;if(i>0&&m>=a[i-1][0]/s){i--;continue}return(e<0&&m!==0?"-":"")+He(m,{locale:n,...r,maximumFractionDigits:h})+l}}return qt(Ut(n,{notation:"compact",...r}).format(e))}var ga=(e,t=Z(e)==="ko"?"KRW":"USD")=>({style:"currency",currency:t,maximumFractionDigits:t==="KRW"?0:2});function Ze(e,t=de,n){if(typeof e=="function")return e;let r=(o,a="",i="")=>{let s=Ut(t,o);return l=>Number.isFinite(l)?`${i}${qt(s.format(l))}${a}`:"-"};if(e&&typeof e=="object"){let{suffix:o="",prefix:a="",...i}=e;return r(i,o,a)}switch(e??n){case"integer":return r({maximumFractionDigits:0});case"decimal":return r({minimumFractionDigits:1,maximumFractionDigits:2});case"percent":return o=>ze(o,{locale:t});case"ratio":return o=>ze(o*100,{locale:t});case"compact":return o=>lr(o,{locale:t});case"currency":return r(ga(t));default:{let o=r({maximumFractionDigits:1});return a=>Yt(a)?Xt(a,t):o(a)}}}function Jt(e,t=de,n=0){return e!==void 0?Ze(e,t):n>=1e5?r=>Yt(r)?Xt(r,t):lr(r,{locale:t}):r=>He(r,{locale:t})}function pa(e,t,n=1){let r=new Date(+e,+t-1,+n);return r.getMonth()===+t-1&&r.getDate()===+n?r:null}var ba=e=>Number.isInteger(e)&&e>=1e3&&e<=9999;var ya=["january","february","march","april","may","june","july","august","september","october","november","december"],or=e=>{let t=e.toLowerCase();return t.length<3?0:ya.findIndex(n=>n.startsWith(t))+1},ar=e=>+e+(+e<30?2e3:1900);function ur(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}var xa=[/^(\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})일)?$/],ka=/^(\d{1,2})([./-])(\d{1,2})\2(\d{4})$/,cr=/\{([^{}]+)\}/g;function va(e,t){let n;for(let r of xa)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?[ar(n[3]),+n[2],+n[1],1]:[ar(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=ka.exec(e)){let r=+n[1],o=+n[3],a=r>12||o<=12&&t===!0;return[+n[4],a?o:r,a?r:o,1]}if(n=/^(\d{1,2})[\s-]+([a-z]{3,9})\.?[\s-]+(\d{4})$/i.exec(e)){let r=or(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=or(n[1]);return r?[+n[3],r,+(n[2]??1),n[2]?1:2]:null}return null}function mr(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(ba(e))return new Date(e,0,1);if(e>=19000101&&e<=21001231)return mr(`${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=va(n,t);if(r)return pa(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 ir=new Map;function dr(e,t={month:"short",day:"numeric"}){let n=mr(e);if(!n)return"-";let{locale:r=de,...o}=t,a=r+JSON.stringify(o),i=ir.get(a);return i||(i=new Intl.DateTimeFormat(r,o),ir.set(a,i)),i.format(n)}var fr={white:"#ffffff",black:"#000000",transparent:"#00000000"};function hr(e){if(!e)return null;let t=e.trim(),n=/^var\(\s*--[\w-]+\s*,\s*(.+)\)$/i.exec(t);if(n&&(t=n[1].trim()),fr[t.toLowerCase()]&&(t=fr[t.toLowerCase()]),t.startsWith("#")){let o=t.slice(1);if((o.length===3||o.length===4)&&(o=o.split("").map(i=>i+i).join("")),o.length!==6&&o.length!==8||/[^\da-f]/i.test(o))return null;let a=parseInt(o,16);return o.length===6?[a>>16&255,a>>8&255,a&255,1]:[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16),parseInt(o.slice(6,8),16)/255]}let r=/^rgba?\(([^)]+)\)$/i.exec(t);if(r){let o=r[1].split(/[\s,/]+/).filter(Boolean);if(o.length<3)return null;let a=o.slice(0,3).map(s=>s.endsWith("%")?parseFloat(s)/100*255:parseFloat(s)),i=o[3]!==void 0?o[3].endsWith("%")?parseFloat(o[3])/100:parseFloat(o[3]):1;return a.some(s=>Number.isNaN(s))?null:[a[0],a[1],a[2],Number.isNaN(i)?1:i]}return null}function wa(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 Zt(e){let t=e/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ca(e){return[Zt(e[0]),Zt(e[1]),Zt(e[2])]}function Qt(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 gr(e){let[t,n,r]=Ca(e),o=Math.cbrt(.4122214708*t+.5363325363*n+.0514459929*r),a=Math.cbrt(.2119034982*t+.6806995451*n+.1073969566*r),i=Math.cbrt(.0883024619*t+.2817188376*n+.6299787005*r);return[.2104542553*o+.793617785*a-.0040720468*i,1.9779984951*o-2.428592205*a+.4505937099*i,.0259040371*o+.7827717662*a-.808675766*i]}function $a([e,t,n],r){let o=(e+.3963377774*t+.2158037573*n)**3,a=(e-.1055613458*t-.0638541728*n)**3,i=(e-.0894841775*t-1.291485548*n)**3;return[Qt(4.0767416621*o-3.3077115913*a+.2309699292*i),Qt(-1.2684380046*o+2.6097574011*a-.3413193965*i),Qt(-.0041960863*o-.7034186147*a+1.707614701*i),r]}function pr(e,t,n){let r=hr(e),o=hr(t);if(!r||!o)return e;let a=gr(r),i=gr(o),s=Math.max(0,Math.min(1,n));return wa($a([a[0]*s+i[0]*(1-s),a[1]*s+i[1]*(1-s),a[2]*s+i[2]*(1-s)],r[3]*s+o[3]*(1-s)))}var en=R(j(),1),pt=(0,le.createContext)({theme:ke,cssVars:!0});function Ma(e,t=ke){return e?typeof e=="string"?Vt[e]??t:Gt(t,e):t}function yt(e){let t=(0,le.useContext)(pt),n=e.base?Vt[e.base]:t.theme,r=(0,le.useMemo)(()=>Ma(e.theme,n),[e.theme,n]),o=e.cssVars??t.cssVars,a=e.locale??t.locale,i=(0,le.useMemo)(()=>({theme:r,cssVars:o,locale:a}),[r,o,a]),s=(0,le.useMemo)(()=>Kt(r),[r]),l=e.paint?{background:r.bg,color:r.ink,fontFamily:r.fontFamily,...s,...e.style}:{display:"contents",...s,...e.style};return(0,en.jsx)(pt.Provider,{value:i,children:(0,en.jsx)("div",{className:e.className,"data-ztd-theme":r.name,lang:e.locale,style:l,children:e.children})})}var Ta=new Set(["bg","panel","ink","muted","dim","accent","accentText","onAccent","onInk","line","line2","neutral","neutralStrong","onNeutralStrong","neutralSoft","lift","tint"]);function bt(e){return Ta.has(e)}function Sa(e,t){let n=r=>t?`var(${Wt(r)}, ${e[r]})`:e[r];return{theme:e,cssVars:t,paint:n,color:(r,o="neutral")=>r?bt(r)?n(r):r:n(o),raw:(r,o="neutral")=>r?bt(r)?e[r]:r:e[o],mix:(r,o,a)=>{let i=Math.round(Math.max(0,Math.min(1,a))*1e3)/10;return t?`color-mix(in oklab, ${n(r)} ${i}%, ${n(o)})`:pr(e[r],e[o],a)}}}function pe(e){let t=(0,le.useContext)(pt);return(0,le.useMemo)(()=>{let n=Gt(t.theme,e);return Sa(n,t.cssVars)},[t.theme,t.cssVars,e])}function ue(e){let t=(0,le.useContext)(pt);return e??t.locale??de}function yr(e){return e?Kt(e):{}}var xt=R(J(),1),tn=(0,xt.createContext)(void 0);function xr(e){let t=(0,xt.useContext)(tn);return e!==void 0&&t!==void 0?`${e}:${t}`:e??t}var C=R(j(),1),Aa={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`},Na={en:Aa,ko:{legend:"범례",replay:"애니메이션 다시 재생",replayTitle:"다시 재생",sample:"예시 데이터",loadError:"데이터를 불러오지 못했어요",retry:"다시 시도",loading:"불러오는 중",empty:"표시할 데이터가 없어요",source:"출처",shown:(e,t)=>`${t}개 중 ${e}개 보임`}};var Ra={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},nn=e=>Na[Z(ue(e))];function rn(e){let t=pe(e.theme),n=nn(e.locale),[r,o]=(0,kt.useState)(!1),a=e.size??11.5,i=e.onToggle,s=new Set(i?e.hidden:void 0),l=e.items.filter(h=>!s.has(h.label)).length,u=(0,C.jsx)("ul",{"aria-label":n.legend,style:{display:"flex",flexWrap:"wrap",justifyContent:e.align==="start"?"flex-start":"flex-end",gap:"4px 12px",margin:0,padding:0,listStyle:"none"},children:e.items.map((h,m)=>{let g=!s.has(h.label),y=g&&l===1,d=(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(Fa,{p:t,item:h,off:!g}),(0,C.jsx)("span",{style:g?void 0:{textDecoration:"line-through"},children:h.label})]});return(0,C.jsx)("li",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:a,color:t.paint("muted"),lineHeight:1.3},children:i?(0,C.jsx)("button",{type:"button",className:"ztd-btn","aria-pressed":g,"aria-disabled":y||void 0,onClick:()=>{y||(i(h.label),o(!0))},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,minWidth:24,padding:"0 2px",margin:0,border:0,borderRadius:4,background:"transparent",color:"inherit",fontSize:"inherit",lineHeight:"inherit",cursor:y?"default":void 0},children:d}):d},m)})});return i?(0,C.jsxs)(C.Fragment,{children:[u,(0,C.jsx)("span",{"aria-live":"polite","aria-atomic":"true",style:Ra,children:r?n.shown(l,e.items.length):""})]}):u}function Fa({p:e,item:t,off:n}){let r=t.color?bt(t.color)?e.paint(t.color):t.color:e.paint("neutral"),o=t.shape??"square";return o==="line"||o==="dash"?(0,C.jsxs)("svg",{width:14,height:8,"aria-hidden":"true",style:{flex:"none",opacity:n?.35:void 0},children:[(0,C.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,C.jsx)("circle",{cx:7,cy:4,r:2.2,fill:r}):null]}):(0,C.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 Pa(e){let t=pe(e.theme),n=nr(e.level,Z(ue(e.locale)));return(0,C.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 Da(e,t,n){if(typeof e!="string"||!t)return e;let r=e.indexOf(t);return r<0?e:(0,C.jsxs)(C.Fragment,{children:[e.slice(0,r),(0,C.jsx)("span",{style:{color:n},children:t}),e.slice(r+t.length)]})}function kr(e){let t=pe(e.theme),n=nn(e.locale),[r,o]=(0,kt.useState)(0);me(()=>Je(),[]);let a=()=>{o(g=>g+1),e.onReplay?.()},i=Array.isArray(e.legend)?(0,C.jsx)(rn,{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,h=e.source!==void 0||e.note!==void 0?(0,C.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,C.jsxs)("footer",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,marginTop:2},children:[(0,C.jsx)("span",{style:{fontSize:17,fontWeight:800,color:t.paint("ink"),letterSpacing:-.3,lineHeight:1.3,minWidth:0},children:e.takeaway}),(0,C.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"none"},children:[e.sample?(0,C.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,C.jsx)(Pa,{level:e.level,theme:e.theme,locale:e.locale}):null]})]}):null;return(0,C.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,C.jsxs)("header",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[(0,C.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:10,minWidth:0},children:[l?(0,C.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,C.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:Da(e.title,e.accent,t.paint("accentText"))}),e.actions,u?(0,C.jsx)("button",{type:"button",className:"ztd-btn",onClick:a,"aria-label":e.replayLabel??n.replay,title:e.replayLabel??n.replayTitle,style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,width:28,height:28,display:"inline-grid",placeItems:"center",padding:0,flex:"none"},children:(0,C.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,C.jsx)("path",{d:"M3 12a9 9 0 1 0 3-6.7"}),(0,C.jsx)("path",{d:"M3 3v6h6"})]})}):null]}),e.subtitle!==void 0||i?(0,C.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px 12px",flexWrap:"wrap",minHeight:18},children:[e.subtitle!==void 0?(0,C.jsx)("span",{style:{fontSize:12.5,color:t.paint("muted"),lineHeight:1.4},children:e.subtitle}):(0,C.jsx)("span",{}),i]}):null]}),(0,C.jsx)("div",{style:{flex:1,display:"flex",flexDirection:"column",justifyContent:"center",minHeight:0,minWidth:0},children:(0,C.jsx)(tn.Provider,{value:r,children:(0,C.jsx)(ft.Provider,{value:typeof e.title=="string"||typeof e.title=="number"?String(e.title):void 0,children:e.children})})}),h?(0,C.jsxs)(C.Fragment,{children:[h,m]}):m]})}function on(e){let t=pe(e.theme),n=nn(e.locale),r=e.height??220;if(me(()=>Je(),[]),e.error){let o=typeof e.error=="string"?e.error:e.error.message;return(0,C.jsx)("div",{role:"alert",style:{height:r,display:"grid",placeItems:"center",textAlign:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,C.jsxs)("div",{style:{display:"grid",gap:8,justifyItems:"center",padding:16},children:[(0,C.jsx)("span",{style:{fontSize:14,fontWeight:700,color:t.paint("ink")},children:n.loadError}),(0,C.jsx)("span",{style:{fontSize:12,color:t.paint("muted"),maxWidth:280,wordBreak:"break-word"},children:o}),e.onRetry?(0,C.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,C.jsx)("div",{role:"status","aria-busy":"true","aria-label":n.loading,style:{height:r,display:"flex",alignItems:"flex-end",gap:8,padding:"12px 4px"},children:[.55,.8,.4,.95,.65,.75,.5].map((o,a)=>(0,C.jsx)("span",{className:"ztd-skeleton",style:{flex:1,height:`${o*100}%`,background:t.paint("lift"),borderRadius:6,animationDelay:`${a*90}ms`}},a))}):e.empty?(0,C.jsx)("div",{style:{height:r,display:"grid",placeItems:"center",border:`1px dashed ${t.paint("line2")}`,borderRadius:10},children:(0,C.jsx)("span",{style:{fontSize:13,color:t.paint("muted")},children:e.emptyText??n.empty})}):(0,C.jsx)(C.Fragment,{children:e.children})}function be(e,t,n,r,o="max"){let a=new Set,i=n.length,s=u=>{if(i&&u!=="none"){if(u==="first")a.add(0);else if(u==="last")a.add(i-1);else if(u==="max"||u==="min"){let h=-1,m=u==="max"?-1/0:1/0;r.forEach((g,y)=>{Number.isFinite(g)&&(u==="max"?g>m:g<m)&&(m=g,h=y)}),h>=0&&a.add(h)}}};if(e==null)return s(o),a;if(typeof e=="function")return t.forEach((u,h)=>{h<i&&u!==null&&u!==void 0&&e(u,h)&&a.add(h)}),a;let l=Array.isArray(e)?e:[e];for(let u of l)typeof u=="number"?u>=0&&u<i&&a.add(u):u==="max"||u==="min"||u==="first"||u==="last"||u==="none"?s(u):n.forEach((h,m)=>{h===u&&a.add(m)});return a}function Qe(e,t){let n=new Array(e),r=[];for(let a=0;a<e;a++)t.has(a)?n[a]="accent":r.push(a);let o=r.length;return r.forEach((a,i)=>{o===1?n[a]="neutral":i===0?n[a]="ink":i===o-1?n[a]="neutral":n[a]="neutralStrong"}),n}function vr(e,t){return Qe(e+1,t).slice(0,e)}function et(e,t){return Object.hasOwn(e,t)||t in e&&!(t in{})}function La(e,t){if(e==null||typeof e!="object")return;let n=e;if(et(n,t))return n[t];if(t.includes(".")){let r=n;for(let o of t.split(".")){if(r===null||typeof r!="object"||!et(r,o))return;r=r[o]}return r}}function Re(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 an(e,t){if(typeof e=="function")return e;let n=e??t;return r=>La(r,n)}function Fe(e,t){let n=an(e,t);return(r,o)=>Re(n(r,o))}function Pe(e,t){let n=an(e,t);return(r,o)=>{let a=n(r,o);return a==null?"":a instanceof Date?new Date(a.getTime()-a.getTimezoneOffset()*6e4).toISOString().slice(0,10):String(a)}}function sn(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}var se=R(J(),1);function Ea(e){let t=[],n=!1;for(let l=0;l<e.length&&l<4e3;l++){let u=e[l];if(u==='"')n=!n;else if(!n&&(u===`
23
+ `||u==="\r"))break;t.push(n?"":u)}let r=t.join(""),o=l=>r.split(l).length-1,a=[","," ",";","|"],i=",",s=0;for(let l of a){let u=o(l);u>s&&(s=u,i=l)}return i}var _a=/^[-+(]?[₩$€£¥]?\s?\d[\d,]*(\.\d+)?([eE][-+]?\d+)?\)?\s?(%|원|명|건|개|회)?$/;function wr(e){let t=e.trim();if(t==="")return null;if(/^-?0\d/.test(t))return t;if(_a.test(t)||/^[-+]?\.\d+$/.test(t)){let n=Re(t);if(Number.isFinite(n))return n}return t}function De(e,t={}){let{typed:n=!0,header:r=!0}=t,o=e.replace(/^\uFEFF/,"");if(!o.trim())return[];let a=t.delimiter??Ea(o),i=[],s=[],l="",u=!1;for(let d=0;d<o.length;d++){let f=o[d];u?f==='"'?o[d+1]==='"'?(l+='"',d++):u=!1:l+=f:f==='"'&&!l.trim()?(u=!0,l=""):f===a?(s.push(l),l=""):f===`
24
+ `||f==="\r"?(f==="\r"&&o[d+1]===`
25
+ `&&d++,s.push(l),i.push(s),s=[],l=""):l+=f}(l!==""||s.length)&&(s.push(l),i.push(s));let h=i.filter(d=>!(d.length===1&&d[0].trim()===""));if(!h.length)return[];let m=d=>n?wr(d):d;if(!r)return h.map(d=>Object.fromEntries(d.map((f,x)=>[String(x),m(f)])));let g=[],y=new Set;return h[0].forEach((d,f)=>{let x=d.trim()||`col${f+1}`,b=x;for(let v=2;y.has(b);v++)b=`${x}_${v}`;y.add(b),g.push(b)}),h.slice(1).map(d=>Object.fromEntries(g.map((f,x)=>[f,m(d[x]??"")])))}function ln(e,t,n={}){if(!e.length)return[];let{typed:r=!0}=n,o=(t??e[0]).map((i,s)=>String(i??"").trim()||`col${s+1}`);return(t?e:e.slice(1)).map(i=>Object.fromEntries(o.map((s,l)=>[s,r&&typeof i[l]=="string"?wr(i[l]):i[l]??null])))}function Oa(e,t={}){let{labelKey:n="label",valueKey:r="value"}=t,o=Object.values(e);if(o.length&&o.every(a=>Array.isArray(a))){let a=Object.keys(e),i=Math.max(...o.map(s=>s.length));return Array.from({length:i},(s,l)=>Object.fromEntries(a.map(u=>[u,e[u][l]??null])))}return Object.entries(e).map(([a,i])=>({[n]:a,[r]:i}))}function Cr(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 we(e){if(e==null)return[];if(typeof e=="string"){let t=e.trim();if(!t)return[];if(t.startsWith("[")||t.startsWith("{"))try{return we(JSON.parse(t))}catch{}return De(t)}if(Array.isArray(e))return e.length?Array.isArray(e[0])?ln(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)?we(t.data):Array.isArray(t.rows)&&Array.isArray(t.columns)?ln(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)?we(t.rows):Array.isArray(t.values)?ln(t.values):Array.isArray(t.items)?we(t.items):Array.isArray(t.results)?we(t.results):Oa(t)}return[]}function $r(e){if(!Array.isArray(e))try{return JSON.stringify(e??null)??""}catch{return String(e)}let t=e.length,n=a=>{try{return JSON.stringify(a)}catch{return String(a)}};if(t<=300)return n(e);let r=Math.ceil(t/60),o=[];for(let a=0;a<t;a+=r)o.push(e[a]);return o.push(e[t-1]),`${t}:${n(o)}`}async function Ia(e,t="auto",n="",r){let o=e.headers.get("content-type")??"",a=await e.text();if(t==="text")return a;if(o.includes("text/html")||/^\s*<(!doctype html|html[\s>])/i.test(a))throw new Error(Z(r)==="ko"?`데이터 대신 HTML 페이지를 받았어요. 주소를 확인해 주세요${n?`: ${n}`:"."}`:`Got an HTML page instead of data${n?` (${n})`:""}. Check the URL.`);if(t==="csv")return De(a);if(t==="json"||o.includes("json"))return JSON.parse(a);if(o.includes("csv")||/[./]csv(\?|#|$)|output=csv|format=csv|tqx=out:csv/i.test(n))return De(a);let i=a.trim();return i.startsWith("{")||i.startsWith("[")?JSON.parse(i):De(a)}async function Ba(e,t={}){let n=t.signal??new AbortController().signal,r;if(typeof e=="function")r=await e(n);else{let o=e instanceof Request?e.url:String(e),a=await fetch(e instanceof Request?e.clone():o,{...t.init,signal:n});if(!a.ok)throw new Error(`HTTP ${a.status}${a.statusText?` ${a.statusText}`:""}`);r=await Ia(a,t.parse,o,t.locale)}return t.select&&(r=Cr(r,t.select)),t.transform?t.transform(r):we(r)}function Mr(e,t={}){let{refreshMs:n,enabled:r=!0,keepPrevious:o=!0}=t,[a,i]=(0,se.useState)(()=>({data:[],status:e&&r?"loading":"idle",error:null,updatedAt:null})),[s,l]=(0,se.useState)(0),u=ue(t.locale),h=(0,se.useRef)(t);h.current={...t,locale:u};let m=(0,se.useRef)(e);m.current=e;let g=typeof e=="function"?"fn":e instanceof Request?e.url:e?String(e):"",y=t.deps??[],d=JSON.stringify(y.map(b=>typeof b=="object"?JSON.stringify(b):String(b))),f=(0,se.useRef)(!1);(0,se.useEffect)(()=>{let b=m.current;if(!b||!r){i(M=>M.status==="loading"?{...M,status:"idle"}:M);return}let v=new AbortController,P=!0;return f.current=!0,i(M=>({...M,data:o?M.data:[],status:"loading",error:null})),Ba(b,{...h.current,signal:v.signal}).then(M=>{P&&i({data:M,status:"success",error:null,updatedAt:Date.now()})}).catch(M=>{!P||v.signal.aborted||i(S=>({...S,status:"error",error:M instanceof Error?M:new Error(String(M))}))}).finally(()=>{P&&(f.current=!1)}),()=>{P=!1,f.current=!1,v.abort()}},[g,r,s,d,o]),(0,se.useEffect)(()=>{if(!n||!r)return;let b=setInterval(()=>{f.current||l(v=>v+1)},n);return()=>clearInterval(b)},[n,r]);let x=(0,se.useCallback)(()=>l(b=>b+1),[]);return{data:a.data,status:a.status,loading:a.status==="loading",error:a.error,empty:a.status==="success"&&a.data.length===0,updatedAt:a.updatedAt,reload:x}}var cn=R(j(),1),za=["csv","svg","png"],Ha=/^[=+\-@\t\r\n=+-@]/,ja=/var\(|color-mix\(/;function Tr(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?ur(e.getTime()):String(e);return`"${(Ha.test(t)&&!Number.isFinite(Re(t))?`'${t}`:t).replace(/"/g,'""')}"`}function Va(e){return[...new Set(e.slice(0,200).flatMap(t=>t&&typeof t=="object"?Object.keys(t):[]))]}function Wa(e,t){return`\uFEFF${[t.map(Tr),...e.map(r=>t.map(o=>Tr(r[o])))].map(r=>r.join(",")).join(`\r
26
+ `)}\r
27
+ `}function Ka(e){return Array.from((e??"").replace(/[\\/:*?"<>|\r\n\t]+/g,"-").trim()).slice(0,80).join("")||"chart"}function un(e,t){let n=document.createElement("a");n.href=URL.createObjectURL(e),n.download=t,n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e4)}var Sr=2,Ce=16;function Ar(e,t){if(!/^(ok)?l(ab|ch)\(|^color\(/.test(e))return e;let n=t.get(e);if(n)return n;let r=document.createElement("canvas").getContext("2d");if(!r)return e;r.fillStyle=e,r.fillRect(0,0,1,1);let[o,a,i,s]=r.getImageData(0,0,1,1).data;return n=s===255?`rgb(${o}, ${a}, ${i})`:`rgba(${o}, ${a}, ${i}, ${Math.round(s/255*1e3)/1e3})`,t.set(e,n),n}function Nr(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 Rr(e,t,n){let r=e.closest(".ztd-card"),o=r?.querySelector("svg.ztd-svg");if(!r||!o)return null;let{width:a,height:i}=o.viewBox.baseVal,[s,l]=[a+Ce*2,i+Ce*2],u=o.cloneNode(!0),h=u.querySelectorAll("*"),m=new Map;o.querySelectorAll("*").forEach((d,f)=>{let x;for(let b of Array.from(d.attributes)){if(!ja.test(b.value))continue;let v=(x??(x=getComputedStyle(d))).getPropertyValue(b.name);v&&h[f].setAttribute(b.name,Ar(v,m))}}),u.removeAttribute("style");for(let[d,f]of Object.entries({viewBox:`${-Ce} ${-Ce} ${s} ${l}`,width:s*t,height:l*t,"font-family":getComputedStyle(o).fontFamily}))u.setAttribute(d,String(f));let g=Ar(getComputedStyle(r).backgroundColor,m),y=o.parentElement?.querySelector("canvas")??null;if(n){let d=u.querySelector("desc")?.nextSibling??u.firstChild;u.insertBefore(Nr("rect",{x:-Ce,y:-Ce,width:s,height:l,fill:g}),d),y&&u.insertBefore(Nr("image",{href:y.toDataURL(),width:a,height:i}),d)}return{svg:new XMLSerializer().serializeToString(u),w:s,h:l,vw:a,vh:i,bg:g,canvas:y}}function Ga(e,t){let n=Rr(e,Sr,!1);if(!n)return;let r=Sr,o=document.createElement("canvas");o.width=Math.ceil(n.w*r),o.height=Math.ceil(n.h*r);let a=o.getContext("2d");if(!a)return;a.fillStyle=n.bg,a.fillRect(0,0,o.width,o.height),n.canvas&&a.drawImage(n.canvas,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=()=>{a.drawImage(s,0,0,o.width,o.height),URL.revokeObjectURL(i),o.toBlob(l=>l&&un(l,`${t}.png`),"image/png")},s.onerror=()=>URL.revokeObjectURL(i),s.src=i}function Fr(e){let t=pe(e.theme),n=Z(ue(e.locale))==="ko",r=Ka(e.filename),o=(a,i)=>{if(a==="csv")return un(new Blob([Wa(e.data,e.columns?.length?e.columns:Va(e.data))],{type:"text/csv;charset=utf-8"}),`${r}.csv`);if(a==="png")return Ga(i,r);let s=Rr(i,1,!0);s&&un(new Blob([s.svg],{type:"image/svg+xml"}),`${r}.svg`)};return(0,cn.jsx)("span",{style:{display:"inline-flex",gap:6,flex:"none"},children:za.filter(a=>!e.formats||e.formats.includes(a)).map(a=>{let i=a.toUpperCase(),s=n?`${i} 내려받기`:`Download ${i}`;return(0,cn.jsx)("button",{type:"button",className:"ztd-btn","aria-label":s,title:s,onClick:l=>o(a,l.currentTarget),style:{background:"transparent",color:t.paint("muted"),border:`1px solid ${t.paint("line2")}`,borderRadius:14,height:28,padding:"0 10px",fontSize:12,fontWeight:700,flex:"none"},children:i},a)})})}var Dr=R(j(),1);function Pr(e,t=de){let n=Ze(void 0,t),r=e.split(`
28
+ `),o=(a,i)=>{if(i==="label")return a.label;if(i==="value")return a.formatted??(a.value===null?null:n(a.value));if(i==="series")return a.series??null;let s=a.datum&&typeof a.datum=="object"?a.datum[i]:void 0;return s==null||s===""||typeof s=="number"&&!Number.isFinite(s)?null:typeof s=="number"?n(s):s instanceof Date?dr(s,{locale:t,year:"numeric",month:"short",day:"numeric"}):String(s)};return a=>{let i=[];for(let s of r){let l=!1,u=s.replace(cr,(h,m)=>o(a,m.trim())??(l=!0,""));l||i.push(u)}return i.length?i.map((s,l)=>(0,Dr.jsx)("div",{children:s},l)):null}}var p=(e,t,n,r,o={})=>({name:e,type:t,required:n,description:r,...o}),ce=p("label","string",!0,"Item name field"),ee=p("value","number",!0,"Value field"),Ua=[ce,ee],qa=[ce,ee],Ya=[p("label","string",!0,"Stage name"),p("value","number",!0,"Users at the stage")],Xa=[ce,ee],Ja=[p("label","string",!0,"Leaf (lowest level) name"),ee,p("group","string",!1,"Parent group field")],Za=[p("label","string",!0,"Leaf name"),ee,p("group","string",!1,"Parent group field")],Qa=[ce,p("value","number",!0,"Change (total rows may omit it)"),p("type","string",!1,'"total" makes a total bar')],ei=[ce,ee],ti=[p("x","string",!0,"Column field"),p("series","string",!0,"Stacked series field"),ee],ni=[p("x","string",!0,"Column field"),p("y","string",!0,"Row field"),ee],ri=[p("axis","string",!0,"Metric (axis) field"),p("value","number",!0,"Value field",{multi:!0}),p("series","string",!1,"Series field")],oi=[p("x","number",!0,"x value"),p("y","number",!0,"y value"),p("size","number",!1,"Circle size"),p("label","string",!1,"Name")],Er=p("upper","number",!1,"Upper bound of the range band. Same shape as lower",{multi:!0}),ai=[p("x","any",!0,"x field (date, number or category)"),p("y","number",!0,"y field. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field (long tables)"),p("lower","number",!1,"Lower bound of the range band. In wide tables an array in the order of y",{multi:!0}),Er],ii=[p("x","any",!0,"x field"),p("y","number",!0,"y field. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field"),p("lower","number",!1,'Lower bound of the range band, with stack "none" only. In wide tables an array in the order of y',{multi:!0}),Er],si=[p("x","any",!0,"x field"),p("y","number",!0,"y field",{multi:!0}),p("series","string",!1,"Series field")],li=[p("x","string",!0,"Category field"),p("y","number",!0,"Value field. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field"),p("line","number",!1,"Lines over vertical bars on the same axis, such as a target or last year. An array for several. Bars stay gray unless highlight is set, and with series the line averages rows of the same x",{multi:!0})],ui=[ce,ee],ci=[p("value","number",!0,"Value field",{prop:"valueKey"}),p("target","number",!1,"Target field",{prop:"targetKey"})],mi=[ce,p("value","number",!0,"Actual value field"),p("target","number",!1,"Target field")],di=[p("x","any",!1,"x field"),p("y","number",!0,"y field")],fi=[ce,p("x","string",!1,"Period field (long tables)"),p("value","number",!1,"Value field (long tables)")],hi=[ce,p("start","number",!0,"Before value"),p("end","number",!0,"After value")],gi=[ce,ee],pi=[p("value","number",!0,"Value field"),p("group","string",!1,"Group (row) field"),p("label","string",!1,"Dot name")],bi=[p("group","string",!0,"Group field"),p("value","number",!0,"Value field")],yi=[p("source","string",!0,"Source node"),p("target","string",!0,"Target node"),ee],xi=[p("source","string",!0,"Sending group"),p("target","string",!0,"Receiving group"),ee],ki=[p("date","date",!0,"Date field"),ee],vi=[p("x","any",!0,"Period field"),p("series","string",!0,"Item field"),p("rank","number",!1,"Rank field (1 is first)"),p("value","number",!1,"Value field (instead of rank, largest is first)")],wi=[p("group","string",!0,"Group field"),p("value","number",!0,"Value field")],Ci=[p("label","string",!1,"Row name field")],$i=[p("x","date",!0,"Date (period) field"),p("open","number",!0,"Open price field"),p("high","number",!0,"High price field"),p("low","number",!0,"Low price field"),p("close","number",!0,"Close price field"),p("volume","number",!1,"Volume field")],Mi=[ce,ee],Ti=[p("x","any",!0,"Period field (date or category)"),p("y","number",!0,"Back row fields stacked into each block. An array for wide tables",{multi:!0}),p("series","string",!1,"Series field (long tables, back row only)"),p("front","number",!1,"Front row fields: a smaller outcome in the same unit as y (wide tables only)",{multi:!0})],Si=[p("value","number",!1,"Sample value field (raw rows)"),p("group","string",!1,"Group field. Up to 2 groups overlap"),p("x0","number",!1,"Bin start (pre-binned rows)"),p("x1","number",!1,"Bin end (pre-binned rows)"),p("count","number",!1,"Samples in the bin (pre-binned rows)")],Ai=[p("x","number",!0,"x value"),p("y","number",!0,"y value"),p("series","string",!1,"Series field (one color per series)"),p("label","string",!1,"Name")],Lr={pie:Ua,donut:qa,funnel:Ya,waffle:Xa,treemap:Ja,sunburst:Za,waterfall:Qa,pareto:ei,marimekko:ti,heatmap:ni,radar:ri,bubble:oi,line:ai,area:ii,stream:si,bar:li,radialBar:ui,gauge:ci,bullet:mi,sparkline:di,slope:fi,dumbbell:hi,lollipop:gi,beeswarm:pi,ridgeline:bi,sankey:yi,chord:xi,calendar:ki,bump:vi,box:wi,parallel:Ci,candlestick:$i,segmented:Mi,skyline:Ti,histogram:Si,scatter:Ai},je={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 _r(e,t){return t==="ko"?e.nameKo:e.name}function Or(e,t){let n=t??e.options?.locale;return typeof n=="string"&&n?n.replace(/_/g,"-"):void 0}var mn=["line","area","bar","scatter"];function dn(e,t,n){return e==="bar"&&n.orientation!=="horizontal"&&n.layout!=="percent"?[].concat(t.line??[]).map(String):[]}function Ir(e,t,n){return mn.includes(e)&&!dn(e,t,n).length}function Br(e){let t=e.options?.tooltip?.template;return typeof t=="string"&&t?t:void 0}var Ni={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 vt(e){let t=Lr[e]?e:Ni[e]??Object.keys(je).find(n=>n.toLowerCase()===e.toLowerCase()||je[n].component.toLowerCase()===e.toLowerCase());if(!(!t||!je[t]))return{type:t,component:je[t].component,name:je[t].name,nameKo:je[t].nameKo,encoding:Lr[t]}}function zr(e){let t=new Set,n=a=>{Array.isArray(a)?a.forEach(n):typeof a=="string"&&a&&t.add(a)},r=e.encoding??{};for(let a of vt(e.type)?.encoding.map(i=>i.name)??Object.keys(r))n(r[a]);let o=e.options??{};for(let a of["dimensions","start","end","ranges"])n(o[a]);return[...t]}var Ri=Math.PI*2;function wt(e,t,n){return e<t?t:e>n?n:e}function Hr(e){let t=0;for(let n of e)Number.isFinite(n)&&(t+=n);return t}function k(e){return Math.round(e*100)/100}function Ct(e,t,n,r,o){if(n<0&&(e+=n,n=-n),r<0&&(t+=r,r=-r),n<=.01||r<=.01)return"";let a=typeof o=="number"?{tl:o,tr:o,br:o,bl:o}:o,i=Math.min(n,r)/2,s=wt(a.tl??0,0,i),l=wt(a.tr??0,0,i),u=wt(a.br??0,0,i),h=wt(a.bl??0,0,i);return`M${k(e+s)},${k(t)}H${k(e+n-l)}`+(l?`A${k(l)},${k(l)} 0 0 1 ${k(e+n)},${k(t+l)}`:"")+`V${k(t+r-u)}`+(u?`A${k(u)},${k(u)} 0 0 1 ${k(e+n-u)},${k(t+r)}`:"")+`H${k(e+h)}`+(h?`A${k(h)},${k(h)} 0 0 1 ${k(e)},${k(t+r-h)}`:"")+`V${k(t+s)}`+(s?`A${k(s)},${k(s)} 0 0 1 ${k(e+s)},${k(t)}`:"")+"Z"}function Fi(e,t=!0){let n=e.length;if(!n)return"";let r=l=>`${t?"M":"L"}${k(l[0])},${k(l[1])}`;if(n<3)return r(e[0])+e.slice(1).map(l=>`L${k(l[0])},${k(l[1])}`).join("");let o=[],a=[];for(let l=0;l<n-1;l++){let u=e[l+1][0]-e[l][0];o.push(u),a.push(u===0?0:(e[l+1][1]-e[l][1])/u)}let i=[a[0]];for(let l=1;l<n-1;l++)if(a[l-1]*a[l]<=0)i.push(0);else{let u=2*o[l]+o[l-1],h=o[l]+2*o[l-1];i.push((u+h)/(u/a[l-1]+h/a[l]))}i.push(a[n-2]);let s=r(e[0]);for(let l=0;l<n-1;l++){let u=o[l]/3;s+=`C${k(e[l][0]+u)},${k(e[l][1]+i[l]*u)} ${k(e[l+1][0]-u)},${k(e[l+1][1]-i[l+1]*u)} ${k(e[l+1][0])},${k(e[l+1][1])}`}return s}function jr(e,t="smooth"){if(!e.length)return"";if(t==="smooth")return Fi(e);if(t==="step"){let n=`M${k(e[0][0])},${k(e[0][1])}`;for(let r=1;r<e.length;r++){let o=(e[r-1][0]+e[r][0])/2;n+=`H${k(o)}V${k(e[r][1])}H${k(e[r][0])}`}return n}return Pi(e)}function Pi(e){if(!e.length)return"";let t=`M${k(e[0][0])},${k(e[0][1])}`;for(let n=1;n<e.length;n++)t+=`L${k(e[n][0])},${k(e[n][1])}`;return t}function Le(e,t){if(!e.length)return NaN;let n=(e.length-1)*t,r=Math.floor(n),o=n-r;return e[r+1]!==void 0?e[r]+o*(e[r+1]-e[r]):e[r]}var Di=e=>new Float64Array(e.map(Re).filter(Number.isFinite)).sort(),Li=(e,t)=>t>=0&&t<=100?Le(e,t/100):NaN;function Vr(e,t){return Li(Di(e),t)}function fn(e){let t=/^p(\d+(?:\.\d+)?)$/.exec(e),n=t?Number(t[1]):NaN;return n>=0&&n<=100?n:NaN}function Ur(e,t,n){let r=e.filter(d=>Number.isFinite(d)),o=r.length;if(!o)return t.map(()=>0);let a=r.reduce((d,f)=>d+f,0)/o,i=t.length>1?Math.abs(t[t.length-1]-t[0]):0,s=i>0?i/40:Math.abs(a)*.05||1,l=Math.sqrt(r.reduce((d,f)=>d+(f-a)**2,0)/o)||s,u=[...r].sort((d,f)=>d-f),h=Le(u,.75)-Le(u,.25),m=Math.min(l,h>0?h/1.34:l)||l,g=n??Math.max(1e-9,.9*m*Math.pow(o,-.2)),y=1/(Math.sqrt(2*Math.PI)*g*o);if(o>2e3){let f=u[0],b=(u[o-1]-f)/512||1,v=new Array(513).fill(0);for(let P of r)v[Math.min(512,Math.floor((P-f)/b))]++;return t.map(P=>{let M=0;for(let S=0;S<=512;S++){if(!v[S])continue;let B=(P-(f+S*b))/g;B>6||B<-6||(M+=v[S]*Math.exp(-.5*B*B))}return M*y})}return t.map(d=>{let f=0;for(let x of r){let b=(d-x)/g;b>6||b<-6||(f+=Math.exp(-.5*b*b))}return f*y})}var gn=2;function qr(e,t,n){return n!==void 0?!0:t!==void 0||!e?!1:["x0","x1","count"].every(r=>et(e,r))&&!et(e,"value")}var Ei=50,_i=200,Oi=[1,2,2.5,5,10],$t=[[1],[1,3],[1,2,5],[1,1.6,2.5,4,6.3],[1,1.25,1.6,2,2.5,3.15,4,5,6.3,8]],$e=e=>Number(e.toPrecision(12));function hn(e,t=!1){let n=10**Math.floor(Math.log10(e)),r=Oi.map(o=>$e(o*n));return t?r.find(o=>o>=e*(1-1e-9))??$e(10*n):r.reduce((o,a)=>Math.abs(Math.log(a/e))<Math.abs(Math.log(o/e))?a:o)}function Wr(e,t,n){let r=Math.floor(e/n+1e-9)*n,o=Math.max(1,Math.ceil((t-r)/n-1e-9)),a=Array.from({length:o+1},(i,s)=>$e(r+s*n));return a[0]>e&&a.unshift($e(a[0]-n)),a[a.length-1]<t&&a.push($e(a[a.length-1]+n)),a}function pn(e,t,n,r=0){let o=[];for(let a=Math.floor(Math.log10(e))-r;a<=Math.ceil(Math.log10(t))+r;a++)for(let i of n)o.push($e(i*10**a));return o}function Kr(e,t,n){let r=pn(e,t,n,1),o=r.length-1;for(;o>0&&r[o]>e*(1+1e-9);)o--;let a=o+1;for(;a<r.length-1&&r[a]<t*(1-1e-9);)a++;return r.slice(o,a+1)}function Gr(e){let t=e.length,n=Le(e,.75)-Le(e,.25);return t>=30&&n>0?2*n/Math.cbrt(t):(e[t-1]-e[0])/(Math.ceil(Math.log2(t))+1)}function Ii(e,t){let n=[...new Set(e.filter(r=>Number.isFinite(r)&&(!t||r>0)))].sort((r,o)=>r-o);return n.length>=2?n:null}function Yr(e,t={}){let n=t.log===!0,r=t.edges?Ii(t.edges,n):null;if(r)return r;let o=Float64Array.from(e.filter(g=>Number.isFinite(g)&&(!n||g>0))).sort();if(!o.length)return[];let a=o[0],i=o[o.length-1],s=t.binWidth!==void 0&&t.binWidth>0&&!n?t.binWidth:void 0;if(a===i){if(n)return[$e(a/2),$e(a*2)];let g=s??1;return[a-g/2,a+g/2]}let l=t.bins!==void 0&&t.bins>=1?Math.round(t.bins):void 0,u=s!==void 0||l!==void 0?_i:Ei;if(n){let g=l!==void 0?Math.log10(i/a)/l:Gr(o.map(Math.log10)),y=x=>Math.abs(Math.log(1/x.length/g)),d=$t.reduce((x,b,v)=>y(b)<y($t[x])?v:x,0),f=Kr(a,i,$t[d]);for(;f.length-1>u&&d>0;)f=Kr(a,i,$t[--d]);return f}let h=s??hn(l!==void 0?(i-a)/l:Gr(o));(i-a)/h>u&&(h=hn((i-a)/u,!0));let m=Wr(a,i,h);for(;m.length-1>u;)m=Wr(a,i,h=hn(h*1.01,!0));return m}function bn(e,t){let n=e.length-1;if(n<1||!(t>=e[0]&&t<=e[n]))return-1;let r=0,o=n;for(;o-r>1;){let a=r+o>>1;e[a]<=t?r=a:o=a}return r}function Xr(e,t){let n=new Array(Math.max(0,t.length-1)).fill(0),r=0;for(let o of e){if(!Number.isFinite(o))continue;let a=bn(t,o);a<0?r++:n[a]++}return{counts:n,outside:r}}function Jr(e,t){let n=Math.max(1,Math.floor(t));if(!(e>n))return 1;if(!Number.isFinite(e))return 1/0;for(let r=10**Math.max(0,Math.floor(Math.log10(e/n))-1);;r*=10)for(let o of[1,2,5])if(Math.ceil(e/(o*r))<=n)return o*r}function Zr(e){if(Array.isArray(e))return e;if(e&&typeof e=="object"){let t=e;if(Array.isArray(t.values))return t.values;if(typeof t.csv=="string")return De(t.csv)}return null}var oe=R(J(),1);var O=R(j(),1),Mt=60;var Qr={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function eo(e){let{c:t,events:n}=e,r=(0,oe.useId)().replace(/:/g,""),o=`${r}t`,a=`${r}d`;t.events.current=n,me(()=>{Je()},[]);let i=n.length,s=!e.noNav&&i>0,l=(0,oe.useContext)(ft),u=e.ariaLabel??l??e.kind,h=(0,oe.useMemo)(()=>s?`${n.length}${n.slice(0,Mt).map(T=>`${T.label}${T.series??""}${T.formatted??T.value??""}`).join("")}`:"",[n,s]),m=(0,oe.useMemo)(()=>(0,O.jsx)(Bi,{label:u,events:n,t:t.t}),[u,h,t.t]),g=(0,oe.useRef)(null);(0,oe.useEffect)(()=>{let T=()=>{g.current=null};return window.addEventListener("scroll",T,{capture:!0,passive:!0}),window.addEventListener("resize",T,{passive:!0}),()=>{window.removeEventListener("scroll",T,{capture:!0}),window.removeEventListener("resize",T)}},[]),(0,oe.useEffect)(()=>{g.current=null},[t.width,t.height]);let y=T=>{if(T.target!==T.currentTarget)return;if(e.onKey?.(T)){T.preventDefault();return}let K=t.active,z;switch(T.key){case"ArrowRight":case"ArrowDown":z=K===null?0:(K+1)%i;break;case"ArrowLeft":case"ArrowUp":z=K===null?i-1:(K-1+i)%i;break;case"Home":z=0;break;case"End":z=i-1;break;case"Escape":if(K===null)return;z=null;break;case"Enter":case" ":K!==null&&(T.preventDefault(),t.click(K));return;default:return}T.preventDefault(),t.setActive(z,"keyboard")},{via:d,node:f,setActive:x}=t;(0,oe.useEffect)(()=>{if(d!=="touch"||!f)return;let T=K=>{f.contains(K.target)||x(null)};return document.addEventListener("pointerdown",T),()=>document.removeEventListener("pointerdown",T)},[d,f,x]);let b=t.active!==null?n[t.active]:null,v=t.showTooltip&&e.renderTip!==!1&&!t.pending&&t.via!=="sync"?e.tip:null,P=v&&!t.responsive&&t.node&&t.width&&t.node.getBoundingClientRect().width/t.width||1,M=typeof e.renderTip=="function"&&b?e.renderTip(b):null,S=e.announce??(t.via==="keyboard"&&b?`${b.label}${b.series?` ${b.series}`:""}: ${b.formatted??b.value??""} (${(t.active??0)+1}/${i})`:""),B;if(v){let T=v.x*P,K=t.width*P,z=`clamp(${(4-T).toFixed(1)}px, -50%, calc(${(K-T-4).toFixed(1)}px - 100%))`,ne=v.y<64;B={position:"absolute",left:T,top:v.y*P,transform:`translate(${z}, ${ne?"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*P-8)}}let Q=T=>{g.current=null,T.pointerType!=="touch"&&t.via!=="keyboard"&&t.setActive(null)},te=T=>T?K=>{let z=g.current??(g.current=K.currentTarget.getBoundingClientRect());z.width&&T((K.clientX-z.left)/z.width*t.width,(K.clientY-z.top)/z.height*t.height,K)}:void 0,D=te(e.onPointerMove),L=te(e.onPointerDown),w=D||L?T=>{T.pointerType==="touch"&&D?.(T),L?.(T)}:void 0,F=te(e.onPointerUp),_=yr(e.theme);return(0,O.jsxs)("div",{ref:t.ref,className:`ztd-root${t.reduced?" ztd-still":""}${e.className?` ${e.className}`:""}`,role:"group","aria-roledescription":t.t.chart,"aria-label":u,"aria-describedby":a,tabIndex:s?0:void 0,onKeyDown:s?y:void 0,onBlur:T=>{t.via==="keyboard"&&!T.currentTarget.contains(T.relatedTarget)&&t.setActive(null)},onPointerLeave:Q,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"),..._,...e.style},children:[t.pending?null:e.underlay,(0,O.jsxs)("svg",{className:"ztd-svg",role:"img","aria-labelledby":`${o} ${a}`,viewBox:`0 0 ${Math.max(1,Math.round(t.width*10)/10)} ${Math.max(1,Math.round(t.height*10)/10)}`,width:"100%",preserveAspectRatio:"xMidYMid meet",onPointerMove:D,onPointerDown:w,onPointerUp:F,onPointerCancel:F,style:{fontFamily:"inherit",touchAction:"pan-y",position:e.underlay?"relative":void 0},children:[(0,O.jsx)("title",{id:o,children:u}),(0,O.jsx)("desc",{id:a,children:i||t.description!==void 0?e.description:e.emptyText??t.t.empty}),e.defs&&!t.pending?(0,O.jsx)("defs",{children:e.defs}):null,t.pending?null:e.children]}),t.pending?null:e.overlay,v?(0,O.jsx)("div",{className:"ztd-tip","aria-hidden":"true",style:B,children:M??(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("div",{style:{fontWeight:600,fontSize:11.5,color:t.p.paint("muted"),marginBottom:v.rows.length?4:0,overflow:"hidden",textOverflow:"ellipsis"},children:v.title}),v.rows.map((T,K)=>(0,O.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:16,justifyContent:"space-between"},children:[(0,O.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:7,color:t.p.paint(T.strong?"ink":"muted")},children:[T.color?(0,O.jsx)("span",{style:{width:8,height:8,borderRadius:999,background:T.color,display:"inline-block",boxShadow:"inset 0 0 0 1px rgba(127,127,127,0.3)"}}):null,T.label]}),(0,O.jsx)("span",{style:{fontWeight:T.strong===!1?500:700},children:T.value})]},K))]})}):null,(0,O.jsx)("span",{className:"ztd-sr",style:Qr,"aria-live":"polite","aria-atomic":"true",children:S}),s&&!t.pending?m:null]})}function Bi({label:e,events:t,t:n}){return(0,O.jsx)("div",{className:"ztd-sr",style:Qr,children:(0,O.jsxs)("table",{children:[(0,O.jsx)("caption",{children:n.table(e)}),(0,O.jsxs)("tbody",{children:[t.slice(0,Mt).map((r,o)=>(0,O.jsxs)("tr",{children:[(0,O.jsx)("th",{scope:"row",children:r.series?`${r.label} · ${r.series}`:r.label}),(0,O.jsx)("td",{children:r.formatted??r.value??""})]},o)),t.length>Mt?(0,O.jsx)("tr",{children:(0,O.jsx)("td",{colSpan:2,children:n.more(t.length-Mt)})}):null]})]})})}function Me(e){let t=e.baseline??"central";return(0,O.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 to(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 Tt=new Map;function Te(e,t,n=400){let r=String(e),o=`${r}|${n>=600?1:0}`,a=Tt.get(o);if(a===void 0){let i=0,s=0;for(let l=0;l<r.length;l++){let u=r.charCodeAt(l);no(u)?i+=to(u):s+=to(u)}a=i+s*(n>=600?1.07:1),Tt.size>5e3&&Tt.clear(),Tt.set(o,a)}return a*t}function yn(e,t,n,r=400){if(e=e.trim(),Te(e,n,r)<=t)return e;let o="…",a=0,i=e.length;for(;a<i;){let l=a+i+1>>1;Te(e.slice(0,l)+o,n,r)<=t?a=l:i=l-1}a>0&&(e.charCodeAt(a-1)&64512)===55296&&a--;let s=e.slice(0,a).trimEnd();return s.length<(no(s.charCodeAt(0))?2:3)?"":s+o}var Ve=R(j(),1),tt=10.5;function ro(e,t,n){let r=e.map(t);if(new Set(r).size===r.length)return r;let o=1/0;for(let i=1;i<e.length;i++)o=Math.min(o,Math.abs(e[i]-e[i-1]));let a=o>0&&Number.isFinite(o)?Math.min(20,Math.max(2,Math.ceil(-Math.log10(o)-1e-9))):2;return e.map(i=>He(i,{locale:n,maximumFractionDigits:a}))}function oo(e,t,n){let r=18;for(let o of ro(e,t,n))r=Math.max(r,Te(o,tt));return Math.ceil(r+8)}function ao(e){let{p:t,ticks:n,y:r,x0:o,x1:a,fmt:i}=e,s=e.side==="right",l=e.labels===!1?null:ro(n,i,e.locale);return(0,Ve.jsx)("g",{"aria-hidden":"true",opacity:e.opacity,children:n.map((u,h)=>{let m=Math.round(r(u))+.5,g=u===0&&e.zero!==!1;return(0,Ve.jsxs)("g",{children:[(0,Ve.jsx)("line",{x1:o,x2:a,y1:m,y2:m,stroke:t.paint(g?"dim":"line"),strokeWidth:1,shapeRendering:"crispEdges",opacity:g?.7:1}),l?(0,Ve.jsx)(Me,{x:s?a+6:o-6,y:m,anchor:s?"start":"end",size:tt,fill:t.paint("muted"),children:l[h]}):null]},u)})})}function io(e,t,n){let r=[],o=-1/0;for(let a of e){let i=Te(a.label,tt),s=Math.max(a.x-i/2,0);s<o+8||a.x-i/2<t||a.x+i/2>n||(r.push(a),o=s+i)}return r}function xn(e,t){if(!(e>0)||!Number.isFinite(e))return 1;let n=e/Math.max(1,t),r=Math.pow(10,Math.floor(Math.log10(n))),o=n/r;return(o>=7.071?10:o>=3.162?5:o>=1.414?2:1)*r}function so(e,t,n=4,r={}){let o=e,a=t;if(!Number.isFinite(o)||!Number.isFinite(a))return[0,1];if(r.zero!==!1&&(o>0&&(o=0),a<0&&(a=0)),o===a)return o===0?[0,1]:o>0?[0,o*1.2]:[o*1.2,0];let i=a-o,s=r.pad??.07,l=xn(i,n),u=[o,a];for(let h=0;h<4;h++){let m=Math.ceil(a/l-1e-9)*l,g=Math.floor(o/l+1e-9)*l;u=[o===0?0:o-g<=l*.3?g:o-i*s,a===0?0:m-a<=l*.3?m:a+i*s];let y=xn(u[1]-u[0],n);if(y===l)break;l=y}return u}function kn(e,t,n=4){let r=Math.min(e,t),o=Math.max(e,t),a=xn(o-r,n),i=[],s=Math.ceil(r/a-1e-9)*a;for(let l=s,u=0;l<=o+a*1e-9&&u<200;l+=a,u++)i.push(Number((Math.round(l/a)*a).toPrecision(12)));return i}function St(e,t){let[n,r]=e,[o,a]=t,i=r===n?0:(a-o)/(r-n),s=(l=>o+(l-n)*i);return s.domain=e,s.range=t,s.invert=l=>i===0?n:n+(l-o)/i,s.ticks=(l=4)=>kn(n,r,l),s}function lo(e){let t=1/0,n=-1/0;for(let r of e)Number.isFinite(r)&&(r<t&&(t=r),r>n&&(n=r));return t===1/0?[0,1]:[t,n]}var q=R(J(),1);var ae=R(J(),1);function zi(e){return[...new Set([0,.01,.02,.05,.1,.15,.2,e].filter(t=>t<=e))].sort((t,n)=>t-n)}function Hi(e,t){let n=e.rootBounds?.height??window.innerHeight;return e.isIntersecting&&(e.intersectionRatio>=t||e.intersectionRect.height>=n*.5)}function mo(e,t=!0){let[n,r]=(0,ae.useState)({visible:!t,near:!t});return(0,ae.useEffect)(()=>{if(!t){r({visible:!0,near:!0});return}if(!e)return;if(typeof IntersectionObserver>"u"){r({visible:!0,near:!0});return}let o=new IntersectionObserver(i=>{let s=Hi(i[i.length-1],.25);r(l=>l.visible===s?l:{...l,visible:s,near:l.near||s})},{threshold:zi(.25),rootMargin:"0px 0px -8% 0px"}),a=new IntersectionObserver(i=>{let s=i[i.length-1];r(l=>l.near===s.isIntersecting?l:{...l,near:s.isIntersecting})},{threshold:0,rootMargin:"240px 0px 240px 0px"});return o.observe(e),a.observe(e),()=>{o.disconnect(),a.disconnect()}},[e,t]),n}function uo(e){let t=e.getBoundingClientRect().width;return t>0?Math.round(t*10)/10:0}function fo(e){let[t,n]=(0,ae.useState)(null),[r,o]=(0,ae.useState)(e??null),a=(0,ae.useCallback)(i=>{n(i),i&&e===void 0&&o(uo(i))},[e]);return me(()=>{if(e!==void 0){o(e);return}if(!t)return;let i=u=>o(h=>h!==null&&Math.abs(h-u)<.5?h:u),s=()=>i(uo(t));if(typeof ResizeObserver>"u")return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s);let l=new ResizeObserver(u=>{let h=u[u.length-1]?.contentRect;h?i(h.width>0?Math.round(h.width*10)/10:0):s()});return l.observe(t),()=>l.disconnect()},[t,e]),[t,a,r]}var ji=()=>()=>{};function At(){return(0,ae.useSyncExternalStore)(ji,()=>!0,()=>!1)}var co="(prefers-reduced-motion: reduce)";function ho(e="auto"){let[t,n]=(0,ae.useState)(()=>ge&&typeof window.matchMedia=="function"?window.matchMedia(co).matches:!1);return(0,ae.useEffect)(()=>{if(e!=="auto"||!ge||typeof window.matchMedia!="function")return;let r=window.matchMedia(co),o=()=>n(r.matches);return o(),r.addEventListener?.("change",o),()=>r.removeEventListener?.("change",o)},[e]),e===!0?!0:e===!1?!1:t}function go(e,t){let n=pe(e.theme),[r,o,a]=fo(e.width),i=At(),s=e.width??(a||t.ssrWidth||480),l=typeof t.height=="function"?t.height(s):t.height,u=e.height??l,h=ho(e.reducedMotion??"auto"),m=e.animate!==!1&&!h&&ge,g=mo(r,e.animateOnView!==!1&&m),y=ue(e.locale),d=Z(y),f=(0,q.useMemo)(()=>Ze(e.format,y,t.format),[e.format,y,t.format]),x=(0,q.useCallback)(Y=>ze(Y,{locale:y}),[y]),b=(0,q.useMemo)(()=>sr(f,e.unit),[f,e.unit]),v=(0,q.useMemo)(()=>$r(e.data),[e.data]),[P,M]=(0,q.useState)(null),[S,B]=(0,q.useState)(null),Q=(0,q.useRef)([]),te=(0,q.useRef)(e.onHover);te.current=e.onHover;let D=(0,q.useRef)(e.onClick);D.current=e.onClick;let L=(0,q.useRef)(null),w=(0,q.useRef)(null),F=(0,q.useRef)(null),_=(0,q.useCallback)((Y,re="pointer")=>{if(F.current!==Y){F.current=Y;let at=Y===null?null:Q.current[Y]??null;queueMicrotask(()=>te.current?.(at)),w.current?.(Y)}L.current=Y===null?null:re,M(Y),B(L.current)},[]),T=(0,q.useCallback)(Y=>{L.current!=="keyboard"&&(L.current=Y===null?null:"sync",M(Y),B(L.current))},[]),K=(0,q.useCallback)(Y=>{let re=Q.current[Y];re&&D.current?.(re)},[]),z=xr(e.replayKey),ne=e.width!==void 0||(a??0)>0,ot={enabled:m,active:g.visible&&ne,near:g.near,replayKey:z,dataKey:v,easing:e.easing??"spring",duration:e.duration??t.duration??900,stagger:e.stagger??t.stagger??0},Ke=(0,q.useCallback)((Y,re=1)=>P===null||P===Y?re:re*.38,[P]);return{p:n,width:s,height:u,measured:ne,responsive:e.width===void 0,pending:ge&&i&&e.width===void 0&&a===null,node:r,hydrated:i,ref:o,motion:ot,fv:b,fmt:f,pct:x,locale:y,lang:d,t:d==="ko"?tr:er,active:P,via:S,setActive:_,click:K,events:Q,showTooltip:e.tooltip!==!1,showLabels:e.showLabels!==!1,dim:Ke,sig:v,description:e.description,reduced:h,publish:w,applySync:T}}var U=R(J(),1);function Vi(e){return 1-Math.pow(1-e,3)}function Wi(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Ki(e){return e==="easeInOut"?Wi:e==="linear"?t=>t:Vi}function Gi(e,t){return e==="linear"?1:e==="easeInOut"?t<.5?12*t*t:3*Math.pow(-2*t+2,2):3*Math.pow(1-t,2)}function We(e,t){if(e.length===t)return e.slice();if(!e.length)return new Array(t).fill(0);if(e.length===1||t===1)return new Array(t).fill(e[0]);let n=new Array(t);for(let r=0;r<t;r++){let o=r/(t-1)*(e.length-1),a=Math.floor(o),i=Math.min(e.length-1,a+1);n[r]=e[a]+(e[i]-e[a])*(o-a)}return n}function 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 po(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 bo(e,t,n,r){if(!t||!n||t.length!==n.length)return We(e,r);let o=[],a=0;for(let i=0;i<n.length;i++){let s=e.slice(a,a+t[i]);a+=t[i];for(let l of We(s,n[i]))o.push(l)}return o.length===r?o:We(e,r)}var 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 a=t.from??t.to,i=t.enter??a;return{key:t.key,data:t.data,from:n.slice(),vel:new Array(t.to.length).fill(0),to:t.to.slice(),appear:a.slice(),enter:i.slice(),exit:(t.exit??i).slice(),delay:o,t0:r,cur:n.slice(),curVel:new Array(t.to.length).fill(0),done:!1,exiting:!1,order:this.seq++,progress:0,parts:t.parts}}snap(t){let n=new Map;for(let r of t){let o=this.tracks.get(r.key),a=this.make(r,r.to,0,0);o&&(a.order=o.order),a.done=!0,a.progress=1,n.set(r.key,a)}this.tracks=n,this.animating=!1,this.entranceStart=-1}hold(t){let n=new Map,r=0;for(let o of t){let a=this.tracks.get(o.key),i=this.make(o,o.from??o.to,1/0,o.delay??0);a&&(i.order=a.order),r=Math.max(r,o.delay??0),n.set(o.key,i)}this.maxDelay=r,this.tracks=n,this.animating=!1,this.entranceStart=-1}start(t){for(let n of this.tracks.values())n.t0=t+n.delay,n.from=n.appear.slice(),n.vel.fill(0),po(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,a=0;for(let i of t){o.add(i.key);let s=this.tracks.get(i.key),l=r>0?Math.min(a*r,240):0;if(s){let u=i.to.length;s.from=bo(s.cur,s.parts,i.parts,u),s.vel=bo(s.curVel,s.parts,i.parts,u),s.parts=i.parts,s.to=i.to.slice(),po(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=Nt(s.from,s.to)&&s.vel.every(h=>Math.abs(h)<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=Nt(u.from,u.to),this.tracks.set(i.key,u)}a++}for(let i of this.tracks.values())o.has(i.key)||i.exiting||(i.from=i.cur.slice(),i.vel=i.curVel.slice(),i.to=We(i.exit,i.cur.length),i.t0=n,i.exiting=!0,i.done=!1,i.progress=0);this.animating=!0}step(t){if(!this.animating)return!1;let n=!1,r=Ki(this.easing),o=this.duration/1e3,a=this.omega,i=[];for(let s of this.tracks.values()){if(s.done)continue;let l=(t-s.t0)/1e3,u=s.to.length;if(s.from.length!==u&&(s.from=We(s.from,u)),s.vel.length!==u&&(s.vel=We(s.vel,u)),s.cur.length!==u&&(s.cur=new Array(u).fill(0),s.curVel=new Array(u).fill(0)),!(l>0)){for(let m=0;m<u;m++)s.cur[m]=s.from[m],s.curVel[m]=0;s.progress=0,n=!0;continue}let h;if(this.easing==="spring"){let m=Math.exp(-a*l),g=a*l>=8&&a*l<20,y=0;for(let d=0;d<u;d++){let f=s.from[d]-s.to[d],x=s.vel[d]+a*f;s.cur[d]=s.to[d]+(f+x*l)*m,s.curVel[d]=(s.vel[d]-a*x*l)*m,g&&y<.15&&(y=Math.max(y,Math.abs(s.cur[d]-s.to[d]),Math.abs(s.curVel[d]/a)))}h=a*l>=20||g&&y<.15,s.progress=Math.min(1,1-(1+a*l)*m)}else{let m=Math.min(1,l/o),g=r(m),y=Gi(this.easing,m)/o;for(let d=0;d<u;d++)s.cur[d]=s.from[d]+(s.to[d]-s.from[d])*g,s.curVel[d]=(s.to[d]-s.from[d])*y;h=m>=1,s.progress=g}if(h){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}},nt=new Set,Ft=0;function yo(e){Ft=0;let t=Array.from(nt);for(let n of t){let r;try{r=n(e)}catch{r=!1}r||nt.delete(n)}nt.size&&typeof requestAnimationFrame<"u"&&(Ft=requestAnimationFrame(yo))}function xo(e){return nt.add(e),!Ft&&typeof requestAnimationFrame<"u"&&(Ft=requestAnimationFrame(yo)),()=>{nt.delete(e)}}function Ui(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 ko(e,t){let n=(0,U.useMemo)(()=>Ui(e),[e]),{enabled:r,active:o,near:a=!0,replayKey:i,dataKey:s,easing:l="spring",duration:u=900,stagger:h=0}=t,m=(0,U.useRef)(null),g=(0,U.useRef)("init"),y=(0,U.useRef)(null),d=(0,U.useRef)(s),f=(0,U.useRef)(i),x=(0,U.useRef)(!1),b=(0,U.useRef)(0),[,v]=(0,U.useState)(0),P=(0,U.useRef)(null),M=(0,U.useRef)(!0);m.current||(m.current=new Rt,m.current.configure(l,u),m.current.snap(n),y.current=n);let S=m.current;if(S.configure(l,u),y.current!==n){let w=g.current,F=!Object.is(d.current,s);S.sameTargets(n)?S.refreshData(n):!r||w==="init"?S.snap(n):w==="idle"?S.hold(n):w==="running"||F?S.update(n,gt(),h):S.snap(n),y.current=n,d.current=s}let B=(0,U.useRef)(()=>!1);B.current=w=>{if(!M.current)return!1;let F=S.step(w);return!F&&g.current==="running"&&(g.current="done"),v(_=>(_+1)%1e9),F||(P.current=null),F};let Q=(0,U.useCallback)(()=>{if(!ge||P.current||!S.animating)return;let w=F=>B.current(F);P.current=xo(w)},[S]);me(()=>{let w=!Object.is(f.current,i);if(f.current=i,!r){(g.current!=="done"||S.animating)&&(S.snap(y.current??n),g.current="done",v(F=>F+1));return}g.current==="init"||w&&a?(S.hold(y.current??n),g.current="idle",x.current=!1,v(F=>F+1)):w&&(x.current=!0)},[r,i]),me(()=>{!r||!a||!x.current||(x.current=!1,S.hold(y.current??n),g.current="idle",v(w=>w+1))},[a,r]),(0,U.useEffect)(()=>{r&&o&&g.current==="idle"&&(S.start(gt()),b.current+=1,g.current="running",Q(),v(w=>w+1))},[r,o,i,S,Q]),(0,U.useEffect)(()=>{S.animating&&Q()}),(0,U.useEffect)(()=>(M.current=!0,()=>{M.current=!1,P.current?.(),P.current=null}),[]);let te=gt(),D=S.elapsed(te),L=r&&g.current==="idle";return{items:S.items(),get:w=>S.get(w),elapsed:L?0:D,fade:(w,F=320)=>L?0:Number.isFinite(D)?Math.max(0,Math.min(1,(D-w)/F)):1,waiting:L,animating:S.animating,generation:b.current}}var qi=R(J(),1);var wo=R(j(),1);var vo=e=>e?"neutralStrong":"accent";var vn=R(j(),1);function Co(e,t,n,r){if(typeof e!="function")return be(e,n,n,n.map(()=>0),"first");let o=new Map(n.map((i,s)=>[i,s])),a=new Set;return t.forEach((i,s)=>{let l=o.get(r(i,s));l!==void 0&&e(i,s)&&a.add(l)}),a}var Yi=R(J(),1);var Cn=R(j(),1),Xi={name:"Candlestick chart",open:"Open",high:"High",low:"Low",close:"Close",change:"Change",volume:"Volume",empty:"No data.",ohlc:(e,t,n,r)=>`open ${e}, high ${t}, low ${n}, close ${r}`,span:(e,t,n)=>`${e} to ${t}: ${n}`,desc:(e,t,n,r,o)=>`${e} to ${t}, ${ve(n,"candle")}. First open ${r}, last close ${o}`,ma:e=>`MA${e}`,up:"Up",down:"Down",maLegend:e=>`${e}-day MA`},$o={en:Xi,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}일 이동평균`}},wn=["ink","muted","dim"];function Mo(e,t){return(e??[]).filter(n=>n>=2&&n<t).slice(0,wn.length)}var Ee=R(J(),1);var E=R(j(),1),Ji={kind:"Histogram",count:"Count",cum:"Cumulative",range:(e,t)=>`${e} to ${t}`,inBin:(e,t)=>`${e} · ${t}`,row:(e,t)=>`${e} (${t})`,rowCum:e=>`cumulative ${e}`,samples:e=>ve(e,"sample"),median:e=>`median ${e}`,about:e=>`about ${e}`,peak:(e,t)=>`the tallest bin is ${e} (${t})`,past:(e,t,n,r,o)=>`${e} ${t?"above":"below"} ${r?`the ${r} of ${n}`:n} (${o})`,outside:e=>`${e} outside the edges`,excluded:e=>`${e} at or below 0 left out`,dot:e=>`1 dot = ${ve(e,"sample")}`,groups:e=>ve(e,"group"),hidden:(e,t)=>`Only the first ${e} of ${t} groups are drawn`},Zi={en:Ji,ko:{kind:"히스토그램",count:"건수",cum:"누적",range:(e,t)=>`${e} ~ ${t}`,inBin:(e,t)=>`${e}건 · ${t}`,row:(e,t)=>`${e}건(${t})`,rowCum:e=>`누적 ${e}`,samples:e=>`표본 ${e}개`,median:e=>`중앙값 ${e}`,about:e=>`약 ${e}`,peak:(e,t)=>`가장 많은 구간 ${e}(${t}건)`,past:(e,t,n,r,o)=>`${r?`${r} `:""}${n} ${t?"넘음":"미만"} ${e}건(${o})`,outside:e=>`범위 밖 ${e}개`,excluded:e=>`0 이하 ${e}개 제외`,dot:e=>`점 하나 = ${e}건`,groups:e=>`그룹 ${e}개`,hidden:(e,t)=>`그룹 ${t}개 중 앞의 ${e}개만 그려요`}},$n=e=>e,Qi=["p50","p95"],No=10,Pt=15,Dt=16,To=96,es=e=>e==="p50"?void 0:e==="p99"?"1.5 2.5":"4 3";function ts(e,t,n,r,o){let a=Fe(t,"value"),i=n?Pe(n,"group"):()=>"",s=new Map,l=[];e.forEach((d,f)=>{let x=a(d,f);if(!Number.isFinite(x))return;let b=i(d,f),v=s.get(b);v||s.set(b,v={values:[],excluded:0}),o.log&&x<=0?v.excluded++:(v.values.push(x),r?.(d,f)&&l.push({g:b,v:x}))});let u=[...s.keys()].slice(0,gn),h=u.length?Yr(u.flatMap(d=>s.get(d).values),o):[],m=u.map(d=>Xr(s.get(d).values,h)),g=h.slice(1).map((d,f)=>({i:f,x0:h[f],x1:d,counts:m.map(x=>x.counts[f])})),y=u.map((d,f)=>({name:d,n:s.get(d).values.length,values:s.get(d).values,outside:m[f].outside,excluded:s.get(d).excluded}));return{bins:g,samples:y,groupCount:s.size,binned:!1,fnBins:new Set(l.map(d=>bn(h,d.v)).filter(d=>d>=0)),fnGroup:l.map(d=>u.indexOf(d.g)).find(d=>d>=0)??-1}}function ns(e,t,n,r){let o=Fe(t.x0,"x0"),a=Fe(t.x1,"x1"),i=Fe(t.count,"count"),s=t.group?Pe(t.group,"group"):()=>"",l=new Map,u=new Map;e.forEach((f,x)=>{let b=o(f,x),v=a(f,x),P=i(f,x);if(!(Number.isFinite(b)&&Number.isFinite(v)&&v>b&&Number.isFinite(P)&&P>=0))return;let M=s(f,x);if(l.set(M,l.get(M)??0),r&&b<=0){l.set(M,l.get(M)+P);return}let S=`${b}|${v}`,B=u.get(S);B||u.set(S,B={x0:b,x1:v,by:new Map,picked:new Set}),B.by.set(M,(B.by.get(M)??0)+P),n?.(f,x)&&B.picked.add(M)});let h=[...l.keys()].slice(0,gn),m=[],g=new Set;for(let f of[...u.values()].sort((x,b)=>x.x0-b.x0||x.x1-b.x1)){let x=m[m.length-1];x&&f.x0>x.x1&&m.push({i:m.length,x0:x.x1,x1:f.x0,counts:h.map(()=>0)}),f.picked.size&&g.add(m.length),m.push({i:m.length,x0:f.x0,x1:f.x1,counts:h.map(b=>f.by.get(b)??0)})}let y=h.map((f,x)=>({name:f,n:m.reduce((b,v)=>b+v.counts[x],0),values:[],outside:0,excluded:l.get(f)})),d=h.findIndex(f=>[...u.values()].some(x=>x.picked.has(f)));return{bins:m,samples:y,groupCount:l.size,binned:!0,fnBins:g,fnGroup:d}}function So(e,t,n,r){let o=e.samples[t];if(!e.binned)return Vr(o.values,n);let a=n/100*o.n,i=0;for(let s of e.bins){let l=s.counts[t];if(l>0&&i+l>=a){let u=(a-i)/l;return r?10**(Math.log10(s.x0)+u*(Math.log10(s.x1)-Math.log10(s.x0))):s.x0+u*(s.x1-s.x0)}i+=l}return NaN}function Mn(e,t,n){let r=n?Math.log10:$n;if(n&&t.value<=0)return t.side==="below"?0:1;let o=(r(t.value)-r(e.x0))/(r(e.x1)-r(e.x0));return Math.max(0,Math.min(1,t.side==="below"?o:1-o))}function rs(e,t,n,r){let o=n.side!=="below",a=e.samples[t];if(!e.binned)return{n:a.values.filter(l=>o?l>n.value:l<n.value).length,est:!1};let i=0,s=!1;for(let l of e.bins){let u=Mn(l,n,r);i+=l.counts[t]*u,u>0&&u<1&&l.counts[t]>0&&(s=!0)}return{n:Math.round(i),est:s}}function Ao(e,t,n,r=-1/0,o=1/0){let a=t.length,i=l=>Math.min(e[l+1],o)>Math.max(e[l],r),s="";for(let l=0;l<a;l++){if(!i(l))continue;let u=l;for(;u+1<a&&i(u+1);)u++;let h=Math.max(e[l],r),m=Math.min(e[u+1],o);s+=`M${k(h)},${k(h===e[l]?Math.max(l?t[l-1]:n,t[l]):t[l])}V${k(t[l])}`;for(let g=l;g<u;g++)s+=`H${k(e[g+1])}V${k(t[g+1])}`;s+=`H${k(m)}`,m===e[u+1]&&(s+=`V${k(Math.max(u+1<a?t[u+1]:n,t[u]))}`),l=u}return s}function os(e,t){let n=[];for(let r=0;r<t;r++){if(!e.has(r))continue;let o=r;for(;e.has(o+1);)o++;n.push([r,o]),r=o}return n}function as(e,t,n){let r=[...e].sort((l,u)=>l.at-u.at),o=l=>{let u=[];return r.map(h=>{let m=Te(h.text,No,700)+10,g=[h.at,h.at+m/2-4,h.at-m/2+4].map(y=>Math.max(t+m/2,Math.min(n-m/2,y)));for(let y=0;;y++){let d=u[y]??(u[y]=[]),f=l.map(x=>g[x]).find(x=>d.every(([b,v])=>x+m/2+4<=b||x-m/2-4>=v));if(f!==void 0)return d.push([f-m/2,f+m/2]),{...h,x:f,w:m,row:y}}})},a=l=>Math.max(0,...l.map(u=>u.row)),i=o([0,1,2]),s=o([2,0,1]);return a(s)<a(i)?s:i}function is(e,t,n){let r=[];for(let o=Math.max(2,n);o<=Math.max(2,n)+4&&r.length<3;o++)r=kn(e,t,o).filter(a=>a>=e-1e-9&&a<=t+1e-9);return r}function ss(e,t,n){let r=a=>pn(e,t,a).filter(i=>i>=e*.999999999&&i<=t*1.000000001),o=r(n>=110?[1,2,5]:[1]);return o.length>=2?o:r([1,2,3,4,5,6,7,8,9])}function Tn(e){let t=go(e,{height:c=>Math.max(230,Math.min(310,c*.55)),duration:800}),{p:n,width:r,height:o}=t,a=Zi[t.lang],i=t.fv,s=e.log===!0,l=e.variant??"bars",u=e.threshold&&Number.isFinite(e.threshold.value)?e.threshold:void 0,h=u?.value,m=u?.side,g=m!=="below",y=e.edges?.join(","),d=(e.marks??Qi).filter(c=>Number.isFinite(fn(c))).join(","),f=typeof e.highlight=="function"?e.highlight:null,x=typeof e.highlight=="function"?void 0:e.highlight,{data:b,value:v,group:P,x0:M,x1:S,count:B,binWidth:Q,bins:te}=e,D=(0,Ee.useMemo)(()=>{let c=b.find(N=>N!==null&&typeof N=="object");if(qr(c,v,B))return ns(b,{x0:M,x1:S,count:B,group:P},f,s);let A=y?y.split(",").map(Number):void 0;return ts(b,v,P,f,{edges:A,binWidth:Q,bins:te,log:s})},[b,v,P,M,S,B,y,Q,te,s,f]),{bins:L,samples:w}=D,F=L.length,_=w.length>1,T=(0,Ee.useMemo)(()=>D.samples.map((c,A)=>{let N=d?d.split(",").map($=>({id:$,v:So(D,A,fn($),s)})):[];return{median:N.find($=>$.id==="p50")?.v??So(D,A,50,s),marks:N}}),[D,d,s]),K=(0,Ee.useMemo)(()=>h===void 0?[]:D.samples.map((c,A)=>rs(D,A,{value:h,side:m},s)),[D,h,m,s]),[z,ne]=(0,Ee.useMemo)(()=>lo(D.bins.flatMap(c=>[c.x0,c.x1])),[D]),ot=e.kde===!0&&!D.binned,Ke=(0,Ee.useMemo)(()=>{if(!ot||!D.bins.length)return null;let c=s?Math.log10:$n,[A,N]=[c(z),c(ne)],$=Array.from({length:To},(W,I)=>A+(N-A)*I/(To-1)),G=(N-A)/D.bins.length;return{xs:$,curves:D.samples.map(W=>Ur(W.values.map(c),$).map(I=>I*W.n*G))}},[ot,D,s,z,ne]),Y=w.map(c=>c.name),re=_?f?D.fnGroup:[...be(x,Y,Y,w.map(c=>c.n),"first")][0]??-1:-1,at=L.map(c=>c.counts[0]),it=c=>a.range(i(c.x0),i(c.x1)),Lt=_||u?new Set:f?D.fnBins:be(x,L,L.map(it),at,"max"),_e=_&&re===0?1:0,Ge=_?1-_e:0,X=l==="dots"&&!_,Ae=l==="step",Et=s?Math.log10:$n,Oe=Math.max(0,...L.flatMap(c=>c.counts)),An=Math.max(2,Math.round(o/70)),st=so(0,Math.max(1,Oe,...Ke?.curves.flat()??[]),An),Nn=St(st,[0,1]).ticks(An).filter(c=>Number.isInteger(c)),Rn=Jt(void 0,t.locale,st[1]),Fn=X?8:oo(Nn,Rn,t.locale),Ie=Fn+2,Ne=r-10,Pn=St([Et(z),Et(ne)],[Ie,Ne]),V=c=>Pn(Et(c)),_t=c=>Number.isFinite(c)&&c>=z&&c<=ne&&(!s||c>0),Dn=w.reduce((c,A)=>c+A.outside,0),Ln=w.reduce((c,A)=>c+A.excluded,0),lt=[Dn?a.outside(Dn):"",Ln?a.excluded(Ln):""].filter(Boolean).join(" · "),Io=Math.max(0,re),Ot=t.pending||!F?[]:as([...(T[Io]?.marks??[]).filter(c=>_t(c.v)).map(c=>({key:c.id,at:V(c.v),text:`${c.id} ${i(c.v)}`,fill:n.paint(_?"accentText":"ink"),stroke:n.paint(_?"accent":"ink"),dash:es(c.id)})),...u&&_t(u.value)?[{key:"threshold",at:V(u.value),text:u.label?`${u.label} ${i(u.value)}`:i(u.value),fill:n.paint(_?"ink":"accentText"),stroke:n.paint(_?"ink":"accent")}]:[]],4,r-4),En=t.showLabels?Math.max(0,...Ot.map(c=>c.row+1)):0,Bo=lt||X?Dt:0,ut=c=>6+Bo+c*(Pt+3),ie=ut(En)+(En?4:0),H=o-22,zo=F?Math.min(...L.map(c=>V(c.x1)-V(c.x0))):10,_n=Math.max(1.5,Math.min(6,zo/2-1)),On=Math.min(_n,2.5),fe=X?Jr(Oe,(H-ie)/(On*2+1.5)):1,It=Math.max(On,Math.min(_n,((H-ie)/Math.max(1,Math.ceil(Oe/fe))-1.5)/2)),ct=It*2+1.5,Ue=X?c=>H-c/fe*ct:St(st,[H,ie]),Bt=e.stagger??Math.min(28,520/Math.max(1,F)),Ho=(0,Ee.useMemo)(()=>{let c=[];if(!Ae)for(let N of L)c.push({key:`${X?"d":"b"}${N.i}`,to:[X?1:Ue(N.counts[_e])],from:[X?0:H],enter:[X?0:H],delay:N.i*Bt,data:{k:_e,i:N.i}});let A=_?Ae?[_e,Ge]:[Ge]:Ae?[0]:[];for(let N of A)c.push({key:`s${N}`,to:L.map($=>Ue($.counts[N])),from:L.map(()=>H),enter:L.map(()=>H),delay:N===Ge?120:0,data:{k:N,i:-1}});return c},[D,r,o,ie,fe,X,Ae,_,_e,Ge,Bt,st[1]]),In=ko(Ho,t.motion),qe=c=>ze(c,{locale:t.locale,maximumFractionDigits:1}),Ye=(c,A)=>w[c].n?A/w[c].n*100:0,Bn=w.map((c,A)=>{let N=0;return L.map($=>N+=$.counts[A])}),jo=L.map(c=>{let A=w.map((N,$)=>{let G=a.row(c.counts[$],qe(Ye($,c.counts[$])));return _?`${N.name} ${G}`:`${G}, ${a.rowCum(qe(Ye($,Bn[$][c.i])))}`});return{datum:null,index:c.i,key:`b${c.i}`,label:it(c),value:c.counts.reduce((N,$)=>N+$,0),formatted:A.join(", ")}}),ye=n.paint("accent"),zn=c=>Lt.has(c.i)||u!==void 0&&Mn(c,u,s)>=.5,Hn=c=>c===re?ye:n.paint(c===_e&&!Ae?"neutral":"neutralStrong"),jn=null;if(t.active!==null&&L[t.active]){let c=L[t.active],A=Math.max(...c.counts),N=$=>{let G=a.inBin(c.counts[$],qe(Ye($,c.counts[$]))),W={label:a.cum,value:qe(Ye($,Bn[$][c.i])),strong:!1};return _?[{label:w[$].name,value:G,color:Hn($),strong:$===re},W]:[{label:a.count,value:G,color:zn(c)?ye:n.paint(X||Ae?"neutralStrong":"neutral"),strong:!0},W]};jn={x:(V(c.x0)+V(c.x1))/2,y:X?H-Math.ceil(A/fe)*ct:Ue(A),title:it(c),rows:w.flatMap(($,G)=>N(G))}}let Vn=c=>{let A=w[c],N=T[c],$=K[c],G=I=>D.binned?a.about(i(I)):i(I),W=[a.samples(A.n),a.median(G(N.median)),...N.marks.filter(I=>I.id!=="p50").map(I=>`${I.id} ${G(I.v)}`)];return!_&&Oe&&W.push(a.peak(it(L[at.indexOf(Oe)]),Oe)),$&&u&&W.push(a.past($.est?a.about(`${$.n}`):`${$.n}`,g,i(u.value),u.label??"",qe(Ye(c,$.n)))),W},zt=[lt,X?a.dot(fe):""].filter(Boolean),Vo=D.groupCount>w.length?` ${a.hidden(w.length,D.groupCount)}.`:"",Wo=F?_?`${a.kind}, ${a.groups(w.length)}. ${w.map((c,A)=>`${c.name}: ${Vn(A).join(", ")}`).join("; ")}${zt.length?`. ${zt.join(", ")}`:""}.${Vo}`:`${a.kind}. ${[...Vn(0),...zt].join(", ")}.`:"",Ko=e.description??Wo,Xe=u&&_t(u.value)?V(u.value):null,mt=F?[V(L[0].x0),...L.map(c=>V(c.x1))]:[],Wn=(c,A)=>c>0&&H-A<1?H-1:A,Go=(c,A,N)=>{let $=V(c.x0)+.5,G=V(c.x1)-.5,W=G-$;if(W<=0||c.counts[N]<=0)return null;let I=Wn(c.counts[N],A),he=Math.min(2,W/4),dt=n.paint("neutral"),Be=u&&!_?Mn(c,u,s):0;if(Be<=0||Be>=1||Xe===null)return(0,E.jsx)("path",{d:Ct($,I,W,H-I,{tl:he,tr:he}),fill:Be>=1||Lt.has(c.i)?ye:dt});let Ht=Math.max($,Math.min(G,Xe)),[Qo,ea]=g?[dt,ye]:[ye,dt];return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{d:Ct($,I,Ht-$,H-I,{tl:he}),fill:Qo}),(0,E.jsx)("path",{d:Ct(Ht,I,G-Ht,H-I,{tr:he}),fill:ea})]})},Uo=(c,A)=>{let N=A.map((W,I)=>Wn(L[I]?.counts[c]??0,W)),$=_&&c===Ge&&re>=0,G=_?[]:u?Xe===null?[]:[g?[Xe,1/0]:[-1/0,Xe]]:os(Lt,F).map(([W,I])=>[mt[W],mt[I+1]]);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("path",{d:Ao(mt,N,H),fill:"none",stroke:$?ye:n.paint("neutralStrong"),strokeWidth:$?2:1.6,strokeLinejoin:"round"}),G.map(([W,I],he)=>(0,E.jsx)("path",{d:Ao(mt,N,H,W,I),fill:"none",stroke:ye,strokeWidth:2,strokeLinejoin:"round"},he))]})},qo=(c,A)=>{let N=c.counts[0],$=Math.floor(N/fe),G=N%fe>0,W=Math.round(A*($+(G?1:0))),I=k((V(c.x0)+V(c.x1))/2),he=zn(c)?ye:n.paint("neutralStrong");return(0,E.jsxs)(E.Fragment,{children:[Array.from({length:Math.min(W,$)},(dt,Be)=>(0,E.jsx)("circle",{cx:I,cy:k(H-ct*(Be+.5)),r:k(It),fill:he},Be)),G&&W>$?(0,E.jsx)("circle",{cx:I,cy:k(H-ct*($+.5)),r:k(It-.65),fill:"none",stroke:he,strokeWidth:1.3}):null]})},Yo=F?s?ss(z,ne,(Ne-Ie)/Math.max(1e-9,Math.log10(ne/z))):is(z,ne,Math.round((Ne-Ie)/70)):[],Xo=Jt(e.format,t.locale,Math.max(Math.abs(z),Math.abs(ne))),Jo=io(Yo.map(c=>({t:c,x:V(c),label:Xo(c)})),0,r),xe=t.active!==null?L[t.active]:void 0,Zo=xe&&(X||Ae||_),Kn=In.fade(Math.min(700,F*Bt)+200,320);return(0,E.jsxs)(eo,{c:t,kind:a.kind,ariaLabel:e.ariaLabel,description:Ko,events:jo,tip:jn,renderTip:e.tooltip,className:e.className,style:e.style,theme:e.theme,children:[!X&&F?(0,E.jsx)(ao,{p:n,ticks:Nn,y:Ue,x0:Fn,x1:r,fmt:Rn,locale:t.locale}):null,Zo?(0,E.jsx)("rect",{x:k(V(xe.x0)),y:k(ie),width:k(V(xe.x1)-V(xe.x0)),height:k(H-ie),fill:n.paint("line"),opacity:.6,pointerEvents:"none"}):null,L.map(c=>(0,E.jsx)("rect",{x:k(V(c.x0)),y:k(ie),width:k(Math.max(0,V(c.x1)-V(c.x0))),height:k(Math.max(0,H-ie)),fill:"transparent",onPointerEnter:A=>t.setActive(c.i,A.pointerType==="touch"?"touch":"pointer"),onClick:()=>t.click(c.i),style:{cursor:e.onClick?"pointer":void 0}},`h${c.i}`)),In.items.map(c=>{let{k:A,i:N}=c.data,$=L[N];return(0,E.jsx)("g",{className:"ztd-mark",pointerEvents:"none",opacity:c.exiting?.4:N<0?1:t.dim(N),children:N<0?Uo(A,c.v):$?X?qo($,c.v[0]):Go($,c.v[0],A):null},c.key)}),xe&&t.via==="keyboard"?(0,E.jsx)("rect",{x:k(V(xe.x0)-1),y:k(ie-2),width:k(V(xe.x1)-V(xe.x0)+2),height:k(H-ie+4),rx:3,fill:"none",stroke:n.paint("ink"),strokeWidth:2,pointerEvents:"none"}):null,Ke?.curves.map((c,A)=>(0,E.jsx)("path",{d:jr(c.map((N,$)=>[Pn(Ke.xs[$]),Math.max(ie,Ue(N))])),fill:"none",stroke:_?Hn(A):n.paint("ink"),strokeWidth:1.6,opacity:Kn,pointerEvents:"none"},`k${A}`)),(0,E.jsxs)("g",{opacity:Kn,pointerEvents:"none","aria-hidden":"true",children:[Ot.map(c=>(0,E.jsx)("line",{x1:k(c.at),x2:k(c.at),y1:t.showLabels?ut(c.row)+Pt:ie,y2:H,stroke:c.stroke,strokeWidth:c.key==="threshold"?1.5:1.4,strokeDasharray:c.dash},c.key)),t.showLabels?Ot.map(c=>(0,E.jsxs)("g",{children:[(0,E.jsx)("rect",{x:k(c.x-c.w/2),y:ut(c.row),width:k(c.w),height:Pt,rx:5,fill:n.paint("panel"),opacity:.92}),(0,E.jsx)(Me,{x:c.x,y:ut(c.row)+Pt/2,anchor:"middle",size:No,weight:700,fill:c.fill,children:c.text})]},c.key)):null]}),(0,E.jsxs)("g",{"aria-hidden":"true",children:[Jo.map(c=>(0,E.jsx)(Me,{x:c.x,y:H+11,anchor:"middle",size:tt,fill:n.paint("muted"),children:c.label},c.t)),X&&F?(0,E.jsx)("line",{x1:Ie,x2:Ne,y1:k(H)+.5,y2:k(H)+.5,stroke:n.paint("dim"),shapeRendering:"crispEdges"}):null,lt?(0,E.jsx)(Me,{x:Ie,y:6+Dt/2,size:10.5,fill:n.paint("muted"),children:yn(lt,Math.max(40,Ne-Ie-(X?110:0)),10.5)}):null,X?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("circle",{cx:k(Ne-Te(a.dot(fe),10.5,600)-8),cy:6+Dt/2,r:3.5,fill:n.paint("neutralStrong")}),(0,E.jsx)(Me,{x:Ne,y:6+Dt/2,anchor:"end",size:10.5,weight:600,fill:n.paint("muted"),children:a.dot(fe)})]}):null,F?null:(0,E.jsx)(Me,{x:r/2,y:o/2,anchor:"middle",size:12,fill:n.paint("muted"),children:t.t.empty})]})]})}var ls=R(J(),1);var Do=R(j(),1),us={pie:"Pie chart",donut:"Donut chart",share:"Share",desc:(e,t,n)=>`${ve(e,"item")}, total ${t}. ${n}.`,other:e=>`Other (${e})`},cs={en:us,ko:{pie:"파이 차트",donut:"도넛 차트",share:"비중",desc:(e,t,n)=>`${e}개 항목, 합계 ${t}. ${n}.`,other:e=>`기타 ${e}개`}},Ro=(e,t)=>cs[e].other(t);function Fo(e,t,n){if(typeof t!="number"||!(t>=1)||e.length<=t+1)return{kept:e,other:null};let r=new Set(e.map((a,i)=>({v:a.value,i})).sort((a,i)=>i.v-a.v).slice(0,Math.floor(t)).map(a=>a.i)),o=e.filter((a,i)=>!r.has(i));return{kept:e.filter((a,i)=>r.has(i)),other:n(o.length,Hr(o.map(a=>a.value)))}}var Po=e=>Number.isFinite(e)&&e>0?e:0;var Se=R(j(),1);function Lo(e,t){let n=vt(e);return n?.type==="scatter"&&t?.size!==void 0?vt("bubble"):n}function ms(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 ds(e,t,n,r=!1){let o=Lo(e.type,e.encoding);if(!o||!t.length)return[];let a=e.encoding??{},i=e.options??{},s=i.highlight,l=new Set(!r&&mn.includes(o.type)&&Array.isArray(i.hidden)?i.hidden.map(String):[]),u=m=>m.filter(g=>!l.has(g.label)),h=["pie","donut","waffle"];if(o.type==="donut"&&i.legend!=="none")return[];if(h.includes(o.type)){let m=Pe(a.label,"label"),g=Fe(a.value,"value"),y=o.type==="waffle",d=t.map((M,S)=>({r:M,label:m(M,S),value:y?g(M,S):Po(g(M,S))})),{kept:f,other:x}=y?{kept:d,other:null}:Fo(d,i.other,(M,S)=>({r:{},label:Ro(Z(n),M),value:S})),b=be(s,f.map(M=>M.r),f.map(M=>M.label),f.map(M=>M.value),y?"first":"max"),v=x?[...f,x]:f,P=Qe(v.length,b);return v.map((M,S)=>({label:M.label,color:P[S]}))}if(o.type==="candlestick"){let m=Mo(Array.isArray(i.ma)?i.ma:void 0,t.length),g=$o[Z(n)];return[{label:g.up,color:i.upColor??"accent"},{label:g.down,color:i.downColor??"neutralStrong"},...m.map((y,d)=>({label:g.maLegend(y),color:wn[d],shape:"line"}))]}if(o.type==="scatter"){if(typeof a.series!="string")return[];let m=Pe(a.series,"series"),g=sn(t.map((d,f)=>m(d,f)));if(g.length<2)return[];let y=vr(g.length,Co(s,t,g,m));return u(g.map((d,f)=>({label:d,color:y[f],shape:"circle"})))}if(["marimekko","area","bar","line","stream","radar"].includes(o.type)){let m=[];if(Array.isArray(a.y))m=a.y;else if(typeof a.series=="string"){let f=Pe(a.series,"series");m=sn(t.map((x,b)=>f(x,b)))}let g=dn(o.type,a,i);if(g.length){let f=Qe(m.length,be(s,m,m,m.map(()=>0),"none")),x=m.length<2?[{label:String((Array.isArray(a.y)?a.y[0]:a.y)??"y"),color:"neutral"}]:m.map((b,v)=>({label:b,color:f[v]}));return[...u(x),...g.map((b,v)=>({label:b,color:vo(v),shape:"line"}))]}if(m.length<2)return[];let y=be(s,m,m,m.map(()=>0),"first");if(o.type==="line"||o.type==="radar")return u(m.map((f,x)=>({label:f,color:y.has(x)?"accent":"neutralStrong",shape:o.type==="line"?"line":"square"})));let d=Qe(m.length,y);return u(m.map((f,x)=>({label:f,color:d[x]})))}return[]}function Eo(e,t){let{spec:n}=e,r=Lo(n.type,n.encoding),o=(0,rt.useMemo)(()=>Zr(n.data),[n.data]),a=!o&&n.data&&typeof n.data=="object"&&"url"in n.data?n.data:null,i=Or(n,e.locale),s=ue(i),l=Z(s),u=Mr(a?.url??null,{parse:a?.format??"auto",select:a?.select,init:e.fetchInit,locale:s}),h=Br(n),m=(0,rt.useMemo)(()=>h?Pr(h,s):void 0,[h,s]),g=n.options?.hidden,y=Array.isArray(g)?g.map(String):[],d=y.join(""),[f,x]=(0,rt.useState)(null);if(!r)return(0,Se.jsx)(on,{error:l==="ko"?`알 수 없는 차트 종류: ${n.type}`:`Unknown chart type: ${n.type}`,height:e.height??200,locale:i});let b=o??u.data,v=t[r.type],P={...n.options??{}},M={...ms(r,n.encoding),...P,...m?{tooltip:m}:{},data:b,...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},S=n.card?.legend==="toggle"&&Ir(r.type,n.encoding??{},P),B=f&&f.base===d?f.hidden:y;S&&(M.hidden=B);let Q=w=>x(F=>{let _=F&&F.base===d?F.hidden:y;return{base:d,hidden:_.includes(w)?_.filter(T=>T!==w):[..._,w]}}),te=M.height??220,D=a&&!b.length&&(u.loading||u.error||u.empty)?(0,Se.jsx)(on,{loading:u.loading,error:u.error,empty:u.empty,onRetry:u.reload,height:te,locale:i}):(0,Se.jsx)(v,{...M});if(n.card){let w=n.card,F=w.legend==="auto"||w.legend==="toggle"?ds(n,b,s,S):w.legend,_=F?.length?S?(0,Se.jsx)(rn,{items:F,hidden:B,onToggle:Q,locale:i}):F:void 0,T=w.download?(0,Se.jsx)(Fr,{data:b,columns:zr(n),filename:w.title??r.type,formats:Array.isArray(w.download)?w.download:void 0,locale:i}):void 0;D=(0,Se.jsx)(kr,{number:w.number,title:w.title??_r(r,l),subtitle:w.subtitle,legend:_,actions:T,source:w.source||void 0,note:w.note||void 0,accent:w.accent,takeaway:w.takeaway,level:w.level,sample:w.sample,replay:w.replay!==!1,className:e.className,locale:i,children:D})}let L=e.theme??n.theme;return L&&(D=(0,Se.jsx)(yt,{theme:L,children:D})),D}function fs({cfg:e,components:t}){let n=At();return Eo({spec:e.spec,height:e.height,locale:e.locale,width:n?void 0:e.width,animate:n?void 0:!1},t)}function Oo(e,t){let n=document.getElementById("ztd-chart-config")?.textContent,r=document.getElementById("chart");if(!n||!r)return;let o=JSON.parse(n);(0,_o.hydrateRoot)(r,(0,Sn.createElement)(yt,{theme:o.theme,cssVars:!0},(0,Sn.createElement)(fs,{cfg:o,components:{[e]:t}})))}Oo("histogram",Tn);})();