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